PID spotlight, part 9: Heuristic tuning for a selflimiting process
When a PID controller is behaving badly, do we start over? What if our open or closed loop tuning method got us almost there? Can we use what we see and a few simple rules to fix PID controller tuning in one or two easy steps? Using heuristic methods for loop tuning may be the answer.
Learning Objectives
 Know the rules to correct PID controller misbehavior (heuristics) and the importance of natural period to proper identification of looptuning results.
 Knowhow to estimate integral after the correct controller gain has been identified and how to estimate controller gain after the correct integral has been identified.
 Understand that heuristic tuning may require multiple steps and the limitations of heuristic tuning.
PID controller tuning insights
 Correcting PID controller misbehavior (heuristics) and the importance of natural period to proper identification of looptuning results are covered in this Control Engineering article.
 Estimating the integral after the correct controller gain has been identified and the controller gain after the correct integral has been identified are discussed.
 Heuristic tuning may require multiple steps and it has limits. See also heuristic tuning tips.
For some difficult control loops, heuristics (pattern recognition) may be the only practical looptuning method. There are three common methods used to tune control loops:

Open loop (PID spotlight 7)

Closed loop (PID spotlight 8)

Heuristics (PID spotlight 9, this article, and 10, next month).
There is considerable published literature on open and closedloop tuning methods and all control textbooks cover open and closed loop tuning. Heuristics methods are not well covered; R. Russell Rhinehart’s Criteria and Procedure for Controller Tuning (Heuristic Tuning), available at https://www.r3eda.com under the MIT open access software license, may be unique (and very different from the method presented here).
Heuristics are normally used for finalizing tuning constants (fine tuning) after either open or closedloop tuning is complete or to adjust the tuning of a controller that has degraded over time. As we saw in PID spotlight parts 7 and 8 open or closed loop tuning methods often do not yield “final” tuning constants. Heuristics may be used to tune a previously untuned control loop and, for certain difficult control loops, may be the only practical method, however, open loop tuning is usually the best choice for new controllers.
Heuristic tuning for controlloop tuning
“Trialanderror” tuning has a bad name and deservedly so. Most people who engage in trialanderror tuning have a picture in their mind of what the controller response should look like (this is good) but have no idea how to get there (this is bad).
Heuristics is a fancy way of saying pattern recognition. Humans are very good at pattern recognition, if they know what pattern they are looking for and what to do when they find it. Heuristic loop tuning is nothing more than looking at a controller response and trying to answer these questions:

Is there too much controller gain or too little?

Is there too much integral or too little?

Is there too much derivative?
All selfregulating control loops with similar lag/deadtime ratios behave the same way, the only difference is scale. Whether the open loop settling time is measured in milliseconds or days, the patterns we are looking for are the same, and the rules we apply for each pattern are the same.
Heuristic tuning is a multistep procedure as illustrated in Figure 1:
Following Figure 1, when we first looked at the controller, we guessed that it had too little controller gain and too little integral (there is an element of guesswork involved, especially when we think there is too little controller gain and too little integral. Hence the large oval.) Our first step was to increase controller gain.
Our next assessment was that we had too much controller gain (we went too far) and still too little integral (but we are more certain that we have too little integral). We lowered the controller gain and increased the integral.
We then assessed that we still had too much controller gain (we didn’t go far enough) and also had too much integral (we went too far) and made commensurate adjustments. Our penultimate assessment was back to too little controller gain and still too much integral (but we are almost there). Our final adjustment made everybody happy.
Your initial thought may be “That sounds like a lot of steps.” This is a worstcase example of circling the drain (so to speak). Typically, if you are working from tuning constants provided by an open or closedloop tuning test, you will rarely need more than two adjustments, and one is normal. Needless to say, with practice you will get better.
However, if you are using heuristics to tune a difficult controller, typically a very slow controller, heuristic tuning benefits from the fact that:

We are usually in the office every day.

Optimum controller tuning exists on a fairly broad, flat plain. Being a little off target for a day or two isn’t going to hurt too badly.

The time to make an adjustment doesn’t take very long.
Hint: My personal experience is that, for slow control loops, the amount of time sitting at a screen tuning a control loop is shorter for heuristic methods than it is for open or closedloop tuning. (Calendar time can run to days for the very slowest controllers; my longest was four steps over four days.)
Your next thought may be: “How do I know that I’m done?”
One very good answer is: “when people stop complaining.” But normally, before you tune a control loop, you should determine what kind of response you are looking for.

Does the controller need to get to setpoint quickly (for example, it’s a cascade secondary)?

Does the controller need to reject disturbances?

Does this controller provide slow optimization (Also known as: Keep it between the lines)?
The answer to these questions determines how you tune the controller (critically damped, underdamped or overdamped) and also may affect how you set up the controller.
When should a control loop start to correct a load disturbance?
Critical concept: A control loop cannot start to correct a load disturbance until half the natural period (P_{n}) has passed.
You will recall that the natural period of a control loop (roughly four times the deadtime) is an important concept in closedloop tuning (see PID spotlight, part 8 [WEBlink – not yet avaiable]). It also provides insight into controller performance and important guidance for controller tuning. One of the insights is that you will not see the impact of a controlloop tuning change until at least ½ of the Natural Period has passed. A quick way to estimate the natural period is:
Natural Period (P_{n}) = 4 * Deadtime (D_{t})
In short, after you make a control loop tuning change walk away until at least ½ the Natural Period has passed. Even better, stay away for more than a full period.
Hint: One of the biggest mistakes trialanderror tuners make is stacking tuning changes on top of each other before the process has had time to ‘digest” the earlier tuning changes. The failure to understand the importance of the natural period leads to a lot of wasted time and results in poor tuning either because the tuner gave up or misinterpreted the current response as actually a reflection of the last tuning adjustment – it probably wasn’t.
The basics: How to tune lag dominant and moderate selflimiting processes
Note: Everything that follows applies only to lag dominant and moderate selflimiting processes. Heuristic tuning of deadtime dominant selflimiting processes has different rules which will be covered in the next PID spotlight, part 10.
In PID spotlight, part 5, we learned how poorly tuned controllers respond (what bad looks like). Here’s a quick review:

If a controller has too much controller gain, integral or derivative it swings.

If it has too much controller gain the process variable (PV) and output (OP) peaks line up (or are very close).

If it has too much integral the OP peaks trail the PV peaks.

If it has too much derivative the OP peaks lead the PV peaks, and the amplitude of the OP swings are usually larger than the PV swings.


For moderate selflimiting processes if the controller has too little controller gain the initial OP response is less than the final OP resting value. Controller response is slow because the integral action is having to do most of the work.

If the controller has too little integral the initial OP response will be equal or greater than the final OP value, however the OP will droop and the PV will stall short of the setpoint (SP). The control response is slow because the integral isn’t fast enough to backfill the controller gain as its contribution falls off as the PV approaches the SP.

Too little derivative can only occur with a moderate process with multiple lags. Derivative may be added to dampen overly oscillatory responses.
Based on the pattern you can see there are rules for how you adjust the controller tuning constants.
Heuristic tuning methodology explained
Heuristic tuning has four steps:

Change the controller SP (the controller is in auto).

Observe the process response; what pattern does it match?

Execute the rules for the identified pattern.

Repeat as necessary.
In the real world you may find that the pattern you see doesn’t exactly match any of the patterns described above. This is not unusual; often controllers that need tuning will have multiple problems. Pick the closest pattern and execute the rules. It may require multiple steps, but the process will get you to a final answer.
What are the rules for too much controller gain?
Figure 2 shows a SP step test of a controller with too much controller gain. This controller looks like it has too much gain; the PV and OP peaks nearly line up. Integral does cause the OP to change direction a little after the PV changes direction, but the delay is small relative to the time between peaks (a few seconds delay versus four minutes between peaks).
The rules for reducing controller gain are:

Cut the controller gain by 30% (anywhere between 2550% will do).

Repeat until swinging is reduced to an acceptable level.


If the tuning logs show the controller gain was recently raised, then split the difference.
If you have no reason to investigate the integral tuning, you can update the tuning logs (you do maintain tuning logs?) and continue with your day. If, however, you have reason to believe that the integral tuning also needs attention (integral could be too slow) you can use what you’ve learned correcting the controller gain to estimate the integral tuning constant.
How to estimate the integral when loop tuning
When we know the controller gain is correct, we can estimate the integral tuning constant as follows:
T_{i} = 2 * D_{t} * K / K_{base}
Deadtime (D_{t}) and baseline controller gain (K_{base}) can be estimated from the chart of the controller response. This calculation works reasonably well for lag/deadtime ratios from 20:1 down to 1:4.
The method is:

Calculate K_{base}.

Guess a new controller gain K.

Calculate an estimated integral constant T_{i}.
Applying the method to figure 2 yields:

K_{base} = ΔOP/ΔPV = 5/10 = 5

Guess a new controller gain K.
Let’s try K = 0.6 (reduce controller gain 25%)

Calculate an estimated integral tuning constant (T_{i}) using:
 T_{i} = 2 * D_{t} * K / K_{base}
 T_{i} = 2 * 0.85 * 0.6 / 0.5
 T_{i} = 2.04
While we are here, we should estimate the lag constant T_{1}:
 T_{1} = T_{i}/0.75 – D_{t}
 T_{1} = 2.04/0.75 – 0.85
 T_{1} = 1.87
And from this we can calculate the lag/deadtime ratio (T_{1}/D_{t}) as a sanity check.
 Lag/Deadtime (T_{1}/D_{t}) ratio = 1.87/0.85 = 2.2
For comparison purposes during open loop testing, we identified the process lag (T_{1}) as 1.27 minutes and therefore the lag/deadtime ratio (T_{1}/D_{t}) was 1.49 (we used this same process in PID spotlight, part 7. Figure 2 in PID spotlight part 7 shows that a controller gain of 0.63 and integral of 1.59 is oscillatory. The tuning constants we just calculated also oscillate; we could make another guess at controller gain (say 0.5), and calculate an integral tuning constant (T_{i}) of 1.7, a lag (T_{1}) of 1.42, and a lag/deadtime ratio (T_{1}/D_{t}) of 1.67.
Why does estimating the integral tuning constant work?
In figure 1 in PID spotlight, part 6, we explored the impact of lag/deadtime ratio on controller stability and found as lag/deadtime ratio increases the controller gain (K) can be raised while maintaining controller stability. If we have an estimate of the controller gain to baseline gain ratio (K/K_{base}) and the process deadtime (D_{t}) we have all the knowledge necessary to estimate the process lag (T_{1}), and thus the controller integral constant (T_{i}). Because the basic shape of the controller response stretches proportionately to changes in process gain, deadtime and lag, it’s straightforward to reduce a wide range of possible values to a simple equation.
One convenient property of this equation is if we guess a new controller gain that is too high, then the estimated integral is too slow. We are not going to cause a controller to go unstable (assuming the estimated controller gain is stable) by changing the integral tuning constant at the same time. Similarly, if we guess a new controller gain that is a little too low the integral will be too fast, which will show up in the controller response to a SP change – but it will not be unstable.
Finally, the calculations are based on the simplified IMC tuning calculations presented in PID spotlight part 7 and, therefore, are no more likely to give you final tuning constants than any other tuning method. You may still need to trim the tuning constants.
What are the rules for too much integral?
Figure 3 shows a SP step test of a controller with too much integral. And it looks like it has too much integral; the OP peak trails the PV peak by a significant margin.
The rules for slowing down integral are:

Increase the integral by 50% (anywhere between 2575% will do).

Repeat until swinging is reduced to an acceptable level.


If the tuning logs show the integral was recently lowered split the difference.
If you have no reason to investigate the controller gain, you can update the tuning logs and continue with your day. If, however, you have reason to believe that the controller gain needs attention you can use what you’ve learned correcting the integral to estimate the controller gain.
How to estimate controller gain
When we know the controller integral is correct we can estimate the controller gain as follows:
K = 0.5 * T_{i} * K_{base} / D_{t}
The method is:

Calculate K_{base}.

Guess a new integral tuning constant T_{i}.

Calculate an estimated controller gain K.
Applying the method to figure 3 yields:

K_{base} = 0.5

Guess a new integral tuning constant T_{i}.
Let’s try T_{i} = 1.25

Calculate an estimated controller gain (K) using:
 K = 0.5 * T_{i} * K_{base} / D_{t}
 K = 0.5 * 1.25 * 0.5 / 0.85
 K = 0.37
Let’s estimate the lag constant T_{1}:
 T_{1} = T_{i}/0.75 – D_{t}
 T_{1} = 1.25/0.75 – 0.85
 T_{1} = 0.82
And from this we can calculate the lag/deadtime ratio (T_{1}/D_{t}) as a sanity check.
 Lag/Deadtime (T_{1}/D_{t}) ratio = 0.82/0.85 = 0.96
Again, if we compare the process lag and lag/deadtime ratio to the open loop testing results we will see there is a difference. The controller gain is much closer to the results of the closedloop testing performed in PID spotlight, part 8, which was 0.387. The new controller gain and integral are a considerable improvement but still slightly oscillatory. We might make another adjustment to integral depending on how aggressive we want the controller to be.
Rules when there’s too little controller gain
The rules for increasing controller gain are:

Increase the controller gain by no more than 50%.

Repeat until a little swinging is detected, then reduce if necessary.


If the tuning logs show controller gain was recently lowered split the difference.
Note: If the controller gain is less than the baseline controller gain and you are sure this is not a deadtime dominant process then set the controller gain at or slightly below the baseline controller gain (K_{base}) as your first step.
A moderate selflimiting process with too little controller gain will look like figure 7 in PID spotlight part 5.
However, a lag dominant process with too little controller gain may not present the telltale signs. This is because the controller is likely stable for controller gains that are several multiples of the baseline controller gain (K_{base}); the controller response will not look like figure 7 in PID spotlight, part 5. Instead it will likely look like you have adequate gain. Futhermore, how high you can set the controller gain may be limited by other considerations, for example to avoid upsetting downstream processes.
You may wonder why this is a problem. In PID spotlight, part 6, we learned that higher controller gain reduces the effect of a process disturbance, limiting both the size and duration of a disturbance. If this controller is intended to control process disturbances then maximizing the controller gain is highly desirable. In this case keep increasing controller gain until swinging occurs, and then cut back if necessary.
This is one reason to keep a tuning log. Specific to lag dominant processes you may need to record why you tuned the controller a specific way; high gain for disturbance rejection or lower gain to avoid upsetting downstream processes. This will alert anyone who looks at the tuning of this controller of your reasons for tuning this controller this specific way.
Do not estimate the integral tuning constant until you are close to the proper controller gain. If you do this while the controller gain is too small, you will calculate an integral tuning constant that is too fast, which may cause instability.
Rules when integral is too slow
The rules for speeding up integral are:

Decrease the integral by 25 to 50%.

Repeat until a little swinging is detected, then increase if necessary.


If the tuning logs show the integral was recently slowed split the difference.
When integral is set too slow the controller will have a hard time eliminating error after a SP change or disturbance (PID spotlight part 5 figure 8). This is true for lag dominant and moderate selflimiting processes. Recall that controller gain alone cannot eliminate error, only integral can. (However, if controller gain is high enough on a lag dominant process it may be hard to tell that integral is too slow. If controller gain is 10 times baseline controller gain then controller gain alone will eliminate 90% of the error.)
Do not estimate the controller gain until you are close to the proper integral tuning constant. If you do this while the integral tuning constant is too slow you will calculate a controller gain that is too large; this may cause instability.
Rules when there’s too much derivative:
The rules for managing derivative are:

Set derivative to zero.

Correct controller gain and integral if necessary.

If, after correction the process looks like a moderate process consider setting derivative at ¼ of the integral (T_{d} = 0.25 * T_{i}). Remove if this causes problems.
Most control loops should not have derivative. There are situations where it can improve controller response. Before you apply derivative verify that you are working with a moderate selflimiting process with multiple lags.
An example of heuristic loop tuning
OK, all that verbiage was nice, but what does it look like in practice?
Figure 4 is the trace of a controller we’ve been asked to tune. There is no tuning log, so we know next to nothing about the process. We can see from the trace that the controller appears to be tuned too slow, and this is what the operator has complained about. We know:

Deadtime = 0.85 minutes.

K_{base} = (74.6 – 70)/(59.1 – 50) (These are based on the end of trace and are approximate.)

K_{base} = 0.51 (approximately)
We will assume this is not a deadtime dominant process. (We would expect to see a much sharper rise in PV after the deadtime has expired if it were). Therefore the controller gain appears to be too small. We should also suspect that the integral to too slow based on the slow approach of the PV to SP, but it is not necessary to fix that on the first attempt.
We will set the new controller gain equal to the baseline controller gain K_{base}.
Figure 5 shows that our attempt to set the controller gain has been largely successful. We do have some oscillation with the PV and OP peaks lining up, which tells us the controller gain might be a little high. The oscillation certainly indicates that we do not want to raise the controller gain any higher. The integral appears to be too slow; the controller appears to be having trouble eliminating the error. Let’s calculate an estimated integral tuning constant (T_{i}):

K_{base} = ΔOP/ΔPV = 5/10 = 5
K_{base} is recalculated because our first calculation was based on approximate data.

The estimated integral tuning constant (T_{i}) is:
 T_{i} = 2 * D_{t} * K / K_{base}
 T_{i} = 2 * 0.85 * 0.51 / 0.5
 T_{i} = 1.73
The estimated lag constant T_{1} is:
 T_{1} = T_{i}/0.75 – D_{t}
 T_{1} = 1.73/0.75 – 0.85
 T_{1} = 1.46
The lag/deadtime ratio (T_{1}/D_{t}) is:
 Lag/Deadtime (T_{1}/D_{t}) ratio = 1.46/0.85 = 1.72
Figure 6 shows that we are close to a final set of tuning constants. If anything, the controller gain might be too large based on the near alignment of the OP and PV peaks. We have three options at this point:

Accept this tuning, assuming we want somewhat aggressive control to reject disturbances.

Reduce controller gain to eliminate oscillation.

Add derivative. This is a moderate process with multiple lags and is a candidate for adding derivative.
Figure 7 shows that adding derivative nearly completely suppressed the oscillations, resulting in near critically damped control. Our work here is almost done! (Please fill out the loop tuning log.)
What we saw here is that even starting with a worstcase scenario, control loop tuning that tells you almost nothing about the process, we were able to achieve reasonable tuning in two steps and almost ideal critically damped tuning in three. However, if this had been a lag dominant process, tuning would have taken more steps; it would have taken multiple steps to find the right controller gain.
So, how did we do versus the openloop and closedloop tuning methods?
As we can see from Table 1, using the heuristic method resulted in tuning constants that align very well with tuning constants calculated using the open and closedloop methods.
Hints: Heuristic tuning tips
Since heuristic tuning is done by making SP changes in Auto there is little risk to the process. Still, you must work with the operator to determine the largest SP change he will be comfortable with. Larger SP changes will yield better results as noise and control valve problems will have less impact on the results. If you suspect that there are valve problems you should make multiple steps of different sizes both up and down. If the process response is not the same, you likely have problems tuning cannot solve. You should keep a loop tuning log. There are a number of good reasons to keep a log; one is if you are using heuristic methods, you can use the log to guide your tuning efforts. Specifically, if you (for example) recently raised controller gain, and now it appears you went too far, you can split the difference between the last setting and the current setting. The purpose behind heuristic tuning is to speed your tuning efforts; a tuning log can help.
More hints: Heuristic tuning limitations
Patience is a common problem with trialanderror tuning. Heuristics is a fancy way of saying guided trialanderror, and the biggest problem I’ve seen is people are just not willing to wait. Remember that the results of any tuning change will not show up until half the natural period has passed and that the natural period is approximately four times the process deadtime. If you are working with a slow process walk away after making a tuning adjustment to resist the urge to make another change before the current change takes full effect. Stacking changes before they play out hides results and adds time to the tuning process.
As we saw above using heuristics can require multiple steps. If a control loop’s tuning is far off the mark it may be better to use openloop tuning to get a first approximation and then use heuristics to finalize the tuning constants. That said, you will presumably be in the office every day, and as you gain experience you will be able to make educated guesses about how big a change needs to be to get you close to optimum. Furthermore, if you are in a reasonably welltuned facility, if you find you must retune a control loop, it is very likely that the existing tuning constants are not too far from optimum. It will be far quicker to use heuristics, especially if there is a recent SP change in the trends, to estimate new tuning constants.
A bad control valve will warp loop tuning results. One of the more common problems with bad valves is hysteresis will induce a limit cycle swing. If you are unaware of the unique signature a bad valve creates, you may mistake this for a controller with too much controller gain or integral. Nothing you do will fix the swing, but your tuning efforts could slow the loop down to the point where it does not work.
Summary of heuristic tuning (including the need to avoid large moves)
Heuristic tuning is easy and generally safe provided you do not make large moves. As with all the tuning methods experience and understanding how the PID equation works helps. Heuristics also compliments the other loop tuning methods as it can be used to trim up the results of the other methods.
Heuristic tuning works well with slow control loops, provided you have the patience to walk away. It is often impossible to tune slow loops using closed or openloop tuning methods; heuristics will do this very well.
Heuristic tuning will yield good results unless there is a problem tuning cannot fix. Heuristics alone can require multiple steps if you start with a control loop that is badly tuned.
Finally, heuristic tuning will speed and improve your tuning efforts. You do not need to start over every time you tune a controller and, as we have seen, open and closedloop methods will often deliver results that are not exactly what we want. Heuristics will allow you to intelligently adjust tuning constants to get you the performance you need.
Ed Bullerdiek is a retired control engineer with 37 years of process control experience in petroleum refining and oil production. Edited by Mark T. Hoske, editorinchief, Control Engineering, WTWH Media, mhoske@wtwhmedia.com.
KEYWORDS
Proportionalintegralderivative, PID tutorial, heuristic tuning methods
CONSIDER THIS
Open, closed and heuristic tuning methods are complimentary. How will having a working knowledge of the concepts behind all three methods speed and improve your tuning efforts?
ONLINE
Link to PID spotlights, parts 18 and with this article online, starting with “Three reasons to tune control loops: Safety, profit, energy efficiency.”
Aug. 1 RCEP webcast is available for one year: How to automate series: The mechanics of loop tuning
PID series from Ed Bullerdiek, retired control engineer
Part 1: Three reasons to tune control loops: Safety, profit, energy efficiency
PID spotlight, part 2: Know these 13 terms, interactions
PID spotlight, part 3: How to select one of four process responses
PID spotlight, part 4: How to balance PID control for a selflimiting process
PID spotlight, part 5: What does good and bad controller tuning look like?
PID spotlight, part 6: Deadtime? How to boost controller performance anyway
PID spotlight, part 7: Openloop tuning of a selflimiting process
PID spotlight, part 8: Closedloop tuning for selflimiting processes
PID spotlight, part 9: Heuristic tuning for a selflimiting process (this article, part A on heuristic tuning)
PID spotlight, part 10: Heuristic tuning in a selflimiting process (next article, part B on heuristic tuning)
Aug. 1 RCEP webcast available for one year: How to automate series: The mechanics of loop tuning
More on PID and advanced process control from Control Engineering.
Do you have experience and expertise with the topics mentioned in this content? You should consider contributing to our WTWH Media editorial team and getting the recognition you and your company deserve. Click here to start this process.