Interactive Lecture
Proportional, Integral, and Derivative Control Tuning
by Dr Arnaldo Delli Carri
This lecture builds on concepts from Control Systems: Transfer Functions & Block Diagrams. If you haven't explored transfer functions and system response yet, start there.
A PID controller (Proportional-Integral-Derivative controller) is one of the most widely used feedback control mechanisms in industrial control systems. The controller calculates an error value as the difference between a measured process variable and a desired setpoint, then applies a correction based on proportional, integral, and derivative terms.
PID is used everywhere because it works reliably with minimal knowledge of the plant model. The proportional term reacts to current error, the integral term eliminates steady-state offset by accumulating past errors, and the derivative term brakes the response when the error is changing rapidly.
The PID controller output is calculated using the following equation:
\[u(t) = K_p e(t) + K_i \int_0^t e(\tau) \, d\tau + K_d \frac{de(t)}{dt}\]
Where:
The proportional term produces an output proportional to the current error:
\[u_p(t) = K_p e(t)\]
Effect: Larger \(K_p\) gives faster response but may cause overshoot and oscillation. Too small \(K_p\) results in slow response and steady-state error.
The integral term accumulates past errors over time:
\[u_i(t) = K_i \int_0^t e(\tau) \, d\tau\]
Effect: Eliminates steady-state error by continuing to increase the control output as long as error persists. However, excessive \(K_i\) can cause overshoot and oscillations.
The derivative term predicts future error based on the rate of change:
\[u_d(t) = K_d \frac{de(t)}{dt}\]
Effect: Provides damping by opposing rapid changes in error. Reduces overshoot and improves stability. However, amplifies measurement noise.
In the Laplace domain, the PID controller transfer function is:
\[C(s) = K_p + \frac{K_i}{s} + K_d s\]
Or in standard form:
\[C(s) = K_p \left(1 + \frac{1}{T_i s} + T_d s\right)\]
Where \(T_i = K_p/K_i\) (integral time) and \(T_d = K_d/K_p\) (derivative time)
Several methods exist for tuning PID parameters:
Ziegler-Nichols Closed-Loop Tuning:
| Controller | \(K_p\) | \(T_i\) | \(T_d\) |
|---|---|---|---|
| P | \(0.5 K_u\) | \(\infty\) | 0 |
| PI | \(0.45 K_u\) | \(P_u / 1.2\) | 0 |
| PID | \(0.6 K_u\) | \(P_u / 2\) | \(P_u / 8\) |
Where \(K_u\) is the ultimate gain and \(P_u\) is the ultimate period
Real-world PID implementations must address several issues that the idealised equations do not capture.
Integral Windup: When an actuator saturates (e.g. a valve fully open), the integral term continues accumulating error. Once the error reverses, the inflated integral causes large overshoot. The remedy is anti-windup: clamping the integral when the actuator is saturated, or back-calculating the integral to match the actual output.
Derivative Kick: A sudden change in setpoint creates a step in the error signal, causing the derivative term to spike. The standard fix is derivative-on-measurement: computing \(K_d \frac{d(-y)}{dt}\) instead of \(K_d \frac{de}{dt}\), so that only changes in the process variable trigger the derivative action.
Filtered Derivative: Pure differentiation amplifies high-frequency measurement noise. In practice, the derivative term is filtered:
\[D(s) = \frac{K_d s}{1 + \tau_f s}\]
where \(\tau_f\) is a small filter time constant (typically \(\tau_f = T_d / 10\)).
Compare P, PI, and PID controllers side by side. Adjust the gains and observe how each term improves the step response. Use the disturbance button to see how integral and derivative action reject external loads.
PID controllers are the workhorse of industrial control. Two canonical examples:
For a broader survey of control system applications — from aircraft autopilots to power grids — see the Control Systems lecture.
| Concept | Equation | Description |
|---|---|---|
| Error Signal | \(e(t) = r(t) - y(t)\) | Difference between setpoint and process variable |
| PID Control Law | \(u(t) = K_p e(t) + K_i \int_0^t e(\tau)d\tau + K_d \frac{de}{dt}\) | Complete PID controller output |
| Proportional | \(u_p = K_p e(t)\) | Output proportional to current error |
| Integral | \(u_i = K_i \int_0^t e(\tau)d\tau\) | Accumulated error over time |
| Derivative | \(u_d = K_d \frac{de(t)}{dt}\) | Rate of change of error |
| Transfer Function | \(C(s) = K_p + \frac{K_i}{s} + K_d s\) | PID in Laplace domain |
| Filtered Derivative | \(D(s) = \frac{K_d s}{1 + \tau_f s}\) | Noise-tolerant derivative term |
A temperature control system has a steady-state error of 5°C when using a proportional controller with \(K_p = 2\). The plant has unity DC gain, so this is a Type-0 unity-feedback loop. What value of \(K_p\) would reduce the steady-state error to 2°C?
Show Solution
Solution:
Given:
Analysis:
For a Type-0 unity-feedback loop with a unity-DC-gain plant, the steady-state error to a step setpoint \(R\) is \(e_{ss} = R/(1 + K_p)\) — inverse in \((1+K_p)\), not in \(K_p\) itself. Since the setpoint step \(R\) does not change between the two cases:
\[e_{ss1}(1 + K_{p1}) = e_{ss2}(1 + K_{p2}) = R\]
Calculation:
\[5(1 + 2) = 2(1 + K_{p2})\]
\[15 = 2 + 2K_{p2}\]
\[K_{p2} = \frac{13}{2} = 6.5\]
Answer: \(K_p = 6.5\) would reduce steady-state error to 2°C
A PI controller has \(K_p = 3\) and \(K_i = 0.5\). If the error is constant at \(e(t) = 4\) for 10 seconds, what is the total control output \(u(t)\) at \(t = 10\)s?
Show Solution
Solution:
Given:
Formula:
\[u(t) = K_p e(t) + K_i \int_0^t e(\tau) d\tau\]
Calculation:
Proportional term: \(u_p = 3 \times 4 = 12\)
Integral term: \(u_i = 0.5 \times \int_0^{10} 4 \, d\tau = 0.5 \times 4 \times 10 = 20\)
Total output: \(u(10) = 12 + 20 = 32\)
Answer: Control output at t = 10s is 32
A system is tested using the Ziegler-Nichols closed-loop method. The ultimate gain is found to be \(K_u = 8\) and the ultimate period is \(P_u = 2\) seconds. Calculate the PID parameters using the Ziegler-Nichols tuning rules.
Show Solution
Solution:
Given:
Ziegler-Nichols PID Tuning Rules:
Calculations:
Proportional gain: \(K_p = 0.6 \times 8 = 4.8\)
Integral time: \(T_i = 2 / 2 = 1\) s
Integral gain: \(K_i = K_p / T_i = 4.8 / 1 = 4.8\)
Derivative time: \(T_d = 2 / 8 = 0.25\) s
Derivative gain: \(K_d = K_p \times T_d = 4.8 \times 0.25 = 1.2\)
Answer: \(K_p = 4.8\), \(K_i = 4.8\), \(K_d = 1.2\)