PID controllers govern over 90% of industrial automation loops, from precision temperature chambers to quadcopter motor ESCs. Yet many engineers treat the three gains (Kp, Ki, Kd) as arbitrary knobs rather than coefficients of a dynamic second-order differential equation.
#1. The Plant Equation & The Role of Each Term
Consider a classic physical plant with inertia and viscous friction: \(m \ddot{y} + b \dot{y} + k y = u(t)\). The Proportional term (\(K_p e\)) acts as an artificial spring, accelerating the system toward the setpoint. The Integral term (\(K_i \int e \, dt\)) accumulates past error to eliminate steady-state offset caused by friction. The Derivative term (\(K_d \dot{e}\)) acts as a dashpot damper, anticipating trajectory and suppressing overshoot.
Derivative action resists change in error. It prevents violent oscillations, but will amplify high-frequency sensor noise unless coupled with a low-pass filter.
#2. Numerical Simulation & Anti-Windup Guarding
In digital firmware, we discretize the continuous integral using forward Euler numerical integration with timestep \(\Delta t\). Crucially, real actuators possess finite saturation limits (e.g., 0V to 10V or 0% to 100% PWM). If the control output saturates while an error persists, the integrator winds up to massive values, causing severe lag and overshoot upon recovery. Implementing integrator clamping immediately restores stability.
- Rise Time (\(t_r\)): interval required to climb from 10% to 90% of setpoint
- 2% Settling Time (\(t_s\)): elapsed time until process variable permanently remains within ±2% of target
- Percent Overshoot (\(M_p\)): \(((y_{\max} - r) / r) \times 100\%
- Ziegler-Nichols closed-loop tuning method based on ultimate gain \(K_u\) and period \(T_u\)