- Home
- Articles
- Control Systems & PID
- PID tuning guide
// Guide · PID Academy · Control systems
PID Tuning: The Complete Guide from Step Test to Ziegler–Nichols, SIMC and Anti-Windup
Tuning decides whether a PID loop runs quietly for ten years or rings every shift. This is the whole course in one article: how to read your controller's equation, how to measure the process, seven tuning methods with their formulas and limits, a simulated head-to-head comparison on one plant, the practical fixes that real loops need, and a troubleshooting table you can take to the plant floor. Every number is worked out and checked by simulation.
- Check the controller's equation first (ideal, series or parallel; seconds or minutes). The same numbers mean different things in different forms.
- One open-loop step test gives , , . The ratio tells you how hard the loop is.
- Good default: SIMC with : , . Ziegler–Nichols and Cohen–Coon are fast but leave thin margins.
- Real loops also need a filtered D term, anti-windup, sensible sample time and a check of valve stiction.
1. Decide what “well tuned” means
Tuning is choosing , and so that the closed loop meets a specification. Before touching a number, write that specification down, because a loop cannot be best at everything at once. Four things compete:
- Setpoint tracking: rise time, overshoot and settling time after the setpoint moves.
- Disturbance rejection: how far the measurement is pushed by a load change and how fast it returns.
- Robustness: whether the loop stays well damped when the process gain, time constant or dead time drifts by 30–50%.
- Control effort: how much the valve, motor or heater moves, including noise. Excess movement wears actuators.
Aggressive tuning improves the first two and costs the last two. Most process loops are regulatory: the setpoint rarely moves and disturbances dominate, so integral action and disturbance rejection matter most. Motion-control loops are servo loops: the setpoint moves constantly and overshoot is the main enemy. If both matter, use setpoint weighting (section 13) to tune the two behaviours separately.
2. Know the equation your controller really uses
The most common tuning mistake is entering correct numbers into the wrong form. Three forms are common.
| Form | Transfer function | Where you meet it |
|---|---|---|
| Ideal (ISA, standard) | Textbooks, most DCS and PLC function blocks | |
| Parallel | Many MATLAB/Python libraries, some drives and microcontroller code | |
| Series (interacting) | Older pneumatic and electronic controllers, some vendors |
Ideal and parallel convert directly: , , . The series form multiplies out to the ideal form with different numbers:
When is small compared with the two forms nearly agree, but with strong derivative action they do not. Three more details change what a number means:
- Proportional band: some controllers ask for PB (%) instead of gain: when input and output are both in percent of span.
- Integral units: may be in seconds or minutes, and some vendors use repeats per minute . A larger number then means more integral action, the opposite of .
- Engineering units vs percent: if the controller works on percent of span, the process gain must be expressed in the same percent. A gain measured in °C per % must be divided by the span of the measurement before you use a rule.
3. What P, I and D do to the response
Here is a short recap; the article “What is a PID controller?” has the longer story. With error :
- P acts on the present error. For a process with gain and no integrator, a P-only loop settles with a permanent offset for a unit setpoint step.
- I acts on the accumulated error, so it removes that offset. Its price is phase lag: more integral action (smaller ) means a slower, more oscillatory loop.
- D acts on the trend. It adds phase lead and damping, but its gain grows in proportion to frequency, so it amplifies high-frequency noise.
| Raise | Rise time | Overshoot | Settling | Offset | Stability |
|---|---|---|---|---|---|
| Shorter | Larger | Little change | Smaller | Worse | |
| Integral action (smaller ) | Shorter | Larger | Longer | Removed | Worse |
| Little change | Smaller | Shorter | No change | Better, up to a point |
4. Classify the process before you tune
Every tuning rule assumes a process model. Nearly all industrial processes can be described well enough by one of two shapes:
- Self-regulating (FOPDT): “first order plus dead time”, . After a step in the output the measurement settles to a new value. Temperature, flow, pressure in a vented volume, speed.
- Integrating: . The measurement ramps for as long as the input is nonzero. Tank level with a pump, the position of a motor driven by velocity.
The three FOPDT numbers are the process gain (change in measurement per change in output), the dead time (also called delay or ) and the time constant (also ). Dead time is the enemy: no controller can react before the measurement moves, and every extra second of delay lowers the gain you can safely use. The ratio summarises how hard the loop is.
| Character | What it means for tuning | |
|---|---|---|
| below 0.1 | Lag-dominant | High gain is possible; integral action should be fast; derivative can help; SIMC limits to . |
| 0.1 to 0.5 | Balanced | The “textbook” case. PI is usually enough; PID gives modest gains. |
| 0.5 to 1 | Delay matters | Lower the gain; derivative adds little; expect slower loops. |
| above 1 | Delay-dominant | Use low gain and mostly integral action. Consider dead-time compensation (Smith predictor) or feedforward. |
The example plant used throughout this article is (°C per % of heater output), s, s, so . The numbers are scaled so they are easy to follow; the method is the same for a furnace measured in minutes.
5. Measure the process with a step test
A step test (also called a bump test) is the single most valuable half hour you can spend on a loop. It turns guesswork into three numbers.
Procedure
- Prepare. Put the loop in manual and wait until the measurement is steady. Make sure other loops and operators are not changing the process.
- Step the output by 5–10% of its range. The measurement change should be at least 5–10 times the noise band, but small enough to stay in the linear region and within safety limits.
- Record the measurement and the output at a sample time of about one twentieth of the expected or faster, until the measurement is flat again (about 4–5 after the dead time).
- Restore the output and, if you can, repeat in the other direction and at another operating point. A large difference tells you the process is nonlinear.
Reading K, L and T
The process gain is in the same units the controller uses. For and there are two standard readings.
- Tangent (reaction-curve) method. Draw the tangent at the steepest point. is where it crosses the initial value; is the time it takes to rise from there to the final value. It is quick but sensitive to how you draw the line, particularly with noise.
- Two-point method (28.3% and 63.2%). For a first-order response with delay, reaches 28.3% of its final change at and 63.2% at . Subtracting gives and . This is more repeatable than a hand-drawn tangent.
Reading the step test in Figure 2
The heater output is stepped by . The temperature rises by . It reaches 28.3% of the change (5.7 °C) at s and 63.2% (12.6 °C) at s.
, s, s, so . The tangent construction in Figure 2 gives the same values.
Integrating processes
If the measurement ramps instead of settling (a tank level), step the output and measure the slope after the dead time. Then , and is the time from the step to the start of the steady ramp. The tuning rules for this case are in section 10.
6. Manual tuning: the procedure that always works
When you cannot run a clean step test, or you only need to refine a loop that already runs, tune by trial and error, but in a fixed order.
- Verify the loop first. Is the sensor reading sensible, does the valve move the right way, is the controller direct or reverse acting as required, is the output not already at a limit?
- Remove I and D. Set integral action off ( at maximum) and . Start with a low gain.
- Find the proportional gain. Make setpoint steps of 5–10%. Raise by factors of about 1.5–2 until the response begins to ring, then back off to roughly half. In practice this lands near .
- Add integral action. Begin with (or the time the measurement takes to reach 63% of its change). Shorten it step by step until the offset disappears in an acceptable time. Stop as soon as a slow, rolling overshoot appears.
- Add derivative only if needed. Try –, with its filter on. Increase until overshoot is acceptable and the output is not jittery.
- Test properly. Check a setpoint step and a disturbance (a load change or an output bump), at more than one operating point, and watch the controller output as well as the measurement.
| What you see | Probable cause | What to change |
|---|---|---|
| Fast ringing with short period, grows or persists | too high (or D too high with noise) | Lower by 30–50% |
| Slow rolling oscillation, period several times | Integral action too strong | Increase (or lower ) |
| Approaches setpoint very slowly and stops short | Gain too low, little integral action | Raise ; shorten |
| Large overshoot after a big setpoint change, controller output pinned at a limit | Integral windup | Enable anti-windup (section 13) |
| Output jumps wildly, measurement looks fine | D acting on noise | Filter D, lower , or drop D |
| Sawtooth measurement with square-wave output | Valve stiction or backlash | Fix the valve (positioner); do not retune |
Manual tuning is slow for processes with long time constants, because each trial takes minutes or hours. That is when a model-based rule pays off.
7. Ziegler–Nichols closed-loop (ultimate gain) method
Published in 1942, this method needs no model. With at maximum and , raise until the loop oscillates with constant amplitude. The gain at that point is the ultimate gain and the oscillation period is the ultimate period . Then read the table.
| Controller | |||
|---|---|---|---|
| P | – | – | |
| PI | – | ||
| PID | |||
| PI, Tyreus–Luyben | – | ||
| PID, Tyreus–Luyben |
The classic rules aim for a quarter-amplitude decay ratio, in which each overshoot is a quarter of the previous one. That is fast but very oscillatory. The Tyreus–Luyben variant (1992) keeps and but is much gentler, and is a better default for chemical processes.
ZN closed-loop on the example plant
For , the phase reaches at rad/s, where . So and s. (On the real plant you would find these values by experiment, as in Figure 1.)
PID: , s, s. Section 12 shows what this does to the real response: 56% overshoot.
8. Ziegler–Nichols open-loop (reaction-curve) method
The second ZN method uses the step test of section 5 instead of a stability experiment, and is safer. With , and from the recording:
| Controller | |||
|---|---|---|---|
| P | – | – | |
| PI | – | ||
| PID |
ZN open-loop PID for
, s, s. Notice the formula: the gain is inversely proportional to , so a larger dead time or a larger process gain lowers the controller gain, which is exactly right.
The rule aims for quarter-amplitude decay on moderate-delay processes. It becomes poor when the dead time is very small compared with (the gain grows without limit) or very large (the loop is then too aggressive).
9. Cohen–Coon
Cohen and Coon (1953) refined the step-test rules by adding terms that depend on the ratio , so they cope better with a larger dead time than the ZN open-loop table. They still aim at quarter-amplitude decay. With :
| Controller | |||
|---|---|---|---|
| PI | – | ||
| PID |
Cohen–Coon PID for the same plant
Here and .
, s, s. It is the most aggressive of the rules in this article (85% overshoot in section 12), so treat it as a starting point to be detuned.
10. IMC, lambda and SIMC: tune by choosing the speed
The earlier rules are fitted to a performance criterion. The internal model control (IMC) idea turns it around: decide how fast you want the closed loop to be and calculate the controller that gives exactly that. Ask for the response , a first-order response with the unavoidable dead time. Approximating the delay as , the controller for a FOPDT process is a PI controller:
Skogestad's SIMC rule (2003) modifies one number. For lag-dominant processes makes the loop slow to recover from a load disturbance, so SIMC caps it:
The single tuning knob is the desired closed-loop time constant. A practical recommendation is : about as fast as the dead time allows. Larger values give smoother, more robust loops; values below buy little speed and cost a lot of robustness.
SIMC PI for
- With s:
- With s (smoother):
, s for the tight setting; , s for the smooth one. Computed exactly, the first has a gain margin of 3.14 and a phase margin of 61°.
Other process shapes
- Integrating process (tank level): , .
- Second-order plus delay : use the series form , , (convert to ideal form with the formulas of section 2).
- Lambda tuning is the same PI rule with always. It is popular in the paper and chemical industries because a large gives smooth, non-interacting loops.
Because the response is specified rather than discovered, SIMC and lambda tuning fit well into a procedure: a model, a speed, a controller. That is why they are a good default.
11. Relay auto-tuning
The relay experiment of Åström and Hägglund (1984) finds and without taking the loop to the edge of stability. Replace the controller with a relay that switches the output between and . Most processes then settle into a steady oscillation whose amplitude is limited by . If the measurement oscillates with amplitude , the describing-function approximation gives
Then you apply the Ziegler–Nichols or Tyreus–Luyben table of section 7. This is how most commercial “auto-tune” buttons work.
Auto-tune of an oven
A relay of makes the oven temperature oscillate with amplitude and period s.
- Tyreus–Luyben PI:
PI: , s.
Practical points: use some hysteresis on the relay so measurement noise does not cause false switching; choose small enough that the oscillation is harmless but large enough to be clear of noise; and keep in mind that the approximation assumes the process filters out the harmonics of the square wave, which is true for most lag-type processes.
12. Head-to-head: the same plant, many rules
Each rule was applied to the plant and simulated: a unit setpoint step at , then a load step of at the process input at s. The D term acts on the measurement with a filter . “Settling” is the time after which the response stays within 2%; IAE is the integrated absolute error (smaller is better), measured separately for the setpoint step and the load step.
| Rule | (s) | (s) | Overshoot | Settling (s) | IAE setpoint | IAE load | Gain margin | Phase margin | |
|---|---|---|---|---|---|---|---|---|---|
| ZN closed-loop PID | 2.55 | 3.72 | 0.93 | 56% | 19.1 | 5.50 | 0.90 | 1.63 | 40° |
| ZN closed-loop PI | 1.91 | 6.20 | – | 44% | 20.8 | 5.40 | 1.62 | 1.92 | 36° |
| ZN open-loop PID | 3.00 | 4.00 | 1.00 | 64% | 19.6 | 5.33 | 0.79 | 1.33 | 39° |
| Cohen–Coon PID | 3.46 | 4.55 | 0.70 | 85% | 24.2 | 6.08 | 0.79 | 1.31 | 27° |
| Tyreus–Luyben PI | 1.33 | 16.4 | – | 0% | 40.2 | 6.08 | 6.05 | 3.06 | 69° |
| Tyreus–Luyben PID | 1.93 | 16.4 | 1.18 | 0% | 13.7 | 4.22 | 4.16 | 1.76 | 75° |
| SIMC PI, | 1.25 | 10.0 | – | 4% | 12.1 | 4.34 | 3.99 | 3.14 | 61° |
| SIMC PI, | 0.83 | 10.0 | – | 0% | 15.7 | 5.99 | 5.99 | 4.71 | 71° |
What the numbers say
- The ZN and Cohen–Coon PID rules reject the load four to five times better (IAE 0.8–0.9 versus 4.0 for SIMC) but overshoot by 56–85% and run with gain margins of 1.3–1.6, so a 30–60% rise in process gain would push them toward instability.
- The load-rejection difference is explained by one number, . For a response with little overshoot, the area under the error after a load step of size is . For SIMC: so , matching the simulated 3.99. For ZN PID , predicting 0.73 (the simulated 0.90 is higher because that response oscillates).
- SIMC with is the best all-rounder here: the fastest settling of every row (12.1 s), a setpoint error area (4.34) close to the best (4.22 for Tyreus–Luyben PID), only 4% overshoot, and a gain margin above 3. Its price is slower disturbance recovery, which you can buy back by choosing a smaller if the margins allow.
- Tyreus–Luyben PI is very slow on this plant because s exceeds the process time constant; adding D (the PID row) helps the setpoint response but narrows the gain margin to 1.76.
| Situation | Reasonable choice |
|---|---|
| You have a step test and want a smooth, safe loop | SIMC with (or if the process varies) |
| You can only run experiments on the closed loop | Relay test, then Tyreus–Luyben (or ZN detuned) |
| Load disturbances dominate and some overshoot is acceptable | ZN open-loop, then detune by 20–30% |
| Level of a buffer tank | Integrating-process SIMC with a large , or P-only/low-gain PI |
| Very long dead time () | Low-gain PI, then consider Smith predictor or feedforward |
| Process is nonlinear or varies | Tune at the worst operating point; use gain scheduling for the rest |
These results are for one plant. Different values change the picture, which is why you should always check a new tuning by simulation or a careful field test.
13. Practical fixes every real loop needs
Filter the derivative and keep it off the setpoint
A pure derivative has infinite gain at high frequency. Use a first-order filter:
so the high-frequency gain is limited to . Also apply the derivative to the measurement , not the error : a setpoint step then does not cause a huge “derivative kick” on the output. Most commercial controllers do this by default; check yours. If the signal is noisy, a first-order low-pass filter on the measurement is a better cure than a lower .
Setpoint weighting (two degrees of freedom)
The same that rejects disturbances makes the setpoint response overshoot. Weighting the proportional term of the setpoint, with , lowers the overshoot to a setpoint step without touching the disturbance response. Many controllers expose as “setpoint weight” or “beta”.
Integrator windup and anti-windup
If the actuator saturates (valve fully open, heater at 100%) while an error remains, the integral keeps growing. When the error finally reverses, the integral takes a long time to unwind and the measurement overshoots. Two common remedies:
- Clamping (conditional integration): stop integrating while the output is saturated and the error would push it further.
- Back-calculation: feed the saturation difference back into the integrator, . A common choice is for PI and for PID.
Bumpless transfer
When switching from manual to auto (or changing a setpoint source), initialise the integrator so that the output starts from its present value. Otherwise the output jumps and the process is bumped.
Sample time
Digital controllers sample the measurement every . As a rule of thumb, take at most one tenth of the time constant , and no more than about half the dead time when is small. A zero-order hold also adds about of delay, so tune with . The lesson on digital control covers this in detail.
When the hardware is the problem
- Stiction and backlash: a sticky valve sticks, then jumps. The result is a limit cycle (sawtooth measurement, square-wave output) that gets worse as you add integral action. Fix the valve or add a positioner; do not retune around it.
- Dead band and resolution: a coarse output (a few percent steps) or low-resolution input forces the loop to hunt. Reduce integral action or add a dead band in the controller.
- Nonlinearity: valve characteristics, pH curves and furnace gains change with the operating point. Tune at the most difficult point, or schedule the gain with the operating point.
- Saturation of your own range: if the output is saturated most of the time, no tuning will help; the loop is mis-sized.
14. Typical loop types and where to begin
Use these as qualitative starting points, then refine with a step test; plants differ widely.
| Loop | Typical character | Usual controller | Notes |
|---|---|---|---|
| Flow | Fast, small dead time, noisy signal | PI, low gain, no D | Filter the measurement; the valve is often the slowest element. |
| Pressure (gas) | Fast, often nearly integrating | PI, sometimes PID | Fast loops need fast sampling. |
| Level (buffer tank) | Integrating | P or low-gain PI | Averaging level control passes flow changes smoothly to the next unit; do not tune it tight. |
| Temperature | Slow, significant dead time | PI or PID | Large rewards D; large rewards patience. |
| Speed (motor) | Lag-dominant, fast | PI | Often inside a current loop; tune inner loops first. |
| Position | Integrating | P, PD or PID | Friction can need a little integral action and anti-windup. |
| pH, composition | Strongly nonlinear, long delay | PI with gain scheduling | Tune where the slope is steepest, then schedule. |
For cascade loops (temperature outer, flow or valve position inner) always tune the inner loop first and make it several times faster than the outer loop.
15. How to judge a tuning
Judge the loop with numbers, not by how the trend “feels”.
- Time-domain: overshoot, settling time (±2% or ±5%), peak deviation after a load step, and recovery time.
- Error integrals: IAE , ISE , ITAE . Compare tunings on the same test; the lower the better. IAE for a load step is about .
- Robustness: gain margin at least 2 (6 dB), phase margin 45–60° and peak sensitivity of 1.4–2. In the comparison table above, only the two SIMC rows and Tyreus–Luyben PI have both a gain margin above 2 and a phase margin above 45°.
- Control effort: look at the standard deviation or total variation of the output. Noise amplified by D shows up here first.
16. Troubleshooting guide
| Symptom | Check | Action |
|---|---|---|
| Loop runs away immediately after switching to auto | Direct/reverse action, sensor scaling, setpoint source | Fix action and scaling; initialise for bumpless transfer |
| Steady oscillation with period near | Is near ? | Halve ; verify with a 50% gain test |
| Slow oscillation, a few times | too small for the dead time | Double (or lower and together) |
| Never reaches setpoint, sits short | No integral action, or output clamped | Enable I; check output limits and mode |
| Reaches setpoint but crawls the last few percent | much too long | Shorten toward |
| Overshoots only after large moves | Windup | Anti-windup; limit the setpoint rate |
| Output noisy, valve chatters | D on noise, unfiltered measurement | Filter the measurement and D; lower |
| Good at one load, bad at another | Nonlinear process | Tune at the hardest point or schedule the gain |
| Limit cycle that gets worse with more I | Valve stiction | Repair or add a positioner |
17. A repeatable tuning workflow
- Write the specification: tracking or regulation, allowed overshoot, allowed actuator movement.
- Check the hardware and the equation: sensor, valve, direct/reverse, form of the PID block, time units.
- Run a step test (section 5) and read , , ; compute .
- Choose the rule: SIMC by default; a relay test if you cannot open the loop; Ziegler–Nichols only as a first guess.
- Convert to the controller's form and units (section 2).
- Add the practical items: D filter, anti-windup, output limits, sample time.
- Test a setpoint step, a disturbance and a 50% gain increase at the relevant operating points.
- Refine and document the final values, the date and the test results, so the next engineer does not start from zero.
18. Practice problems
Try each one on paper, then open the answer.
Form conversion
A series-form controller has , s, s. Find the ideal-form values.
Show the answer
Ziegler–Nichols from an experiment
A closed-loop test gives and s. Find the ZN PID values and the parallel-form gains and .
Show the answer
SIMC for a delay-heavy process
A step test gives , s, s. Find the SIMC PI values with . What is ?
Show the answer
Estimating disturbance rejection
A PI loop has and s, with little overshoot. A load disturbance of 0.4 (in controller-output units) arrives. Estimate the IAE. How does it change if is halved?
Show the answer
Halving halves the error area, but it also lowers the margins, so check the response.Keep learning in the library
The full lessons are in Thai, with English technical terms and the same formulas; the interactive labs run in the browser.
- The PID controller: structure, effects and a simulation lab (in Thai)
- PID tuning: Ziegler–Nichols, Cohen–Coon, SIMC, relay and a try-it lab (in Thai)
- Gain and phase margins, the robustness numbers used here (in Thai)
- Time response: rise time, overshoot, settling time (in Thai)
- Digital control and choosing the sample time (in Thai)
- Analog I/O, PID blocks and VFDs in a PLC (English)
- Short article: what is a PID controller?
Frequently asked questions
What is the fastest reliable way to tune a PID loop?
Run one open-loop step test, read the gain K, dead time L and time constant T from the recording, then apply the SIMC rule , with . It needs one experiment, has one knob, and gives a smooth response with a gain margin near 3.
Should I use Ziegler–Nichols?
Use it as a starting point when you have nothing else, and expect 40–80% overshoot and thin stability margins, because it was designed for a quarter-amplitude decay ratio. Most engineers detune it (lower , larger ) or use SIMC or Tyreus–Luyben instead.
Do I always need the D term?
No. Most industrial loops run PI. Derivative action helps lag-dominant processes with clean measurements (temperature, some position and speed loops) and is of little use when dead time dominates or the signal is noisy. If you use it, always filter it.
How do I choose the integral time ?
For a self-regulating process a good first value is (the process time constant), limited to when that is smaller. A that is too short gives slow, rolling oscillation; too long leaves the error hanging around. The load-disturbance error area is about with .
What sample time should the controller use?
Roughly one tenth of the process time constant or smaller, and no more than about half the dead time when the dead time is small. Sampling adds about of extra delay, so slow sampling forces lower gains.
Why does my loop oscillate even with small gains?
Suspect the hardware first: valve stiction, backlash or a dead band produces a limit cycle that no gain setting removes, and a noisy or badly filtered measurement can do the same. Look at the controller output: a sawtooth in the measurement with a square-wave output is the classic sign of stiction.
What is integral windup and how do I stop it?
Windup is the integral term growing while the actuator is saturated, which causes large overshoot afterwards. Stop it with anti-windup: clamp the integrator, or use back-calculation . In the simulation in this guide, back-calculation cut the overshoot from 19% to 0.5%.
How can I tell whether a tuning is robust enough?
Aim for a gain margin of at least 2, a phase margin of 45–60° and a peak sensitivity of 1.4–2. A quick field check is to raise by 50% (or let the process gain double) and confirm that the response stays damped.