PID spotlight, part 8: Closedloop tuning for selflimiting processes
Closedloop tuning can be used to tune a PID loop. How is it done? What data do I collect? What calculations are required? How well will it work? What problems might I run into? See “How to execute a closedloop test in four steps” and two warnings.
Learning Objectives
 Know how to execute a closedloop test and a relaytuning test.
 Know how to estimate the two process parameters required to calculate proposed PID controller tuning constants and one method (of hundreds) to calculate PID controller tuning constants.
 Understand that the calculated PID controller tuning constants are only an estimate; further trimming of the tuning constants may be required to get the required PID controller performance. Also review the limitations of the closedloop tuning method.
PID controller tuning insights
 Eighth article in the Control Engineering PID tuning spotlight series explains how to execute a closedloop test and a relaytuning test.
 Text and supporting figures show how to estimate the two process parameters required to calculate proposed PID controller tuning constants and one method (of hundreds) to calculate PID controller tuning constants.
 Calculated PID controller tuning constants are only an estimate; further trimming of the tuning constants may be required to get the required PID controller performance. Tips and limits of the closedloop tuning method are covered along with two warnings.
Closedloop tuning generally should be avoided, though if you have a loop that is already swinging, then enough information may be available to apply closedloop tuning rules. Relay tuning is a subset of closedloop tuning (though, strictly speaking, not all relay tuning is closed loop). Both proportionalintegralderivative (PID) tuning methods are explained.
There are three common methods used to tune control loops:

Open loop (PID spotlight 7)

Closed loop (PID spotlight 8, this article)

Heuristics (PID spotlights 9 and 10).
There is considerable published literature on open and closedloop tuning methods, and all control textbooks cover open and closedloop tuning. Heuristics methods are not well covered (parts 9 and 10 in this series). Each has its place in the control engineer’s toolbox. There are concepts unique to each method that will help you think critically about control loop performance.
Closedloop tuning generally should be avoided, however, if you happen to find a loop that is already swinging, you may have all the information you need to use the closedloop tuning rules. Openloop tuning is generally the best choice when you have a “cheerfully start over” situation; either a new control loop or one where the process has been significantly modified. Existing control loops that just need to be trimmed up are best approached using heuristics.
Relay tuning is a subset of closedloop tuning. It avoids the problem of pushing the process to the limits of stability by performing the test in manual mode (open loop). The method was first proposed by Karl Johan Åström and Tore Hägglund in 1984. Depending on the system, you may find this available as automated looptuning software, and if it isn’t, it is not difficult to write your own software. Regardless, if the process is slow enough relay tuning can be done manually.
Closed loop tuning method explanation
The closedloop controller tuning method is done with the controller in auto mode (if you haven’t heard the term before, when a controller is in auto or cascade, it is considered to be operating in closedloop mode.)
The method is:

Turn integral and derivative off. Depending on the system, you can set integral and derivative to 0, although in some systems, you must set integral to a very large number.

Raise the controller gain until the controller swings continuously. You may need to bump the setpoint (SP) to get a swing started.

When the controller is oscillating continuously write down:

The controller gain – this is the ultimate gain (K_{u}).

The time between process variable (PV) peaks – this is the natural period (P_{n}).


Calculate the tuning constants using your favorite calculation method.
How to execute a closed loop test in four steps
Figure 1 shows a closedloop test for a process with a process gain of 2, three lags of 30 seconds, and a deadtime of 30 seconds.
All closedloop tuning methods use this procedure. The only difference is how you calculate the tuning constants once you have determined the ultimate gain (K_{u}) and natural period (P_{n}).
Step 1: Remove integral and derivative.
Step 2: With the controller in auto increase controller gain until a continuous swing occurs. You may need to bump the SP a little bit to get a swing started.
Step 3: Write down K_{u} and P_{n}:
 K_{u} = 1.26
 P_{n} = 3.42 minutes
Step 4: Calculate and test.
Calculating tuning constants
There are reportedly some 400 to 500 published looptuning methods. I will discuss a few of the multiple methods later on, but to get you started, I will use a modified version of ZieglerNichols (ZN) that aims at critically damped PID tuning.
Closedloop tuning methods will not tell you if a process is lag dominant, moderate or deadtime dominant. If you choose to use derivative, you must verify that it improves controller performance.
For a true first order plus deadtime (FO+D_{t}) process these produce tuning constants that are slightly more aggressive than critically damped (a critically damped controller will get the PV to SP as fast as possible without overshoot.)
How did we do with the closedloop test?
Table 2 shows the critically damped ZN calculations for the process that was tested in Figure 1.
The calculated tuning constants are:
PI:
 K = 0.387
 T_{i} = 2.05
PID:
 K = 0.504
 T_{i} = 1.71
 T_{d} = 0.41
Before we put up the performance charts, we should note that the calculated tuning constants are different from those achieved by openloop tuning (covered in “PID spotlight, part 7: Openloop tuning of a selflimiting process.”
Those values were:
 K = 0.63
 T_{i} = 1.59
 T_{d} = 0.40 (if used)
There is a significant difference. This is because the tuning constants calculated by any given method can be quite divergent based on the assumptions built into each method. In this case, both the Simplified internal model control (IMC) and the critically damped ZN methods are intended to provide tuning constants that will yield critically damped response to a SP change. You would think that two methods that had the same goal would provide very similar tuning constants.
Furthermore, if you were to use a looptuning method that is intended to achieve (let’s say) optimal disturbance rejection, you will get very different, and much more aggressive, tuning constants. There also are methods that allow you to dial in the type of controller performance you want using a performance tuning constant.
There are two points to make:

Regardless of the tuning method you use the calculated tuning constants may not be perfect because the assumptions embedded in the method may not match your process.

“Optimal” looptuning constants exist on a fairly broad curve. If the curve had a sharp peak, you would expect all the calculation methods to yield consistent results (and there likely wouldn’t be more than 400 looptuning methods).
From a practical perspective:

Regardless of the looptuning method you use, expect that you may need to trim the tuning constants to get the desired controller response.

You do not need to calculate tuning constants to three significant figures. Our goal is to get loop tuning done quickly to a sufficient degree of accuracy so you can work on the million other things you have to do.
Figure 2 shows the controller performance for the PI tuning constants.
PV response to a SP change approximates openloop response until the PV stalls without reaching SP. The response to a disturbance also shows a good initial response, but then the PV stalls before reaching SP. Based on these response characteristics, we can conclude that the integral is set too slow (see “PID spotlight, part 5: What does good and bad controller tuning look like?” under the section “What bad looks like: Integral set too slow.”
A slight reduction in the integral constant (faster integral) is recommended (1.5 is about correct).
Figure 3 shows the controller performance for the PID tuning constants.
The response is critically damped for a SP change, proving that sometimes no further adjustment of the tuning constants is necessary.
Relay tuning method explained
Relay tuning is not, strictly speaking, closedloop tuning. However, like closedloop tuning, relay tuning induces a swing in the process and calculates an ultimate gain (K_{u}) and natural period (P_{n}), but it does this by stepping the controller output (OP) up and down in manual mode. This can be done manually, or software can be written to automate the process. As a result, relay tuning is generally quite safe.
The method is:

Verify the controller is lined out (no disturbances) and the PV is on SP.

Place the controller in manual.

Step the OP up ½ of the desired full OP step size.

When the PV moves off SP move the OP down a full step.

When the PV crosses the SP move the OP up a full step.

Repeat until the PV achieves a full steady oscillation.

Write down:

The time between PV peaks – this is the natural period (P_{n}).

The full OP step size (OP_{s})

The peaktovalley amplitude of the PV swing (K_{a}).


Calculate the ultimate gain (Ku).
K_{u} = 4 * OP_{s}
π * K_{a}

Calculate the tuning constants using your favorite calculation method.
Executing a relay tuning test
Figure 4 shows automated relay testing of a process with a process gain of 2, three lags of 30 seconds, and a deadtime of 30 seconds.
The vertical lines across the bottom are when the software detects a SP crossing. If you write your own software, trending the crossing detection will help you troubleshoot problems.
The software automatically calculates the natural period and swing amplitude. These are:
 K_{a} = 5.23
 P_{n} = 204 seconds = 3.40 minutes
The OP step size was:
 OP_{s} = 5%
The ultimate gain is:
K_{u} = 4 * 5
3.14 * 5.23
K_{u} = 1.21
Note that when we tested this process using the closedloop tuning method, we found an ultimate gain and natural period of:
 K_{u} = 1.26
 P_{n} = 3.42 minutes
The natural period (P_{n}) turned out to be within a second (204 versus 205), but the apparent ultimate gain (K_{u}) is a bit different (1.21 versus 1.26; a difference of ~4%). These differences are not enough to materially affect the calculated tuning constants.
Table 3 shows the critically damped ZN calculations for the process that was tested in Figure 4.
The calculated tuning constants are:
PI:
 K = 0.363
 T_{i} = 2.04
PID:
 K = 0.484
 T_{i} = 1.70
 T_{d} = 0.41
As expected, the tuning constants are little different from those calculated above, and we should expect that controller performance will be about the same.
Closedloop tuning tips and a warning about closedloop tuning
WARNING: Avoid using closedloop tuning in a live process environment. Pushing a process to the edge of stability runs the risk that it may get away from you, which may cause an incident.
If, however, you plan to use closedloop tuning anyway clamp the controller output some small distance above and below the current controller output (there is a hard lesson behind this advice.) Set the clamps based on how big a swing the process operator will allow.
Relay tuning tips (safer, but also with a warning)
Relay tuning is much safer than closedloop tuning; there is little chance that a control loop will go unstable. Relay tuning can be used to tune slow loops provided you write relay testing logic that will manage the test automatically.
WARNING: You can leave it running and do something else, however, the operator must be able to stop the test automatically in the event of an upset.
Closed loop and relay tuning limitations
Slow control loops cannot be tested using the standard closedloop method. They must be watched closely to make sure they do not go unstable. This is time consuming and tedious. It also may be difficult to tell that a controller is going unstable and once it does it will take a long time to stop the oscillation. Slow loops can be tested using relay tuning if the testing process is automated, however the test will be ruined if a disturbance occurs during the test.
Bad valves will warp the results. It may be impossible to start an oscillation at an acceptable amplitude when a valve has hysteresis and/or stiction. A bad valve will affect the estimate of ultimate gain and natural period; ultimate gain may be larger or smaller than actual, and natural period will likely be longer.
Process noise makes relay tuning difficult if not impossible. It becomes difficult to determine when the PV crosses the SP. Failure to change OP at this time will yield a false natural period.
If you walk up to a control loop that is already swinging, you can use the calculations above if the controller is swinging because it has too much controller gain. A controller with integral will swing at a period greater than the Natural Period (P_{apparent} > P_{n}). If the swing is caused by excess controller gain then the apparent period will be only slightly higher than the Natural Period and can safely be used to calculate the integral and derivative tuning constants. This will be discussed in more detail in the PID spotlight on heuristic tuning, covered in parts 9 and 10 of the series.
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
CONSIDER THIS
After you have executed a closedloop test, calculated PID controller tuning constants and entered them into your PID controller, are you done?
ONLINE
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 (this article)
PID spotlight, part 9: Heuristic tuning for a selflimiting process (part A on heuristic tuning)
PID spotlight, part 10: Heuristic tuning in a selflimiting process (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
https://www.controleng.com/controlsystems/pidapc/
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.