PID Controllers

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.

Understanding PID Controllers

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 Control Equation

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 Three Terms Explained

Proportional Term (P)

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.

Integral Term (I)

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.

Derivative Term (D)

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.

Transfer Function Representation

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)

Tuning PID Controllers

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

Practical PID Considerations

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\)).

Interactive PID Simulation

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.

2.0
1.0
0.3
Presets:

Where PID Shines

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.

Summary of Key Equations

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

Practice Problems

Problem 1: Proportional Controller Design

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

Problem 2: Integral Action

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

Problem 3: Ziegler-Nichols Tuning

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

Knowledge Check Quiz

Question 1: What is the primary purpose of the integral term in a PID controller?

Question 2: What effect does increasing the derivative gain (Kd) have on the system?

Question 3: In the PID control equation \(u(t) = K_p e(t) + K_i \int_0^t e(\tau) \, d\tau + K_d \frac{de(t)}{dt}\), what does \(e(t)\) represent?

Question 4: A purely proportional (P) controller typically results in:

Question 5: Which tuning method uses induced oscillations to determine controller parameters?