Home / Science / Engineering / Control and robotics / PID tuning simulatorTool #636

PID tuning simulator: step response, Bode plot, gain and phase margins and Ziegler-Nichols gains

Pick a plant (first or second order, or any transfer function) with dead time, set the PID gains with sliders and see the closed-loop step response with rise time, overshoot, settling time and steady-state error, the controller output, the Bode plot with gain and phase margins, and Ziegler-Nichols starting values. Nothing is uploaded.

Keep it one tap away for everyday use.

Bookmark PID tuning simulator?

Press Ctrl + D now. Your browser opens its own bookmark box, where you choose the name and folder.

  1. Plant
  2. PID gains
  3. Step
  4. Margins
Nothing is uploadedWorks offline once open

Plant (the process you control)

PID controller

C(s) = Kp + Ki/s + Kd·s/(Tf·s + 1), in parallel form; Ti = Kp/Ki and Td = Kd/Kp. Tf smooths the derivative; empty means Td/10. Sliders run from 0 to 3 times the value you typed.

Test settings

The load disturbance is a step added to the plant input, as a sudden extra load would be.

Step response

Bode plot of the open loop C·G

Ziegler-Nichols starting values

Ziegler-Nichols gains are aggressive on purpose (about a quarter-amplitude decay). Treat them as a first guess and soften from there.

Download

What it does

A PID controller sets its output from the error between what you want (the setpoint) and what you measure: a proportional part (Kp × error), an integral part (Ki × the error added up over time, which removes steady offsets) and a derivative part (Kd × how fast the error changes, which damps the response). This simulator closes the loop around a plant you describe and shows what the gains do:

  • Step response of the output to a setpoint step, with the rise time (10 to 90 %), settling time (into ±2 % or ±5 %), overshoot, peak and steady-state error, plus the controller output u so you can see how hard the actuator works.
  • Closed-loop poles and whether the loop is stable.
  • Bode plot of the open loop C(s)·G(s) with the gain margin, phase margin and delay margin.
  • Ziegler-Nichols starting gains from the ultimate gain and period, and from the reaction curve (the tangent to the plant’s own step response). Press Use to try them.
  • An optional load disturbance: a step added to the plant input part way through, to test how well the loop holds the setpoint.

The plant

  • First order + dead time: G(s) = K e^(−Ls) / (τs + 1), the usual model of a heater, a tank level or a speed loop.
  • Second order + dead time: G(s) = K ωn² e^(−Ls) / (s² + 2ζωn s + ωn²), for something springy such as a motor and load.
  • Transfer function + dead time: type the numerator and denominator coefficients, highest power of s first (“1 3 3 1” is s³ + 3s² + 3s + 1). It must be proper (no more zeros than poles).

The controller

C(s) = Kp + Ki/s + Kd·s/(Tf·s + 1). Tf filters the derivative so it does not amplify noise without limit; leave it empty for Td/10, where Td = Kd/Kp. Derivative acts on output only avoids the spike (“derivative kick”) a setpoint step would cause. The sliders run from 0 to three times the value in each box.

Worked example

The page opens with a made-up first-order plant: K = 2, τ = 5 s and a dead time of 1 s, with Kp = 1.2, Ki = 0.3 and Kd = 0.5 (Tf = 0.0417 s). The loop is stable with a rise time of 2.59 s, an overshoot of 4.78 % (peak 1.048 at 7.55 s) and a settling time of 12.3 s (±2 %); the steady-state error is 0 because of the integral action. The Bode plot gives a gain margin of 10.9 dB (× 3.5) at 2.32 rad/s and a phase margin of 67.7° at 0.468 rad/s, so the loop could take 2.52 s more dead time before going unstable.

For this plant the phase reaches −180° at 1.689 rad/s, so the ultimate gain is Ku = 4.251 and the period Pu = 3.721 s, giving Ziegler-Nichols PID gains Kp = 2.551, Ki = 1.371 and Kd = 1.186. The reaction curve gives back K = 2, T = 5 s and L = 1 s, and Kp = 3, Ki = 1.5, Kd = 1.5. Press Use on either row: the response is much faster but overshoots a lot, which is what Ziegler-Nichols gains do.

Tips

  • Start with P only, raise Kp until the response is quick but not ringing, add Ki to remove the offset, then a little Kd to calm the overshoot.
  • Aim for a phase margin of about 45° to 60° and a gain margin of 6 dB or more.
  • Dead time limits how fast any controller can be: the delay margin tells you how much extra delay the loop can take.

FAQ

How is the response worked out? Without dead time the loop is a linear system that is stepped exactly with a matrix exponential. With dead time it is integrated with fourth-order Runge-Kutta, with a whole number of steps per dead time. The list of closed-loop poles uses a 6th-order Padé approximation of the dead time; the time response and the Bode plot use the exact delay.

Does it model output limits or integral windup? No, the loop is linear. Watch the controller output plot: if it goes beyond what your actuator can give, the real response will be slower.

Is anything uploaded? No. Everything runs in your browser and works offline.

Where the numbers come from

  • PID control with a filtered derivative, closed-loop simulation, Bode plots, gain and phase margins and the Ziegler-Nichols tuning rules (ultimate-gain and reaction-curve forms) are standard control textbook material, written out by fibub.
  • Checked against python-control 0.10.2 (step_response, step_info, margin, poles) on 8 loops, and against an independent numpy simulation for loops with dead time.
  • The example plant and gains are made up for this tool.

Standard scientific values, such as constants, atomic weights and melting points, are facts found in every textbook; we name where ours were checked. If you are an author or publisher and want a value, a credit or a table changed or removed, tell us and we will act quickly.

Last updated 2026-11-09.

Related tools

Reaction kinetics fitter #81 Paste concentration against time to find the reaction order, the rate constant with its uncertainty and the half-life; paste k at several temperatures for the activation energy, A, ΔH‡ and ΔS‡. Impedance (EIS) equivalent circuit fitter #111 Paste or open an electrochemical impedance spectrum and fit an equivalent circuit (R(RC), R(RQ), Randles with Warburg diffusion, two-arc R(RQ)(RQ) or a blocking CPE) by complex non-linear least squares. Get each element with its error, the effective capacitance, time constants, exchange current density and a comparison of all circuits. D-H forward kinematics #635 Type a robot arm's Denavit-Hartenberg table (standard or modified convention), move the joints with sliders and get every link transform, the end-effector position and orientation (roll, pitch, yaw, quaternion), the Jacobian and a 3D picture you can turn. Nothing is uploaded. Inverse kinematics for 2 and 3 link arms #637 Find the joint angles that put a planar 2-link arm's tip, or a 3-link arm's tool at a given angle, on a target point. Both elbow-up and elbow-down solutions, a reach check that says why a point is out of reach, optional joint limits, a drawing of the arm and its workspace, and a batch of targets to CSV. State space and pole placement #638 Enter the state-space matrices A, B, C and D to get controllability and observability (matrices and ranks), the open-loop eigenvalues, the state-feedback gain K that places your chosen poles (Ackermann), an observer gain L by duality, and the closed-loop step response. Nothing is uploaded. Kalman filter playground #639 Try a Kalman filter in your browser. Simulate a noisy sensor with a repeatable seed or paste your own measurements, pick a constant-level or constant-velocity model, move the Q and R sliders, and watch the estimate against the truth, the innovations, the uncertainty and the gain. Download every step as CSV.