Quote:
Originally posted by Allen Nelson
It's easy enough to roll your own (although a bit more than 3 multiplies, unless you are willing to combine constants, (LoopUpdateTime is a constant, and SUM(E*k) = k*SUM(E), from the distubive principle that you should have learned in 4th grade)
So the equation becomes:
CV = P*E + I*(Totalized{E}) + D*(Current PV  Last PV) + Bias
Where
P = K_{p} ;
I = K_{i} * LoopUpdateTime;
D = K_{d} / LoopUpdateTime

That is how I combine the constants. Now it is just 3 multiplies and adds and some limiting. Oh yeah, a subtract is required to get the error. Still fast and simple.
Quote:
When I saw that you were changing the LoopUpdateTime threefold, I thought that you'd have to do the inverse to K_{i} in order to keep the 'I' term the same.
But since you changed the trigger time as well, there was only 1/3 as many values of 'E' in the totalized(E), which is why you say you didn't detune the loop.
But that doesn't take the derivative portion into account. There, there is no historical sampling of E, and so (I think) that you effectively divided the derivative portion by 3. I doubt that derivative by itself would produce the drastic changes in your graphs (that's due, as you point out, to the CV not being adjusted frequently enough to control the PV adequately) but it might explain the detuning that happened when you updated even more frequently (Fig 6).

In your equation the change in PV is divided by the loop time.
Kd*(Current PV  Last PV)/LoopUpdateTime
If the loop time is 1/3 as long and the PV changes 1/3 as much in the same time, then the result stays the same.