Recovery from power-off

The controller was doing fine in keeping a constant beer temperature at 7°C for about a week or so.

Today, at 21:18, I had to power off the raspberry Pi3, so the BrewPi controller turned off too.
I restored the power at 21:22, then saw this behavior, that looks a bit strange to me.

Il looks like, after the reset, the controller set the fridge temp to about 7°C, instead of keeping it close to 3.3°C, as it was before the power off.

This caused an overshoot of beer temp of 0.5°C., very long to stabilize to the 7.0°C target temperature…
My PID parameters are at their default values, except both Td (that I set to 0) and Beer-to-fridge Ti, which I set to 12000 (just to experiment).

Is it the expected behavior after a power recovery? Am I doing anything wrong?

The reason it is so slow to adjust is because you set Ti to 120000.
The integral value is not stored to non-volatile memory, so after a reset it will build up from zero again. The time constant of your integrator is 12000 seconds, which means it will take very long to build up.

The integral corrects steady state errors: constant disturbances when the beer temperature has reached setpoint, like heat generated from fermentation. In your example, the fridge temp is 4 degrees lower than the beer temp, yet the beer temp does not drop.

Thank you for the reply, Elco.

I repeated the power-off experiment after stabilization of the system and after setting Ti=5000.

The result didn’t change much. The overshoot was 0.6°C and target temp was reached after about 10 hours.

Also in this case, after system restart, Fridge setting was initialized to Beer setting (7°C).
My understanding is that it is due to the PID formula that I saw somewhere else in the forum:

 Fridge setting = beer setting + P + I + D

However, in my current setup the equilibrium is found when Fridge setting is around 3°C, so restarting at Fridge setting=7°C is someway causing the temperature “disruption”. Main factor, as I understand it now, is the loss of the integral information “I” that was built before the power-off…

If I think about it, at the recovery after a power failure, if the beer temp is already found very close to target temp, it seems reasonable that fridge setting is initialized to the current fridge temperature, isn’t it? The best is to keep continuity.

I don’t know much about PIDs (yet :wink:), but I see that, referring to the formula above, if you forget about D for a moment and, after a power failure, you start by setting:

  • Fridge setting = current fridge temp
  • Beer setting left unchanged
  • P=0 ( I’m supposing that the error is very small, as the system was in equilibrium at power off)

you could get a reasonable approximation of what the value of “I” was before the failure

  I = Fridge temp - Beer setting

In this way, you could be able to resume the PID cycle at (about) the same status in which it was before the power failure.
It’s still an approximation, as D and the error value aren’t zero but, if it works, it could give better results than the current solution.

Does it make sense? (Please forgive me if it’s heresy… :grin:)