Voltage-Mode Control and Type II and Type III Compensators
Averaged and Small-Signal Models gave the plant of a to , buck: at low frequency, a resonance at with , and an ESR zero at . Without feedback a load step makes this output ring by hundreds of millivolts and leaves a permanent error; an input change passes straight through. Voltage-mode control closes a loop around it: an error amplifier compares a fraction of the output with a reference, and its output, compared with a sawtooth, sets the duty cycle. The loop is designed with the tools of Control Systems: crossover frequency, phase margin and a compensator that shapes the loop gain. This lesson designs a Type III compensator for that plant, shows why a Type II is not enough here, and checks the result in a switched ngspice model.
The loop and its pieces
The modulator compares with a sawtooth of amplitude : , a gain of (here , the ramp of the averaged-models deck). The divider sets the DC output (, for ); because the op-amp holds its inverting input at , carries no AC signal and drops out of the loop gain. What remains is .
Targets. Crossover at to (here for ; above that the averaged model and the sampling of the PWM stop being accurate), a phase margin of to , an integrator for zero steady-state error, and gain falling at through crossover.
Type I, II and III compensators
| Type | Phase at crossover | Use | |
|---|---|---|---|
| I | only very slow loops | ||
| II | + boost, boost | plants whose phase at is near : current-mode, or an ESR zero well below | |
| III | + boost, boost up to nearly | voltage-mode plants with the LC double pole below |
For the op-amp network in the figure:
Placement for a voltage-mode buck. Put both zeros at the LC resonance , where they cancel the phase swing of the double pole; the first pole on the ESR zero, which it cancels; the second pole at to filter switching noise. Then set so that . A more general recipe, the K-factor method, places zeros at and poles at for the boost the margin needs; it ignores where the plant's own poles and zeros sit, which matters here.
Worked example: Type III for the 4 A buck
Given: the plant above, , , , .
Find: the boost needed for margin, the pole-zero placement, the components and the margin with standard values.
Solve: the code evaluates the plant at : and . A compensator with an integrator contributes plus its boost, so for :
and from : , , , .
Check: with standard values (, , , , ) the loop crosses at with of margin, better than the target: the double zero at (with the poles at and ) boosts the phase by about at , more than the needed, so even the exact values give . The placement fixes the boost; only was solved for.
import numpy as np
import control as ct
# plant of the averaged-models lesson: 24 V, D = 0.5, 100 uH (30 mohm), 470 uF (ESR 40 mohm), 3 ohm, 100 kHz
Vin, L, RL, C, RC, R, Vm, fsw = 24.0, 100e-6, 0.03, 470e-6, 0.04, 3.0, 1.0, 100e3
s = ct.tf("s")
Zc = RC + 1 / (s * C)
Zload = R * Zc / (R + Zc)
Gvd = ct.minreal(Vin * Zload / (RL + s * L + Zload), verbose=False)
fc = 10e3
g = complex(Gvd(2j * np.pi * fc)) / Vm
print(f"plant + modulator at {fc/1e3:.0f} kHz: {20*np.log10(abs(g)):.2f} dB, {np.degrees(np.angle(g)):.1f} deg")
print(f"phase boost needed for PM = 60 deg: {60 - 180 - np.degrees(np.angle(g)) + 90:.1f} deg (Type II gives < 90)")
# Type III placement: double zero at f0, poles at the ESR zero and at fsw/2
f0 = 1 / (2 * np.pi * np.sqrt(L * C))
fz1 = fz2 = f0
fp1, fp2 = 1 / (2 * np.pi * RC * C), fsw / 2
w = lambda f: 2 * np.pi * f
shape = (1 + s / w(fz1)) * (1 + s / w(fz2)) / (s * (1 + s / w(fp1)) * (1 + s / w(fp2)))
wI = 1 / abs(complex(shape(2j * np.pi * fc)) * g)
print(f"zeros {fz1:.0f} Hz (x2), poles {fp1:.0f} Hz and {fp2/1e3:.0f} kHz, integrator wI = {wI:.0f} rad/s")
# components (R1 = 10 k): R3, C3 from fz2 and fp1; C1, C2, R2 from wI, fz1, fp2
R1 = 10e3
R3 = R1 / (fp1 / fz2 - 1); C3 = 1 / (w(fp1) * R3)
Ct = 1 / (wI * R1); C2 = Ct * fz1 / fp2; C1 = Ct - C2; R2 = 1 / (w(fz1) * C1)
print(f"exact: R2 = {R2:.0f}, R3 = {R3:.0f} ohm; C1 = {C1*1e9:.2f} nF, C2 = {C2*1e12:.0f} pF, C3 = {C3*1e9:.2f} nF")
R2, R3, C1, C2, C3 = 5.6e3, 1.0e3, 39e-9, 560e-12, 22e-9 # nearest standard values
Gc = (1 + s * R2 * C1) * (1 + s * (R1 + R3) * C3) / (
s * R1 * (C1 + C2) * (1 + s * R2 * C1 * C2 / (C1 + C2)) * (1 + s * R3 * C3))
T = Gc * Gvd / Vm
gm, pm, wpc, wgc = ct.margin(T)
print(f"standard values: crossover {wgc/2/np.pi/1e3:.2f} kHz, phase margin {pm:.1f} deg")
for f in (100, 733, 2000, 10e3, 50e3):
t = complex(T(2j * np.pi * f))
print(f" T at {f:7.0f} Hz: {20*np.log10(abs(t)):6.1f} dB, {np.degrees(np.angle(t)):7.1f} deg")
# closed-loop output impedance and the response to a 1 A load step
Zo = ct.minreal(Zload * (RL + s * L) / (RL + s * L + Zload), verbose=False)
Zcl = ct.minreal(Zo / (1 + T), verbose=False)
tt = np.linspace(0, 2e-3, 8001)
for name, Z in (("open loop", Zo), ("closed loop", Zcl)):
y = ct.step_response(Z, tt).outputs
print(f"{name:11s}: 1 A step -> peak dip {1e3*float(np.max(y)):6.1f} mV at {1e6*tt[np.argmax(y)]:5.0f} us, "
f"final {1e3*float(ct.dcgain(Z)):5.2f} mV")plant + modulator at 10 kHz: -14.04 dB, -129.0 deg
phase boost needed for PM = 60 deg: 99.0 deg (Type II gives < 90)
zeros 734 Hz (x2), poles 8466 Hz and 50 kHz, integrator wI = 2677 rad/s
exact: R2 = 5890, R3 = 950 ohm; C1 = 36.80 nF, C2 = 548 pF, C3 = 19.80 nF
standard values: crossover 9.68 kHz, phase margin 68.1 deg
T at 100 Hz: 39.9 dB, -76.2 deg
T at 733 Hz: 39.2 dB, -88.4 deg
T at 2000 Hz: 16.7 dB, -125.3 deg
T at 10000 Hz: -0.3 dB, -112.0 deg
T at 50000 Hz: -17.6 dB, -136.9 deg
open loop : 1 A step -> peak dip 391.5 mV at 307 us, final 29.70 mV
closed loop: 1 A step -> peak dip 43.5 mV at 5 us, final 0.00 mV
The loop gain is about from to the resonance and still at , so disturbances in that range are suppressed by factors of 7 to 100. Of the printed points the phase is lowest at , , where the gain is already . The closed loop cuts the load-step dip from to and removes the steady error. Most of what is left is the instant drop across the ESR, , which no loop can prevent; the estimate of Component Selection is the same order.
Interactive: the shape of a good loop gain
The Bode lab cannot hold the Type III loop, but it shows the shape to aim for. Choose "1st order" with and : an integrator-like loop that crosses at with of margin. The block below adds two more poles at and , standing for an uncompensated LC pole and the modulator delay: the crossover drops to and the margin to , with of gain margin at . Move down and watch the margin vanish: that is what the zeros of the Type III prevent.
Cross-check in ngspice: the switched converter in closed loop
The deck closes the Type III loop (standard values) around the switched buck of the averaged-models lesson (comparator, ramp, ) and, next to it, around the averaged model. The reference rises over (soft start), and a load step arrives at .
cat > vmc.cir <<'EOF'
* Voltage-mode buck, 24 V -> 12 V, 100 kHz, Type III compensator; switched and averaged; 1 A load step at 4 ms
.model SWM SW(Ron=1m Roff=1meg Vt=0 Vh=0)
.model DI D(Is=1e-12 N=0.05 Rs=1m)
.model DCL D(Is=1e-14 N=1)
.subckt T3 out ctl
* Type III network around an op-amp (gain 1e5, GBW 10 MHz, output clamped near 0 and 3 V); duty 0.005 to 0.9; Vref 2.5 V, 2 ms soft start; divider to 12 V
VREF ref 0 PWL(0 0 2m 2.5)
R1 out fb 10k
R3 out x3 1k
C3 x3 fb 22n
RB fb 0 2.6316k
C2 fb ea 560p
C1 fb x1 39n
R2 x1 ea 5.6k
EOL oi 0 ref fb 1e5
ROL oi oo 1k
COL oo 0 1.59u
VRAIL rail 0 3
DC1 oo rail DCL
DC2 0 oo DCL
EBUF ea 0 oo 0 1
BL ctl 0 V = max(0.005, min(0.9, v(ea)))
.ends
VIN vin 0 24
VRAMP ramp 0 PULSE(0 1 0 9.99u 10n 0 10u)
X1 out ctl T3
S1 vin sw ctl ramp SWM
D1 0 sw DI
L1 sw a 100u
RDCR a out 30m
C1 out c 470u
RESR c 0 40m
RLOAD out 0 3
ISTEP out 0 PULSE(0 1 4m 1u 1u 10 20)
* averaged copy: switch node = d * vin
X2 outa ctla T3
BAV swa 0 V=v(ctla)*v(vin)
L2 swa a2 100u
RDCR2 a2 outa 30m
C2 outa c2 470u
RESR2 c2 0 40m
RLOAD2 outa 0 3
ISTEP2 outa 0 PULSE(0 1 4m 1u 1u 10 20)
.control
tran 0.1u 6m 0 0.1u
meas tran vsw_before avg v(out) from=3.9m to=4m
meas tran vsw_min min v(out) from=4m to=5m
meas tran vsw_after avg v(out) from=5.9m to=6m
meas tran vav_before avg v(outa) from=3.9m to=4m
meas tran vav_min min v(outa) from=4m to=5m
meas tran vav_after avg v(outa) from=5.9m to=6m
.endc
.end
EOF
ngspice -b vmc.cir 2>&1 | grep -E '^v(sw|av)_[a-z]+ +=' | awk '{print $1, $2, $3}'vsw_before = 1.199909e+01
vsw_min = 1.194962e+01
vsw_after = 1.199957e+01
vav_before = 1.199996e+01
vav_min = 1.195631e+01
vav_after = 1.199995e+01
Both regulate to (the open-loop plant gave ). After the step the averaged model dips by , matching the Python , and the switched converter by : the extra is the switching ripple riding on the dip. Both are back at two milliseconds later.
Guided lab: measuring the loop of a buck board
Hand calculation. For a voltage-mode buck evaluation board (from its schematic: , , ESR, ramp amplitude, the compensation parts), compute , , the compensator's zeros and poles and the expected and margin with the code.
Simulation. Replace the plant and component values in the cell and the deck.
What you would measure. Inject to through a to resistor in the feedback path with an isolating injection transformer and a frequency-response analyser, as described in Averaged Models, and read directly. Expect within and the margin within about of the calculation (capacitor tolerances, ESR spread, ceramic capacitors' DC-bias loss). Then load-step the board with an electronic load (, ) and compare the dip with the closed-loop estimate.
Hazards and safe setup. Board from a current-limited bench supply at . The injection resistor sits in the feedback path: if it opens, the output runs to the input voltage, so check it before powering up and keep the output load connected. Large injection signals can drive the loop into saturation or trip protection: start small. The inductor, switches and load get hot.
Pitfalls
- Crossing over above . The averaged model no longer describes the plant; PWM sampling adds phase lag.
- Relying on the ESR zero. Its frequency varies with temperature and supplier; a change to ceramic capacitors removes it and the loop that needed it may oscillate.
- Designing at one operating point. The buck's gain changes with input voltage; check the margin at minimum and maximum (or use input feed-forward, a ramp proportional to ).
- Forgetting the op-amp. Its gain-bandwidth must be well above the compensator's highest pole, or it adds its own pole near crossover.
Practice
- The input rises from to . By how much does the crossover move (assume near crossover)?
- Why are the compensator's zeros placed at the LC resonance and not at the crossover?
- With instead of , what must change in the compensator to keep ?
Answer
- scales with , a factor (); with the crossover moves up by the same factor, to about .
- The double pole swings the phase by within a decade of ; zeros there cancel it before it reaches crossover. Zeros at would leave the phase near at the resonance (conditional stability).
- The modulator gain halves, so the compensator gain must double: double and halve and : doubles while and stay where they were.
Test yourself
In voltage-mode control, the PWM modulator with a sawtooth of amplitude has the small-signal gain…
- from control voltage to duty cycle
- from duty to output
- zero
Why can a Type II compensator not give 60° of margin for the 4 A buck at 10 kHz?
- its gain is too low
- the plant phase at 10 kHz is −129°, so the compensator would need 99° of boost, and a Type II gives less than 90°
- it has no integrator
- the ESR zero is too high
Where are the Type III zeros usually placed for a voltage-mode buck?
- at the switching frequency
- at (or slightly below) the LC resonance
- at the ESR zero
- at 1 Hz
After a 1 A load step, the closed-loop buck still dips by about 44 mV. What sets most of that dip?
- the integrator
- the instant drop across the output capacitor's ESR,
- the reference
- the divider