A simulator always gives you an answer. It plots a clean waveform, prints an efficiency with four digits and never says "I am not sure". That is the danger. A switching converter simulation can be wrong by a factor of two while looking perfectly reasonable, and nothing on the screen warns you.
The good news: almost every bad result comes from one of five mistakes, and each one has a quick check. This article walks through them with real Voltecx runs. For each one you will see the wrong result next to the right one, the reason, and the fix.
The five checks:
- Time step and solver. Is the step small enough to see the fastest thing in the circuit?
- Steady state and initial conditions. Are you measuring after the start-up transient has died out?
- Ideal versus real models. What does an ideal switch hide?
- Parasitics that matter. Which small R, L and C change the answer?
- How you measure. Is your averaging window, RMS window and probe point right?
Most examples use the textbook buck example that ships with Voltecx, buckIdeal: 48 V in, 12 V out, 100 kHz, a fixed duty cycle of 0.25, a 100 µH inductor, a 100 µF capacitor and a 2.4 Ω load (5 A).
1. Time step and solver: a big step misreads the ringing
The intuition
A simulator does not see a waveform continuously. It takes snapshots, one per time step, and draws straight lines between them. Think of a camera filming a spinning wheel: at a slow frame rate the wheel seems to stand still or turn backwards. If the circuit rings at 50 MHz and the simulator takes one snapshot every 50 ns, two and a half periods of the ring pass between two snapshots. The simulator cannot draw the ring as it is: depending on how it integrates, it either loses the ring or shows a slower, wrong one, like the wheel that seems to turn backwards.
In a real converter the fastest events are at the switching edges. The loop inductance of the power stage (the traces, the capacitor leads, the package) rings with the capacitance at the switch node. The resonance frequency is
A worked example
Add 10 nH of loop inductance between the source and the switch of the buck, and 1 nF (with 0.5 Ω of damping) across the switch node. Then
Now run the same circuit with different maximum steps (simulation.settings, maxStep, fixed step) and look at one turn-on edge.
- At 50 ns (the example's own setting, fine for a buck without parasitics) the edge rises slowly and rings at about 9 MHz instead of 50 MHz, peaking at 69.9 V. There is a ring, but it is the wrong one.
- At 5 ns the ring is a little slow (about 43 MHz), jagged, and peaks at 80.7 V.
- At 0.5 ns the ring is smooth and peaks at 85.9 V.
The same circuit gives a peak anywhere from 62 V to 88 V depending on one setting (the table below). If you were choosing a 75 V MOSFET, the 50 ns run would tell you it is safe. It is not.
Why a slow ring? Voltecx integrates with the trapezoidal rule and opens the step after each switching with two short backward-Euler sub-steps. The trapezoidal rule keeps a ring's energy at any step, but once the step is longer than the ring's period it bends the frequency down to : 9.2 MHz at a 50 ns step. A solver that takes a whole backward-Euler step after each switching damps the ring away instead and draws a clean ramp to 48 V. Neither is the circuit.
The fix: a convergence check
Do not guess the step. Halve it until the number you care about stops moving:
| maxStep | peak v(sw) |
|---|---|
| 50 ns | 69.9 V |
| 20 ns | 87.7 V |
| 10 ns | 62.4 V |
| 5 ns | 80.7 V |
| 2 ns | 83.8 V |
| 1 ns | 85.6 V |
| 0.5 ns | 85.9 V |
| 0.2 ns | 85.8 V |
The answer settles once the step is below about 1 ns, which is a twentieth of the ring period. Above that the numbers jump around, and at 20 ns the run even reads 87.7 V, above the settled value: a coarse run can be wrong in either direction, so it tells you nothing about the margin. That gives a practical rule:
- Rule of thumb: use a step of at most 1/20 of the shortest period you want to see. For the switching ripple that is or smaller; for edge ringing it is .
- Verify, don't trust the rule: run once more at half the step. If the number you care about (peak, RMS, loss) changes by more than a few percent, you were not converged.
- Only resolve what you need. If you only want the average output voltage, a 50 ns step is fine. Ringing matters for voltage stress, EMI and snubber design.
Solver choice
Voltecx has two solvers. fast is the production solver (event location, cached matrix factorisations, an optional error-controlled variable step). reference is deliberately simple and is used as an oracle to check the fast one. When a result surprises you, switch solver in simulation.settings and run again. If the two disagree, look harder before you believe either.
A variable step does not remove the need for maxStep: the step can only shrink where the solver sees something happening, and the upper limit still caps how much it can miss between events.
2. Steady state and initial conditions: measure after the start-up
The intuition
When you switch on a converter, the output capacitor starts empty and the inductor carries no current. The LC filter is a spring and a mass: give it a sudden push and it bounces before it settles. Anything you measure while it is still bouncing describes the start-up, not the converter.
The buck's output filter has
A Q of 2.4 means a slow decay: several cycles of a 0.63 ms period, so a couple of milliseconds before the output is quiet. That is 200 switching periods.
What goes wrong
Started from an empty capacitor (blue), the output overshoots to 18.1 V and the inductor current to 13.6 A before settling at 12 V and 5 A. Now suppose you measure efficiency with scope.efficiency over the first 0.5 ms:
| Window | Efficiency |
|---|---|
| 0 to 0.5 ms (during start-up) | 83.6 % |
| Last switching period (steady state) | 99.9 % |
The start-up reading is wrong because part of the input energy is going into charging the capacitor and the inductor, not into the load. (The 99.9 % is high because the example's switch and diode are almost ideal; the point is the difference.)
Initial conditions help, but check them too
The fix many people reach for is to set initial conditions: start the capacitor at 12 V (v0) and the inductor at 5 A (i0). The red curve shows how much quieter that is. But it does not make the first milliseconds trustworthy either: over the same first 0.5 ms the efficiency now reads 101.3 %. The preset values are slightly off the real operating point, so the filter still moves a little and gives back stored energy while it settles. More than 100 % is an obvious error; 98 % instead of 97 % would not be.
The fix
- Measure late. Set
t0(andt1) onscope.measure,scope.powerandscope.efficiencyto a window near the end of the run, after everything has settled. - Let the simulator find steady state.
simulation.steadyStateruns a shooting method: it searches for the initial state that repeats itself after one switching period, instead of waiting for the transient to decay. On the buck example it converges in a few periods. - Ask for a second opinion.
analysis.diagnoseWaveformslooks for common faults in the last result. On the cold start it reports thatv(out)overshoots 51 % of its step and rings at about 1.56 kHz, which is the LC resonance above. (Its suggested cause mentions a control loop; this buck runs open loop, so here the cause is simply the undamped LC filter.) - Watch slow states. Thermal networks and large DC-link capacitors settle over seconds or minutes, so a run of a few milliseconds is not steady state for them.
3. Ideal versus real models: what an ideal switch hides
The intuition
An ideal switch is a perfect tap: fully open or fully closed, flipping in zero time, with no capacitance and no stored charge. It is the right model for learning topologies, checking control loops and estimating conduction loss. It is the wrong model for anything that happens during the switching edge, because in an ideal switch the edge does not exist.
Real devices have:
- Output capacitance () that must be charged and discharged at every edge.
- Gate dynamics: a delay and a finite slope set by the gate driver and the gate charge.
- Reverse recovery: a diode (including a MOSFET's body diode) carrying forward current holds charge, and pulling it out makes a current spike when the opposite switch turns on.
- Dead time behaviour: during the gap between two gate signals, the current flows through a diode, as explained in Dead-time effects.
The comparison
The doublePulse example tests a SiC MOSFET at 400 V and 20 A with the gate and capacitance data of a real part from the device library, the way a data sheet measures switching energy. Voltecx can run the same circuit with every parasitic and loss removed, without editing it: simulation.settings with "fidelity": "ideal".
| Real models | Ideal | |
|---|---|---|
| Peak current at turn-on | 36.7 A | below 21 A |
| Peak voltage at turn-off | 412 V | 400 V |
| Turn-on energy | 289 µJ | about 0 |
| Turn-off energy | 38 µJ | about 0 |
With real models the current overshoots to 36.7 A at turn-on: the 20 A load current plus the recovery charge of the other device's body diode and the charging current of its capacitance. The drain voltage falls later and more slowly than the gate command, and while voltage and current overlap, the device dissipates energy. Each edge costs energy, and at 100 kHz every microjoule per cycle is 0.1 W.
The ideal run shows a perfect square and zero switching loss. If you estimated losses from it, you would miss most of the device's loss at high frequency.
The fix
- Know what your model includes. Use ideal switches for topology, control and averaged behaviour; use device models (with , gate data, recovery) for losses, stresses and EMI.
- Run both and compare. The
fidelitysetting makes the comparison one setting away. If the result you care about changes a lot, you need the real model for that result. - Check soft switching explicitly.
analysis.softSwitchingreads every gate edge, classifies each turn-on as ZVS, partial or hard, and checks each leg's dead time against the measured transition. It needs capacitance on the switches (coss); with none, the switch node swings within one step and there is nothing to measure.
4. Parasitics that matter: loop inductance, ESR and ESL
The intuition
Every real part has small unwanted elements: a capacitor has series resistance (ESR) and series inductance (ESL); a PCB loop has inductance; an inductor's winding has resistance (DCR). Most of the time they are negligible. A few of them decide the answer. The trick is to know which ones, for the question you are asking.
A worked example: ESR doubles the output ripple
In the buck the inductor ripple current is
With an ideal capacitor the output ripple comes only from charging and discharging the capacitance:
Add 20 mΩ of ESR. The ripple current flowing through it makes a triangle of
The two parts are out of phase (the capacitive part lags by a quarter period), so they do not simply add: the simulated ripple is 11.25 mV with the ideal capacitor and 19.7 mV with the ESR, close to double. If the specification allows 15 mV, the ideal model passes and the real board fails.
Which parasitics to include
| Question | Parasitics that matter |
|---|---|
| Output ripple | Capacitor ESR (and ESL for ceramic or high-frequency ripple) |
| Switch voltage stress, ringing, EMI | Power loop inductance, , diode capacitance |
| Efficiency at full load | Inductor DCR, switch on-resistance, capacitor ESR (its RMS current) |
| Light-load behaviour | Gate charge, , core loss |
| Loop stability | Capacitor ESR (it adds a zero), DCR (damping) |
Take values from the part's data sheet, not from habit. If you don't know a value yet, circuit.makeRealistic fills generic engineering typicals for the parasitics that are unset, so you can see whether they matter before you pick parts. Treat that as a sensitivity check; replace the typicals with data-sheet numbers before you sign off. Section 1 was the loop-inductance case: 10 nH turned a 48 V edge into 85 V.
5. How you measure: windows, RMS and the probe point
The intuition
Even with a perfect simulation, a measurement taken the wrong way gives the wrong number. Switching waveforms are periodic, and an average or RMS is only meaningful over whole periods. Measure over 1.5 periods of a pulsed current and you have counted one pulse in a window one and a half periods long.
A worked example: the RMS of the switch current
The buck's switch carries 5 A for a quarter of each period and nothing for the rest. Its RMS current is
(2.507 A with the 0.9 A ripple included). Now measure it with scope.measure over windows of different lengths that all end at the same instant:
- Over 1, 2, 3 or 4 whole periods: 2.507 A every time.
- Over 1.5 periods: 2.05 A, 18 % low.
- Over 1.75 periods: 1.89 A, 24 % low.
- Over half a period (only the off-time): 0 A.
Conduction loss goes with the square of the RMS current, so an 18 % RMS error is a 33 % loss error.
The fix
- Use whole periods. Set
t0andt1so that is an integer number of switching periods (scope.powersays this in its help: use a window of whole periods for exact figures). For a mains-frequency converter, use whole line cycles, not switching periods. - Use more periods for ripple and noise. A peak-to-peak value from one period can miss a sub-harmonic oscillation that repeats every two or three periods.
- Measure at the right point. The output voltage across the capacitor's terminals includes the ESR and ESL drops; the voltage across the ideal capacitance inside does not. Measure where your specification is defined (usually the load terminals) and compare like with like.
- Watch the sign. A source's current is negative when it delivers power in the usual simulator convention. Measure input power at a point where the current flows into the converter, or check the sign before computing an efficiency.
A quick checklist for every run
Before you send a result to anyone:
- Halve the time step. Did the number move more than a few percent?
- Is the measurement window after the start-up, and whole periods long?
- Did you use ideal switches for a loss or stress question?
- Which parasitics decide this answer, and are they in the circuit with data-sheet values?
- Would the other solver give the same answer?
The formulas follow standard texts: R. W. Erickson and D. Maksimović, Fundamentals of Power Electronics, 3rd ed., for the buck's ripple and the LC filter, and N. Mohan, T. M. Undeland and W. P. Robbins, Power Electronics, for switching transitions. The double-pulse device data come from the Wolfspeed C3M0065090D data sheet, as the example cites.
Try it in Voltecx
- Open the
buckIdealexample and changemaxStepinSimulation › Settings; add a small inductor in series with the switch and a capacitor at the switch node to reproduce the ringing above. Thesolversetting switches betweenfastandreference. - Use
Simulation › Steady-State Analysis(simulation.steadyState) before measuring, or sett0in the scope's measurements to skip the start-up. - Open the
doublePulseexample and run it twice, once with"fidelity": "ideal"insimulation.settings.analysis.losseslists the conduction and switching loss of each device;analysis.softSwitchingclassifies every turn-on. - Run
analysis.diagnoseWaveformsafter any run that looks suspicious. It reports ringing, inrush, sub-harmonic oscillation, overlapping gates and other faults, each with a plain-language cause.
More on these tools on the simulation and debugging and scope pages.