So after setting my shiny new BrewPi, it’s first mission was to ferment a lager (for the missus, poor taste I know). I know some of the variables are “learnt” over time, but I’m slightly confused as to some of the behaviour. I’d like some opinions if it’s behaving as expected:
So, my questions:
The Blue circle I’ve drawn - Why is the fridge temp up and down so erratically? At this point, it was trying to cool down the wort to the profile temp.
The red circle - Once the wort was at temperature, the fridge setting and temp seem to rise and fall almost randomly? A very strange pattern, no?
The green circle - At this point, I changed the profile to drop it by 3 degrees, and it smoothly dropped the temperature. But again, the fridge setting seems all over the place to achieve this?
The Yellow circle - This was my bad, I knocked the fridge relay loose while removing some dry hops from a different chamber, then went to work without the fridge circuit working. So it was attempting to cool without any cooling circuit working. Not expected behaviour, sure, but why didn’t it just leave the circuit on, instead of the erratic up-down jagged lines there??
Any opinions or explanations appreciated! You can examine the graph and zoom here: http://brew.benbenson.co.uk
The interplay between Fridge Setting and Fridge Temp, within the blue circle area, seems fairly logical to me. The fridge setting is set at 8C throughout that time, and the fridge indeed gets down to within touching distance of 8C at the end of each cooling cycle, shuts off, then proceeds to warm up by about 1.1C over the course of 10 minutes before the cooling cycle starts again.
But the thing which I’m confused about, since you’re in Beer Profile mode, is why Fridge Setting seems to be in the driver’s seat. Assuming the goal is getting the beer to meet Beer Setting as quickly as possible, then it’s odd that the freezer made 10 short cooling cycles over the course of about 5 hours. I’d expect its initial cycle to be appreciably longer, perhaps with some pauses for the compressor to breathe, until the beer temp approaches Beer Setting and then System Idle so it doesn’t overshoot. Fridge Setting seems to be similarly in charge within the green circle area.
Another interesting thing, within your red circle area, is that the heater ran continuously for about 2.5 hours to arrest the cool-down of the beer. And once your beer gets stuck pretty well to the Beer Setting, the heater subsequently comes on for much longer cycles than the freezer. So your freezer seems to be a Goliath to your heater’s David.
That funky behavior of Fridge Setting / Temp within the red area, that’s a Real Headscratcher™.
The main explanation for this is: the heater and cooler are tied to fridge temperature, not beer temperature.
The fridge setpoint is determined by what the beer needs, so the heater and cooler are controlled by beer temperature indirectly.
The fridge setting is calculated as follows:
Fridge setpoint = Beer set point + Kp * beer temperature error + Ki * beer temperature error integral + Kd * beer temperature error derivative. Or in short, Fridge setpoint = beer setpoint + PID
So slight variations in beer temperature (due to 0.0625 degree steps in temperature caused by digitization) are multiplied by Kp and result in a larger fluctuation in fridge setpoint (most visible in yellow area).
In the blue area, the fridge setpoint is 8C (beer setpoint + PID max). PID max can be configured in advanced settings and defaults to 10C. You just see the fridge cooling to the fridge setpoint and keeping it at 8C perfectly. The fluctuation in the blue line is caused by minimum cycle times and physics.
The red area: highest peak is a result of the sharp derivative in beer temp. The setpoint fluctuates a bit due to fluctuations in beer temp, mostly caused by the digital nature of the sensor. The reason they are not staircases is that the sensor signal is filtered.
Green area: fridge setpoint is set to 5C (again beer setpoint - PIDMAX), fridge cools to that point. When the beer temp comes closer to setpoint, the PID result decreases, mainly because P decreases). As the beer temp comes closer to setpoint, the fridge and beer setpoint approach each other.
So to summarize: the algorithm uses cascaded PID: the fridge setting is adjusted to what the beer needs and the actuators are tied to the fridge setpoint/temperature. They predict overshoot and turn of prematurely when overshoot is expected.
If you wonder where the fridge setpoint is coming from, take a look at the control algorithm page in the web interface. Click the 3 refresh buttons to get the up to date values for all fields.