Lag and Lead-Lag Compensation
The position loop of the root-locus lessons has nice damping at (, 15.7 % overshoot) but a velocity constant of only : following a ramp of it lags behind. The customer wants . Raising 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
At DC it multiplies the gain by ; far above its gain is 1. Between and it adds negative phase (lag). The trick is to put both corners well below the gain crossover , typically : then at crossover the lag contributes a gain of almost exactly 1 and a phase of only about , so the margins hardly change while every error constant grows by .
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 , 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 : an infinite , 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
Given: , crossover , , .
Find: a lag that gives ; compare zero positions , and .
Solve: , so . With (): , and the phase at crossover drops by about (the program finds instead of ). Closer zeros cost more margin, farther ones a slower tail.
Check:
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 . The zero at , only a third of the crossover frequency, costs of margin and the overshoot jumps to . At the cost is , but the slow pole at leaves a tail that stretches the 2 % settling to . At the margin is almost untouched () and the tail is so small that it stays inside the 2 % band; it is still there (time constant ) 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 , pole , gain 336) gave , a settling time near and . A lag with and its zero at , a decade below the lead design's crossover of about , lifts to 10 and costs about of margin. The combined controller
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 : leaves a 25 % error. With (zero at , far below crossover) the error goes to zero with no overshoot, but the lab's settling time is : the slow creep. With (zero at ) it settles in but overshoots : the zero is now close enough to crossover to eat phase.
Guided lab: ramp tracking of a motor position loop
Hand calculation. For your motor position loop, compute with the gain you trust; pick for the target ; put the lag zero at . Predict the ramp-following error 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 supply with the controller in a microcontroller. Command a slow ramp (e.g. ) and log the error once it is steady. Expect the error to drop by about after the lag is added (within 10–20 %; friction adds an offset at low speed), and to take several times seconds to settle to its new value.
Hazards and safe setup. Current limit about , 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
- A loop has (position constant) and needs a step error below 2 %. What does a lag need?
- Crossover is and . Choose the lag zero and pole, and estimate the phase it costs at crossover.
- Why does a PI controller remove the step error completely while a lag only reduces it?
Answer
- Error needs , so .
- , ; phase at : .
- 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 .
Test yourself
A lag compensator is used mainly to
- increase phase margin
- increase the low-frequency gain and so the error constants
- increase the bandwidth
- cancel a resonance
Where is a lag's zero typically placed?
- at the gain crossover
- about a decade below the gain crossover
- at the phase crossover
- above the highest plant pole
What is the typical side effect of a lag with a very low zero frequency?
- noise amplification
- a slow creeping tail in the step response
- instability
- loss of the DC gain
In a lead-lag design, which part is usually designed first?
- the lag
- the lead
- either, the order does not matter
- the sensor filter