# Opening minds about controllers, part 1

## Explore the full range of PID possibility before moving to model predictive control

**Greg**: While essentially a PID guy, I have dabbled in small model predictive control (MPC) applications. I have learned to appreciate the capability of MPC to replace valve position control, to optimize processes and adapt virtual plants. Mark Darby, principal at CMiD Solutions and part-time lecturer at the University of Houston, greatly expanded my horizon on MPC in our column, “Model Predictive Control - Past, Present and Future” and subsequent columns with MPC experts in industry. Now a recent conversation has led to new columns. Mark is exceptional in that he also understands PID control to a great degree and has an open mind to the relative merits of PID and MPC.

**Stan**: We start with a discussion of how to tune your PID in Part 1. We’ll give our thoughts on how to get more out of your PID and when you need to move on to MPC in Part 2.

**Greg**: I understand you did a study of PID performance for the various tuning rules documented in my “Tuning and Control Loop Performance, Fourth Edition."

**Mark**: I wanted to compare your recommendations to tuning formulas that I am familiar with. Since there are so many tuning formulas out there, I was hoping to reduce the number of tuning formulas I use and recommend. I compared the performance of your revised Lambda tuning recommendations with Internal Model Control (IMC)-based PID formulas and Ziegler Nichols (ZN) Reaction Curve tuning rules for first-order, self-regulating and integrator-plus-deadtime processes. For a first-order-plus-deadtime approximation for a self-regulating process, various time constant to deadtime (t/q) ratios were studied corresponding to classifications of the process as being lag-dominant (t/q = 10), balanced (t = q), and deadtime-dominant (t/q = 0.1). Also studied was a process at your proposed transition point from balanced to lag-dominant (t/q = 4). An integrating-plus-deadtime process was also studied.

The major revisions tested involved switching to Lambda integrating process tuning rules at the transition point from a balanced to a lag-dominant response, setting Lambda relative to deadtime with Lambda equal to the deadtime for a non-oscillatory minimum Integrated Absolute Error (IAE) response, and reducing Lambda to ½ the deadtime if you want a response closer to what you would get from tuning settings whose sole objective is to achieve the absolute minimum IAE without being concerned about oscillations.

**Greg**: I selected the transition point to be a time constant-to-deadtime ratio of 4 because this would give me the same reset time setting (T_{i} = 3*q) and offered the possibility of Lambda equal to ½ the deadtime to give about the same controller gain setting (K_{c} = 0.9/(K_{i}*q)) as the ZN Reaction Curve method for PI control. When ½ the deadtime is used, the reset setting is about twice the deadtime (T_{i} = 2*q), which corresponds to about half the ultimate period and what is used in other tuning methods when derivative action is used (PID). There was also reasoning that the ZN Reaction Curve method that measures the maximum slope in an open-loop response is similar to the near-integrating approximation for a lag-dominant process by realizing that the equivalent open-loop integrating process gain (K_{i}) is the time constant (t) divided by open-loop, self-regulating process gain (K_{o}). This relationship can be used to convert back and forth between lag-dominant and near integrating process dynamics (K_{i} = t/K_{o}). Since lag-dominant processes take a long time to reach steady state to see the open-loop, self-regulating process gain (e.g., five time constants), you can save a lot of test time by using the near integrating process tuning rules, and also get better tuning settings. Test times can be reduced by 96% for a time constant-to-deadtime ratio of 20 to 1. The open-loop, self-regulating process gain is not needed in the tuning but can be observed for previous setpoint changes as the % change in process variable divided by % change in PID output.

The consideration that a well-tuned PID will normally arrest (stop the diversion of the PV that will lead to the start of the return to setpoint) a load disturbance in less than four deadtimes also leads to the best transition point corresponding to four deadtimes. Internal Model Controller (IMC) tuning could use the same transition point, but the IMC tuning rules I have for integrating processes gave a more oscillatory response if you set the IMC gamma equal to the deadtime. The transition from self-regulating to integrating process tuning rules changes Lambda from being a closed-loop time constant for a setpoint response to an arrest time for the closed-loop response to a load disturbance. Thus, the transition and setting Lambda relative to deadtime addresses the main requirements by Shinskey and other practitioners that the PID be tuned to handle load disturbances and have a reset time set relative to the deadtime. The setpoint response can be achieved with load disturbance tuning by your choice of PID structure or use of a setpoint lead-lag. The first tuning test is to momentarily put the PID in manual, make an output change at least five times larger than the noise band (seen in the output when PID is in auto) plus valve resolution limit plus deadband, and then to immediately put the PID back in auto. The objective is the minimum peak error and IAE error with a smooth, non-oscillatory response. The tuning and testing should be done for the worst case (highest open-loop gain, largest deadtime and smallest time constant). The second tuning test is then the setpoint response after a setpoint lead-lag has been set (e.g., lag = reset time and lead = ¼ reset time) or a better PID structure is used.

There is some benefit to knowing the ultimate period and ultimate gain that can be rather quickly achieved by use of Karl Astrom’s relay oscillation method for auto tuning. The ratio of the PID gain used to the ultimate gain is an indication of the gain margin. A gain margin of at least 4 is recommended for industrial applications, which means the loop will remain stable for increases in open-loop gain or deadtime by a factor of 4. This corresponds to using about half of the PID gain seen in the literature for the original Ziegler Nichols tuning rules. The original rules are not robust enough and have an oscillatory response even for perfectly known and constant dynamics. Often, comparisons of tuning methods use the original rules for Ziegler Nichols Ultimate Oscillation method and not the Ziegler Nichols Reaction Curve method, and in both cases, neglect simply cutting the gain in half to smooth the response and significantly increase the robustness.

**Mark**: I would like to make a few comments about Internal Model Control (IMC). IMC is a model-based control methodology that directly incorporates a process model. For simple process models, such as first-order and second-order without dead time, there is a direct translation from IMC to PID tuning parameters, and hence, identical results can be obtained with both approaches. A design consideration for IMC is based on the type of disturbance and where it enters the process. The reported PID tuning rules are usually based on step changes entering at the output of the process (or setpoint). For more complicated processes, approximations must be used to develop PID tuning expressions. Deadtime is often approximated by the Pade approximation in the derivation of IMC-based PID tuning rules. If instead a Taylor series approximation is used for the deadtime, the IMC and Lambda tuning results are equivalent. For processes with complex dynamics or inverse response, it may make sense to consider an IMC or MPC controller.

**Greg**: My other modifications to the Lambda tuning rules include setting a derivative time that is at least ½ the deadtime to ensure some derivative action and less than ¼ the integral time for protection against excessive derivative action approaching and exceeding integral action if a Parallel Form or ISA Standard Form is used. The Series Form in pneumatic and analog controllers, and the principal form in early distributed control systems (DCS)) provided inherent self-limiting to prevent such oscillations. While a modern DCS may offer a Series Form, the ISA Standard Form is more often used. For a first-order-plus-deadtime approximation, the secondary time constant increases the deadtime identified and thus accordingly increases the derivative time. If the secondary time constant can be identified and is larger than the deadtime, I recommend the derivative time be set equal to the secondary time constant. This is done for balanced, lag-dominant and integrating processes, whereas the original Lambda tuning rules only used derivative action in integrating processes and simply set it equal to the secondary time constant. The identification of a primary and a secondary time constant (second-order-plus-deadtime approximation) reduces the deadtime and the time constant seen in the first-order-plus-deadtime approximation.

I also limit the reset time (integral time) to be greater than 0.4 times the deadtime in the Lambda self-regulating process tuning rules where the reset time is normally set equal to the primary time constant. This limit corresponds to the minimum reset time used in other tuning methods for deadtime-dominant processes and in so doing, ensures that there is some proportional action addressing the complaint that Lambda tuning results in integral-only control for severely deadtime-dominant processes.

Mark: The tuning tests as seen in my online document “PID Tuning Comparisons.” show that modifications to Lambda tuning work well for the wide range of processes considered. Based on the simulated PV and CO results, I found that I prefer the Lambda tuning results over the other approaches. Processes with t/q as low as 4 benefit from using the Lambda integrator tuning rule. The tests show the ZN Reaction Curve settings work best on lag-dominant or integrating processes.

Once good disturbance rejection is achieved, the tests show that a two-degrees-of-freedom (2DOF) PID structure can be used to obtain a good setpoint response avoiding excessive overshoot. As the setpoint weight on proportional action beta (b) is decreased, overshoot is reduced but the time to first reach setpoint (rise time) is increased. As the setpoint weight on derivative action gamma (g) is reduced, the drastic kick in PID output is decreased. The increase in rise time from a smaller gamma is not as great as seen from a smaller beta. Thus, reducing gamma is preferable, especially when kicks in the PID output would affect other loops. While this kick may help in getting through valve deadband and resolution limits for small setpoint changes in balanced processes, a better solution is a better valve and if necessary, a lead-lag on the PID output or in the valve positioner.

**Greg**: Setting both beta and gamma equal to zero corresponds to an “I on error and PD on PV” structure. This is identical to a lead time of zero in a setpoint lead-lag where the lag time is set equal to the reset time. Setting only gamma equal to zero and using a beta of one corresponds to the most frequently used structure of “PI on error and D on PV.”

Most users do not realize that the peak error is inversely proportional to the controller gain and the IAE is proportional to the ratio of the reset time to controller gain. There is a tradeoff in controller performance versus robustness. A more aggressive controller is more oscillatory and less robust. A sluggishly tuned controller gives performance similar to a loop with more deadtime. Thus, if you compare an aggressively or sluggishly tuned PID to a more sophisticated algorithm, you can show the PID has less robustness or less performance, respectively. To conclude, the good news is that you can prove any point you want by how you tune the controller. The bad news is that this may not be the truth.

**Stan**: Next time, we’ll see how we can improve control for cascade loops, multiple valves, feedforwards, constraints, composition measurements and compound responses.

### “Believe it or don’t”

(10) Capabilities of both PID and MPC are fully appreciated and achieved

(9) PID loops are tuned robustly to reduce peak error

(8) Aggressive PID tuning in literature for minimum integrated absolute error (IAE) is extensively used in plants

(7) Specialists adjust personal favorite tuning rules based on merits of other tuning rules

(6) Engineers increase PID gain when oscillations appear due to deadband from backlash in valve connections and the great increase in response time due to poor positioner sensitivity

(5) Control specifications require valves to respond precisely and quickly to small changes

(4) The existence of low PID gain limit to prevent oscillations and the need to overdrive the PID output is recognized for any process that is not deadtime-dominant or balanced

(3) Tests show advantage of new algorithm over PID that uses best PID features and tuning for disturbances on the process input

(2) Tuning rules are modified depending on robustness needed and whether response is deadtime-dominant, balanced, near integrating, true integrating or runaway

(1) There will be another Shinskey