Voltecx is in beta. The macOS build comes first; Windows and Linux packages are still being tested.Beta. macOS comes first; Windows and Linux are still in testing. What's new

Peak current mode control is unstable above a duty cycle of 0.5 unless a compensating ramp is added: a disturbance of the inductor current is multiplied by −(m2−ma)/(m1+ma)-(m_2 - m_a)/(m_1 + m_a) every switching period, where m1m_1 and m2m_2 are the inductor current's up and down slopes and mam_a is the ramp's slope. With no ramp that factor is −m2/m1=−D/(1−D)-m_2/m_1 = -D/(1-D), larger than 1 in size above D=0.5D = 0.5, so the current breaks into subharmonic oscillation. A ramp of ma≥m2/2m_a \ge m_2/2 keeps every duty cycle stable, and ma=m2m_a = m_2 cancels a disturbance in one period. In a 12 V to 8 V buck at 200 kHz with 10 µH (D=2/3D = 2/3), Voltecx shows a 0.2 A disturbance doubling every period with no ramp, halving with ma=0.4m_a = 0.4 A/µs, and gone after one period with ma=0.8m_a = 0.8 A/µs.

What peak current mode control does

In voltage mode control, the error amplifier sets a duty cycle and a PWM comparator turns it into a gate signal. In peak current mode control, the error amplifier sets a current instead, and each switching period goes like this:

  1. A clock pulse sets a latch, and the switch turns on.
  2. The inductor current rises at m1m_1. A comparator watches it (through a current-sense resistor or transformer).
  3. When the sensed current reaches the command ici_c, the comparator resets the latch, and the switch turns off.
  4. The current falls at m2m_2 until the next clock pulse.

For a buck the slopes are m1=(Vin−Vo)/Lm_1 = (V_{in} - V_o)/L and m2=Vo/Lm_2 = V_o/L. The duty cycle is no longer commanded directly: it is whatever on-time makes the current reach ici_c.

The attractions are well known. The inductor nearly disappears from the voltage loop, which then sees a single pole instead of the LC double pole, so a simple Type II compensator does the job. The switch current is limited cycle by cycle just by clamping ici_c. Parallel phases share current naturally, and input voltage changes are corrected within a period, because a higher input steepens m1m_1 and shortens the on-time at once. This is why so many controller ICs, from the UC384x family on, use it.

The catch is that the loop is a sampled system: the current is only "looked at" once per period, at the instant it crosses ici_c. A sampled loop can oscillate at half its sampling rate, and this one does.

The circuit in Voltecx

The test circuit is the textbook buck example, buckIdeal, with its open-loop PWM replaced by a peak current modulator built from five control blocks:

  • Clk, a PWM block at a fixed duty of 0.02 on a 200 kHz sawtooth, gives a 100 ns clock pulse at the start of every period (net clk);
  • Latch, an SR flip-flop, is set by clk and drives the switch gate g;
  • Cmp, a comparator, resets the latch when its input isum passes the 5 A command Ic;
  • Saw and Se, a ramp block in saw mode restarted by clk and a gain, make the compensating ramp, mam_a in A/µs (its height at the end of a period is maTm_a T);
  • Sum adds the ramp to the inductor current iL, measured by the ammeter AmL.

To look at the current loop alone, the output is held at 8 V by a voltage source, as a battery or a large output capacitor would hold it over a few periods. The switch and diode are ideal (100 µΩ on). With Vin=12V_{in} = 12 V and L=10L = 10 µH, D=2/3D = 2/3, m1=0.4m_1 = 0.4 A/µs and m2=0.8m_2 = 0.8 A/µs.

The peak current mode buck: the power stage below, the modulator above (clock, compensating ramp, sum, comparator and SR latch), joined by the labels g and iL.

Why it oscillates: the perturbation gain

Take the converter in steady state and add a small error Δi0\Delta i_0 to the inductor current at the start of a period. The current now rises from a higher valley, so it reaches ici_c earlier: the on-time shrinks by Δt=Δi0/m1\Delta t = \Delta i_0 / m_1. The off-time grows by the same Δt\Delta t, during which the current falls at m2m_2 instead of rising at m1m_1. At the next clock edge the error is

Δi1=−Δi0 m2m1\Delta i_1 = -\Delta i_0 \, \frac{m_2}{m_1}

and after nn periods Δin=Δi0 (−m2/m1)n\Delta i_n = \Delta i_0 \,(-m_2/m_1)^n. In steady state the volt-seconds balance, m1D=m2(1−D)m_1 D = m_2 (1-D), so

m2m1=D1−D\frac{m_2}{m_1} = \frac{D}{1-D}

Below D=0.5D = 0.5 the error shrinks and changes sign every period; above it, the error grows. At D=2/3D = 2/3 the factor is −2-2.

The simulation shows exactly that. Starting the buck 0.2 A above its 3.67 A steady-state valley, the valley error goes +0.2+0.2, −0.4-0.4, +0.8+0.8 A in the first three periods, each ratio within 5 % of −2-2. Then the on-time runs into the next clock edge, the linear picture ends, and the current settles into no steady state at all: each valley is followed by one on the other side, wandering below 2 A and above 4.5 A while the peaks stay pinned at the 5 A command. That is subharmonic oscillation: a large ripple at half the switching frequency (and its sub-multiples), audible in magnetics, and a current loop that no longer controls the average current.

Without a ramp at D = 2/3: the inductor current peaks at the 5 A command (horizontal line) every period, but the valleys and on-times alternate irregularly.

Notice that the peak current is perfectly controlled. It is the average current that wanders, because a peak with a short on-time and a peak with a long on-time give different averages.

The cure: a compensating ramp

Add a ramp of slope mam_a to the sensed current (or, equivalently, subtract it from the command). The comparator now trips when iL+mat=ici_L + m_a t = i_c. Repeating the argument, the on-time shrinks by Δi0/(m1+ma)\Delta i_0/(m_1 + m_a) and the error at the next edge is

Δi1Δi0=−m2−mam1+ma\frac{\Delta i_1}{\Delta i_0} = -\frac{m_2 - m_a}{m_1 + m_a}

This is the perturbation gain, derived in Erickson and Maksimović, Fundamentals of Power Electronics, 2nd ed. (Kluwer, 2001), Chapter 12 "Current Programmed Control". Three values of mam_a are worth remembering:

  • The stability edge is where the gain reaches −1-1: ma=(m2−m1)/2m_a = (m_2 - m_1)/2. In the example, 0.2 A/µs, a quarter of m2m_2.
  • ma=m2/2m_a = m_2/2 makes the gain smaller than 1 in size for every duty cycle up to 1, because m1≥0m_1 \ge 0. It is the usual rule. In the example the gain is −(0.8−0.4)/(0.4+0.4)=−0.5-(0.8-0.4)/(0.4+0.4) = -0.5.
  • ma=m2m_a = m_2 makes the gain zero: a disturbance is gone after one period (deadbeat). The ramp then makes the comparator see a falling-slope mirror of the inductor current, so the trip point no longer depends on where the current started.

With ma=0.4m_a = 0.4 A/µs the same 0.2 A start becomes −0.1-0.1 A, then +0.05+0.05 A, and the valley settles at 2.33 A within a few periods.

With a ramp of m2/2 = 0.4 A/µs: the sum of the inductor current and the ramp (iL + ramp) reaches the 5 A command each period; the inductor current settles within a few periods.

The ramp costs something: the peak inductor current is no longer ici_c but ic−maDTi_c - m_a D T. Here the ramp takes 0.4×3.33=1.330.4 \times 3.33 = 1.33 A off the peak, so the steady-state valley drops from 3.67 A to 2.33 A for the same 5 A command. The outer voltage loop simply asks for more current, but the current limit (a clamp on ici_c) becomes duty-dependent: at high duty the converter can deliver less current before it limits. Too much ramp also turns the converter back towards voltage mode, which is the subject of the next section.

The figure below puts the four cases side by side: the valley error after each period, divided by the first error. At D=0.4D = 0.4 (20 V in) the gain with no ramp is −m2/m1=−0.8/1.2=−2/3-m_2/m_1 = -0.8/1.2 = -2/3, so the error rings down. At D=2/3D = 2/3 it grows by −2-2 with no ramp, decays by −0.5-0.5 with m2/2m_2/2, and vanishes in one step with m2m_2. Every simulated point is within 0.05 of the formula, or 5 % where the formula's value is larger than 1.

Valley-current error after each period, as a share of the first, for the 12 V buck with no ramp, m2/2 and m2, and the 20 V buck (D = 0.4) with no ramp.

Ridley's model: the double pole at half the switching frequency

The sampled-data picture explains stability, but loop design needs a transfer function. R. B. Ridley, "A new, continuous-time model for current-mode control", IEEE Transactions on Power Electronics, vol. 6, no. 2, April 1991, folds the sampling into a pair of complex poles at half the switching frequency, in the current loop:

He(s)≈1+sωnQp+s2ωn2,ωn=πfsH_e(s) \approx 1 + \frac{s}{\omega_n Q_p} + \frac{s^2}{\omega_n^2}, \qquad \omega_n = \pi f_s

with the quality factor

Qp=1π (mcD′−0.5),mc=1+mam1,D′=1−DQ_p = \frac{1}{\pi\,(m_c D' - 0.5)}, \qquad m_c = 1 + \frac{m_a}{m_1}, \quad D' = 1 - D

The two pictures agree. QpQ_p goes to infinity, an undamped oscillation at fs/2f_s/2, exactly when mcD′=0.5m_c D' = 0.5, which works out to ma=(m2−m1)/2m_a = (m_2 - m_1)/2, the edge where the perturbation gain reaches −1-1. Below that QpQ_p is negative: right-half-plane poles, the subharmonic oscillation of the previous section.

For the example at D=2/3D = 2/3 (D′=1/3D' = 1/3):

Ramp mam_a mcm_c Gain −(m2−ma)/(m1+ma)-(m_2-m_a)/(m_1+m_a) QpQ_p
0 1 −2 negative (unstable)
0.2 A/µs (m2/4m_2/4) 1.5 −1 infinite
0.4 A/µs (m2/2m_2/2) 2 −0.5 1.91
0.58 A/µs (0.73 m20.73\,m_2) 2.46 −0.22 1
0.8 A/µs (m2m_2) 3 0 0.64

A QpQ_p of 1.91 is stable but peaky: the current loop's response has a resonance at 100 kHz that eats phase margin from the voltage loop near crossover, and it rises further at low input voltage where DD grows. Ridley recommends a ramp that gives QpQ_p about 1; here that is ma=0.58m_a = 0.58 A/µs. With ma=m2m_a = m_2, Qp=2/π=0.64Q_p = 2/\pi = 0.64, well damped, at the cost of more peak-current error.

The next figure sweeps the ramp from 0 to 1.25 m21.25\,m_2. Each point is one Voltecx run of the 12 V buck, measuring the ratio of the second valley error to the first; all eleven lie within 0.04 of the formula. The lower panel is Ridley's QpQ_p from the formula, crossing 1 at ma/m2=0.73m_a/m_2 = 0.73.

Top: perturbation gain against the ramp, as a share of m2, from the formula and from Voltecx runs. Bottom: Ridley's Qp from the formula; the vertical lines mark the stability edge (m2/4 here) and m2/2.

Sizing the ramp in practice

  1. Find the worst case. m2m_2 depends only on the output: Vo/LV_o/L for a buck, (Vo−Vin)/L(V_o - V_{in})/L for a boost, the reflected output for a flyback. The required ramp is set at the highest duty cycle, which for a buck is the lowest input voltage.
  2. Refer everything to the comparator. The controller compares a voltage. With a sense resistor RsR_s (or a current transformer with its burden), the inductor slope becomes m2Rsm_2 R_s in V/s, and the ramp you add must be specified in the same units. Controller data sheets give the internal ramp in mV per period or mV/µs.
  3. Choose between m2/2m_2/2 and m2m_2. m2/2m_2/2 is the minimum for any duty; aim for QpQ_p near 1 at the lowest input voltage, which usually lands between the two.
  4. Remember the inductance tolerance. m2=Vo/Lm_2 = V_o/L grows when LL drops with temperature or with DC bias in a powder core. Size the ramp with the lowest LL you expect.
  5. Check the current limit. The peak current at the limit is ic,max−maDTi_{c,max} - m_a D T; at the highest duty it is lowest. Make sure that is still above the full-load peak current.

Below D=0.5D = 0.5 a small ramp is still worth adding: the perturbation gain at D=0.4D = 0.4 is −0.67-0.67, which rings for several periods and makes the loop sensitive to noise on the sense signal.

Common mistakes

  • Testing only at nominal input. A buck from 12 V to 5 V is at D=0.42D = 0.42 and looks fine; the same board at 9 V in runs at D=0.56D = 0.56 and oscillates.
  • Adding the ramp in the wrong place. The ramp has to be synchronised to the clock and restarted every period. A free-running ramp or one taken from a different oscillator does nothing useful.
  • Leading-edge spikes. The current-sense signal carries the diode's reverse recovery and the switch-node charge at turn-on. Without leading-edge blanking or a small RC filter, the comparator trips on the spike, at minimum on-time, every period.
  • Too much filtering on the sense signal. A large RC delays the sensed current and flattens its slope, which changes m1m_1 and m2m_2 as the comparator sees them.
  • Reading the waveform at too coarse a time step. In simulation, a comparator crossing is only as accurate as the step around it. The runs here use steps of at most 2 ns, 0.04 % of the period. With 50 ns steps the trip can come up to 50 ns late, 40 mA at 0.8 A/µs, a fifth of the 0.2 A disturbance studied here.

How to do it in Voltecx

  1. File › Open Example › buck, then remove Duty and PWM and add the modulator blocks with Circuit › Add Component (circuit.addComponent): a pwm at duty 0.02 as the clock, a ramp in saw mode clocked by it, a gain for the ramp height maTm_a T, a sum, a comparator against a constant current command, and an srff latch driving the switch gate. Put an ammeter in series with the inductor for iL.
  2. Simulation › Settings (simulation.settings): a maximum step of a few ns (here 2 ns at 200 kHz), and an initial inductor current a little off steady state (L1.i0) to see the disturbance grow or decay.
  3. Simulation › Run Simulation (simulation.run, F5), then look at iL, isum and g on the scope; Scope › Measurements (scope.measure) gives the valley and peak of each.
  4. Analysis › Parameter Sweep (analysis.paramSweep) over the gain of Se sweeps the ramp; measure iL with min over a late window to see where the valley settles.
  5. Circuit › Subsystem › Create Subsystem (circuit.createSubsystem) wraps the modulator blocks into one subsystem, with pins for the sensed current, the command and the gate, once it works.

For a complete loop rather than the current loop alone, design.compare (Design › Automate › Compare Topologies and Control) designs peak current mode with a Type II compensator on Ridley's model, and the behavioural pwmController IC (UC384x type) is a ready peak-current-mode controller to place with ic.place.

Frequently asked questions

Why does peak current mode control need slope compensation above 50 % duty?

Because the current loop is sampled once per period and a disturbance in the inductor current is multiplied by −m2/m1=−D/(1−D)-m_2/m_1 = -D/(1-D) each period. Above D=0.5D = 0.5 that is larger than 1 in size, so the disturbance grows into subharmonic oscillation.

How much slope compensation is enough?

At least ma=(m2−m1)/2m_a = (m_2 - m_1)/2 at the highest duty cycle to be stable; ma=m2/2m_a = m_2/2 is stable at every duty cycle. For a well-damped current loop, choose mam_a so that Ridley's Qp=1/(π(mcD′−0.5))Q_p = 1/(\pi(m_c D' - 0.5)) is about 1, which lies between m2/2m_2/2 and m2m_2.

What does ma=m2m_a = m_2 give?

A perturbation gain of zero: any disturbance of the inductor current is corrected in one switching period (deadbeat control), and Qp=2/π≈0.64Q_p = 2/\pi \approx 0.64. The price is the largest difference between the commanded and the actual peak current.

Does slope compensation matter below 50 % duty?

The loop is stable without it, but the disturbance rings for several periods (gain −0.67-0.67 at D=0.4D = 0.4) and the current loop is sensitive to noise. A small ramp also damps the fs/2f_s/2 poles that otherwise peak near the voltage loop's crossover at high duty.

Does the same apply to a boost or a flyback?

Yes. Only the slopes change: for a boost m1=Vin/Lm_1 = V_{in}/L and m2=(Vo−Vin)/Lm_2 = (V_o - V_{in})/L; for a flyback in continuous conduction, m2m_2 is the reflected output voltage over the magnetising inductance. The formulas for the perturbation gain and QpQ_p are the same.