Lesson 10 / Theory and practice

A first speed controller

P and PI control, voltage saturation and integrator anti-windup.

Third-year engineering · 120 minutes

Before you begin: motor transfer functions, poles and integral action.

After this lesson you can: derive the closed-loop polynomial, check PI stability and assess actuator limits.

Work through the explanation, examples, practical experiment and independent exercises.

Why add external feedback?

Back EMF reduces load sensitivity but does not restore a commanded speed. A controller compares reference r with measured speed and adjusts voltage. Use r = 60 rad/s, voltage limits ±12 V and a 0.1 N·m load step at 1 s. Sensors and the converter are ideal here; practical current limits, sampling and delays come later.

Proportional control

ε = r − ω; u = Kpε
ω∞ = ktKp r/(Rb + ktke + ktKp) for ML = 0

A nonzero voltage is needed to sustain speed, so a pure P controller normally needs a nonzero error. Raising Kp reduces the error but can make transients more aggressive and cannot remove actuator limits. With Kp = 0.3 and r = 60, the unsaturated no-load equilibrium is about 40.91 rad/s.

Integral action and feasibility

z′ = ε; uraw = Kpε + Kiz; u = clip(uraw,−12,12)

In a stable unsaturated equilibrium with constant reference, z′ = 0 implies zero speed error. Use Kp = 0.3 V·s/rad and Ki = 1 V/rad as teaching values, not universal settings. At 60 rad/s with a 0.1 N·m load, required current is 2.2 A and voltage 10.4 V, so the reference is feasible. At 100 rad/s it requires 16 V; no gain can make a 12 V actuator achieve it.

Saturation and windup

error = target - speed
raw = kp*error + ki*z
voltage = np.clip(raw, -12, 12)
outward = ((raw >= 12 and error > 0) or
           (raw <= -12 and error < 0))
dz = 0.0 if outward else error

Conditional integration stops accumulation when the error pushes further into saturation and resumes when it helps leave the limit. Voltage limiting is not current limiting. Inspect current and saturation duration as well as speed quality.

PI speed feedback with voltage saturation
PI speed feedback with voltage saturation. Select the image to enlarge it.

Reference and disturbance channels

C(s) = Kp + Ki/s; G(s) = kt/D(s)
Ω/Rref = CG/(1 + CG)
Ω/ML = −[(Ls + R)/D(s)]/(1 + CG)

These transfer functions describe the linear unsaturated regime. The integral term increases low-frequency gain, but does not make an unreachable reference reachable.

Full-model PI stability

a₃s³ + a₂s² + a₁s + a₀ = 0
a₃ = LJ; a₂ = Lb + RJ
a₁ = Rb + ktke + ktKp; a₀ = ktKi
Ki < [(Lb + RJ)(Rb + ktke + ktKp)]/(LJkt)

For a positive leading coefficient, a cubic is Hurwitz when all coefficients are positive and a₂a₁ > a₃a₀. With positive gains, the displayed bound remains. At Kp = 0.3, Ki < 44.44 V/rad. Ki = 1 satisfies it, but stability alone guarantees neither acceptable overshoot nor current. The boundary is not a recommended tuning point.

An initial reduced-model tuning

Gᵣ(s) = K/(τs + 1); K = 7.143 (rad/s)/V; τ = 0.2857 s
Kp = (2ζωnτ − 1)/K; Ki = τωn²/K

Choosing ζ = 0.8 and ωn = 5 rad/s gives Kp = 0.18 and Ki = 1. Validate this initial tuning on the full model. A PI zero changes the closed-loop numerator, so the standard no-zero second-order overshoot formula is not exact here.

Back-calculation and validation

uraw = Kpε + v
v′ = Kiε + (u − uraw)/Tt; Tt > 0

Back-calculation returns the integral voltage state toward a realizable command. A very small Tt introduces a fast scale requiring finer integration. Compare it with conditional integration under identical limits. Test small and large reference steps, load application and removal, an unreachable reference followed by a reduction, and R/J changes of ±20%.

Independent exercises

1. For Kp = 0.18, find the full-model Ki limit. Is Ki = 40 stable?

Show solution

a₁ = 0.032 and the critical Ki is 32.32 V/rad. Ki = 40 violates the linear stability condition.

2. At r = 60 rad/s, ML = 0.1 N·m and Ki = 1, find equilibrium z.

Show solution

Required voltage is 10.4 V and error is zero, so z = 10.4 rad. In the alternative v formulation the integral state is 10.4 V; the state units are different.

Practical work

Compare Kp = 0.15, 0.3, 0.6 with Ki = 1, then Ki = 0.5, 1, 2 with Kp = 0.3. Tabulate settling time with a stated band, peak current, overshoot, disturbance dip and saturation duration. Compare protected and unprotected integration when a 100 rad/s reference drops to 40 rad/s.

Calculated illustrations

P and PI speed control
P and PI speed control. Generated from the downloadable Python examples.
Voltage saturation and actual current
Voltage saturation and actual current. Generated from the downloadable Python examples.

Key takeaways

Use feasibility, linear stability and nonlinear experiments together. The next lessons extend the model to identification, PWM, cascaded control, flexible mechanics and digital control.

Download Python examples ↓

Progress is stored only in this browser.