Advice for simulations with good results in LTspice

From LTwiki-Wiki for LTspice
Revision as of 19:24, 11 June 2013 by Lewispaul (talk | contribs) (Created page with "The problem with simulators is that people who don't understand how they work have to use them (this is the garbage-in, garbage-out effect). Following the lead of modern wor...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The problem with simulators is that people who don't understand how they work have to use them (this is the garbage-in, garbage-out effect). Following the lead of modern word processing software, in which auto-spell check is now ubiquitous, user frustration levels with simulators could be greatly reduced if they could contain a "what I really meant" auto circuit check function to correct impossible or unrealistic user input.

By their very nature, circuit simulators must be open to nearly any combination of components as user input, so until circuit simulation crystal ball code is perfected, the next best thing may be to educate users as to how simulation works and how to "tune" their input in order to avoid giving the simulation engine convergence fits.

In my experience, if the circuit to be simulated is made with realistic models, including certain important circuit elements not necessarily on the circuit schematic, then the circuit will run with no convergence issues. So, what makes input realistic?

First is to note that most real world circuit voltages and currents are continuous functions with continuous derivatives. The key property of functions of this type is that as their behavior is examined in fine enough detail, they will always appear linear, and linear behavior is what admittance matrix solvers do best.

Any model that tends toward quasi-linear functional behavior between closely spaced points will yield both valid operating point and transient solutions. Ideal switches, diodes, hard limits, if-then functions can be problematic in this regard. LTspice offers extended versions of ideal switches, diodes and limit functions that are continuous with continuous derivatives (while still appearing ideal from the user's point of view). I believe LTspice's encrypted models run so well not because they contain "magic" undocumented elements, but because they simply are generally well written making full use of the many simulator-friendly extensions to the basic elements available in LTspice.

The second most important key to providing realistic behavior in a simulation model is to note that in all real circuits the branches will present finite impedances and the nodes will always have some stray capacitance. Simulators depend on this behavior to combat transient convergence problems. Capacitors are linear elements and if all nodes have some finite capacitance and all branches have some finite impedance, then at very small time steps, the circuit admittance matrix will become dominated by the linear capacitances and will be able to "small-step" its way through any very nonlinear large signal behavior.

Unfortunately, most engineers like to fill their simulations with ideal voltage sources, which if of a nonlinear behavioral nature, will never yield to shunting capacitances, even at very small time steps. This often results in the dreaded "time step too small" failure message and frustrated users.

Admittance matrix solvers do best with voltage controlled current sources, so all sources (except zero volt current sensors) should be "Nortonized" (current sources shunted with an equivalent Norton resistance and at least some capacitance to ensure convergence at very small time steps).

LTspice offers many auto-Nortonized elements, but this is not always the default and the user has the clueless freedom to specify pure voltage sources in any case. By the way, I would wager that avoidance of this potential pitfall also contributes much to the robustness of LTspice's encrypted IC models.