S1150 of 55
0 XP
  1. Hook
  2. Predict
  3. Name it
  4. Check
  5. Explain

S11 · Lesson 50 · Converter simulation lab

Simulating a synchronous buck switch by switch with Runge–Kutta, checking its ripple against the formulas of lesson 3, simulating the averaged model with a tenth of the steps, and measuring the overshoot of a duty-cycle step against the second-order transfer function

Lesson 16 replaced the switch by its average and got a linear model that's easy to analyze and fast to simulate. In this lab you'll test that trade directly. You'll simulate a 12 V buck both ways, check the switching model's ripple against the formulas you derived by hand, and find where the averaged model is exact, where it's off, and by how much.

Predict

Starting from rest, the switching model's output voltage, averaged over each cycle, runs slightly ahead of the averaged model during the start-up transient. Why?

Name it

The converter

A synchronous buck with Vg = 12 V, L = 22 µH, C = 47 µF, R = 2 Ω and fs = 100 kHz. The state is the inductor current and capacitor voltage:

LdiLdt=vs−v,Cdvdt=iL−vR

where the switch node vs is Vg for the first DT of each cycle and 0 for the rest (both switches are ideal and the current may reverse).

The averaged model

Replace vs by its average DVg. The model is linear and time-invariant, with the transfer function of lesson 17, a resonance at 1/2πLC = 4.95 kHz and damping ζ=12RL/C = 0.171.

What to check

  • The switching model in steady state: average DVg, inductor ripple (Vg−V)D/(Lfs), output ripple ΔiL/(8Cfs).
  • The averaged model against its exact solution, and its peak from rest, DVg(1+e−πζ/1−ζ2).
  • A duty step's overshoot, the same expression, independent of the step's size and direction.

Worked example

What do the two models give at D = 0.3?

Show the solution
  1. Switching model at steady state. It settles to an average of 3.6000 V, with 1.147 A of inductor ripple (the formula gives 1.145) and 30.5 mV of output ripple (the formula gives 30.5).
  2. Averaged model from rest. It peaks at 5.686 V, using 2,000 steps against the switching model's 20,000. The formula gives Vpk=3.6×1.5796=5.687V
  3. During start-up. The switching model's cycle averages lead by up to 0.31 V (8.5% of the final value) four cycles in; by the time the ringing has died out the two agree.

Answer both models agree with the formulas: the switching model settles at 3.6000 V with 1.147 A and 30.5 mV of ripple, and the averaged model peaks at 5.686 V from rest.

Worked example

A duty step from 0.3 to 0.4 overshoots by how much in each model?

Show the solution
  1. Averaged model. It overshoots by 0.5796 of the step, matching e−πζ/1−ζ2 with ζ = 0.171.
  2. Switching model. Its cycle averages overshoot by 0.5753, 0.75% less.
  3. A small step. For a small step (0.6 to 0.65) the difference shrinks to 0.07%.
  4. Which to use. For loop design at crossovers well below the switching frequency, the averaged model is the right tool.

Answer 0.5796 of the step in the averaged model and 0.5753 in the switching model, 0.75% less.

Check

Step 1. Write simulate_switched(D): the buck pulse by pulse.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Step 2. Write simulate_averaged(D): the same converter with the switch averaged.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Step 3. Write duty_step_overshoot(D1, D2): a small-signal step on the averaged model.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Explain why

When is the averaged model good enough, and when do you need the switching simulation?

Practice

Keep practicing

3 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.