Dlloydev / QuickPID

A fast PID controller with multiple options. Various Integral anti-windup, Proportional, Derivative and timer control modes.
MIT License
195 stars 50 forks source link

outputSum value stuck when using SetTunings #48

Closed brN2k closed 2 years ago

brN2k commented 2 years ago

Hey Dlloydev,

thanks for providing this great library! I noticed that my process was running away sometimes when i switched tunings and/or the output limits on the fly.

I am adjusting my tuning parameters based on how far i am away from the setpoint (more or less agressive) and also the output limits based on what my precontrol value is. These tunings sometimes set Ki > 0 and sometimes = 0. My guess is that when outputSum > 0 and you set Ki = 0 then it will not be reduced further and keep the value as is. I did not have time to dive into the code yet, for now i set outputSum = 0 in SetTunings and it seems to fix the problem for now

Dlloydev commented 2 years ago

Thanks, Yes, this seems reasonable. I've published a new release with an updated SetTunings function.