# How to Get the Most Out of Your PID by Better Tuning

## Tuning Tune-up. McMilland and Weiner Ask Sigifredo: What Are the Approximate Percentages of the Various Sources of Problems in the Loops You Have Worked With?

Stan: We finish up our series with Sigifredo Nino, the founder and owner of Summa Control Solutions, with a discussion of how to get the most out of your PID by better tuning. A PID will only do as well as the PID tuning will allow. A loop with a poorly tuned PID will perform as badly in terms of minimizing errors from load disturbances as a loop with a larger dead time.

Greg: Money spent to improve measurement and process dynamics is wasted unless the PID tuning takes advantage of the improvement. The integrated absolute error (IAE) for load disturbances is proportional to the ratio of the PID reset time to the PID gain. The ultimate limit to loop performance and how aggressive you can get with the PID tuning settings depend principally upon the degree of dead time relative to the primary time constant. The January/February 2012 InTech article "PID Tuning Rules" details the equation for the peak error and integrated error as a function of tuning settings. Appendix C for the article provides the derivation of the equations and the ultimate limit to these errors based on dynamics. Equation C-16 gives an estimate of the equivalent dead time from slower tuning. Since most loop dynamics change with operating point, load, run or cycle time, and production rate, less aggressive tuning settings are used to provide more stability for the inevitable changes.

Some disturbances are incredibly slow (e.g., bioreactor temperature and pH control) and the emphasis shifts. There are many other objectives besides integrated absolute error (IAE) that require a smaller PID gain, such as maximizing the absorption of variability and the coordination of loops and the minimization of interaction, resonance, and the upset to headers.

For minimum IAE, the PID gain is maximized with an upper limit of about ½ the ratio of the time constant to the product of the dead time and the open loop self-regulating process gain. When the time constant becomes larger than 4 times the dead time we term the process near-integrating and use a near-integrating process gain that is the ratio of the self-regulating process gain to the time constant. The maximum PID gain then simplifies to ½ the inverse of the product of the dead time and open loop integrating process gain. However, if the PID gain is set at this upper limit, an increase in dead time or process gain, or a decrease in time constant that is greater than 3 will cause instability. Since most loop dynamics change with operating point, load, run or cycle time, and production rate, a smaller PID gain is used to provide more stability for the inevitable changes.

For minimum IAE, the PID reset time is minimized with a lower limit that is a factor of the dead time. The minimum reset time is about four times the dead time for loops with a near-integrating or true integrating or runaway process response. Examples are gas pressure control and level, composition, temperature and pH control of liquid volumes. For self-regulating processes, the minimum reset time starts at four times the dead time for a time constant that is four times the dead time, but approaches ½ the dead time as the time constant becomes much less than the dead time indicating a high degree of dead time dominance. Equation C-13 in Appendix C shows this relationship if you realize the ultimate period goes from four to two dead times as the time constant to dead time ratio goes from being much greater to much less than one, respectively.

There are not many severely dead-time-dominant processes in the process industry. Most temperature loops have an appreciable time constant due to thermal lags associated with heat transfer surfaces and thermowells. The most prominent examples of nearly pure dead time processes are the composition, moisture and thickness control of sheets or webs due to sheet or web transportation delay, and the composition control in gas volumes due to at-line analyzer sample time and cycle time.

The more common problem is a reset time that is too small unless the user forgets to switch to integrating process tuning rules with a tuning parameter that is an arrest time rather than a closed loop time constant. For near-integrating, true integrating and runaway processes, the reset time is often an order of magnitude too small. Some of this is due to human response being similar to the integral mode response. Increasingly we are becoming aware the reset time is too small because the PID gain is too small. In Appendix C, Equation C-14a shows that the reset time must be greater than twice the inverse of the product of the open-loop integrating process gain and PID gain. Equation C-14b reveals the reset time must be increased by a factor of 10 to be about 40 times the dead time because the PID gain used is 10 times smaller than the maximum PID gain due to comfort levels with the degree of sudden movement of the PID output.

Stan: Enough of a preamble. Sigifredo, what are the approximate percentages of the various sources of problems in the loops you have worked with?

Sigifredo: Overall, I estimate PID tuning as 20%, control strategy as 10%, PID options as 5%, measurements as 5%, and control valves and other final control elements as 60% of the problems.

Greg: I have had seen a lot of terrible problems created by on-off valves posing as control valves described in the November 2012 Control article "Is Your Control Valve an Imposter?" Given that we have a good strategy, measurement and control valve, what are some of the most common mistakes made in the different process industries?

Sigifredo: The measurement is either not filtered at all when the controller could benefit from the reduction in the response to noise or is very heavily filtered to mask a problem.

Level controls are like the teenagers: Nobody seems to understand them. More often than not, the user would like to have steady level and steady manipulated variable! So they use small gains and short reset times. I have seen oscillations as a result of this practice. I have also found loop tuning modes scheduled to the controller performance. For example if the deviation from SP is too big, then the PID gain or integral time (reset time) is increased. This makes a good recipe for an oscillator.

Stan: What tuning mode is causing most of the problems in the process industries?

Sigifredo: Even though it is the most commonly used, the PID gain is almost always underestimated and underused. Often robustness or minimizing movement in the PID output is overemphasized. I have also seen series form PID controllers tuned with the normal values of rate time and reset time interchanged. The controller is too aggressive unless the proportional term is adjusted to maintain the Integral/Gain ratio. A controller tuned to cancel a dominant process lag can also be tuned for fast setpoint tracking, but this tuning provides slow recovery from a load upset and may wear out the final control element. The derivative mode is rarely used, as it has been wrongfully portrayed as a bearer of instability. In general, the users don't know what to do with it. Very few know that as the rate time is increased, it can prevent overshoot and enable higher performance gain and reset time settings.

Greg: The interaction between the derivative mode and the other modes in the series form will prevent instability from the rate time being set larger than the reset time. For the ISA standard form, this is not the case, and the rate time is usually set to be less than ¼ the reset time. Migration projects going from older distributed control systems (DCS) or analog controllers that use the series form to a modern DCS where the ISA standard form is the default have gotten unstable when the rate time was set larger than the reset time. What PID tuning problems do you see that are different for batch operations?

Sigifredo: PV overshooting due to integral mode is very common. However the implementation of the integral mode in a PI controller by using a positive feedback of the controller output through a first-order filter (external-reset feedback) gives flexibility to the operation, including the possibility of stopping the integration if so required and resetting the integral's initial condition to set the controller output for the start of the batch. External-reset feedback is an effective way to deal with the windup of the integral mode of a controller; however the fact that the external-reset feedback allows a seamless handling of the slave controller windup in a cascade or override arrangement makes the configuration easier and more robust at the same time, for any changes in the time delay of the downstream blocks are automatically taken care of as the integral mode will be effectively changed by the same amount and in the right direction. This functionality is not available in all the PID controllers, unfortunately.

Greg: The May 2006 Control article "The Power of External Reset Feedback" discusses how this PID option can suppress oscillations in cascade control and the November 2011 article "Don't Over Look PID in APC" outlines how this PID option can provide directional move suppression for optimization by valve position control.

Stan: How do you get the initial tuning settings, and how do you know what mode to adjust and in what direction?

Stan: What type of process nonlinearities do you see, and what do you do to prevent a problem?

Sigifredo: The most common difficulties in process control are stiction and backlash of the final control elements. The bad news about them is that you can't tune yourself out of a mechanical nonlinearity. The actuator or the final elements need to be fixed, although this may take a long time to be resolved if the oscillation is not causing "financial" or production liabilities. On the other hand, "normal" nonlinearities I have dealt with are the installed valve characteristics, which can be resolved by a linearization function in the DCS; I normally address anticipated changes in the process gain with gain scheduling.

Greg: External reset feedback of actual valve position can stop the limit cycle from backlash in all processes and from stiction in self-regulating processes if the positioner does not use integral action, but the right solution is to get the valve fixed. For ratio control of feeds for blending and ratio control of reactants for reactors, how do you tune the setpoint response of the flow loops for production rate changes?

Sigifredo: A first-order filter block (lag time) tuned for the slowest secondary loop is inserted in between the master and the slave controllers and takes care of the strategy without sacrificing the ability of the inner controllers to reject load disturbances (as it would happen if the controllers where tuned for setpoint tracking).

Stan: What additional PID tuning rules do you use for integrating processes and for open loop unstable processes?

Sigifredo: Over seven years or so I started using Peter Hansen's algebraic tuning. In this method, the integrating process is treated as a limiting case of the dominant lag case, so the tuning calculations can be used directly. However the general rule, as I encounter these processes is this: Back to the basics; the controller gain will do most of the work. And this also applies to unstable reactors, as they must be lag-time-dominant to be controllable.

Greg: What final words of wisdom do you have for getting the most out of the PID?

Sigifredo: Paraphrasing Einstein: "Stability without performance is lame; performance without stability is blind". The integrated error (IE) is the area delimited by the SP and the PV; the smaller the area for a non-oscillatory loop, the better. Back in 1967, Shinskey came up with a very valuable expression that relates IE as being directly related to the product of the proportional band (PB) and the integral time settings of the controller. Stemming from this relationship, I recommend that control tuning should be addressed as an optimization problem stated as the minimization of the IE, subject to stability constraints; namely, the PID gain should be maximized, and the reset time minimized.

If a loop is not oscillating, the IE is the IAE, since errors all have the same sign. If the loop is oscillating, the positive and negative areas can cancel out. If the oscillation amplitude is constant, the IE is zero.

I tend to distinguish between "controller optimization" and "process controller optimization." The minimization of the integrated absolute error (IAE) is the best theoretical performance that a controller can accomplish; however its typical robustness margin is only about two; i.e. if the process gain or dead time increases by a factor of two, the loop will be undergoing a sustained oscillation. It is very difficult to find a controller in the chemical industry that can be tuned like this, among other reasons because the variability of the PV is moved to the CO, and that can cause trouble to the downstream processes. This is where the use of more conservative tuning comes into play, however detuning is not a solution. It's a matter of balancing performance and robustness, and this is what I call "process controller optimization" … in a single phrase: "mind the IE" whenever you have to adjust the tuning parameters of a PID controller.

And the last recommendation: I don't trust anybody's tuning rules, not even the ones I use, if tuning is producing a problem with stability. However "control stability" is rarely a problem that cannot be fixed by tuning at a plant unless the field devices misbehave.

Greg: I have a lot of respect for marketing people because if you cannot sell a product, you don't have a job to improve the process. Fortunately, there are some very talented people to perform in this role, such as Noelle Hasser, Marketing Manager at Mynah Technologies. Noelle came up with the following "Top Ten" list to help you decide whether your career is in marketing.

### Top 10 Signs You Are Heading Down a Path to a Marketing Career

10. You sign up for a networking session at a users group meeting and wonder where the cocktails are.
9. You realize the marketability of your market's ability.
8. Your company recruits you to "man the booth" at any and every industry trade show.
7. You have a stockpile of company branded swag to give away to customers at a moment's notice.
6. Your engineering coworkers never quite understand exactly what it is that you do.
5. You are an active member of Twitter, LinkedIn, Facebook, or any social media outlet, have a blog or at the very least, are familiar with Jim Cahill,
4. You like taking selfies and are learning the engineering path doesn't offer as many opportunities for that.
3. You are more interested in the advantages of a product rather than an equation.
2. You are more into tuning a presentation than a loop.
1. When you think of Pi, you can't help but think…apple, cherry, blueberry….