diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-08-13 17:18:44 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-08-13 17:18:44 +0300 |
commit | 7a8b7c29bad7af57580201bc6b65907b5a8570e1 (patch) | |
tree | 7ec3ecdc40f2d8a3d54498c0e6e292d56398ad32 | |
parent | 51e7f518074f099ec7f7bc9fd2632d156bf7e441 (diff) |
Fixed heating fault detection for heaters with slow cooling rates
-rw-r--r-- | src/Configuration.h | 3 | ||||
-rw-r--r-- | src/Heating/LocalHeater.cpp | 12 | ||||
-rw-r--r-- | src/Heating/LocalHeater.h | 2 |
3 files changed, 8 insertions, 9 deletions
diff --git a/src/Configuration.h b/src/Configuration.h index 89765445..bf047bf5 100644 --- a/src/Configuration.h +++ b/src/Configuration.h @@ -124,9 +124,10 @@ constexpr float DefaultThermistorC = 7.06e-8; // Parameters used to detect heating errors constexpr float DefaultMaxHeatingFaultTime = 5.0; // How many seconds we allow a heating fault to persist -constexpr float AllowedTemperatureDerivativeNoise = 0.25; // How much fluctuation in the averaged temperature derivative we allow +constexpr float AllowedTemperatureDerivativeNoise = 0.12; // How much fluctuation in the averaged temperature derivative we allow constexpr float MaxAmbientTemperature = 45.0; // We expect heaters to cool to this temperature or lower when switched off constexpr float NormalAmbientTemperature = 25.0; // The ambient temperature we assume - allow for the printer heating its surroundings a little +constexpr float LowAmbientTemperature = 15.0; // A lower ambient temperature that we assume when checking heater performance constexpr float DefaultMaxTempExcursion = 15.0; // How much error we tolerate when maintaining temperature before deciding that a heater fault has occurred constexpr float MinimumConnectedTemperature = -5.0; // Temperatures below this we treat as a disconnected thermistor diff --git a/src/Heating/LocalHeater.cpp b/src/Heating/LocalHeater.cpp index 2803d49b..d2b6bde3 100644 --- a/src/Heating/LocalHeater.cpp +++ b/src/Heating/LocalHeater.cpp @@ -260,7 +260,7 @@ void LocalHeater::Spin() noexcept else if (gotDerivative) { const float expectedRate = GetExpectedHeatingRate(); - if (derivative + AllowedTemperatureDerivativeNoise < expectedRate + if (derivative + AllowedTemperatureDerivativeNoise < expectedRate * 0.75 && (float)(millis() - timeSetHeating) > GetModel().GetDeadTime() * SecondsToMillis * 2) { ++heatingFaultCount; @@ -463,12 +463,10 @@ float LocalHeater::GetAveragePWM() const noexcept // Get a conservative estimate of the expected heating rate at the current temperature and average PWM. The result may be negative. float LocalHeater::GetExpectedHeatingRate() const noexcept { - // In the following we allow for the gain being only 60% of what we think it should be, to avoid false alarms - const float maxTemperatureRise = 0.60 * GetModel().GetGainFanOff() * GetAveragePWM(); // this is the highest temperature above ambient we expect the heater can reach at this PWM - const float initialHeatingRate = maxTemperatureRise/GetModel().GetTimeConstantFanOn(); // this is the expected heating rate at ambient temperature - return (maxTemperatureRise >= 20.0) - ? (maxTemperatureRise + NormalAmbientTemperature - temperature) * initialHeatingRate/maxTemperatureRise - : 0.0; + const float initialHeatingRate = GetModel().GetHeatingRate() * GetAveragePWM(); + return (temperature > LowAmbientTemperature) + ? initialHeatingRate - (temperature - LowAmbientTemperature) * GetModel().GetCoolingRateFanOn() + : initialHeatingRate; } // Auto tune this heater. The caller has already checked that no other heater is being tuned and has set up tuningTargetTemp, tuningPwm, tuningFans, tuningHysteresis and tuningFanPwm. diff --git a/src/Heating/LocalHeater.h b/src/Heating/LocalHeater.h index c107c2d3..f9988ff4 100644 --- a/src/Heating/LocalHeater.h +++ b/src/Heating/LocalHeater.h @@ -21,7 +21,7 @@ class HeaterMonitor; class LocalHeater : public Heater { - static const size_t NumPreviousTemperatures = 4; // How many samples we average the temperature derivative over + static const size_t NumPreviousTemperatures = 8; // How many samples we average the temperature derivative over public: LocalHeater(unsigned int heaterNum) noexcept; |