Skip to content

Chapter 6 — Numerical issues of switching

Switching is where a clean EMT method meets a messy reality: events happen between the grid points, and the trapezoidal rule that served Module 1 so well has one notorious weakness that switching triggers. This short chapter is about the two numerical hazards every power-electronics simulation faces — switching-instant error and trapezoidal chatter — the standard remedies, and the practical rule for choosing a time step when a converter is switching at kilohertz rates.

Learning objectives

By the end of this chapter you should be able to:

  • Explain why a switching event that falls between time steps causes error, and how interpolation to the switching instant fixes it.
  • Describe trapezoidal chatter after an inductive current interruption and why it appears.
  • Name the standard remedies — critical-damping adjustment and interpolation — and why backward Euler damps.
  • Choose a time step from a steps-per-switching-period budget and diagnose a step that is too coarse.

6.1 Events fall between the grid points

The EMT engine advances on a fixed grid t=0,Δt,2Δt, But a diode reaches its current zero, or a PWM edge fires, at some true instant t that almost never lands exactly on a grid point. If the engine simply waits until the next grid point to act on the event, it has mistimed the switch by up to one full step Δt — a switching-instant error.

A switching event at the true instant t falls between grid points tn and tn+1. Acting only at tn+1 mistimes the switch by up to Δt; the remedy is to interpolate the solution back to t, switch there, and resynchronize onto the grid.

The remedy production engines use is interpolation: detect that a crossing happened during the step, interpolate the network solution back to t, apply the switch there, and then resynchronize onto the regular grid. This keeps the switching time accurate to far better than Δt and — as we are about to see — also avoids seeding a numerical oscillation.

6.2 Trapezoidal chatter

Chapter 2 flagged the trapezoidal rule's one vice: after an abrupt event it can produce a sustained numerical oscillationchatter — that does not decay. The classic trigger is interrupting an inductor current: opening a switch in series with an inductor that is carrying current.

Why does it happen? The trapezoidal rule assumes each quantity varies linearly across the step. Forcing an inductor current to jump violates that assumption, and the inductor's companion model (a conductance GL=Δt/2L with a history source) responds with an oscillation at the grid's Nyquist rate — one that alternates sign every step and, because the trapezoidal rule is non-dissipative (it sits exactly on the stability boundary, Appendix A), never dies out. You see it as a fast ± buzz on the inductor voltage or the node it feeds, superimposed on the physical waveform:

Trapezoidal chatter: after a current interruption the physical response (smooth curve) should settle, but a non-dissipative integrator adds a sustained sign-alternating oscillation at the Nyquist rate (dots) that does not decay. Critical-damping adjustment removes it.

Chatter is purely numerical: it lives at two samples per cycle, does not depend on any physical L/C resonance, and its amplitude does not shrink when you merely wait. That is exactly how you tell it apart from real ringing (which has a physical frequency ω0=1/LC and decays with the circuit's damping, as in Chapter 3).

6.3 Remedies

Two techniques, often used together, tame switching numerics:

  • Interpolation to the switching instant (§6.1). By switching at t rather than at the next grid point, the engine avoids the mistimed jump that seeds chatter in the first place.
  • Critical-damping adjustment (CDA). Right after a discontinuity, replace the trapezoidal rule with a couple of half-steps of backward Euler, then resume trapezoidal. Backward Euler is strongly dissipative (L-stable): it kills the Nyquist-rate oscillation in a step or two without distorting the physical response. Because it is applied only for the brief window around the event, the second-order accuracy of trapezoidal integration is preserved everywhere else.

You do not have to invoke these by hand — a mature engine applies them around detected switching events. The point for you as a user is to recognize the symptom (a fast, non-decaying buzz right after a switching event) and know that it is a numerical artifact, not a physical result.

6.4 Choosing the time step for a switching circuit

Module 1's rule of thumb — step an order of magnitude below the fastest period of interest — becomes concrete for a converter. If it switches at frequency fsw, the number of time steps per switching period is

N=1fswΔt.

You want N comfortably large — commonly tens to a couple of hundred steps per switching period — so that the duty cycle, the switching edges, and the ripple are all resolved. Take the buck converter: it switches at fsw=5 kHz (a 200 μs period) and runs at Δt=1 μs, giving

N=1(5000)(106)=200 steps per switching period,

which is plenty: each on/off interval is resolved by about a hundred samples, so the duty of 0.5 and the small output ripple come out cleanly. Coarsen Δt toward the switching period and N collapses — the edges blur, the effective duty jitters, and the ripple estimate degrades.

6.5 Lab: resolve the switching, then starve it

Open the buck converter in app →

(Full description: buck converter.)

The buck is a good bench for the step-size effect. As shipped (Δt=1 μs, N=200), plot Vm and Vout: the switch node is a crisp 0/12 V square wave and the output sits at a clean 6 V with a small ripple.

  1. Starve the resolution. Increase the document time step toward the switching period (10 μs gives N=20; 40 μs gives N=5). Re-run and watch Vm coarsen into a ragged staircase and the average Vout drift as the duty can no longer be represented — a direct view of the switching-instant error of §6.1.
  2. Reason about chatter. The buck does not chatter, and that is instructive: its freewheeling diode (Chapter 5) always gives the inductor current a path, so the current is never hard-interrupted. Chatter needs an inductive branch that is truly opened with nowhere for the current to go. Well-designed converters — like this one — avoid the condition by construction.

A dedicated chatter demo is on the roadmap

A minimal "switch in series with an inductor, opened on command" circuit makes chatter and its damping remedy vivid. That course-specific sample is planned; until then, the buck lets you explore the step-size half of the story.

6.6 Summary

  • Switching events fall between grid points; acting only at the next grid point mistimes the switch by up to Δt. Interpolation to the true instant t fixes it.
  • Trapezoidal chatter is a sustained, non-decaying Nyquist-rate oscillation seeded by interrupting an inductor current; it is numerical, not physical.
  • The standard remedies are interpolation plus critical-damping adjustment (a brief backward-Euler window that dissipates the oscillation).
  • Budget the step by a steps-per-switching-period count N=1/(fswΔt); the buck's N=200 is comfortable, and coarsening it visibly degrades the waveform.

6.7 Problems

Problem 6.1. A converter switches at fsw=20 kHz. How small must Δt be for N=100 steps per switching period? What N do you get at Δt=5 μs, and is that adequate?

Solution 6.1

N=1/(fswΔt), so for N=100: Δt=1/(20000100)=5×107=0.5 μs. At Δt=5 μs: N=1/(200005×106)=10 steps per period — marginal. The edges and duty are only crudely resolved; you would tighten the step for a quantitative ripple or loss study.

Problem 6.2. Why is an explicit rule like forward Euler a poor choice for a switching circuit, even setting chatter aside?

Solution 6.2

Forward Euler is only conditionally stable: on a stiff circuit (large conductance ratios, small L/C time constants relative to Δt) it diverges unless Δt is extremely small. Switching circuits are stiff by nature (on/off conductances differ by 107), so an explicit rule would blow up or force an impractically tiny step. The trapezoidal rule is A-stable (Chapter 2, Appendix A) and does not, which is why EMT engines use it.

Problem 6.3. You see a fast oscillation right after a breaker opens in your simulation. How can you decide whether it is real ringing or numerical chatter?

Solution 6.3

Check three things. (1) Frequency: chatter sits at the Nyquist rate — two samples per cycle, alternating sign each step — whereas real ringing has a physical frequency ω0=1/LC independent of Δt. (2) Decay: real ringing decays with the circuit's damping; chatter does not. (3) Step sensitivity: halve Δt — a physical oscillation keeps its frequency, while chatter's period (in time) halves with the step and its presence depends on the integrator/damping. If enabling damping or reducing the step makes it vanish, it was chatter.

Problem 6.4. What does critical-damping adjustment do, and why is backward Euler the right tool for the job?

Solution 6.4

CDA replaces the trapezoidal rule with a short burst (typically two half-steps) of backward Euler immediately after a discontinuity. Backward Euler is L-stable — strongly dissipative — so it damps the non-physical Nyquist-rate oscillation within a step or two. Because it is applied only in the brief window around the event, the trapezoidal rule's second-order accuracy is retained for the rest of the run.

Problem 6.5. A switch is mistimed by up to one step. Estimate the timing error as a fraction of a cycle for (a) a 60 Hz event at Δt=50 μs and (b) a 1 MHz event at the same step. What does this say about when interpolation matters most?

Solution 6.5

(a) A 60 Hz cycle is 16.7 ms; a 50 μs error is 50×106/16.7×1030.3% of a cycle — usually negligible. (b) A 1 MHz cycle is 1 μs; a 50 μs error is 50× a whole cycle — catastrophic. Interpolation matters most when the switching period is comparable to Δt (fast converters, surge events); for slow, mains-frequency switching a fixed grid is often good enough.

6.8 References

  • H. W. Dommel, Electromagnetic Transients Program (EMTP) Theory Book, Bonneville Power Administration — numerical oscillations and re-initialization at discontinuities.
  • J. R. Marti and J. Lin, "Suppression of numerical oscillations in the EMTP," IEEE Transactions on Power Systems — the critical-damping-adjustment idea.
  • J. Arrillaga and N. R. Watson, Power Systems Electromagnetic Transients Simulation, IET Power and Energy Series 39 — switching instants, interpolation, and chatter removal.

Previous: Chapter 5 — Switches and self-commutating devices · Next: Chapter 7 — Rectifiers and converters.