BrewPi / firmware

Brewing temperature control firmware for the BrewPi Spark (Particle Photon inside)
http://www.brewpi.com
GNU Affero General Public License v3.0
98 stars 55 forks source link

With long minimum ON time and period, integrator can be held at zero. #58

Closed elcojacobs closed 8 years ago

elcojacobs commented 8 years ago

I noticed an issue running tests with my new fridge.

To reduce the number of compressor cycles, I set the minimum ON time for the compressor at 10 minutes and the period at 60 minutes. This caused the fridge temperature to fluctuate above the setpoint, instead of around it.

This fridge responds very quickly to compressor action, so what will happen is:

  1. During the 10 minutes of cooling, the fridge temp drops quickly.
  2. This reduces proportional gain (because temp approaches setpoint). So during a PWM cylce, the actuator value changes. Due to the time limits and long period, the actuator cannot follow the quicly changing actuator value.
  3. The achieved actuator action is fairly constant, but the actuator setting changes quickly.
  4. And this is a guess: Because the actuator achieved value does not reach the setting, anti windup is triggered.

I have added a simulation to mimic this behavior, see below.

anti-windup-long-period

elcojacobs commented 8 years ago

Results with new implementation:

anti-windup-long-period-fix

Took a while to find a solution that did not affect other simulations. This fix seems to have good results for all situations.

elcojacobs commented 8 years ago

This fix was part of release 0.4.4