Proper specification of PID controller settings ensure that target temperatures are met quickly but not overshot, and cycling of temperature, or more formally, the process variable, is minimized. In an electric brewery, PID settings will be system specific, and will be especially determined by element wattage, liquid volumes, recirculation speed, and other environmental variables.
I have gathered that most homebrewers utilize a trial and error method of setting their PIDs, and this works mostly fine because we utilize PIDs for low lag processes. In a typical HERMS system for instance, the hot liquor tank will be controlled to a specific temperature, which represents a calibrated difference to a target mash temperature, as detailed in a previous post. In this situation, the delay between turning on an electric element and seeing the temperature change, as well as the delay between turning off an element and seeing the temperature stop changing, is on the scale of seconds.
It’s also possible to use your PID to control your mash temperature directly without making any assumptions on the required temperature difference between your hot liquor tank and mash lauter tun. The lag in this set up is much greater, and trial and error will likely be an ineffective method of specifying PID settings.
In either case, a basic tuning procedure can be utilized to properly specify your PID settings. The procedure I am going to detail does take some time to carry out, but is not necessarily time consuming. It’s lengthy-ness is due to the fact that it involves reaching an equilibrium temperature, twice actually, for manually specified element duties.
The procedure is as follows, which has been adapted from Control Guru’s Practical Process Control ebook:
- If you are utilizing StrangeBrew Elsinore, ensure data recording is enabled. If you are not, grab a stop watch, a pad of paper, and a pencil.
- Under normal vessel usage conditions (volumes, recirculation, etc), enter manual mode and specify an element duty cycle of 8%. Allow for your vessel to reach an equilibrium temperature for this duty cycle. We’ll denote this first equilibrium temperature as temp1
- Now, enter a new duty cycle of 10%, and allow for the vessel to reach a second equilibrium temperature, which we’ll denote as temp2. For StrangeBrew Elsinore users, you have now collected all of the data you need, which can analyzed through temperature graphs. For brewers without data logging capabilities, you will have to pay closer attention during this process of moving from temp1 to temp2, recording some data by hand (read the entire post, and you’ll know what things to look out for).
- You must now calculate the following:
- Process gain, Kp, as (temp2-temp1)/(duty2-duty1), which in this case is (temp2-temp1)/2%
- Dead time, Θp, as the seconds elapsed before a visible impact of changing duty cycle could be detected (longer in this case is more conservative)
- Process time constant, Tp, as the seconds elapsed from duty cycle change, to when 63% of the change in temperature has been reached (that is, seconds until temp1+0.63*(temp2-temp1) is reached), subtracting the dead time, Θp.
- Closed loop time constant, Tc, as the larger of 0.01*Tp and 0.08*Θp for moderate action.
- From the previous calculations, you can now find your PID settings as:
- Proportional, Kc = 1/Kp * (Tp+0.5*Θp)/(Tc+0.5*Θp)
- Integral, Ti = Tp + 0.5*Θp
- Derivative, Td = Tp*Θp/(2*Tp+Θp)