TemperatureControl: PID resets I to 0 if output exceeds bounds to reduce anti-windup...
authorMichael Moon <triffid.hunter@gmail.com>
Fri, 18 Jan 2013 03:44:08 +0000 (14:44 +1100)
committerMichael Moon <triffid.hunter@gmail.com>
Fri, 18 Jan 2013 03:44:08 +0000 (14:44 +1100)
src/modules/tools/temperaturecontrol/TemperatureControl.cpp

index 65a1277..152590e 100644 (file)
@@ -257,13 +257,13 @@ void TemperatureControl::pid_process(double temperature)
 
     if (this->o >= heater_pin->max_pwm())
     {
-        i -= (this->o - (heater_pin->max_pwm())) * 256 / heater_pin->max_pwm();
+        i = 0;
         this->o = heater_pin->max_pwm();
     }
     if (this->o < 0)
     {
         if (this->o < -(heater_pin->max_pwm()))
-            i += (-(heater_pin->max_pwm()) - this->o) * 256 / heater_pin->max_pwm();
+            i = 0;
         this->o = 0;
     }