VOLTAGE MODE BUCK

← all examples · the closed loop the buck notebook stops just short of · voltage regulators
V_ref
TYPE 3 G_c(s)
PWM vs RAMP
L, C, R
V_o
COMPENSATOR (K-FACTOR)
The two zeros and two poles are placed by the K-factor method: everything the compensator does is decided by where you want to cross over and how much phase margin you want when you get there.
POWER STAGE
DISTURBANCE
The time domain runs the switching converter, not the averaged model. The Bode plots are the prediction; the transients are the experiment.
CROSSOVER
PHASE MARGIN
GAIN MARGIN
f_LC / f_ESR
ZEROS / POLES
BOOST NEEDED
SLOWEST CL POLE
LINE STEP
LOAD STEP
Plant / modulator
Compensator
Loop gain T
Crossover
Disturbance

WHAT YOU ARE LOOKING AT

The PWM buck runs open loop: you set a duty cycle and the output lands wherever VDDH·D puts it. The notebook that page comes from ends by asking the obvious next question — "Can I make output voltage independent of input voltage? Yes. With a feedback loop." This page is that feedback loop.

Voltage mode means the only thing measured is the output voltage. The error against V_ref goes through a compensator, the compensator's output is compared against a sawtooth ramp, and that comparison makes the duty cycle. The awkward part is the plant. A buck's control-to-output response is

G_vd(s) = VDDH · Z(s) / (sL + R_s + Z(s)),   Z(s) = R(1 + sR_cC) / (1 + sC(R + R_c))

which has an LC double pole. Two poles close together means the phase falls through −180° in barely a decade, and it does so while the gain is still well above one. A single integrator on top of that is a loop that oscillates.

A type 3 compensator answers this with two zeros and three poles, one of them at the origin:

G_c(s) = A (1 + s/ω_z1)(1 + s/ω_z2) / [ s (1 + s/ω_p1)(1 + s/ω_p2) ]

The pole at the origin gives infinite DC gain, which is what makes the output independent of VDDH. The two zeros hand back up to 180° of phase around the crossover, which is what buys back what the LC took. The two remaining poles roll the gain off again before the switching frequency, so the loop does not amplify switching ripple. Here they are placed by the K-factor method, so the only things you choose are the crossover frequency and the phase margin.

The bottom row is the check. It runs the actual switching converter — comparator, ramp, both switches, the compensator integrated alongside — and steps first the input voltage and then the load. The averaged model in the top row is a prediction about what those transients will look like. Comparing the two is the entire point.

THINGS WORTH TRYING

THE MODEL

# Plant, averaged small signal, evaluated at s = j*2*pi*f
Z    = R*(1 + s*Resr*C) / (1 + s*C*(R + Resr))
G_vd = VDDH * Z / (s*L + Rs + Z)

# K-factor placement for a type 3
boost = PM - 90 - angle(G_vd(fc)/Vramp)
K     = tan(radians(boost/4 + 45))**2
fz1 = fz2 = fc/sqrt(K)
fp1 = fp2 = fc*sqrt(K)

# Time domain: the real switching loop, one dt at a time
e   = Vref - vo
vc  = compensator(e)                 # 3rd order state space, RK4
pmos = (ramp < vc)                   # ramp = (t mod T)/T
vx   = pmos*VDDH - Rs*iL
iL  += (vx - vo)/L * dt
vC  += (iL - vo/R)/C * dt
vo   = (vC + Resr*iL)/(1 + Resr/R)

This page has no notebook behind it — it is the loop jupyter/buck.ipynb describes in its closing markdown but never builds. The power stage integration is the notebook's, with the capacitor ESR added because a type 3 compensator's whole reason for existing is what happens when there is not enough of it. See the open-loop buck for the plant on its own, and the PFM buck for regulating the same stage with no linear loop at all.