Bonj said:
What I tend to do, is arbitrarily pick a P value, and then follow their instructions with regard to setting the I and D values. Following the very basic premise that the P gain sets to speed at which you approach your target and the I gain sets the rate at which you adjust for error over time (If the correction isn't correcting enough, it accumulates the I gain to correct faster... that can lead to over correction and instability if the accumulator has a chance to run away. This is why Matho only enables PID control within 5�C of the target temperature and also why we experimented with clamping the accumulator (I use the modified library in my HERMS, but matho elected not to, in favour of the 5�C method)). The D term attenuates (dampens) the speed at which you approach the target as you get closer, so as to hopefully avoid overshoot.
Apart from that, you basically have to run the system a number of times under similar to expected conditions in order to adjust the gains by trial and error. I played with mine in a 2.4KW kitchen jug which enabled me to check it was working and the tuning iterations were faster (albeit completely different from an actual system), but the jug is so over powered for the volume of water that it is very hard to tune.
The arduino PID algorithm, incidently doesn't disable the D term by default. Most people are happy with a PI system, or even a PD. The article I linked does a good job of explaning the benefits and drawbacks of the various configurations.
Bonj, thanks. I'd got the PID library and PID autotune library confused - it's the latter that defaults to PI.
I've since looked through the PID library to see how the output is calculated, and it's a whole lot simpler than I'd thought. In the sort of scenario a PID's going to be used for in a home brewery, it seems to me that the D term is ineffective unless the gain (Kd) is very high. For example, in my HLT, I'm getting about 1 degree a minute temp rise. That's a small fraction of a degree per second. Unless Kd is several hundred, the impact of the D term is going to be insignificant. However, my DS18B20 measures at 12 bits, so increments in 0.0625 degree jumps every several seconds. I therefore get several seconds of D=0 followed by one of D=high, i.e. noise. I've therefore effectively disabled D by setting it to 1.
When I originally went through Matho's code, I didn't understand why (a) he'd disabled PID until within 5 degrees, and ( B) set the PID output to 100 when his PID window size is 5000ms (at least I think he's done that, now I'm not sure
I had my PID output set to 5000, as that's what my window size is. The trouble is the I term winds up to 5000 very quickly, and unless Ki is large, the accumulator takes ages to unwind and you get huge overshoot. I've now set my output to 100, and just use a multiplier to convert that to my window size (i.e. max output x 50 = window size.) With Ki limited to max output, it's a lot quicker to unwind with a smaller Ki. Here's the sort of response I'm getting on a test run of my HLT ~ 2/3 full with Kp = 100, Ki = 1.4, Kd = 1
I'm still getting some overshoot, but no oscillation, and it settles down to target temp within a few minutes. That's fine for the HLT. Next is the direct fired RIMS MLT which might be a bit more tricky to tune.
Cheers,
Jon