Source code coming soon. The GitHub repository is private for now and opens to everyone very soon.
BetterSPICE Beta 0.8.0 Join the beta Download soon
Part I  LearnExplanationContentsIndex
06

How BetterSPICE thinks

BetterSPICE runs every circuit in two ways. The live simulation shows what it does while you draw. Simulate measures it, with the manufacturers' own models where a part has one. Live shows. Simulate measures.

06.1Two ways to run a circuit

Two ways to run a circuit
When it runsUse it to
Live simulationAlways, from the moment a circuit opens. Ctrl+R pauses it.See the circuit work while you edit. Built-in parts and discrete vendor models (diodes, transistors) use the same equations as ngspice. Vendor chips such as op-amps use a model fitted to the vendor's.
SimulateWhen you press F5, or run an analysis from the Analysis menu.Measure: transient, AC sweep, DC sweep, operating point, parameter step, FFT. Circuits with vendor chips run the vendor's own model files in ngspice, or in PSpice for TI when Cadence encrypted the model. Both run hidden.

You never choose the engine. A Simulate run of built-in parts uses the BetterSPICE engine. A circuit with a vendor model file goes to ngspice, and one with an encrypted file goes to PSpice for TI. Which engine runs has the full rule.

06.2How a run starts

The live simulation of a circuit made with File›New starts at rest: every node at 0 V, every capacitor empty, as at power-on. A first RC filter then charges where you can see it. Examples and files saved before this option start from the DC operating point, the settled state, so a regulator opens already regulating. Simulate›Start at rest (power-on) switches the circuit between the two and restarts it from t = 0. Simulate always starts from the operating point, unless the circuit asks for initial conditions (Settings saved in the circuit).

06.3From drawing to answer

Your drawingNets and partsLive or SimulateWhat you read parts, wires,labels, valueschecks run here:E_ and W_ codessolve the circuitequationscolours, scope,plots, tables
FlowEvery change to the drawing goes through the same path, many times a second for the live simulation.

Before the circuit is solved, BetterSPICE checks it for a ground, a path from every net to ground, and sources that short themselves. A problem becomes a diagnostic: a code, a sentence that names the part and the net, and the fix. E_ codes stop the run. W_ codes are warnings and it keeps running. There are 78 codes, all in Diagnostics and what they mean.

06.4Nets and ground

A net is a set of pins joined by wires, labels or flags. Every pin on a net has the same voltage. Two labels with the same name are one net even with no wire between them. A wire that only crosses another doesn't connect to it.

Ground (key G) is net 0, the 0 V reference. Every voltage BetterSPICE shows is measured from it, so every circuit needs one, and every net needs a DC path to it. A net that only connects through capacitors has nothing to set its voltage (E_FLOATING_NET).

A side that must not share that ground, such as a transformer secondary or the output of an optocoupler, gets an isolated ground: a ground symbol with its own name, like ISO1. All grounds with that name are one ground domain. Its side is referenced to net 0 only through a 1 GΩ, 10 pF isolation barrier, the way a real isolation barrier leaks. The barrier belongs to the domain: change it on any symbol of the domain and it changes for all of them.

06.5Parts, models and where a value comes from

A part is what you place: R1, Q3, U2. Its model says how it behaves. A new part simulates with built-in typical values, and the inspector says Generic (no vendor model). Assigning a model from the library replaces them.

Parts, models and where a value comes from
Value comes fromWhenExample
Built-in typical valueA part placed from a key or a tile, with no model.A new NPN has bf = 100.
Vendor model cardA discrete model (.model D, NPN, NMOS and so on) from the library. The live simulation uses the same equations as ngspice.A 2N3904 takes bf, is and vaf from the vendor file.
Fitted from the vendor modelA vendor subcircuit, such as an op-amp. The live simulation uses a behavioural model fitted by running the vendor's. Simulate runs the vendor file itself.TLV9062: gain-bandwidth and slew rate measured from TI's model.
Quick modelDatasheet numbers you typed in the Quick model tab.Vth = 2 V and Rds(on) = 20 mΩ become vto and kp.
Part file (.bspart)A part made with the Part Wizard. The live model uses the typical value, or the middle of min and max.An LDO with V_OUT 3.234, 3.3, 3.366 V.
YouTyped in the inspector, on the canvas, with a slider, or set by an AI agent.

06.6Exact and approximate

Every device type is in one of two classes. Exact devices use the same equations as ngspice and are compared with it signal by signal. Approximate devices are behavioural models measured against a reference. The class is in every device table in Part VI and in the report.

Exact and approximate
ClassDevicesHow it's checked
ExactResistor, capacitor, inductor, sources, switch, diode, BJT, MOSFET level 1, JFET, controlled sources, transformerThe same netlist runs in BetterSPICE and ngspice-47, and every signal is compared within a tolerance (Verification).
ApproximatePower blocks, controller ICs, op-amp macromodels, sensorsCompared with the vendor model or a transistor-level reference. The report gives the error.

06.7When to trust which result

When to trust which result
Your questionUse
Does the circuit work, and how does it react when I change it?The live simulation.
What exactly is the ripple, the overshoot or the settling time?Simulate (F5) with a small max step.
Does an op-amp clip, and how close does it get to its rails?Simulate with the vendor model. The live simulation uses a fitted model.
What are the gain and phase margins?The AC sweep (F7).
Does it still work across component tolerances?A parameter step over the minimum, typical and maximum values.
cautionVendor models have limits too. A vendor macromodel is a model, not the part. The TI TLV9062 model cannot drive its output below about 50 mV from the negative rail, while the datasheet allows 20 mV. Check results that depend on the edge of a model against the datasheet.

06.8If you know SPICE

  • You never choose an engine. The live view always runs the BetterSPICE engine, and Simulate picks BetterSPICE, ngspice or PSpice for TI from the models in the circuit.
  • Probes and every analysis setting are saved in the circuit file.
  • In input fields, M and Meg both mean mega. In a netlist or vendor file, and on the bspice command line, M means milli. Type 1Meg to be safe everywhere.
  • The timebase is circuit time per real second, not time per division.
  • Vendor .lib and .subckt files from TI, ADI, LTspice, PSpice and HSPICE run in ngspice, converted where needed (Dialects and conversion).
  • Hierarchical sheets are flattened before the solve. uic, the integration method and .options can be stored in the circuit (Settings saved in the circuit).

06.9Desktop and browser

The Windows desktop app has everything in this manual. The browser version has the editor, the live simulation, the analyses in the BetterSPICE engine, the library, the Part Wizard and the symbol editor, but no ngspice or PSpice runs, no native file dialogs and no recent files (Desktop or browser).