Not sure if I am making the PID discussion clearer or if I am confusing, just couldn't keep away. As far as I know there are in general three types of PID control equations, they are called Series, Parallel and Standard (also called Ideal).
The most used equation or controller type is the standard/ideal (Industry type) but in our world with Arduinos (Brucontrol) and cheaper PLCs (BCS) it’s the parallel we encounter. The Arduino parallel equation is not exactly as the per the diagram but more something like this:
Code:
error = Setpoint - input
cumError += error * elapsedTime
rateError = (error - lastError)/elapsedTime
output = kp*error + ki*cumError + kd*rateError
Before starting to tune it it’s good to know which equation your controller uses. For example, if you have a PID using the standard equation, if you change the proportional gain it will also affect the integral and derivative. With the parallel P, I and D are independent of each other. That’s why with the parallel controller the integral is a gain while on the standard controller it’s given in seconds or minutes pr repeats as it’s a measure on how often to repeat the contribution from the proportional gain(error*kp). Almost the same thing with derivative. That’s why you can’t use the tuning parameters from a standard controller in a parallel controller and vice versa. Take a look at the equation for the standard PID and the typical Arduino equation you will see that the integral is inverse on the standard equation, to increase integral contribution you have to lower the Ti while on the Arduino you have to raise it (ki). I am not familiar with the Sestos/Auber but the parallel equation is mostly used by software controllers (PLCs) and not discrete controllers.
I have some experience tuning both the standard and the parallel. I experience it’s easier to tune the standard. Maybe it’s because it’s the one I am most familiar with but also since the proportional gain is always the “master” tuning parameter in the standard I feel it’s easier to understand each tuning parameter’s contribution to the output and the relationship between the tuning parameters.
Regardless of the controller type you have, before starting to tune it’s beneficial to know something about the time constant and dead time in your system.
Time Constant is the “how fast” variable. It describes the speed with which the measured input value or process value responds to changes in the controller output. More specifically it represents the time needed for the process value to reach 63.2% of its total and final change. Think high power heating element vs low power heating element or small vs large kettle.
Dead time is the delay from when a controller output signal is issued until when the measured process value is measured/first begins to respond. Think distance between temp sensor and the heating element. If it’s far away the deadtime is larger, and large deadtime makes tuning harder.
As a rule of thumb PID control will struggle and is considered not suited if Dead time:Time constant ratio is close to or above 1.
When tuning, as a rule of thumb, only use derivative action if you have a large Time Constant in your system(slow system). Also be careful with derivative if you have a low resolution input value as the derivative will interpret the “step” changes in a low resolution input value and act as it is quick process changes. The same applies if you have a noisy input. So if using derivative make sure you filter the input.
Another rule of thumb the faster (the smaller time constant) the process is the more integral action is required. Slower processes require more proportional gain and less integral. For example an HLT or BKL controller will do best with almost only proportional gain while a faster process like RIMS or flow control will need more integral and less proportional.
The integral contribution to the output can be both negative and positive depending if the error is negative or positive. Normally if the output is zero or max then integral stops winding down/up since the output is out of range and then it’s no point in reducing/increasing it further. The Brucontrol PID controller integral seems to wind further down after reaching the lower end of the output range and that is good to know about when tuning and/or using the controller. For example, with my (for the purpose tuned) RIMS my script reduces the RIMS setpoint from strike temp down to mash temp after dough in. It takes some time to get uniform temp through the mash so the wort flowing in the RIMS tube is warmer than the setpoint the first minutes. Since the temp is above setpoint the integral winds down, naturally, and the RIMS controller output is quickly reduced to zero. After a few minutes when temp finally comes below setpoint and there is a heating demand it takes forever for the integral to wind up again so I always have a fairly large undershoot if I don’t help the integral to wind up faster by giving a temporary higher setpoint to create a larger error hence faster integral wind up. Another way to deal with it could be to let the setpoint follow the actual temp until mash temp setpoint is reached and then set the setpoint to mash temp, like:
Code:
If dougin == true
“rims PID” MaxOutput = 0
If “rims temp” value > mashtemp
“rims PID” target = “rims temp” value
else
“rims PID” target = mashtemp
doughin = false
“rims PID” MaxOutput = 255
endif
endif
I have not tested but it will keep the error at zero and the integral will not wind further down.
The same thing does not happen when output is at the higher end of the output range.