Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: ryanastiefes on April 17, 2019, 12:26:59 PM

Title: PID.Bias going above 100
Post by: ryanastiefes on April 17, 2019, 12:26:59 PM
I have a pid struct setup and all is well until pid.output is at 100% for long periods of time, say four or five hours. When PV goes above SP pid.output should start decreasing but is will stay at 100% no matter what the error is. When I look at the pid structure I notice that bias is 102.5%, if I decrese that to under 100% the PID.output will start decreasing.
Attatched is my PID setup.

Is the output not decreasing because the PID.bias is above 100%?
Title: Re: PID.Bias going above 100
Post by: BobO on April 17, 2019, 12:49:57 PM
The P term is Output = Error*Gain + Bias. Output is clamped at 100%. If Bias Freeze is enabled, the loop doesn't integrate Bias once the Output is at the rails. With a small Error*Gain, a Bias > 100, and Bias Freeze enabled, I think it could hang at 100%.
Title: Re: PID.Bias going above 100
Post by: ryanastiefes on April 17, 2019, 01:56:24 PM
Okay. Maybe try disabling bias freeze would help out the situation?
Title: Re: PID.Bias going above 100
Post by: BobO on April 17, 2019, 02:02:58 PM
Okay. Maybe try disabling bias freeze would help out the situation?

The key point is that as long as Error*Gain+Bias is > 100 it won't integrate negative Bias, and will stay at 100% until Error*Gain is greater than Bias-100. If you clamped Bias at 100, then any negative Error should allow it to come back.
Title: Re: PID.Bias going above 100
Post by: Mike Nash on April 17, 2019, 02:05:56 PM
I was seeing some odd behavior back in December 2017 due to the bias getting out of the 0-100% range. I don't know if it is related or ever got addressed, but clamping bias to 0-100% outside of the PID instruction worked around the issue.

https://forum.hosteng.com/index.php?topic=2189.0 (https://forum.hosteng.com/index.php?topic=2189.0)
Title: Re: PID.Bias going above 100
Post by: BobO on April 17, 2019, 02:31:42 PM
I was seeing some odd behavior back in December 2017 due to the bias getting out of the 0-100% range. I don't know if it is related or ever got addressed, but clamping bias to 0-100% outside of the PID instruction worked around the issue.

https://forum.hosteng.com/index.php?topic=2189.0 (https://forum.hosteng.com/index.php?topic=2189.0)

I could probably be talked into clamping the Bias at 100 when Bias freeze is enabled, but I have some concern as to possible negative affects of changing it.
Title: Re: PID.Bias going above 100
Post by: Mike Nash on April 17, 2019, 02:42:03 PM
So add another checkbox to enable bias clamping? It does appear to have some issues as-is at least in some otherwise valid configurations.
Title: Re: PID.Bias going above 100
Post by: BobO on April 17, 2019, 03:01:20 PM
So add another checkbox to enable bias clamping? It does appear to have some issues as-is at least in some otherwise valid configurations.

I would need to see if there is a spare bit in the config word, but if so, this is easy.
Title: Re: PID.Bias going above 100
Post by: Controls Guy on April 17, 2019, 03:53:54 PM
When I write my own loop, I don't even allow Bias to wind all the way to the rails (so in some edge cases you can't eliminate all error because you need some P to get to the right CV).  I typically limit bias to maybe 5% off the min/max.