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

Run this example

The browser version is coming soon. Until then, open this example in the desktop app. Download Voltecx

The buckIdeal example (the textbook buck: an ideal switch and diode) steps 48 V down to 12 V at a fixed duty cycle of 0.25 and 100 kHz, into a 2.4 Ω load (5 A). By hand, the output is 12 V, the inductor ripple 0.90 A and the output ripple 11.25 mV. The run gives 11.99 V, 0.90 A and 11.2 mV.

Open it

In the app: File › Open Example › DC-DC › Buck converter, textbook, then press F5. From the command line:

powercraft-cli run --cmd file.openExample --params '{"name": "buckIdeal"}' \
  --cmd simulation.run \
  --cmd scope.measure --params '{"signals": ["v(out)", "i(L1)"], "t0": 0.0039, "t1": 0.004}'

The buck example: a 48 V source, switch S1, freewheeling diode D1, L1 = 100 µH, C1 = 100 µF and a 2.4 Ω load, with a constant duty of 0.25 driving a 100 kHz sawtooth PWM.

Part Value
Input VinV_{in} 48 V
Duty cycle DD 0.25 (open loop)
Switching frequency fswf_{sw} 100 kHz
Inductor L1L_1 100 µH
Output capacitor C1C_1 100 µF, starts at 12 V
Load R1R_1 2.4 Ω

The hand calculation

In continuous conduction the switch node is VinV_{in} for a fraction DD of each period and 0 V for the rest, and the inductor passes its average:

Vout=D Vin=0.25×48=12 V,Iout=122.4=5 AV_{out} = D\,V_{in} = 0.25 \times 48 = 12\ \text{V}, \qquad I_{out} = \frac{12}{2.4} = 5\ \text{A}

While the switch is on, Vin−VoutV_{in} - V_{out} across the inductor ramps its current up by

ΔI=(Vin−Vout) Dfsw L=36×0.25100 kHz×100 μH=0.90 A\Delta I = \frac{(V_{in} - V_{out})\,D}{f_{sw}\,L} = \frac{36 \times 0.25}{100\ \text{kHz} \times 100\ \mu\text{H}} = 0.90\ \text{A}

The capacitor takes the triangular part of that current. The charge in one half of the triangle gives the output ripple:

ΔV=ΔI8 fsw C=0.908×100 kHz×100 μF=11.25 mV\Delta V = \frac{\Delta I}{8\,f_{sw}\,C} = \frac{0.90}{8 \times 100\ \text{kHz} \times 100\ \mu\text{F}} = 11.25\ \text{mV}

The run

The example runs for 4 ms. The capacitor starts at 12 V, so the start-up is short. Measure the last ten periods (3.9 to 4.0 ms):

Quantity Hand Run
Mean output voltage 12 V 11.99 V
Mean inductor current 5 A 5.00 A
Inductor ripple (peak to peak) 0.90 A 0.90 A
Output ripple (last two periods) 11.25 mV 11.2 mV

Two periods at the end of the run: the switch node v(sw) toggling between 48 V and 0 V, the inductor current i(L1) as a 0.90 A triangle around 5 A, and the output v(out) with its 11 mV ripple.

The output sits 6 mV under 12 V: the switch and the diode each have 1 mΩ of on-resistance, and the formula has none. Over ten periods the output ripple reads about 0.4 mV more than over two, because the slow tail of the LC start-up is still in the window.

Try next

  • Change D in the circuit variables to 0.5 and check Vout=24V_{out} = 24 V.
  • Halve L1 to 50 µH: the inductor ripple doubles to 1.8 A and the output ripple to about 22 mV.
  • Raise R1 until the current triangle touches zero. Past that point the buck runs in discontinuous conduction and Vout=D VinV_{out} = D\,V_{in} no longer holds.
  • Close the loop: the closed-loop buck holds 12 V with a PI controller.

Every number on this page comes from a run that a test repeats (auto::tests_worked_examples), so the page changes when the simulator does.