TExcelTAD
Home › Power Electronics & Motor Drives › Voltage-Mode Control and Type II and Type III Compensators

Voltage-Mode Control and Type II and Type III Compensators

Averaged and Small-Signal Models gave the plant of a 24 V24\ \text{V} to 12 V12\ \text{V}, 4 A4\ \text{A} buck: 27.5 dB27.5\ \text{dB} at low frequency, a resonance at 733 Hz733\ \text{Hz} with ζ=0.15\zeta = 0.15, and an ESR zero at 8.47 kHz8.47\ \text{kHz}. Without feedback a 1 A1\ \text{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

Vref+- Gc(s) PWM 1/Vm Gvd(s) buck vcdvout loop gain T(s) = Gc(s) Gvd(s) / Vm R1 10k R3 1kC3 22n vout Rb 2.63k -+Vref C2 560p C1 39n, R2 5.6k vc (to the PWM comparator)

The modulator compares vcv_c with a sawtooth of amplitude VmV_m: d=vc/Vmd = v_c/V_m, a gain of 1/Vm1/V_m (here Vm=1 VV_m = 1\ \text{V}, the ramp of the averaged-models deck). The divider sets the DC output (Vout=Vref(1+R1/Rb)V_\text{out} = V_\text{ref}(1 + R_1/R_b), Rb=2.63 kΩR_b = 2.63\ \text{k}\Omega for 12 V12\ \text{V}); because the op-amp holds its inverting input at VrefV_\text{ref}, RbR_b carries no AC signal and drops out of the loop gain. What remains is T(s)=Gc(s) Gvd(s)/VmT(s) = G_c(s)\,G_{vd}(s)/V_m.

Targets. Crossover fcf_c at fsw/10f_{sw}/10 to fsw/5f_{sw}/5 (here 10 kHz10\ \text{kHz} for 100 kHz100\ \text{kHz}; above that the averaged model and the sampling of the PWM stop being accurate), a phase margin of 4545 to 70∘70^\circ, an integrator for zero steady-state error, and gain falling at −20 dB/decade-20\ \text{dB/decade} through crossover.

Type I, II and III compensators

Type Gc(s)G_c(s) Phase at crossover Use
I ωI/s\omega_I/s −90∘-90^\circ only very slow loops
II ωIs⋅1+s/ωz1+s/ωp\dfrac{\omega_I}{s}\cdot\dfrac{1 + s/\omega_z}{1 + s/\omega_p} −90∘-90^\circ + boost, boost <90∘< 90^\circ plants whose phase at fcf_c is near −90∘-90^\circ: current-mode, or an ESR zero well below fcf_c
III ωIs⋅(1+s/ωz1)(1+s/ωz2)(1+s/ωp1)(1+s/ωp2)\dfrac{\omega_I}{s}\cdot\dfrac{(1 + s/\omega_{z1})(1 + s/\omega_{z2})}{(1 + s/\omega_{p1})(1 + s/\omega_{p2})} −90∘-90^\circ + boost, boost up to nearly 180∘180^\circ voltage-mode plants with the LC double pole below fcf_c

For the op-amp network in the figure:

ωI=1R1(C1+C2),fz1=12πR2C1,fz2=12π(R1+R3)C3fp1=12πR3C3,fp2=12πR2 C1C2C1+C2\begin{aligned} \omega_I &= \frac{1}{R_1(C_1 + C_2)}, \qquad f_{z1} = \frac{1}{2\pi R_2 C_1}, \qquad f_{z2} = \frac{1}{2\pi (R_1 + R_3) C_3} \\ f_{p1} &= \frac{1}{2\pi R_3 C_3}, \qquad f_{p2} = \frac{1}{2\pi R_2\,\frac{C_1 C_2}{C_1 + C_2}} \end{aligned}

Placement for a voltage-mode buck. Put both zeros at the LC resonance f0f_0, where they cancel the −180∘-180^\circ phase swing of the double pole; the first pole on the ESR zero, which it cancels; the second pole at fsw/2f_{sw}/2 to filter switching noise. Then set ωI\omega_I so that ∣T(j2πfc)∣=1\lvert T(j2\pi f_c) \rvert = 1. A more general recipe, the K-factor method, places zeros at fc/Kf_c/\sqrt{K} and poles at fcKf_c\sqrt{K} 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, Vm=1 VV_m = 1\ \text{V}, fsw=100 kHzf_{sw} = 100\ \text{kHz}, fc=10 kHzf_c = 10\ \text{kHz}, R1=10 kΩR_1 = 10\ \text{k}\Omega.

Find: the boost needed for 60∘60^\circ margin, the pole-zero placement, the components and the margin with standard values.

Solve: the code evaluates the plant at 10 kHz10\ \text{kHz}: −14.04 dB-14.04\ \text{dB} and −129.0∘-129.0^\circ. A compensator with an integrator contributes −90∘-90^\circ plus its boost, so for PM=60∘\text{PM} = 60^\circ:

boost=60∘−180∘+129.0∘+90∘=99.0∘(>90∘:a Type II cannot do it)fz1=fz2=f0=734 Hz,fp1=fESR=8466 Hz,fp2=50 kHzR3=R1fp1/fz2−1=10 kΩ10.53=950 Ω,C3=12π⋅8466 Hz⋅950 Ω=19.8 nF\begin{aligned} \text{boost} &= 60^\circ - 180^\circ + 129.0^\circ + 90^\circ = 99.0^\circ \qquad (> 90^\circ: \text{a Type II cannot do it}) \\ f_{z1} = f_{z2} &= f_0 = 734\ \text{Hz}, \qquad f_{p1} = f_\text{ESR} = 8466\ \text{Hz}, \qquad f_{p2} = 50\ \text{kHz} \\ R_3 &= \frac{R_1}{f_{p1}/f_{z2} - 1} = \frac{10\ \text{k}\Omega}{10.53} = 950\ \Omega, \qquad C_3 = \frac{1}{2\pi \cdot 8466\ \text{Hz} \cdot 950\ \Omega} = 19.8\ \text{nF} \end{aligned}

and from ωI=2677 rad/s\omega_I = 2677\ \text{rad/s}: C1+C2=1/(ωIR1)=37.4 nFC_1 + C_2 = 1/(\omega_I R_1) = 37.4\ \text{nF}, C2=37.4 nF⋅734/50 000=548 pFC_2 = 37.4\ \text{nF} \cdot 734/50\,000 = 548\ \text{pF}, C1=36.8 nFC_1 = 36.8\ \text{nF}, R2=1/(2π⋅734 Hz⋅36.8 nF)=5.89 kΩR_2 = 1/(2\pi \cdot 734\ \text{Hz} \cdot 36.8\ \text{nF}) = 5.89\ \text{k}\Omega.

Check: with standard values (R2=5.6 kΩR_2 = 5.6\ \text{k}\Omega, R3=1 kΩR_3 = 1\ \text{k}\Omega, C1=39 nFC_1 = 39\ \text{nF}, C2=560 pFC_2 = 560\ \text{pF}, C3=22 nFC_3 = 22\ \text{nF}) the loop crosses at 9.68 kHz9.68\ \text{kHz} with 68.1∘68.1^\circ of margin, better than the 60∘60^\circ target: the double zero at f0f_0 (with the poles at 8466 Hz8466\ \text{Hz} and 50 kHz50\ \text{kHz}) boosts the phase by about 111∘111^\circ at 10 kHz10\ \text{kHz}, more than the 99∘99^\circ needed, so even the exact values give 71.6∘71.6^\circ. The placement fixes the boost; only ωI\omega_I was solved for.

python · try it yourself
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 40 dB40\ \text{dB} from 100 Hz100\ \text{Hz} to the resonance and still 16.7 dB16.7\ \text{dB} at 2 kHz2\ \text{kHz}, so disturbances in that range are suppressed by factors of 7 to 100. Of the printed points the phase is lowest at 50 kHz50\ \text{kHz}, −136.9∘-136.9^\circ, where the gain is already −17.6 dB-17.6\ \text{dB}. The closed loop cuts the load-step dip from 391.5 mV391.5\ \text{mV} to 43.5 mV43.5\ \text{mV} and removes the 29.7 mV29.7\ \text{mV} steady error. Most of what is left is the instant drop across the ESR, 1 A⋅40 mΩ=40 mV1\ \text{A} \cdot 40\ \text{m}\Omega = 40\ \text{mV}, which no loop can prevent; the estimate ΔI/(2πfcC)=34 mV\Delta I/(2\pi f_c C) = 34\ \text{mV} 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 K=60 dBK = 60\ \text{dB} and f1=10 Hzf_1 = 10\ \text{Hz}: an integrator-like loop that crosses at 10.00 kHz10.00\ \text{kHz} with 90.1∘90.1^\circ of margin. The block below adds two more poles at 10 kHz10\ \text{kHz} and 100 kHz100\ \text{kHz}, standing for an uncompensated LC pole and the modulator delay: the crossover drops to 7.844 kHz7.844\ \text{kHz} and the margin to 47.5∘47.5^\circ, with 20.8 dB20.8\ \text{dB} of gain margin at 31.64 kHz31.64\ \text{kHz}. Move f2f_2 down and watch the margin vanish: that is what the zeros of the Type III prevent.

806040200-20-40-60-80|L| (dB)-270-180-90090100m1101001k10k100k1Mf (Hz)phase (deg)PM 47.5 degGM 20.8 dB|L| exactphase exactasymptotesunity-feedback closed loop: stable

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, 1 V1\ \text{V} ramp, 100 kHz100\ \text{kHz}) and, next to it, around the averaged model. The reference rises over 2 ms2\ \text{ms} (soft start), and a 1 A1\ \text{A} load step arrives at 4 ms4\ \text{ms}.

bash · try it yourself
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 12.00 V12.00\ \text{V} (the open-loop plant gave 11.88 V11.88\ \text{V}). After the step the averaged model dips by 43.7 mV43.7\ \text{mV}, matching the Python 43.5 mV43.5\ \text{mV}, and the switched converter by 49.5 mV49.5\ \text{mV}: the extra 6 mV6\ \text{mV} is the switching ripple riding on the dip. Both are back at 12.00 V12.00\ \text{V} two milliseconds later.

Guided lab: measuring the loop of a buck board

Hand calculation. For a voltage-mode buck evaluation board (from its schematic: LL, CC, ESR, ramp amplitude, the compensation parts), compute f0f_0, fESRf_\text{ESR}, the compensator's zeros and poles and the expected fcf_c and margin with the code.

Simulation. Replace the plant and component values in the cell and the deck.

What you would measure. Inject 2020 to 50 mV50\ \text{mV} through a 1010 to 50 Ω50\ \Omega resistor in the feedback path with an isolating injection transformer and a frequency-response analyser, as described in Averaged Models, and read TT directly. Expect fcf_c within ±20 %\pm 20\ \% and the margin within about ±10∘\pm 10^\circ of the calculation (capacitor tolerances, ESR spread, ceramic capacitors' DC-bias loss). Then load-step the board with an electronic load (1 A1\ \text{A}, 1 A/µs1\ \text{A/µs}) and compare the dip with the closed-loop estimate.

Hazards and safe setup. Board from a current-limited bench supply at ≤24 V\le 24\ \text{V}. 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 fsw/5f_{sw}/5. 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 Vin/VmV_\text{in}/V_m changes with input voltage; check the margin at minimum and maximum VinV_\text{in} (or use input feed-forward, a ramp proportional to VinV_\text{in}).
  • 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

  1. The input rises from 2424 to 30 V30\ \text{V}. By how much does the crossover move (assume ∣T∣∝1/f\lvert T \rvert \propto 1/f near crossover)?
  2. Why are the compensator's zeros placed at the LC resonance and not at the crossover?
  3. With Vm=2 VV_m = 2\ \text{V} instead of 1 V1\ \text{V}, what must change in the compensator to keep fc=10 kHzf_c = 10\ \text{kHz}?
Answer
  1. TT scales with VinV_\text{in}, a factor 1.251.25 (+1.9 dB+1.9\ \text{dB}); with ∣T∣∝1/f\lvert T \rvert \propto 1/f the crossover moves up by the same factor, to about 12.5 kHz12.5\ \text{kHz}.
  2. The double pole swings the phase by 180∘180^\circ within a decade of f0f_0; zeros there cancel it before it reaches crossover. Zeros at fcf_c would leave the phase near −270∘-270^\circ at the resonance (conditional stability).
  3. The modulator gain halves, so the compensator gain must double: double R2R_2 and halve C1C_1 and C2C_2: ωI=1/(R1(C1+C2))\omega_I = 1/(R_1(C_1 + C_2)) doubles while fz1f_{z1} and fp2f_{p2} stay where they were.

Test yourself

In voltage-mode control, the PWM modulator with a sawtooth of amplitude VmV_m has the small-signal gain…

  1. VmV_m
  2. 1/Vm1/V_m from control voltage to duty cycle
  3. Vin/VmV_\text{in}/V_m from duty to output
  4. zero

Why can a Type II compensator not give 60° of margin for the 4 A buck at 10 kHz?

  1. its gain is too low
  2. the plant phase at 10 kHz is −129°, so the compensator would need 99° of boost, and a Type II gives less than 90°
  3. it has no integrator
  4. the ESR zero is too high

Where are the Type III zeros usually placed for a voltage-mode buck?

  1. at the switching frequency
  2. at (or slightly below) the LC resonance f0f_0
  3. at the ESR zero
  4. 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?

  1. the integrator
  2. the instant drop across the output capacitor's ESR, 1 A⋅40 mΩ1\ \text{A} \cdot 40\ \text{m}\Omega
  3. the reference
  4. the divider