Skip to content

The converters in LTspice

  • Open and run the SPICE library’s LTspice schematics, and plot what their READMEs list.
  • Work out how long a simulation from rest must run before its last periods show the steady state.
  • Know which directives the schematics carry, and why.

The repository’s sim/ltspice/ folder has the five basic converters as LTspice schematics [Analog Devices, LTspice simulator], one folder per converter with a README that says what to plot and what to expect. Each schematic is the same circuit as the ngspice netlist of the same name in sim/ngspice/: the library’s script reads every schematic back into a netlist and compares it part by part and node by node, and the nets carry the netlist’s node names. Open a schematic and press Run: its directives come with it.

  • .param sets the values of the synthetic example that the simulator’s preset of the same name uses.
  • .model gives the near-ideal switch and diode.
  • .tran runs from rest, with every capacitor empty and every inductor without current, for 400 to 2500 periods depending on the case, with a time step no longer than a two-hundredth of a period.
  • .options method=gear reltol=1e-4 chooses the integration method and the tolerance. The ngspice page explains why.

The ngspice netlists also carry .meas statements that average each quantity and find its extremes over the last period. In LTspice, zoom in on the last period, or add the same statements to the schematic.

A run from rest has to pass through the whole start-up before its last period shows the steady state. While the converter stays in CCM, its output filter and the load ring after the start, and with ideal parts the ring’s envelope decays with a time constant set by the load and the capacitance alone:

τenv=2RC\tau_\mathrm{env} = 2 R C
τenv\tau_\mathrm{env}
envelope time constant
CC
capacitance (output capacitor)
RR
load resistance
Time constant of the envelope of an L-C filter's ring with a resistive load✓ verified by 7 tests
Assumptions, convention and source
Assumptions
  • ideal (lossless) switches and passive components
  • continuous conduction mode (CCM)
  • fixed duty ratio, no feedback loop (open loop)
  • the output filter rings: its quality factor Q is above 1/2
  • resistive load R
Notes
with ideal parts and the buck's source at rest, the filter is the inductance, the capacitance and the load in parallel: a parallel RLC circuit, whose ring decays as e−t/(2RC)e^{-t/(2RC)} whatever the inductance. A lighter load (a larger RR) rings for longer. The averaged models of the boost and the buck-boost give the same decay rate, ω0/(2Q)=1/(2RC)\omega_0/(2Q) = 1/(2RC). Real parts change the decay: the winding's and the switch's resistances always make the ring decay faster, the capacitor's series resistance does when Q is above 1, and the inductance then matters too. This is how an open-loop converter's output settles in CCM after a start-up or a step; a feedback loop sets its own settling, and in DCM, where the inductance carries no energy from one period to the next, the output settles near its steady state with a single time constant instead
Source
Alexander & Sadiku 2017, Ch. 8 (Second-Order Circuits: the source-free parallel RLC circuit); derived here; Erickson & Maksimović 2020, Ch. 8 (Converter Transfer Functions: the boost and buck-boost resonances, whose omega_0/(2Q) is also 1/(2RC)); Erickson & Maksimović 2020, Ch. 15 (AC and DC Equivalent Circuit Modeling of the Discontinuous Conduction Mode: a single low-frequency pole)
Derivation
step-by-step sympy derivation
Equation id
filter.tau_env · equations.yaml entry

The error left after the start-up shrinks by the same factor in every envelope time constant. To bring it down to a fraction of what it was at the start takes:

Nset=τenvln⁡(1εr)TsN_\mathrm{set} = \frac{\tau_\mathrm{env} \ln{\left(\frac{1}{\varepsilon_r} \right)}}{T_s}
NsetN_\mathrm{set}
periods to settle
TsT_s
switching period
εr\varepsilon_r
start-up error left (fraction)
τenv\tau_\mathrm{env}
envelope time constant
Switching periods until the start-up error has decayed✓ verified by 8 tests
Assumptions, convention and source
Assumptions
  • the start-up error decays with a single time constant, the slowest mode's
Notes
an error that decays as e−t/τenve^{-t/\tau_\mathrm{env}} falls to the fraction εr\varepsilon_r after τenvln⁡(1/εr)\tau_\mathrm{env} \ln(1/\varepsilon_r), and dividing by TsT_s counts the periods. Each factor of ten in accuracy costs ln⁡10\ln 10, about 2.3 envelope time constants more. A transient simulation from rest must run at least this long before its last periods show the steady state
Source
Alexander & Sadiku 2017, Ch. 8 (Second-Order Circuits: the natural response decays as the exponential of minus the neper frequency times t); derived here
Derivation
step-by-step sympy derivation
Equation id
sim.periods_settle · equations.yaml entry

A light load rings longer, and each factor of ten in accuracy adds the same number of periods. Real parts damp the ring a little more: the winding’s and the switch’s resistances always, and the capacitor’s series resistance when the quality factor is above one. A start-up can also leave CCM for a while: in the library’s buck, the inductor current falls to zero in several of its first twenty periods, after the output’s first overshoot. The formula is then an estimate, not an exact count. In DCM the inductor current returns to zero in every period, so the inductor carries nothing from one period to the next: the filter no longer rings as an L-C pair, and near its steady state the output settles with a single time constant instead [Erickson & Maksimović 2020, Ch. 15].

The library runs each case for many times its slowest time constant, and its script checks each run at the end: the output’s average over the last period must lie within one part in ten thousand of its average over the period before, or the case fails as not settled. The check only catches a run far too short. In one period a decaying error shrinks only by a fraction of itself about equal to the period over the time constant, so with a time constant of a hundred periods, as in the library’s DCM flyback, a change of one part in ten thousand still allows an error of about a percent. Where the output rings, near a crest of the ring, where the output’s average stops rising and starts to fall, two consecutive averages can agree while the ring is still large. SPICE’s own accuracy sets a floor, too: in the library’s ngspice runs, the average jumps by up to one or two parts in a thousand long after the start-up has died away.

With LTspice’s default settings the library’s DCM flyback shows a dip of the drain voltage tens of volts below zero that the circuit does not have: about as deep as the one ngspice draws with Gear’s method at its default tolerance, not the kilovolt of ngspice’s trapezoidal ringing. The .options line removes it, as it does in ngspice. The library records a one-time check with LTspice 26.1.1, in which LTspice’s own netlists matched the library’s and its results agreed with ngspice’s within 0.3 % of each quantity’s largest magnitude. The ngspice page describes both effects: the factor by which each step multiplies a fast mode (the trapezoidal rule's factor), and a diode’s current overshooting through zero at a loose tolerance.

The buck example’s filter, load and switching frequency, run from rest until a thousandth of the start-up error is left:

Buck settling example
SymbolValueHow it is obtained
fsf_s switching frequency100 kHzgiven
LL inductance100 µHgiven
CC capacitance (output capacitor)10 µFgiven
RR load resistance10 Ωgiven
εr\varepsilon_r start-up error left (fraction)0.001given
TsT_s switching period10 µsSwitching period
QQ quality factor3.16Buck: quality factor of the LC poles
τenv\tau_\mathrm{env} envelope time constant200 µsTime constant of the envelope of an L-C filter's ring with a resistive load
NsetN_\mathrm{set} periods to settle138Switching periods until the start-up error has decayed

Its quality factor, 3.16, is well above one half, so the filter rings. The envelope time constant is 200 µs, twenty periods, and the output needs 138 periods to settle to a thousandth, well inside the library’s one percent and about as fine as its ngspice runs resolve. The library’s buck case runs 400 periods before it measures the last one.

▶ Open in the equation explorer: Switching periods until the start-up error has decayed
Preset from the example sim-settle

Sweep the fraction left: each factor of ten costs the same number of periods.

▶ Open in the equation explorer: Time constant of the envelope of an L-C filter's ring with a resistive load
Preset from the example sim-settle

Sweep the load: a lighter load rings longer. The site’s simulator finds the steady state without a start-up:

▶ Open in the simulator: Buck
Preset from the example buck-basic

Start a buck at a fixed duty ratio, without a feedback loop, into a resistor, and capture its output from the moment it starts switching. Measure the envelope’s decay from two peaks of the ring a known time apart, after the inductor current has stopped touching zero if it does in the first periods, and compare the time constant with twice the load resistance times the output capacitance: the winding’s and the switch’s resistances damp the ring further, and so does the capacitor’s series resistance when the quality factor is above one, so expect a somewhat shorter one. Count the periods until the output stays within one percent of its final value, and compare with the formula for one percent left. Then run the library’s schematic with your values and the same start.

  • A measurement over a period that has not settled measures the start-up. Run for the periods the formula asks for, then check that the output’s average no longer changes from one period to the next, as the library does: a small change alone does not prove that a slow ring has settled.
  • The envelope formula holds in CCM, with a ringing filter, ideal parts and no feedback loop. In DCM, with a filter damped so heavily that it does not ring, or under closed-loop control, the output settles another way (envelope time constant).
  • A spike that the circuit cannot make is often numerical: check the .options line before you look for a cause in the circuit.
  • Video LTspice Basics (video series) — Analog Devices · retrieved 2026-09-24
    Short videos on a first schematic, transient and AC simulations, and the waveform viewer in LTspice.
  • Tool LTspice — Analog Devices · retrieved 2026-09-24
    A free SPICE simulator from Analog Devices.
  1. With ideal parts, a buck's output filter rings with a 10 ohm load and a 10 µF capacitor. What is the time constant of the ring's envelope?

    1. 100 µs
    2. 200 µs
    3. 31.6 µs
    4. It depends on the inductance
    Answer and explanation

    Correct answer: B The envelope decays with twice the load resistance times the capacitance, whatever the inductance: 2 times 10 ohm times 10 µF is 200 µs.

  2. The envelope time constant is twenty switching periods. About how many periods does a run from rest need before a hundredth of the start-up error is left?

    1. 20
    2. 46
    3. 92
    4. 2000
    Answer and explanation

    Correct answer: C The error shrinks by a factor e in every envelope time constant. A hundredth takes ln 100, about 4.6 time constants, so about 92 periods.

  3. Going on from a hundredth to a ten-thousandth of the start-up error costs how much more?

    1. About as much again as the first hundredth took
    2. A hundred times as much
    3. Nothing: the error is already small
    4. A tenth as much
    Answer and explanation

    Correct answer: A Each factor of ten costs the same, ln 10 or about 2.3 envelope time constants, so two more factors of ten cost as much as the first two.

  4. Why does the envelope formula not say how long a DCM case must run?

    1. DCM cases have no steady state
    2. LTspice cannot simulate DCM
    3. In DCM the capacitor is not charged
    4. In DCM the inductor carries nothing from one period to the next, so the filter does not ring as an L-C pair
    Answer and explanation

    Correct answer: D The inductor current returns to zero in every period, so the ringing L-C pair that sets the envelope is gone; near its steady state the output settles with a single time constant instead.

  5. What does the library's check require before it accepts a run as settled?

    1. That the output equals the ideal equation exactly
    2. That two runs with different time steps agree
    3. That the output's average over the last period lies within one part in ten thousand of its average over the period before
    4. That the run lasted a thousand periods
    Answer and explanation

    Correct answer: C A run that is still settling changes from one period to the next, and the check compares the last two periods' averages. It only catches a run far too short, since a slow ring changes little per period, so the library also runs each case for many time constants.

  6. A DCM flyback run shows the drain dipping far below zero, which the circuit cannot do. What do you check first?

    1. The .options line: the integration method and the tolerance
    2. The turns ratio
    3. The load resistance
    4. The switching frequency
    Answer and explanation

    Correct answer: A At their default settings both ngspice and LTspice draw such dips on the library's DCM flyback; Gear's method with a tighter tolerance removes them.

The numbers in the examples, presets and exercises on this site are synthetic: round teaching values, not data from any real design.