Walk through a plant in Pakistan and count the PID loops that are actually doing their job. A surprising number run on the vendor's default gains, tuned for no process in particular; a good many more are in manual because someone gave up. Both are fixable in an afternoon with a trend screen, a pen and one of two rules. This guide is the afternoon: what the three terms do, how to bump the loop and read three numbers off the trend, how the Ziegler–Nichols and SIMC rules turn those numbers into settings, and what to do when the loop still does not behave.
What P, I and D each do, in one paragraph each
Proportional action moves the output in proportion to the error: an error of 2 % of range with a gain of 2.7 moves the valve 5.4 %. It is the workhorse, and it has one flaw: it only acts while there is an error, so a proportional-only loop settles with a standing offset from the setpoint, since some error is needed to hold the valve away from wherever the process wants it. Too much gain and the loop oscillates, because the output overreacts to an error it caused a dead time ago.
Integral action moves the output at a rate proportional to the error, and keeps moving it for as long as any error remains. It is what removes the offset: the output creeps until the error is zero and then stops. The integral time Ti is the time it takes the integral term to repeat what the proportional term did, which is why old instruments express it as repeats per minute. Too short a Ti and the loop cycles slowly, because the integral keeps pushing after the process has already turned; too long and the offset takes ages to clear.
Derivative action moves the output in proportion to how fast the measurement is changing, which lets the controller act on where the process is heading rather than where it is. It helps on slow, clean signals such as temperature, where it allows a higher gain without oscillation. On noisy signals such as flow and pressure it amplifies the noise into the valve, which is why most flow loops are PI and most derivative terms in a plant are set to zero, correctly. When it is used, it goes on the measurement, not the error, and through a filter.
The step test: three numbers from one bump
The rules need a model of the process, and the simplest model that fits most self-regulating loops is first order plus dead time: after a change in the controller output, the measurement does nothing for a dead time θ, then moves towards a new value along an exponential with a time constant τ, and the total change divided by the output change is the process gain K. A step test measures all three.
Put the controller in manual with the process steady. Note the output and the measurement. Step the output by a clear amount: 5–10 % is usual, big enough to see above the noise and small enough to stay in the region where the process is roughly linear. Record the trend until the measurement has settled, which takes about five time constants. Then, if the plant allows it, step back down and record again; the two tests should give similar numbers, and if they differ by a factor of two the process is nonlinear over that range and you should tune for the direction that matters most.
Reading the trend. K is the total change in the measurement divided by the size of the step, both in percent of range: a 10 % step that moves the temperature by 20 % of the transmitter span is K = 2. θ is the time from the step to the moment the measurement starts to move. τ is the time from that moment to the point where the measurement has covered 63.2 % of its total change. The classic way to find θ is to draw a tangent at the steepest part of the rise and read where it crosses the starting level; the tangent also reaches the final value at exactly θ + τ. A more repeatable way on a noisy trend is the two-point method: measure, from the moment of the step, the time t28 at which the measurement has covered 28.3 % of its change and t63 at which it has covered 63.2 %, then
For the trend in the figure, the step is at 20 s, the measurement passes 28.3 % of its change (35.7 %) at 50 s and 63.2 % (42.6 %) at 90 s, so t28 = 30 s and t63 = 70 s after the step: τ = 1.5 × 40 = 60 s and θ = 70 − 60 = 10 s. Noise, a sticking valve and a step made before the process was steady all corrupt τ and θ more than K; if the measurement wanders by 1 % on its own, a 3 % step will not give usable numbers.
Ziegler–Nichols: fast and a little wild
In 1942 John Ziegler and Nathaniel Nichols of Taylor Instruments published two tables that are still the first thing most engineers learn. The open-loop table uses the step-test numbers directly: for a PI controller Kc = 0.9 τ ÷ (K θ) and Ti = 3.33 θ; for PID Kc = 1.2 τ ÷ (K θ), Ti = 2 θ and Td = 0.5 θ. The closed-loop table uses the ultimate gain and period from the test described below. Both were designed for the same target: quarter-amplitude damping, where each overshoot is a quarter of the one before, so a disturbance dies out in two or three swings.
That target is the strength and the weakness. The loop is fast at rejecting disturbances, which is what a 1940s process plant wanted. It is also lightly damped, with a setpoint overshoot of around half the step, and it has little margin: the gain is roughly half the value that would make the loop oscillate continuously, and if the process gain doubles at a different load, or the model was a little wrong, the loop is on the edge. That is why so many loops "tuned by Ziegler–Nichols" are found running at a third of the rule gain: someone turned it down after the first upset. Use it when speed matters and overshoot is acceptable, expect to reduce the gain, and never use it with derivative on a noisy signal.
SIMC: one knob for robustness
Sigurd Skogestad's 2003 rule takes a different view. Instead of aiming at a damping ratio, it asks you to choose how fast you want the closed loop to be, as a time constant τc, and derives the settings that deliver it for the model you measured. For a first-order-plus-dead-time model the result is a PI controller:
The knob is τc. Set it equal to the dead time, τc = θ, and you get Skogestad's "tight" tuning: a fast loop with a gain margin of about 3 and a phase margin of about 60°, which tolerates the process gain or the dead time being wrong by a factor of two. Set τc larger and the loop becomes slower and more forgiving, with no overshoot; it is the right choice for a noisy measurement, a rough model or a loop whose job is to be smooth rather than fast. Setting τc below θ buys speed the dead time cannot deliver and throws away the margin, so do not. The min() in Ti matters for slow processes: without it a loop with a long τ would take forever to clear an offset, and 4 (τc + θ) is the shortest integral time that does not produce slow cycling.
SIMC is our default at Ahmedonics for the automation systems we commission, because it is explainable. The operator can be told "this number is how many seconds we want the loop to take", the setting can be made gentler or firmer by changing one number, and the loop stays stable when the plant drifts. Skogestad also gives a rule for integrating processes such as level, and a PID rule for second-order models, where the second time constant becomes Td; for a first-order model SIMC is deliberately a PI rule, which for most plant loops is the right answer anyway.
The ultimate-gain test and autotuners
The other classical route needs no model. Set the controller to proportional only, put it in auto, and raise the gain in steps, nudging the setpoint each time, until the measurement oscillates with a constant amplitude. That gain is the ultimate gain Ku and the period of the oscillation is Pu; the Ziegler–Nichols closed-loop table gives PI settings of Kc = 0.45 Ku and Ti = Pu ÷ 1.2. The test is honest, because it measures the loop as it is, valve and transmitter included. It is also slow on a slow process and it takes the loop to the edge of instability, which the plant may not permit.
The relay autotuner of Åström and Hägglund (1984) gets the same two numbers safely. The controller output is switched between two fixed values, say ±5 % around its steady value, each time the measurement crosses the setpoint. The loop settles into a small, bounded oscillation whose period is Pu and whose amplitude gives Ku, and the tuner then applies a rule. This is what the "autotune" button on most PLC blocks and single-loop controllers does. Trust its result when the process was at steady state before the test, the oscillation it produced was clean and symmetrical, and the gains it proposes are in the same region as a step test suggests. Distrust it when the test was run during a load change, when the measurement is noisy enough to trigger extra switches, or when the process is nonlinear enough that the up and down half-cycles differ visibly.
Forms, units and the ways vendors trip you
The settings from any rule are for the ideal (ISA) form, u = Kc (e + (1 ÷ Ti) ∫ e dt + Td de/dt), with Ti and Td in seconds. Before typing them into a controller, check five things.
- Gain or proportional band. Some instruments take PB = 100 ÷ Kc in percent. A gain of 2.7 is a band of 37 %; a bigger band is a smaller gain, and entering 2.7 into a PB field gives a gain of 37.
- Seconds or minutes. Allen-Bradley's PLC PID instructions take their times in minutes; Siemens' compact PID blocks take seconds; older instruments take reset in repeats per minute. An integral time of 33 s typed into a minutes field is 33 min, and the loop will look as if it has no integral action at all.
- Ideal, parallel or series. The parallel form u = Kp e + Ki ∫ e dt + Kd de/dt needs Ki = Kc ÷ Ti and Kd = Kc × Td; typing Ti where Ki belongs makes the integral 1 000 times too strong. The series (interacting) form of older controllers is identical for PI but differs for PID; the calculator gives the conversions.
- Derivative on measurement, and filtered. Derivative on error kicks the output every time the setpoint changes; on the measurement it does not. A filter of Td ÷ N with N of 8 to 20 keeps noise out of the valve. Most blocks default sensibly, some do not.
- Action, limits and windup. A heating loop is reverse acting (measurement up, output down) and a cooling loop is direct acting; get it wrong and the loop runs away to a limit. Set the output limits to what the valve can do, and confirm the block stops integrating at a limit (anti-windup), otherwise the loop overshoots for minutes after a saturation. Check bumpless transfer from manual to auto.
Fine-tuning after the rule
The rule gives a starting point; the loop tells you the rest. Make a setpoint change of a few percent and a disturbance if you can create one, and watch. If the response overshoots and rings, halve the gain. If it approaches the setpoint and then cycles slowly, with a period of many minutes, the integral time is too short: lengthen Ti, do not touch the gain. If it approaches the setpoint and creeps for ages without reaching it, Ti is too long. If it cycles fast, with a period near the dead time, the gain is too high or the derivative is amplifying noise: reduce Td first. Add derivative only where the signal is clean and the process is slow, temperature above all, and start it at the rule value or lower.
Then leave it, and write the settings down with the date and the process conditions. Retune when the process changes: a new valve, a different product, a heat exchanger that has fouled, a pump that now runs on a drive. A loop that was fine for two years and has started to cycle has usually not lost its tuning; something in the process has moved, and the tuning is telling you so.
The example in numbers
The reactor temperature loop of the figure: a 10 % step in the steam valve, 10 s of dead time, a rise to 20 % of span higher with a 60 s time constant. K = 2, τ = 60 s, θ = 10 s, θ ÷ τ = 0.17.
- Ziegler–Nichols PI: Kc = 0.9 × 60 ÷ (2 × 10) = 2.70, Ti = 3.33 × 10 = 33.3 s. In parallel form Ki = 0.0811 s⁻¹; as a band, 37.0 % with 1.80 repeats per minute. Start at half the gain, 1.35.
- Ziegler–Nichols PID: Kc = 3.60, Ti = 20.0 s, Td = 5.00 s, with the derivative on the measurement and filtered.
- SIMC PI with τc = θ = 10 s: Kc = 60 ÷ (2 × 20) = 1.50, Ti = min(60, 80) = 60.0 s. With τc = 20 s for a gentler loop: Kc = 1.00, Ti = 60.0 s.
- For comparison, this model has a theoretical ultimate gain of about 5.0 and an ultimate period of about 38 s; the closed-loop rule applied to those gives Kc ≈ 2.3 and Ti ≈ 31 s, close to the open-loop result, as it should be.
The PID tuning calculator reproduces every one of these, converts them to the parallel form and to proportional band, and flags the controllability ratio. If the loop's temperature comes from a PT100, the PT100 calculator is worth a look too: a 2-wire sensor reading 2.6 °C high is an offset no tuning will remove.
Loops that are not this simple
Integrating processes. A tank level with a pump on the outlet, or a pressure in a closed vessel fed by a compressor, does not settle after a step; it ramps. The step test still works, but what you read is the slope: K′ = rate of change of the measurement (% per second) per % of output, and the dead time. Use the SIMC integrating rule, Kc = 1 ÷ (K′ (τc + θ)) and Ti = 4 (τc + θ), and resist the urge to shorten Ti: on an integrating process a short integral time causes a slow cycle that no gain will fix. If the tank is there to absorb flow surges, tune it loose and let the level move.
Dead-time-dominant loops. When θ is larger than τ, as in a long sampling line, a conveyor or a pH loop, the controller spends most of its time waiting. Ziegler–Nichols gains scale with τ ÷ θ and become tiny yet still aggressive; SIMC with τc ≥ θ gives the fastest loop the dead time allows. Beyond that, a Smith predictor, which runs the process model inside the controller to predict what the measurement will do, can help if the model is good. Reducing the dead time at source, by moving the sensor or speeding up the transmitter, beats any of them.
Nonlinear valves and changing gains. A butterfly valve or a quick-opening valve has a gain that varies several-fold across its travel, so K measured at 50 % is wrong at 20 %. Tune for the worst case, use a valve characteriser in the PLC, or split the range into gain-scheduled regions. The same applies to a heat exchanger whose gain falls as the flow rises.
Interacting and cascade loops. Two loops that fight each other, such as temperature and pressure on the same vessel, need to be tuned at different speeds, one fast and one slow, or decoupled. A cascade, where a slow outer loop (jacket temperature) writes the setpoint of a fast inner loop (steam flow), is tuned inner loop first, in auto, then the outer loop with the inner one as part of its process; the inner loop should be at least three to five times faster than the outer. These are the loops where Ahmedonics gets called in, and where a step test on each element, in order, is still the way to begin.
References
- Ziegler, J. G. and Nichols, N. B., "Optimum settings for automatic controllers", Transactions of the ASME, vol. 64, pp. 759–768, 1942
- Skogestad, S., "Simple analytic rules for model reduction and PID controller tuning", Journal of Process Control, vol. 13, pp. 291–309, 2003 — the SIMC rules, the half rule and the integrating-process rule
- Åström, K. J. and Hägglund, T., Advanced PID Control, ISA, 2006 — controller forms, derivative filtering, anti-windup, relay autotuning and the two-point model fit
- Åström, K. J. and Hägglund, T., "Automatic tuning of simple regulators with specifications on phase and amplitude margins", Automatica, vol. 20, pp. 645–651, 1984