Run this example
The browser version is coming soon. Until then, open this example in the desktop app. Download Voltecx
The flyback example runs a 1:1 coupled inductor at a duty cycle of 0.4 and 100 kHz from 12 V into a 20 Ω load. By hand, the output is 8 V, the primary current peaks at 1.14 A and the converter stays in continuous conduction. The run gives 7.94 V, a 1.15 A peak and 0.19 A still flowing in the secondary when the switch turns on again. It also shows a 57.6 V spike on the drain, where the ideal plateau is 20 V: the leakage inductance.
Open it
In the app: File › Open Example › Isolated › Flyback converter, then press F5. From the command line:
powercraft-cli run --cmd file.openExample --params '{"name": "flyback"}' \
--cmd simulation.run \
--cmd scope.measure --params '{"signals": ["v(out)", "i(T1.1)", "v(drain)"], "t0": 0.0029, "t1": 0.003}'
| Part | Value |
|---|---|
| Input | 12 V |
| Coupled inductor T1 | 50 µH : 50 µH (), |
| Duty cycle | 0.4 (open loop) |
| Switching frequency | 100 kHz |
| Snubber | 2 nF in series with 50 Ω, drain to ground |
| Output | C1 = 47 µF (starts at 8 V), R1 = 20 Ω |
The hand calculation
A flyback stores energy in the magnetising inductance while the switch is on and releases it to the output while the switch is off. In continuous conduction, the volt-second balance gives
The magnetising inductance is about µH. During the on-time it ramps by
All the output current passes through the secondary during the off-time, so the magnetising current (referred to the primary) averages . With the run's 7.94 V, = 0.397 A and that average is 0.661 A. The ramp then runs from
The valley is above zero, so the core never empties: continuous conduction. When the switch is off, the drain sits at V.
The run
The example runs for 3 ms; the measurements are over the last ten periods.
| Quantity | Hand | Run |
|---|---|---|
| Mean output voltage | 8 V (ideal) | 7.94 V |
| Peak primary current | 1.14 A | 1.15 A |
| Secondary current when the switch turns on | 0.18 A | 0.19 A |
| Drain voltage, off-time plateau | 20 V | 20 V |
| Drain voltage, peak | — | 57.6 V |
The output is 0.8 % below the ideal 8 V: the formula has no leakage inductance, no snubber and no on-resistance. The drain spike is the leakage inductance. With , a small part of the primary inductance is not coupled to the secondary. When the switch opens, the current in it has nowhere to go but the snubber capacitor, and at the edge the drain jumps to 57.6 V, the 1.15 A of the primary current times the 50 Ω snubber resistor, before the snubber capacitor takes over and the drain settles to the plateau. A real design sizes the switch's voltage rating for that spike, not for the 20 V plateau.
Try next
- Change k to 0.98 and run again: more of the primary is leakage. Compare the drain spike and the output with this run.
- Raise R1 to 100 Ω. The average magnetising current falls below half the ripple, the secondary current reaches zero before the period ends, and the converter enters discontinuous conduction.
- Read the flyback transformer design steps to choose n, and the core for a real specification.
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.