Lead Compensation
A positioning stage driven by the course's small DC motor must follow a ramp command (a constant-speed move) with a following error of at most the distance travelled in (error speed), i.e. a velocity constant . Turning up the proportional gain until works for accuracy, but the loop then has a phase margin of about and overshoots by almost 60 %. The usual fix is a lead compensator: a zero followed by a pole at a higher frequency, which adds phase exactly where the loop crosses . The root-locus view of the same idea is in Design with the Root Locus; this lesson designs in the frequency domain, where the specifications are margins and error constants.
The lead network
Its phase is positive between the zero and the pole, with a maximum
So a lead with () adds up to and raises the gain at by ; its high-frequency gain is () above its DC gain. The price of phase lead is high-frequency gain: more noise into the actuator. Leads beyond about () become noisy; two stages are then better than one.
The design procedure
- Choose the controller DC gain to meet the steady-state requirement (, or , see Steady-State Error).
- With that gain, find the phase margin of .
- Required lead: ; the extra covers the phase that is lost because the lead's gain pushes crossover to a higher frequency, where the plant has more lag.
- .
- Put at the new crossover: the frequency where ; then , .
- Check the margin; if it falls short, add a few degrees and repeat. Then simulate the step and the control effort.
Worked example: a position loop
Given: the reference motor, voltage to angle: , DC velocity gain ; specification , .
Find: , the lead zero and pole, the resulting margin and step overshoot.
Solve:
- gives .
- Uncompensated: crossover , .
- First try: , , new crossover where : , , . Result: , just short, because the crossover moved up by half an octave.
- Second try with extra: , , , crossover , , gain margin , overshoot .
Check:
import numpy as np
import control as ct
J, b, Ra, La, k = 2e-6, 1e-6, 2.0, 1e-3, 0.02
G = ct.tf([k], np.polymul([1, 0], np.polyadd(np.polymul([J, b], [La, Ra]), [k * k])))
Kc = 500 / (k / (Ra * b + k * k)) # Kv = Kc * 49.75 = 500
gm0, pm0, _, wc0 = ct.margin(Kc * G)
print(f"Kc = {Kc:.2f} V/rad: crossover {wc0:.1f} rad/s, PM {pm0:.1f} deg")
w = np.logspace(1, 4, 30001)
mag_dB = 20 * np.log10(abs(Kc * G(1j * w)))
for extra in (10, 15):
phi = np.radians(50 - pm0 + extra)
a = (1 - np.sin(phi)) / (1 + np.sin(phi))
wm = w[np.argmin(abs(mag_dB + 10 * np.log10(1 / a)))]
z, p = wm * np.sqrt(a), wm / np.sqrt(a)
L = Kc * ct.tf([1 / z, 1], [1 / p, 1]) * G
gm, pm, _, wc = ct.margin(L)
info = ct.step_info(ct.feedback(L, 1), T=np.linspace(0, 0.1, 20001))
print(f"extra {extra:2d} deg: alpha {a:.3f}, zero {z:6.1f}, pole {p:6.1f} rad/s -> "
f"crossover {wc:.1f} rad/s, PM {pm:.1f} deg, GM {20 * np.log10(gm):.1f} dB, overshoot {info['Overshoot']:.1f} %")
info0 = ct.step_info(ct.feedback(Kc * G, 1), T=np.linspace(0, 0.1, 20001))
print(f"no lead : overshoot {info0['Overshoot']:.1f} %")Kc = 10.05 V/rad: crossover 217.7 rad/s, PM 19.4 deg
extra 10 deg: alpha 0.212, zero 151.3, pole 714.1 rad/s -> crossover 328.8 rad/s, PM 48.6 deg, GM 16.6 dB, overshoot 21.2 %
extra 15 deg: alpha 0.167, zero 142.8, pole 856.0 rad/s -> crossover 349.6 rad/s, PM 52.0 deg, GM 16.8 dB, overshoot 17.3 %
no lead : overshoot 57.9 %
The lead raised the phase margin from to the specification, cut the overshoot from to , and moved the crossover up, so the loop is also faster. The steady-state accuracy is untouched because the lead has unit DC gain. What it cost: the controller's gain from position error to voltage rises from at low frequency to at high frequency, so encoder noise drives the motor six times harder.
Intuition with the Bode lab
The lab's loop at (poles at , , ) has a phase margin of . Its optional zero is an ideal lead (a lead whose pole has gone to infinity). Switch the zero on at : the phase margin becomes with crossover at . At : at . At : , but the crossover jumps to , because the zero also raises the gain. A real lead adds its pole a few times above the zero to stop that gain from growing for ever.
Guided lab: an op-amp lead network
Hand calculation. A passive lead in series, to ground, has with , . With , , : , zero at (), pole at (), at ().
Simulation. Compute ct.tf([0.204 * 39e3 * 100e-9, 0.204], [0.204 * 39e3 * 100e-9, 1]) and read its phase at , or put the network into the ee-netlist lab with an AC source.
What you would measure. A peak sine from a generator into the network, followed by a unity-gain op-amp buffer on a current-limited supply; sweep to on a two-channel scope. Expect a maximum phase lead of about near and a gain rising from () to (), with 5 % capacitor tolerance moving the frequencies by about 5 %.
Hazards and safe setup. Low-voltage bench work only; connect the op-amp supplies before the signal.
Pitfalls
- Placing at the old crossover: the lead's gain moves the crossover up, and the peak phase is wasted.
- Asking one lead for more than about ; use two stages or reconsider the bandwidth.
- Forgetting the plant's high-frequency resonances, which a lead amplifies.
- Ignoring actuator limits: a lead's large high-frequency gain saturates the driver on step commands.
Practice
- What gives a maximum phase lead of , and how much gain does the lead add at ?
- A lead has , . Find and .
- Why does a lead not change the steady-state error to a ramp?
Answer
- ; .
- ; , .
- In the form its DC gain is , chosen for ; the lead only changes the response near and above .
Test yourself
A lead compensator with gives a maximum phase lead of about
Where should the lead's maximum-phase frequency be placed?
- at the old gain crossover
- at the new gain crossover, where dB
- at the plant's first pole
- at the phase crossover
The main cost of a strong lead compensator is
- a larger steady-state error
- more high-frequency gain, so more noise and actuator activity
- a lower crossover frequency
- loss of the integrator
In the Bode lab, adding a zero at 100 Hz to the dB loop raised the phase margin to and moved crossover to 302 Hz. Why did the crossover move?
- the zero lowers the gain
- the zero raises above its frequency
- the DC gain changed
- the lab switched to second order