PID Improvement?

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

segallis

Well-Known Member
Joined
May 2, 2011
Messages
92
Reaction score
7
Location
melbounre
I have an idea for twist on the traditional PID algorithm used in homebrewing. I have designed adaptive, second order loops in the past, which are particularly suited for controlling slowly responding systems such as heating hundreds of pounds of mass.

For example, to avoid overshoots as well as prevent slow response time, you can heat to max output when the temp delta is more than threshold (say 10 degrees), then reduce the output and allow more time for energy to propagate throughout the system to close the final gap without overshoot.

The issue with using temperature sensor feedback only is that there is significant latency from the time electrical power is applied to the time that produces heat at the heater surface, then conduction into the wort, then homogeneous movement of the wort (temperature equilibrium), then thermal propagation through the thermowell, then into the temperature probe along with its thermal response lag. So you have to go slow, go over. No single combination of lead and lag terms in a loop can be optimal for varying factors like thermal mass and thermal conductivity.

This will either result in overshoots, or a slower than optimal response time.

So, I was thinking of adding one parameter to the control loop: wort volume. Theoretically, I could calculate a fairly precise time interval - based on the thermal load mass - over which I can power the heater at max output, such that I should be able to predict the net increase in system temperature well after that heater interval has ceased, and after all the previously mentioned system delays have equalized.

I believe this would allow me to converge much quicker, with less temp error.

Anyone tried this approach?

-G
 
If the input to that parameter was a load cell under the vessel, very cool. My batch size rarely changes but when it does, I don't see any issue because I use the Auber EZboil which uses some kind of black magic. I don't think it's ever overshot by more than 1F.
 
If the input to that parameter was a load cell under the vessel, very cool. My batch size rarely changes but when it does, I don't see any issue because I use the Auber EZboil which uses some kind of black magic. I don't think it's ever overshot by more than 1F.
Just curious, does your controller have batch volume or size as an input? If not, does it make an assumption and use that to control the heat, as opposed to only using temperature probe feedback? Seems like even a batch assumption would be faster than just relying on temp data.

-G

P.S. Load cell would be cool - but I'm trying not to go TOO overboard. Although I'm gonna use a load cell for my keg status/pour monitor to control some of my friends consumption. 🤣
 
The PID algorithm if properly tuned already does everything you want to achieve and with minimal or no overshoot.
 
I hate integrators with a passion. With the exception of my EBIAB I have only worked on controls with 7-17ms step response <.01% steady state error.

That being said, some of the products used electromechanical actuators with similar time constants to the disturbances that needed to be rejected. I needed to overcome the phase lag of the actuator and needed a fast integrator because the needed current was proportional to the disturbance force.

One of the "tricks" was to cancel the phase lag of the integrator. I kept it simple for the kettle control:
I_error = (KIDerivative * Error - Derivative of Error)
Iterm = Ki * I_error + Iterm; This is of course constrained to +/- 75% of full power
I run a fixed time step so I cancel out sample time
In English: KIDerivative * error establishes how fast the error should be closing then subtract the derivative of the error to establish a derivative based error term. Then integrating on the derivative based error.

By using the derivative of error it cancels out the integral phase lag. This eliminates integrator overshoot and oscillations to the level that it can be tuned without a proportional term.

This works really well allowing me to run full power until about 3.5-4degrees f from set point and hold about +/- .12f during mash. Or +/- 2bits
It works well for the 6-10 gallons that my mash and whirlpool cover. My high voltage gives me a 5650 watt element based on measured Voltage and current, with a lower wattage element it would drive full power down to a smaller error.

I have thought about adjusting this KID gain with volume in a open loop fashion as this is the only value I need to change to get good performance at my 3gallon cleaning volume. I input my strike volume, grain weight, along with boil time and boil power already so I could estimate my thermal mass at each step within about 10%.

If I add the scale for tracking my actual strike/preboil volumes this could be used as well, but I wouldn't do it "live" as it would introduce more noise. Maybe establish a value at each step in the process.
 
"By using the derivative of error it cancels out the integral phase lag. This eliminates integrator overshoot and oscillations to the level that it can be tuned without a proportional term. "

I should clarify this I still run a derivative based Proportional term using the same error term I use in the integrator. It is just to say the integral term is now in phase like a proportional term and doesn't oscillate when used without a proportional term.
 
Back
Top