Lab
Control Loop Lab
Interactive PID controller tuning with step response, Bode, root locus, and Nyquist plots.
Interactive PID tuning
Select Plant
PID Gains
Proportional gain
Integral gain
Derivative gain
How PID Control Works
Proportional (P)
Applies a correction proportional to the current error. Higher Kp reduces steady-state error but can cause overshoot and oscillation.
Integral (I)
Accumulates past error over time. Eliminates steady-state error completely, but too much integral gain causes slow oscillation (integral windup).
Derivative (D)
Reacts to the rate of change of the error. Damps oscillations and reduces overshoot, but amplifies noise. Use sparingly.
Combined PID
The PID controller uses a filtered derivative term: C(s) = Kp + Ki/s + Kd·(N·s)/(s+N). This controller is in series with the plant, and the unity-feedback loop CG/(1+CG) shapes the closed-loop response.
Challenge 1: Eliminate steady-state error
Scenario: Select the First-Order plant with default parameters and set Kp = 1. Notice the step response doesn't quite reach 1.0.
Task: Add integral gain (Ki) to eliminate the steady-state error. Try Ki = 0.5, then 1.0. Watch the SS Error metric drop to near zero.
This demonstrates why integral action is essential — proportional-only control always leaves a residual error for type-0 plants.
Challenge 2: Tame the oscillation
Scenario: Select the Second-Order plant with ζ = 0.1 (lightly damped). Apply Kp = 2, Ki = 1. Observe the large overshoot.
Task: Add derivative gain (Kd) to reduce overshoot below 10%. Switch to the Bode plot to see how the phase margin improves.
Derivative action adds phase lead near crossover, improving stability margins.
Security model
Everything runs in your browser. No data is sent to any server. All control system computations (RK4 simulation, root finding, frequency response) run entirely in JavaScript on your device.