PID Tuning Simulator
Five tuning methods, three plant models, live comparison — tune before you touch hardware.
The plant models
Most industrial loops fit one of three shapes. FOPDT covers thermal, flow and pressure loops. SOPDT adds a second lag — typical when a sensor or actuator has its own dynamics; tuning rules treat it through Skogestad's half rule (). Integrating plants never settle on their own — tank levels, positions — and punish integral action: note how the methods drop Ki dramatically there.
Relay autotune and the manual bump test
The Relay autotune mode runs the experiment behind the "autotune" button of real temperature controllers and PLCs (Åström–Hägglund, 1984). The PID is replaced by a relay: the output snaps between the actuator limits every time the measurement crosses the setpoint, which forces the loop into a safe, bounded limit cycle. One oscillation tells you everything the classic closed-loop Ziegler-Nichols experiment needed — without driving the plant to the edge of instability:
where is the relay amplitude and the measured oscillation amplitude. The ultimate-cycle table then gives , , — one click applies them and drops you back into closed loop.
The Manual mode is the other field classic, the bump test: step the actuator open-loop and read the plant model straight off the curve — gain , dead time L where the response first leaves zero, and at 63% of the final value. Those three numbers are exactly what every tuning rule below takes as input.
What each tuning method optimizes
Ziegler–Nichols (1942) targets quarter-amplitude damping: fast disturbance rejection, ~25–50% setpoint overshoot — the aggressive baseline everyone measures against. Cohen–Coon refines Z-N for loops with large (dead-time dominant). AMIGO (Åström & Hägglund, 2004) is a modern robustness-first rule: noticeably calmer, rarely needs detuning. IMC / lambda tuning lets you dial the closed-loop speed with λ — with λ = τ you get a smooth, nearly overshoot-free setpoint response at the cost of slower disturbance recovery (chemical industry's favorite). SIMC (Skogestad, 2003) is a half-page rule that is near-optimal for both jobs and is the best default when in doubt — it deliberately returns a PI (no D) for first-order plants.
Turn on the comparison overlay and run both test scenarios: Z-N wins the disturbance test, IMC wins the setpoint test, AMIGO/SIMC sit in the robust middle. That trade-off — servo vs. regulator performance — is the actual content of the whole PID tuning literature. The C code below is the same algorithm the simulator runs: derivative on measurement (no setpoint kick) and a clamped integrator (anti-windup) — remove the actuator limits and watch the overshoot change to see why the clamp matters.