When you configure a PID loop in iocontrol, choose one of the following algorithms: Velocity ISA Parallel Interacting The ISA, Parallel and Interacting algorithms are functionally equivalent; the only difference is the way the tuning constants are factored. The identical and differing equations for all algorithms are shown in the following sections. Key to Terms Used in Equations PV Process variable; the input to the PID TuneD Derivative tuning parameter. In units of seconds. Increasing magnitude increases influence on output. SP Setpoint Output Output from the PID InLo, InHi Range of the input Err_1 The Error (PV SP) from the previous scan OutLo, OutHi Range of the output Integral Integrator. Anti-windup is applied after the output is determined to be within bounds. Gain Proportional tuning parameter. Unitless. May be negative. PvIn_1, PvIn_2 PV from the previous scan and the scan before that. TuneI Integral tuning parameter. In units of 1 seconds. Increasing magnitude increases influence on output. ScanTime Actual scan time (time since previous scan)
Equations Common to All Algorithms Err = PV - SP Span = (OutHi - OutLo) / (InHi - InLo) Output = Output + FeedForward * TuneFF Velocity Algorithm The velocity algorithm is similar to the algorithm used in OptoControl for Mistic I/O except that the derivative does not act on setpoint changes. TermP = ( Err - Err_1 ) TermI = TuneI * ScanTime * Err TermD = TuneD / ScanTime * ( PvIn - 2 * PvIn_1 + PvIn_2 ) ΔOutput = Span * Gain * ( ΔTermP + ΔTermI + ΔTermD ) Non-velocity Algorithms These equations were derived from the article A Comparison of PID Control Algorithms by John P. Gerry in Control Engineering (March 1987). These three equations are the same except for the tuning coefficients; converting from one equation to another is merely a matter of converting the tuning coefficients. Equations common to all but the velocity algorithm: Integral += Err TermP = Err TermI = TuneI * ScanTime * Integral TermD = TuneD / ScanTime * ( PvIn - PvIn_1 ) Ideal or ISA Algorithm: Output = Span * Gain * ( TermP + TermI + TermD ) Parallel Algorithm: Output = Span * ( Gain * TermP + TermI + TermD ) Interacting Algorithm: Output = Span * Gain * ( TermP + TermI ) * ( 1 + TermD )
The PID algorithm used with mistic protocol brains, such as the serial B3000 and the G4A8R, is the velocity PID algorithm. It is an interacting type with a reverse output. Interacting means that the gain is distributed to each term in the equation. Therefore, if you double the gain, you also double the integral and derivative terms. Reverse output means that the output increases as the input decreases. The reverse output mode is used for pump-up control, such as maintaining level, pressure, and flow as well as heating. For cooling or pump-down control, direct output is required. To switch to direct, simply reverse the sign of the gain. For example, a gain of 1.28 would become -1.28. Note that this is not negative gain. The minus sign only serves to change the type of PID output from reverse to direct. This velocity PID algorithm (also referred to as the incremental PID algorithm) is inherently anti-windup since it has no summation in the integral term to saturate. The algorithm is described on pages 160 162 of the book Microprocessors in Instruments and Control by Robert J. Bibbero, published by John Wiley and Sons.
Gain (P) For those familiar with the term proportional band, gain is simply the inverse. Gain acts directly on the change in error since the last scan. (Error is the setpoint minus the input value in engineering units.) Therefore, in the case of steady-state error (that is, change in error = 0), gain alone has no effect on the output. For this reason, gain cannot be used alone. Gain is also used as a multiplier on the integral and derivative. The velocity PID algorithm uses gain much as it is used in the Honeywell type A PID and the Bailey error input type PID. Higher gain results in increased output change. Too much gain results in output oscillation. Too little gain results in very slow performance. Integral (I) This term acts only on the current error. It is used to reduce the current error to zero. Note that during steady-state conditions, integral multiplied by current error multiplied by gain is the only thing affecting the output. The larger the integral value, the larger the change in output. A positive integral value is required. Integral that is too low will result in undershoot. Integral that is too high will result in overshoot.
Derivative (D) This term acts only on the change in slope of the input signal. Its purpose is to anticipate where the input will be on the next scan based on a change in the rate of change of the input value. In other words, it changes the output as the input gets near the setpoint to prevent overshooting or undershooting. Derivative is used in feed forward applications and in systems where the loop dead time is long. Its action type is unlimited (that is, it has no filtering). If the input signal is noisy and the derivative value is greater than zero, the input value must be filtered. See Input Filtering on page 10-65 for details. If the slope of the input signal has remained unchanged for the last two scans, the derivative has no effect. Judging by the change in direction of the input, the derivative contributes an appropriate value to the output that is consistent with where the input will be at the next scan if it continues at its current rate of change. The derivative is very useful in loops with a long dead time and long time constants. To disable it, set it to zero. Integral-Derivative Interaction Integral and derivative can try to move the output in opposite directions. When this is the case, the derivative should be large enough to overcome the integral. Since the derivative is looking ahead based on the change in slope, it has a bigger picture than the integral does. This interaction can be observed when the input is below the setpoint and is rising fast. The integral tries to increase the output (which only makes things worse), while the derivative tries to decrease the output. The derivative does this because at the current rate of change of the input, there will be an input overshoot if the output is increased. Therefore, the derivative needs to be large enough to counteract the integral when necessary.
Solving Tuning Problems Oscillations Oscillations can be caused either by gain that is too high or integral that is too high. If the process variable oscillates below the setpoint, it is probably caused by the gain being too high. If it oscillates at the setpoint, it is not possible to know by looking at the graphs which tuning parameter is causing the problem. Try cutting either the gain or integral, but not both at the same time, to find out which one is causing the problem. Overshoot Overshoot is usually caused by the integral being too high. Gain that is too high can also cause overshoot, but that is usually in conjunction with the integral being too high. Any PID loop can be made to not overshoot and not oscillate if the gain and integral are set low enough, but the response will be slow. Performance There is a limit on how fast a good, stable response can be. The middle chart is the best that can be done with no overshoot and no oscillation. The ones with the gain and integral too high move toward the setpoint faster, but they overshoot and oscillate. There will be a point that is the best the PID loop can be tuned, and it will not be possible to get a faster stable response. There are trade-offs between having a fast response and having a stable PID loop that does not overshoot the setpoint.