Anyone who has simulated a switching converter in a SPICE-family tool has seen it. A MOSFET turns off, the drain voltage jumps, and the current in some nearby branch starts to alternate: up, down, up, down, one reversal on every single timestep. Zoom in and the “oscillation” has no frequency of its own. Halve the maximum timestep and its period halves with it. That is the giveaway: nothing in the circuit is ringing. The integration method is.
This article explains where that artefact comes from, why the two classic cures each cost something, and what the composite method called TR-BDF2 does differently. It is the method Ec-Sim uses for every transient simulation.
One equation is enough to see it
Numerical analysts judge an integration method by what it does to the simplest decaying system there is, a single time constant:
The exact solution over one step of length h multiplies y by ehλ. Every one-step method multiplies it by some other number instead, a rational function R(z) of the product z = hλ. For the two methods every circuit simulator has offered since the 1970s:
When the step is short compared with the time constant, z is small and both are good approximations of ez. The interesting case is the opposite one: a step much longer than the time constant, so that z is a large negative number. The true answer is then simply “it has finished decaying”, ez ≈ 0. Backward Euler agrees, because 1/(1 − z) goes to zero. The trapezoidal rule does not. Its numerator and denominator grow together, and the ratio tends to −1.
| z = h·λ | What one step multiplies y by |
|---|---|
-0.1 | exact 0.905 · backward Euler 0.909 · trapezoidal 0.905 · TR-BDF2 0.905 |
-1 | exact 0.368 · backward Euler 0.500 · trapezoidal 0.333 · TR-BDF2 0.350 |
-10 | exact 4.5 × 10⁻⁵ · backward Euler 0.091 · trapezoidal -0.667 · TR-BDF2 -0.204 |
-100 | exact 0 · backward Euler 0.010 · trapezoidal -0.961 · TR-BDF2 -0.044 |
-10000 | exact 0 · backward Euler 1.0 × 10⁻⁴ · trapezoidal -1.000 · TR-BDF2 -4.8 × 10⁻⁴ |
Read the trapezoidal column downwards. At z = −100 a quantity that should have vanished is instead multiplied by −0.961: it keeps 96% of its size and changes sign. On the next step it changes sign again. That is the alternating pattern on the screen. The method is still stable in the textbook sense, since the magnitude is below one and the error does eventually die, but it dies over hundreds of steps instead of one.
Why a power circuit is full of large z
You might object that nobody chooses a step twenty times longer than the time constant they care about. True, but the time constants that cause trouble are the ones you do not care about. Take a MOSFET with 100 pF of output capacitance that has just been shorted by its own 10 mΩ channel. That node has a time constant of one picosecond. The converter switches every two microseconds, and a sensible step for resolving the inductor ripple is some tens of nanoseconds. For that one parasitic mode, z is around −10 000.
A circuit whose time constants span that many orders of magnitude is called stiff, and switching power electronics is about as stiff as engineering problems get: gate charge moving in nanoseconds, magnetics in microseconds, output filters in milliseconds, and thermal behaviour in seconds. The simulator has to pick steps for the slow dynamics you are looking at while the fast modes stay quietly dead. With the trapezoidal rule they do not stay dead. Every switching edge kicks them, and each kick takes a long train of sign-flipping steps to fade.
There is a name for the property that is missing. A method is A-stable if |R(z)| ≤ 1 for every decaying mode, and L-stable if in addition R(z) → 0 as z → −∞. The trapezoidal rule is A-stable but not L-stable. Backward Euler is both.
Why not just use backward Euler?
Because it buys its good behaviour with accuracy. Backward Euler is a first-order method: halving the step only halves the error, where a second-order method cuts it by four. Worse for circuit work, it damps things that should not be damped. An ideal LC tank has purely imaginary eigenvalues and should ring forever. Step it with backward Euler and the ringing decays as if someone had added a resistor.
That matters in practice. The ringing on a switch node after turn-off is real: it is the loop inductance resonating with the device capacitance, it sets the voltage stress on the transistor, and it is what a snubber is designed against. A method that quietly removes it gives you a prettier waveform and a wrong answer. So the classic choice has been between a method that invents ringing and a method that hides it. Simulators have lived with this for decades through workarounds: switching to a Gear (BDF) method by option, damping the trapezoidal rule slightly, or filtering the alternation out of the result after the fact.
TR-BDF2: one step, two stages
TR-BDF2 was introduced in 1985 by Bank and co-authors for semiconductor device simulation, a field with the same stiffness problem. The idea is to split each step in two. The first stage advances a fraction γ of the step with the trapezoidal rule. The second stage completes the step with the second-order backward differentiation formula (BDF2), fitted through three points: the start of the step, the intermediate point just computed, and the new end point.
The combination inherits the right property from each half:
- It is second-order accurate, like the trapezoidal rule. Both stages are second-order formulas, and the composite keeps that order.
- It is L-stable, like backward Euler. The BDF2 stage ends the step with a fully implicit evaluation, so whatever garbage a very fast mode produced in the first stage is divided by a number that grows with |z|. The last column of the table above shows it going to zero.
- It still preserves real oscillations well. The damping it applies to a resolved resonance is tiny, as the LC figure shows, and it shrinks rapidly as the step gets shorter.
The particular value γ = 2 − √2 is not arbitrary. An implicit stage requires solving a nonlinear system by Newton iteration, and the matrix of that system contains the circuit’s capacitances and inductances scaled by a coefficient that depends on the formula. With γ = 2 − √2 the coefficient is the same for both stages (γ/2 equals (1 − γ)/(2 − γ), both about 0.293). The two stages can then share the same matrix structure and, for linear parts of the circuit, the same factorisation. The same value also minimises the method’s leading error term.
What it costs, and what you get back
Two stages mean two nonlinear solves per step instead of one. That is the price, and it is a real one. It is paid back in three ways. Steps after a switching edge do not have to be made artificially small to suppress alternation. Fewer steps are rejected because a fast mode fooled the error estimate. And the intermediate point is not thrown away: together with the previous accepted point it gives four values along the solution, enough to estimate the third derivative and therefore the truncation error of the step directly. Ec-Sim uses exactly that estimate to decide whether to accept a step and how long the next one should be.
How to tell which kind of ringing you are looking at
- Zoom in until you see individual points. A waveform that reverses direction at every single point is numerical. A real resonance has many points per cycle and a smooth shape.
- Change the maximum timestep. A real ring keeps its frequency, set by an L and a C in your circuit. An artefact moves with the step.
- Find the L and the C. A real ring has a frequency of 1/(2π√(LC)) for some inductance and capacitance you can point at, typically a loop inductance of a few nanohenries and a device output capacitance. If no such pair exists in the schematic, the simulator has nothing physical to ring.
Try it yourself
Open one of the switching converter examples in Ec-Sim, run a transient analysis and zoom into a switch-node edge until the individual solver points are visible. Then add a few nanohenries of series inductance in the switching loop and run again: the ringing that appears has a frequency you can calculate from that inductance and the transistor’s output capacitance, and it stays put when you tighten the timestep.