# Its 12 a.m. Do You Know What Your PIDs Doing?

## The Proportional-Integral-Derivative (PID)

Greg McMillan and Stan Weiner bring their wits and more than 66 years of process control experience to bear on your questions, comments, and problems.
Write to them at
controltalk@putman.net.

Stan: The Proportional-Integral-Derivative (PID) algorithm has been around for more than a half-century, and has been documented in at least 100 books and 10,000 articles.

Greg: We think the PID is well-defined, but in fact, the equations in the literature are idealized at best, and may be misleading because they do not include the details of algorithm implementation in industrial controllers. In most cases, these details are considered proprietary because they use unique ways of dealing with various issues of initialization, operating modes, output limits and override control.

Stan: When a controller exceeds an output limit, and the error has not changed sign, integral (reset) action continues to integrate the error, driving it further beyond the output limit. Does the anti-reset windup algorithm just stop the integral action? What if the error or rate of change of the error increases? Will the output from proportional and derivative terms increase respectively, and will the integral contribution be proportionally reduced to keep the output from going beyond its limit?

Similar questions can be posed about the individual contributions of the proportional, integral and derivative terms when the controller is in manual or remote output, output tracking, or is overridden. When does the controller output change? When the output is exactly at its limit, at the signal selector output in an override scheme, or when the controller is switched to automatic, cascade or remote cascade? What about the option to specify anti-reset windup (ARW) limits where the integral action is 16 times larger between the output and ARW limits, so the output moves quickly through the flat portions of a valve’s installed characteristic? Is there some internal filtering of the PID difference equations in the DCS to attenuate noise? Is there set point filtering or velocity limiting?

Greg: The integral term can be enacted by the literal use of an integrator, or passing the output from the proportional mode through a positive feedback network with a filter whose time constant is the integral (reset) time. This method has several advantages for override and cascade control by the use an external reset signal from the signal selector output, or a secondary controller setpoint. (This is explained in “The Power of External-Reset Feedback.”)
There is also the opportunity for dead-time compensation by the insertion of a time delay as studied in the Advanced Application Note on my Control Insights website

Stan: To make things more interesting, two major forms of the PID algorithm are used today in the process industry. The “series,” “real” or “interacting” algorithm that puts the derivative term in series with the proportional and integral terms was the method of implementation in analog controllers. Here, the use of derivative action affected the gain and integral action, so that the effective derivative (rate) time never exceeds integral (reset) time, which would cause instability. Most DCSs use as their default the ISA “standard,” “ideal” or “noninteracting” algorithm that adds the contribution from the three terms in parallel, so that the rate time setting does not change action from the other terms. Now, it’s up to the user never to set the derivative (rate) time larger than the integral (reset) time.

Greg: Don’t forget the eight major PID structures, depending upon whether there is “P” or “I” action on the process variable (PV) or error, and whether “I” action is replaced with a manual bias.

1. PID action on error  (β = 1 and γ = 1)
2. PI action on error, D action on PV (β = 1 and γ = 0)
3. I action on error, PD action on PV
(β = 0 and γ = 0)
4. PD action on error (β = 1 and γ = 1)
5. P action on error, D action on PV
(β = 1 and γ = 0)
6. ID action on error (β = 1)
7. I action on error, D action on PV
(γ  = 0)
8. Two degrees of freedom controller (β and γ adjustable 0 to 1)
β = set point weight for proportional mode (0 to 1)
γ = set point weight for derivative mode (0 to 1)

Stan: This is getting too advanced for this column, especially since both it and our brains are running out of room, and we have more important endeavors like watching the ZZ Top concert. We will leave the exploration of all this PID capability to Greg’s next book.

Let’s wind up by asking a seemingly simple anti-reset wind-up question. When should the controller output come off its low limit for a direct acting controller as the PV rises toward the set point? Consider three examples: a let-down valve of a header pressure loop that needs to send steam to a lower pressure header when a user is shutting down to prevent a relief valve opening; an acid reagent valve that needs to open as the pH approaches a high pH set point to prevent an environmental limit violation; and a coolant valve for a temperature loop on an exothermic reactor heating up that needs to open to prevent undesirable side reaction products and a runaway reaction at high temperatures.

Greg: If the output doesn’t come off its limit until the PV crosses setpoint and the error changes from a negative to a positive sign, it’s too late because of the inevitable lag (π sec) and dead time (θ sec) in the loop. For self-regulating loops, the result is an overshoot (Ex %) that’s the rate of rise (R%/sec) multiplied by the sum of the lag and dead time (π + (θ). For integrating loops, controller output must match the disturbance before the rise is arrested. This is easiest to visualize for the most common integrating process, level. If the level loop is manipulating an outlet flow, it must increase the flow to equal the inlet flow to stop the rise in level. Most reactors and headers behave like integrating processes, so the overshoot is proportional to the controller output (ΔMV %) multiplied by the integrating process gain (Kp%/sec/%) needed to balance the disturbance, besides being proportional to the rate of rise. For more on this requirement and options to deal with it, read the Control article “Full Throttle Batch and Startup Response.

While you can approximate the overshoot by the following equations on a theoretical basis, you need a virtual plant such as DeltaV Simulate Pro with actual DCS PID algorithm running to test what’s going to happen. Don’t assume the PID algorithm in even the best simulators will be representative of the behavior of the proprietary PID algorithm in your DCS.

Ex = R* (π + θ) for self-regulating processes.
Ex = (R + 0.5*ΔMV*Kp)*(π + θ) for integrating processes.

Stan: If you can’t tolerate the overshoot (Ex), the setpoint needs to be temporarily lowered by the amount of the overshoot, or the controller reset time must be increased, so the reset action in repeats per second is much slower than the rise time in % per second, so that proportional and derivative action take over. Ideally the output should come off the limit when the PV is within Ex of the setpoint. For pure positive feedback implementation of reset in a PI controller, the output won’t come off the limit until the error changes sign, regardless of tuning, unless the ARW algorithm does something special. One solution used in what was called the “batch controller” option is to insert a bias (preload) in the input of the filter used in the positive feedback path.

Greg: Check out the online version for this year’s “Top 10 Broken New Years Resolutions.