Any idea why the integral value (0.01 and -0.04) would be different between the Cool and Heat PID?
I didn’t write the firmware calculations, so any explanation would involve some educated guesses.
Is this a theoretical question about PIDs in general, or about this particular implementation?
This particular implementation. I would have expected the values of P over time to drive the values of I (just like P drives the value of D). Since P is the same for both PIDs, I would have expected the values of I to be the same as well. In my setup, I’m seeing the same P and D values (left column of each panel), but the I’s are different. I suspect there’s a bug somewhere, which is why I’m raising the question.
P is not the same for both PIDs here, nor is Kp.
The top left value is the error, which will indeed be equal. To find the discrepancy in Integral I’d personally check behavior during overshoot (is delta integrator the same for positive and negative error?)
For a definitive answer you’ll need @Elco
Oh, right. I said P, but didn’t mean P. I’m sorry, I meant the calculated Error, Integral, and Derivative (far left column). I would have expected all 3 to be the same for both PIDs.
I checked the actual calculations, and the Integral is indeed clipped to never cross 0 (never negative if Kp > 0, never positive if Kp < 0).
If (for example) the setting is some unattainably high value, you’d see the heating integrator steadily climb until max, and the cooling integrator remain at 0. Both values being != 0 indicates the error has been hovering around 0.
Edit: this does of course not rule out bugs in the implementation. It merely indicates that it is not unlikely for the cooling integrator to differ from the heating integrator.
OK, that makes sense and also explains why they could be different. Thanks!
Integral anti-windup can also play a role here.
There are a few measures to prevent the integral from growing when it is unlikely to be desired behavior:
- The actuator is already clipping to the limits
- The actual value of the actuator is different from the desired value
Anti-windup prevents overshoot caused by the integrator.