Closed aseelye closed 4 years ago
I can possibly see doing it this way. I'm working on an environmental chamber that heats and cools as needed, and needed to learn how PID worked. Chopping the P/I/D pieces out on their own from the final result (that is, my min output is 0, max 100, and I wanted the integral to only comprise up to 40 of that). It's using a thermoelectric/peltier cooler, so cooling is slow. I'm currently using a PI system with 200/8 with output limit of 100 and windup of 5, so if the temp is off by half a degree or more, the proportional will max it out. However, if I'm starting out from ten degrees high, the integral winds up to 100, and will be much slower to shave off that figure and not completely overshoot things.
Perhaps staying within your description of things is possible, but I just found this method much easier for testing and tuning. Having a max integral of 5 kept things on an even keel and led to a much quicker convergence (due to the erratic nature of temp sensors, as well as the thermal delay of the TEC cooling the interior chamber via a heatsink).
I'm not an expert in PID controllers either (part of the reason for doing this project to begin with was to learn a bit), but it sounds to me like a situation which could possibly be solved by changing the tuning parameters, perhaps by setting Ki to something lower?
Anyway, this discussion is mostly on #16 now so we can continue the discussion there instead. I will close this PR since I believe that the current way of calculating the integral term is preferable. Feel free to reopen if you still don't agree and we can discuss it more.
As the title states, the integral value should be just the accumulated product of
error * dt
. Otherwise the integral product can either stick around too long, or be wiped out too quickly if/when Ki != 0.