PID control loop: dealing with sensor drift - Page 1
Forum section: electronics / projects

author: philpem
author_rank: Frequent Contributor
timestamp: April 05, 2018, 08:10:25 am
content: A question for you PID loop experts out there!I've implemented a PID loop which is doing a decent job of controlling a process. I can get almost any PV value I want, the loop is stable... but there's a catch.The process measured value ranges from 0 to 10 (give or take). However, the sensor tends to drift a little at the low end -- so if I demand zero, I get 0.02 (say) -- which is fine.But the constant steadystate error (between 0 and 0.02) causes the integrator to wind up a bit.So when I next ramp from a setpoint of 0 to (say) 5, the response time is much worse than it should be -- and gets worse depending on how long the unit has been left at SP=0.I'm toying with a few ideas to deal with the sensor drift, but before I do.. is there an established way for dealing with this problem?Thanks

author: IanB
author_rank: Super Contributor
timestamp: April 05, 2018, 08:30:49 am
content: Quote from: philpem on April 05, 2018, 08:10:25 amA common feature of industrial controllers is windup limiting (sometimes called "anti-reset windup"). Basically you have a measured value of 0.02 and a set point of 0.00, and this causes the controller output to keep winding up (or down) in an attempt to eliminate that error.One way to implement windup limiting is to provide a feedback signal whenever the controller output tries to wind beyond the limits. Let's say the controller output has reached zero and wants to keep going downwards. The internal output is allowed to go below zero and become negative. The negative output value is added to the controller error as a compensating term, so that (error + compensation) = 0. At this point the integral action will stop winding down any further.

author: ogden
author_rank: Super Contributor
timestamp: April 05, 2018, 08:48:27 am
content: Quote from: IanB on April 05, 2018, 08:30:49 amEasiest way to implement windup limiting - introducing upper/lower limits of integrator state (it shall be done *in* the PID routine). More about that inTim Wescott paper "PID without PhD". I find it very good reading when have questions about PID.

author: Rerouter
author_rank: Super Contributor
timestamp: April 05, 2018, 09:04:25 am
content: The first option would be range capping your output value. So when the output is over max, you subtract the excess from the integrator.The second is integrator reset on pv change. Under normal operation the integrator will have trimmed to zero when stable. So some approaches zero it on a pv change.The third approach may be changing topology to a response and hold control loop. Which outside certain ranges uses more agressive values to get it close. Then inside the range resets the integrator and uses the slower stable control

author: philpem
author_rank: Frequent Contributor
timestamp: April 05, 2018, 03:18:42 pm
content: Thanks guys - plenty to think about here!The control loop already has windup limiting -- if the control output exceeds the min/max values set, both the output limits and integrator are clipped at the min/max.I'll have a look at the Wescott paper -- I remember reading it some time ago, perhaps it's time for a refresher!Rerouter -- I'll have a look at those ideas. Integrator reset on PV change seems counter intuitive though; do you mean reset on setpoint change? (PV is the measured process value, SP is the target you're aiming for).As I said above -- the output value is already clamped. I'm toying with adding a smaller clamp value or clamp multiplier (% of min/max) for the integrator as there shouldn't be too much process drift in this application with a nonzero setpoint at steady-state.Thanks!

author: Kleinstein
author_rank: Super Contributor
timestamp: April 05, 2018, 06:21:44 pm
content: Clipping the integrator values to a fixed min/max value is a crude way of anti wind up. A better way is to recalculate the integral part so that the output is just at the edge of saturation. So the regulator would start with a good value once it leaves saturation - however it would also react to noise a little early when at the edge, but this might not be a big issue.For better response so set-point changes one can add feed forward: that is add a contribution to changes in the SP and maybe the set-point directly. With a programmed set-point profile this might include future planed values for the set-point as well.Ideally this would be a first approximation of the system, so that the regulator part would only do corrections to this first approximation.

author: mikerj
author_rank: Super Contributor
timestamp: April 06, 2018, 11:35:33 am
content: Could you not simply limit the minimum set point to e.g. 0.05 to allow for some sensor drift without integrator windup?

author: philpem
author_rank: Frequent Contributor
timestamp: April 12, 2018, 01:05:06 am
content: Quote from: mikerj on April 06, 2018, 11:35:33 amAlas, there's a customer requirement that the setpoint go down to zero, even if that's impossible... :/Quote from: Kleinstein on April 05, 2018, 06:21:44 pmBack-calculation? I thought about that, maybe I'll do it on the next spin of my PID loop code. As it turns out, conditional integration works pretty well in this application. Well, that and a threshold below which the control element is forced off and the PID resets...Thanks guys -- you've given me a bunch of things to think about for V2!

author: hendorog
author_rank: Super Contributor
timestamp: April 12, 2018, 06:08:30 am
content: Just round the measured value to 1 d.p.?