TExcelTAD
Home › Control Systems & Automation › Control Systems: Introduction

Control Systems: Introduction

A small aluminium block with a 10 Ω10\ \Omega power resistor bolted to it has to sit at 50 ∘C50\,^\circ\text{C} for a sensor calibration, whatever the room does. Switch on a fixed voltage and the block creeps towards some temperature over a quarter of an hour, overshoots nothing, and ends wherever the room and the airflow put it. Measure the temperature, compare it with 50 ∘C50\,^\circ\text{C} and let the difference decide the heater power, and the block gets there in a couple of minutes and stays there when someone opens a window. That comparison, made continuously and automatically, is feedback control, and this course is about designing it so it is fast, accurate, robust and safe.

By the end you should reach the milestone of the roadmap stage this course follows: model, implement, tune and evaluate a closed-loop control system. The roadmap's practical projects run through the course as guided labs: model a DC motor, control its speed from a microcontroller, tune a PID controller and compare tuning methods, build a low-voltage temperature loop, and simulate a multivariable system.

Where this course starts

You need the Laplace transform and transfer functions from Circuit Theory and Signals and Systems, linear ODEs from Differential Equations, and for the state-space part matrices and eigenvalues from Linear Algebra. Sampling and the z-transform are in Signals and Systems; op-amp feedback and its stability are in Analog Electronics. This course links to those lessons instead of repeating them and spends its time on the control engineer's questions.

The course map

Section You will be able to Labs and tools
Getting started explain what feedback buys (and costs): sensitivity, disturbance rejection, noise ee-pid-loop, python-control
Modelling dynamic systems write ODE models of electrical, mechanical, electromechanical, thermal and fluid systems; linearise them SciPy solve_ivp, ee-rc-rl-transient
Transfer functions and block diagrams reduce block diagrams and signal-flow graphs to one transfer function python-control feedback, series, SymPy
Time response predict rise time, overshoot, settling time and steady-state error from poles and system type ee-rlc-resonance, ee-pid-loop, step_info
Stability and root locus test stability with Routh–Hurwitz; sketch and use the root locus ee-pid-loop, root_locus_map
Frequency-response methods read Bode and Nyquist plots of the loop, gain and phase margins, delay ee-bode-plot, margin, nyquist_response
Compensator design design lead, lag and lead-lag compensators to a specification ee-bode-plot, python-control
PID control choose a PID structure, tune it (Ziegler–Nichols, Cohen–Coon, IMC/lambda) and fix the practical problems ee-pid-loop, NumPy loop simulations
State-space control build state models, test controllability and observability, place poles, design observers and LQR ss, ctrb, obsv, place, lqr
Digital control discretise with a zero-order hold, write a discrete PID, design in the z-plane, choose the sample rate c2d, NumPy
Nonlinearities and structures handle saturation, dead zone and backlash; use cascade, feedforward and ratio control NumPy simulations
Industrial automation pick sensors and actuators, read PLC programs (ladder, structured text, function blocks) and reason about scan cycles, interlocks and SCADA Python scan-cycle simulations

Conventions used throughout

Symbol Meaning Unit (typical)
rr, yy, e=r−ye = r - y reference (setpoint), measured output, error the process unit (K, rad/s, m)
uu controller output, actuator command V, W, %
dd, nn load disturbance, measurement noise as uu or yy
G(s)G(s), C(s)C(s) plant (process with actuator and sensor), controller —
L(s)=C(s)G(s)L(s) = C(s)G(s) loop transfer function —
S=11+LS = \frac{1}{1 + L}, T=L1+LT = \frac{L}{1 + L} sensitivity and complementary sensitivity —
ωn\omega_n, ζ\zeta natural frequency, damping ratio rad/s, —
KpK_p, KiK_i, KdK_d PID gains in the parallel form C(s)=Kp+Kis+KdsC(s) = K_p + \frac{K_i}{s} + K_d s uu per ee, per e⋅se \cdot \text{s}, u⋅su \cdot \text{s} per ee
TsT_s sample period of a digital controller s

Angular frequencies are in rad/s, as python-control and SciPy use them; divide by 2π2\pi for hertz. Rise time is 10–90 %, settling time is to the ±2 %\pm 2\,\% band unless a lesson says otherwise. Negative feedback is assumed: e=r−ye = r - y.

python-control is imported as ct. Two functions are worth knowing from the start: ct.feedback(L, 1) closes a unity-feedback loop, and ct.margin(L) returns (gm, pm, w_pc, w_gc): the gain margin (as a ratio) and phase margin (degrees), then the phase-crossover frequency where the gain margin is measured and the gain-crossover frequency where the phase margin is measured. Two reference plants recur in the labs:

Plant Model Numbers
Heater block G(s)=Rthτs+1G(s) = \frac{R_\text{th}}{\tau s + 1} from heater power (W) to temperature rise (K), later with a sensor delay Rth=4 K/WR_\text{th} = 4\ \text{K/W}, τ=300 s\tau = 300\ \text{s}, heater 10 Ω10\ \Omega on 12 V12\ \text{V}: Pmax=14.4 WP_\text{max} = 14.4\ \text{W}
Small DC motor armature RaR_a, LaL_a, constant kk, inertia JJ, friction bb Ra=2 ΩR_a = 2\ \Omega, La=1 mHL_a = 1\ \text{mH}, k=0.02 V⋅s/radk = 0.02\ \text{V} \cdot \text{s/rad}, J=2×10−6 kg⋅m2J = 2 \times 10^{-6}\ \text{kg} \cdot \text{m}^2, b=1×10−6 N⋅m⋅sb = 1 \times 10^{-6}\ \text{N} \cdot \text{m} \cdot \text{s}, 12 V12\ \text{V}

A first loop in Python

Given: the heater block, G(s)=4300s+1G(s) = \frac{4}{300 s + 1} (K/W), a target rise of 25 K25\ \text{K} above a 25 ∘C25\,^\circ\text{C} room.

Find: how long the block takes to settle with a fixed 6.25 W6.25\ \text{W} (open loop), and with a proportional controller u=Kpeu = K_p e, Kp=2 W/KK_p = 2\ \text{W/K} (closed loop); the steady-state error of each.

Solve:

  • Open loop: final rise 4×6.25=25 K4 \times 6.25 = 25\ \text{K} exactly, if the model is right. The 2 % settling time of a first-order system is 3.91τ=1174 s3.91\tau = 1174\ \text{s}, about 20 minutes.
  • Closed loop: L=8300s+1L = \frac{8}{300 s + 1}, T=L1+L=8300s+9=0.88933.3s+1T = \frac{L}{1 + L} = \frac{8}{300 s + 9} = \frac{0.889}{33.3 s + 1}. The loop is nine times faster (τcl=33.3 s\tau_\text{cl} = 33.3\ \text{s}, settling 130 s130\ \text{s}) but ends at 0.889×25=22.2 K0.889 \times 25 = 22.2\ \text{K}: a steady-state error of 11 %11\,\%.
  • The heater must deliver Kp⋅25=50 WK_p \cdot 25 = 50\ \text{W} at the first instant, more than its 14.4 W14.4\ \text{W}: the real loop saturates and is slower than the linear model says. This is the first lesson of control: the linear model is a start, actuator limits decide the rest (Anti-Windup).

Check: the program below computes the same numbers and also tries a PI controller, whose integral action removes the error.

python · try it yourself
import numpy as np
import control as ct

G = ct.tf([4], [300, 1])                 # heater block: K per W
for name, C in (("P   Kp=2", ct.tf([2], [1])),
                ("PI  Kp=2, Ki=0.02", ct.tf([2, 0.02], [1, 0]))):
    T = ct.feedback(C * G, 1)
    info = ct.step_info(T, T=np.linspace(0, 1500, 15001), SettlingTimeThreshold=0.02)
    print(f"{name:18s}: final {25 * ct.dcgain(T):5.2f} K for a 25 K step, "
          f"settling {info['SettlingTime']:6.1f} s, overshoot {info['Overshoot']:4.1f} %")
info = ct.step_info(G, T=np.linspace(0, 3000, 30001), SettlingTimeThreshold=0.02)
print(f"open loop at 6.25 W  : final {6.25 * ct.dcgain(G):5.2f} K, settling {info['SettlingTime']:6.1f} s")
P   Kp=2          : final 22.22 K for a 25 K step, settling  130.5 s, overshoot  0.0 %
PI  Kp=2, Ki=0.02 : final 25.00 K for a 25 K step, settling  309.0 s, overshoot  9.8 %
open loop at 6.25 W  : final 25.00 K, settling 1173.7 s

The PI loop reaches exactly 25 K25\ \text{K}, but with these gains it overshoots by 9.8 %9.8\,\% and needs 309 s309\ \text{s} to settle: the slow integral action (its zero sits at s=−Ki/Kp=−0.01 rad/ss = -K_i/K_p = -0.01\ \text{rad/s}) has to trim the last few kelvin. Why integral action removes the error, and what it costs, is the subject of Steady-State Error and the PID section.

The PID lab

Most lessons use one lab: a unity-feedback loop with a PID controller around a first- or second-order plant. Its defaults (plant 1(s+1)(0.5s+1)\frac{1}{(s + 1)(0.5 s + 1)}, Kp=3K_p = 3, Ki=2 s−1K_i = 2\ \text{s}^{-1}, Kd=0.1 sK_d = 0.1\ \text{s}) give an overshoot of 10.02 %10.02\,\%, a rise time of 0.712 s0.712\ \text{s} and a settling time of 3.458 s3.458\ \text{s}. Set Ki=0K_i = 0 and watch the steady-state error appear (Kp=3K_p = 3 leaves 25 %25\,\%); raise KpK_p and watch the overshoot grow.

r = 1+C(s): Kp 3, Ki 2, Kd 0.1P(s) = 1/((1s+1)(0.5s+1))y-T(s) = (0.100 s^2 + 3.000 s + 2.000) / (0.500 s^3 + 1.600 s^2 + 4.000 s + 2.000)closed-loop poles: -0.63, -1.29+j2.18, -1.29-j2.180.00.51.001 s2 s3 s4 s5 sty(t)t_s 3.46 s+10.0 %y(t)setpoint10-90 % rise

The lab's derivative is ideal (no filter) and the actuator has no limits, so it shows linear behaviour only; Practical PID and Anti-Windup add what real controllers need.

Safety in this course

Hands-on labs here use a bench supply set to at most 24 V24\ \text{V} DC with its current limit set, small DC motors and fans, power resistors as heaters, and USB-powered microcontroller boards. Industrial machinery, mains motor starters, variable-frequency drives on mains, and safety PLCs are taught as concepts and simulations only. Two hazards are real even at low voltage: a heater resistor that reaches 60–100 ∘C60\text{–}100\,^\circ\text{C} (burns, melted plastic: mount it on a metal block, add a thermal fuse or a software cut-off, never leave it unattended) and a motor shaft or propeller that starts unexpectedly (guard it, clamp the motor, keep fingers and hair away). Every guided lab repeats the hazards that apply to it.

Practice

  1. A loop has L(s)=10s+1L(s) = \frac{10}{s + 1}. Give the closed-loop DC gain and time constant with unity feedback, and the steady-state error to a unit step.
  2. In the heater example, which KpK_p (P only) would bring the steady-state error to 2 %? What initial heater power would a 25 K25\ \text{K} step then ask for?
Answer
  1. T=10s+11T = \frac{10}{s + 11}: DC gain 10/11=0.90910/11 = 0.909, τ=1/11=0.0909 s\tau = 1/11 = 0.0909\ \text{s}, error 1/11=9.1 %1/11 = 9.1\,\%.
  2. Error =11+4Kp=0.02= \frac{1}{1 + 4K_p} = 0.02 gives Kp=12.25 W/KK_p = 12.25\ \text{W/K}; the first instant asks for 12.25×25=306 W12.25 \times 25 = 306\ \text{W}, about 21 times the heater's 14.4 W14.4\ \text{W}. High proportional gain alone is not the answer.

Test yourself

What makes a control loop *closed*?

  1. the actuator is switched on
  2. the measured output is compared with the reference and the difference drives the actuator
  3. the plant is stable
  4. the controller has an integrator

With unity feedback and L(s)=8300s+1L(s) = \frac{8}{300s + 1}, the closed-loop time constant is

  1. 300 s300\ \text{s}
  2. 37.5 s37.5\ \text{s}
  3. 33.3 s33.3\ \text{s}
  4. 2400 s2400\ \text{s}

ct.margin(L) in python-control 0.10 returns

  1. (phase margin, gain margin)
  2. (gm, pm, phase-crossover frequency, gain-crossover frequency)
  3. (gm in dB, pm, bandwidth)
  4. the closed-loop poles

Why did the proportional heater loop with Kp=2 W/KK_p = 2\ \text{W/K} not behave like its linear model at the start of a 25 K25\ \text{K} step?

  1. the sensor was too slow
  2. it asked for 50 W50\ \text{W} from a 14.4 W14.4\ \text{W} heater, so the actuator saturated
  3. the model was unstable
  4. the integral term wound up