› PID Controller Simulator Back

PID Controller Simulator

Change the target and gains. See how the response changes.

Detailed calculation & tank experiment

The main view and detailed calculation share their settings. The tank has independent controls.

PID Gains
Proportional Gain Kp
Integral Time Ti (s)
s
Larger Ti = weaker integral. Use the checkbox below to disable I.

Derivative Time Td (s)
s
Setpoint SP
Simulation Time (s)
s

ZN step-response suggestion requires the first-order + dead-time model with L > 0. Other models remain manually adjustable.

Presets
Performance Metrics
Results
—
90% arrival time (s)
—
Settling time ts (s)
—
Overshoot %
—
End-of-run error %
—
IAE
—
ITAE
Process Variable y(t) and Setpoint
0.00–50.00 s

Both charts share this time window. The y(t) line connects 20 ms samples; u(t) shows the value held over each interval. Metrics use the full duration.

Controller Output u(t)
PID control input u(t)
Process variable y(t) Setpoint SP Control output u(t)
Theory & Key Formulas

u(t) = Kp [e(t) + (1/Ti) ∫0t e(τ) dτ + Td de/dt]

Continuous-time reference equation. The actual calculation uses 20 ms sampling, a derivative filter and output limits.

ZN step response tuning:

Kp = 1.2τ/(K·L)Ti = 2LTd = 0.5L

On this page the ZN rule applies to the first-order model with positive explicit dead time L. Reference: ZN step-response tuning

Independent tank demonstration (separate controls)

Independent, normalized first-order demonstration using the controls below and a 20 ms forward-Euler approximation. Physical level bounds and nonlinear flow are not modeled. Live error is instantaneous; settings and results are separate from the calculator above.

0.70
Setpoint SP
0.000
Current value PV
0.700
Error e
0.00
Control output u
0.0%
Step overshoot
—
90% response
—
Observed settling
0.700
Current absolute error |e|
0.000
Ki=Kp/Ti
0.00
Kd=Kp·Td
PV (liquid level) SP (setpoint) e (error) u (inflow = control output)
Proportional Gain Kp1.50
Integral time Ti (s)8.0
Derivative time Td (s)0.00
Target liquid level SP0.70
Process time constant τ (s)5.0
Changing Kp/Ki/Kd visibly shifts the closed-loop response from sluggish → responsive → oscillatory → unstable. For a first-order plant under P-only control, steady-state error for setpoint SP is SP/(1+Kp·K). Integral action approaches zero error only when the setpoint is reachable within actuator limits and the closed loop is stable.
Worked examples, model & questions

TRY THE SAME CONDITIONS

How to use & worked examples

Start with the default first-order plant: process gain 1, time constant 5s, Kp=1, Ti=5s, Td=0s, setpoint 1 and duration 50s. Time to 90% is about 11.5s and IAE about 4.99. Change only Kp first and compare both response and controller output.

Calculator ↑

Model & applicability

The basic form is u=Kp(e+∫e dt/Ti+Td·de/dt); parallel gains are Ki=Kp/Ti and Kd=Kp·Td. This is a sampled model: the controller updates every 0.02 s and its output is held over that interval. The plant is propagated analytically within each interval, and metrics use every update sample. Derivative filtering and output limits of ±10 remain. Distinguish this model from an ideal continuous-time PID. The tank demonstration has independent controls.

Frequently asked questions

Does a larger Ti mean stronger integral action?

For fixed Kp, Ki=Kp/Ti decreases as Ti increases. Use the explicit Disable integral action checkbox to turn I off completely; the P preset checks it. The independent tank illustration disables I at its maximum Ti of 40s.

How are the response metrics defined?

Rise time means first arrival at 90% of the target, not 10–90%. Settling time is the first sample after the last excursion outside ±2%, provided every remaining sample stays inside. A final sample outside gives —. End-of-run error is a finite-time value, not necessarily steady-state error. The tank restarts metrics on a target change, relative to the change from its pre-step output to the new target. It reports first 90% response and step overshoot. Observed settling requires at least the last 0.5 s inside a 2% band of that change, not future stability. Reduced motion uses Advance 60 s. Shared links save input values, the main disturbance setting and tank speed, but not playback time, history or a pending live tank disturbance.

Does Ziegler–Nichols find the optimal gains?

On this page, the suggestion is available only for the first-order + dead-time model with L > 0. Other models and L=0 leave the inputs unchanged. Suggested values are rounded and limited to the input ranges, not guaranteed optimal or stable. Inspect response, controller output and saturation before manual adjustment.

Can I copy these gains to real equipment?

Not directly. PID form, units, sample time, noise and actuator constraints must match. This page compares simplified models and cannot write settings to equipment.

References

MathWorks: PID forms / Plant calculation module used by this page

Explanation updated: 6 September 2026