TExcelTAD
Home › Control Systems & Automation › Lag and Lead-Lag Compensation

Lag and Lead-Lag Compensation

The position loop Ks(s+2)(s+5)\frac{K}{s(s + 2)(s + 5)} of the root-locus lessons has nice damping at K=11.37K = 11.37 (ζ=0.5\zeta = 0.5, 15.7 % overshoot) but a velocity constant of only Kv=1.137 s−1K_v = 1.137\ \text{s}^{-1}: following a ramp of 1 rad/s1\ \text{rad/s} it lags 0.88 rad0.88\ \text{rad} behind. The customer wants Kv=10 s−1K_v = 10\ \text{s}^{-1}. Raising KK ninefold would wreck the damping. A lag compensator raises the low-frequency gain ninefold while leaving the loop near crossover almost untouched. Together with a lead it gives the classic lead-lag design: lead for speed and damping, lag for accuracy.

The lag network

Clag(s)=s+zs+p=β s/z+1β s/z+1,β=zp>1C_\text{lag}(s) = \frac{s + z}{s + p} = \beta\,\frac{s/z + 1}{\beta\,s/z + 1}, \qquad \beta = \frac{z}{p} > 1

At DC it multiplies the gain by β\beta; far above zz its gain is 1. Between pp and zz it adds negative phase (lag). The trick is to put both corners well below the gain crossover ωc\omega_c, typically z≈ωc/10z \approx \omega_c/10: then at crossover the lag contributes a gain of almost exactly 1 and a phase of only about −arctan⁡(1/10)+arctan⁡(1/(10β))≈−5∘-\arctan(1/10) + \arctan(1/(10\beta)) \approx -5^\circ, so the margins hardly change while every error constant grows by β\beta.

In the root-locus picture the pole–zero pair is a dipole near the origin: seen from the dominant poles, its angle contribution is nearly zero, so the locus barely moves. The dipole does add one slow closed-loop pole near −z-z, whose residue is small but whose time constant is long: the response creeps the last few percent towards its final value. That creep is the lag's price, and it grows as the zero moves down.

PI control is the limiting case p=0p = 0: an infinite β\beta, zero steady-state error to a step (Steady-State Error).

lead lag
pole/zero zero below pole pole below zero
placed at the new crossover a decade or more below crossover
improves phase margin, speed steady-state accuracy (error constants)
costs high-frequency gain (noise) a slow creeping tail, a few degrees of margin

Worked example: lag for Kv=10K_v = 10

Given: L0(s)=11.37s(s+2)(s+5)L_0(s) = \frac{11.37}{s(s + 2)(s + 5)}, crossover ωc=1.00 rad/s\omega_c = 1.00\ \text{rad/s}, PM=52.2∘PM = 52.2^\circ, Kv=1.137 s−1K_v = 1.137\ \text{s}^{-1}.

Find: a lag that gives Kv=10 s−1K_v = 10\ \text{s}^{-1}; compare zero positions z=0.3z = 0.3, 0.10.1 and 0.03 rad/s0.03\ \text{rad/s}.

Solve: β=10/1.137=8.80\beta = 10/1.137 = 8.80, so p=z/8.80p = z/8.80. With z=0.1z = 0.1 (ωc/10\omega_c/10): p=0.01137 rad/sp = 0.01137\ \text{rad/s}, and the phase at crossover drops by about arctan⁡(10)−arctan⁡(87.9)=−5.0∘\arctan(10) - \arctan(87.9) = -5.0^\circ (the program finds 47.0∘47.0^\circ instead of 52.2∘52.2^\circ). Closer zeros cost more margin, farther ones a slower tail.

Check:

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

G = ct.tf([1], [1, 7, 10, 0])
K0 = 11.37
gm, pm, _, wc = ct.margin(K0 * G)
print(f"P only     : Kv = {K0 / 10:.3f} 1/s, crossover {wc:.3f} rad/s, PM {pm:.1f} deg")
t = np.linspace(0, 200, 40001)
beta = 10 / (K0 / 10)
for z in (0.3, 0.1, 0.03):
    L = K0 * ct.tf([1, z], [1, z / beta]) * G
    gm, pm, _, wc = ct.margin(L)
    info = ct.step_info(ct.feedback(L, 1), T=t)
    slow = min(abs(ct.poles(ct.feedback(L, 1)).real))
    print(f"lag z={z:4.2f}: Kv = {K0 * beta / 10:.2f} 1/s, PM {pm:4.1f} deg, overshoot {info['Overshoot']:4.1f} %, "
          f"settling {info['SettlingTime']:5.1f} s, slowest pole -{slow:.4f}")

Llead = 336 * ct.tf([1, 2], [1, 20]) * G                    # lead from the root-locus lesson, Kv = 3.36
b2 = 10 / 3.36
Lll = Llead * ct.tf([1, 0.2], [1, 0.2 / b2])
for name, L in (("lead", Llead), ("lead-lag", Lll)):
    gm, pm, _, wc = ct.margin(L)
    info = ct.step_info(ct.feedback(L, 1), T=np.linspace(0, 100, 40001))
    Kv = (ct.minreal(ct.tf([1, 0], [1]) * L, verbose=False)).dcgain()
    print(f"{name:10s}: Kv = {Kv:.2f} 1/s, crossover {wc:.2f} rad/s, PM {pm:.1f} deg, "
          f"overshoot {info['Overshoot']:.1f} %, settling {info['SettlingTime']:.2f} s")
P only     : Kv = 1.137 1/s, crossover 0.998 rad/s, PM 52.2 deg
lag z=0.30: Kv = 10.00 1/s, PM 36.8 deg, overshoot 42.0 %, settling   9.2 s, slowest pole -0.3910
lag z=0.10: Kv = 10.00 1/s, PM 47.0 deg, overshoot 25.2 %, settling  14.3 s, slowest pole -0.1086
lag z=0.03: Kv = 10.00 1/s, PM 50.7 deg, overshoot 18.6 %, settling   9.1 s, slowest pole -0.0307
lead      : Kv = 3.36 1/s, crossover 2.88 rad/s, PM 51.8 deg, overshoot 16.0 %, settling 2.06 s
lead-lag  : Kv = 10.00 1/s, crossover 2.89 rad/s, PM 49.2 deg, overshoot 20.9 %, settling 3.62 s

All three lags reach Kv=10K_v = 10. The zero at 0.3 rad/s0.3\ \text{rad/s}, only a third of the crossover frequency, costs 15∘15^\circ of margin and the overshoot jumps to 42 %42\,\%. At 0.1 rad/s0.1\ \text{rad/s} the cost is 5∘5^\circ, but the slow pole at −0.109-0.109 leaves a tail that stretches the 2 % settling to 14.3 s14.3\ \text{s}. At 0.03 rad/s0.03\ \text{rad/s} the margin is almost untouched (50.7∘50.7^\circ) and the tail is so small that it stays inside the 2 % band; it is still there (time constant 1/0.0307=33 s1/0.0307 = 33\ \text{s}) and would show in a tighter band or in the response to a load disturbance. The lead-lag lines are discussed next.

Lead-lag

The lead of Design with the Root Locus (zero −2-2, pole −20-20, gain 336) gave ζ=0.5\zeta = 0.5, a settling time near 2 s2\ \text{s} and Kv=3.36 s−1K_v = 3.36\ \text{s}^{-1}. A lag with β=10/3.36=2.98\beta = 10/3.36 = 2.98 and its zero at 0.2 rad/s0.2\ \text{rad/s}, a decade below the lead design's crossover of about 2.9 rad/s2.9\ \text{rad/s}, lifts KvK_v to 10 and costs about 3∘3^\circ of margin. The combined controller

C(s)=336 s+2s+20⋅s+0.2s+0.0672C(s) = 336\,\frac{s + 2}{s + 20}\cdot\frac{s + 0.2}{s + 0.0672}

meets both the transient specification and the accuracy specification, which neither part does alone. The order of design matters: first the lead (it sets crossover and margin), then the lag (it must sit below that crossover).

Intuition with the PID lab

In the PID lab, integral action is the extreme lag. Use the defaults with Kd=0K_d = 0: Ki=0K_i = 0 leaves a 25 % error. With Ki=0.5 s−1K_i = 0.5\ \text{s}^{-1} (zero at Ki/Kp=0.17 rad/sK_i/K_p = 0.17\ \text{rad/s}, far below crossover) the error goes to zero with no overshoot, but the lab's settling time is 18.40 s18.40\ \text{s}: the slow creep. With Ki=2 s−1K_i = 2\ \text{s}^{-1} (zero at 0.67 rad/s0.67\ \text{rad/s}) it settles in 3.468 s3.468\ \text{s} but overshoots 12.99 %12.99\,\%: the zero is now close enough to crossover to eat phase.

r = 1+C(s): Kp 3, Ki 0.5, Kd 0P(s) = 1/((1s+1)(0.5s+1))y-T(s) = (3.000 s + 0.500) / (0.500 s^3 + 1.500 s^2 + 4.000 s + 0.500)closed-loop poles: -0.13, -1.43+j2.36, -1.43-j2.360.00.51.005 s10 s15 s20 s25 sty(t)t_s 18.4 sy(t)setpoint10-90 % rise

Guided lab: ramp tracking of a motor position loop

Hand calculation. For your motor position loop, compute KvK_v with the gain you trust; pick β\beta for the target KvK_v; put the lag zero at ωc/10\omega_c/10. Predict the ramp-following error e∞=ωramp/Kve_\infty = \omega_\text{ramp}/K_v before and after.

Simulation. Add the lag to your loop in the program and simulate a ramp with ct.forced_response(T, t, t); check the slow pole and the margin.

What you would measure. The potentiometer-feedback motor on a current-limited 12 V12\ \text{V} supply with the controller in a microcontroller. Command a slow ramp (e.g. 0.5 rad/s0.5\ \text{rad/s}) and log the error once it is steady. Expect the error to drop by about β\beta after the lag is added (within 10–20 %; friction adds an offset at low speed), and to take several times 1/z1/z seconds to settle to its new value.

Hazards and safe setup. Current limit about 1 A1\ \text{A}, motor clamped, software angle limits so the ramp stops before the potentiometer's end, enable switch within reach.

Pitfalls

  • Putting the lag zero near crossover: the margin collapses and overshoot grows.
  • Expecting the lag to speed the loop up: it makes it slightly slower and adds a creeping tail.
  • Implementing a lag with a very slow pole in fixed-point code: the tiny coefficient may round to an integrator or to nothing (Discrete PID).
  • Designing the lag before the lead: the lead moves the crossover, and the lag must then be redone.

Practice

  1. A loop has Kp=4K_p = 4 (position constant) and needs a step error below 2 %. What β\beta does a lag need?
  2. Crossover is 20 rad/s20\ \text{rad/s} and β=5\beta = 5. Choose the lag zero and pole, and estimate the phase it costs at crossover.
  3. Why does a PI controller remove the step error completely while a lag only reduces it?
Answer
  1. Error 1/(1+Kp)<0.021/(1 + K_p) < 0.02 needs Kp>49K_p > 49, so β>49/4=12.25\beta > 49/4 = 12.25.
  2. z=2 rad/sz = 2\ \text{rad/s}, p=0.4 rad/sp = 0.4\ \text{rad/s}; phase at 20 rad/s20\ \text{rad/s}: arctan⁡(10)−arctan⁡(50)=84.29∘−88.85∘=−4.6∘\arctan(10) - \arctan(50) = 84.29^\circ - 88.85^\circ = -4.6^\circ.
  3. PI has its pole at the origin (an integrator), so the loop gain at DC is infinite; a lag multiplies the DC gain by a finite β\beta.

Test yourself

A lag compensator is used mainly to

  1. increase phase margin
  2. increase the low-frequency gain and so the error constants
  3. increase the bandwidth
  4. cancel a resonance

Where is a lag's zero typically placed?

  1. at the gain crossover
  2. about a decade below the gain crossover
  3. at the phase crossover
  4. above the highest plant pole

What is the typical side effect of a lag with a very low zero frequency?

  1. noise amplification
  2. a slow creeping tail in the step response
  3. instability
  4. loss of the DC gain

In a lead-lag design, which part is usually designed first?

  1. the lag
  2. the lead
  3. either, the order does not matter
  4. the sensor filter