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 VI  Parts and modelsReferenceContentsIndex
43

The model catalogue

The library holds 169,551 models. Every one was run before it was listed, and a model that cannot run in any engine isn’t in the app.

43.1Where the models come from

Where the models come from
SourceWhat it’sModels
Vendor downloads (library/raw)Model files from manufacturers' websites (TI, Analog Devices, Infineon, Vishay, Murata, Würth, Rohm, Nexperia, onsemi and many more) and curated community collections, each folder with a SOURCE.md naming where and when it came from.246,841
Vendor fixes (library/raw-fix)Newer or corrected files fetched from vendor sites to replace models that didn’t run, with the URL, date, licence and checksum of every file.2,397
KiCad Spice LibraryThe KiCad community collection of vendor models.36,471
LTspice libraryThe models of your LTspice installation, read from %LOCALAPPDATA%\LTspice\lib.8,159
BetterSPICE part filesParts made with the Part Wizard, in parts/library and My parts.

Identical definitions found in several places are listed once, keeping the vendor's own copy first. The vendor model files themselves aren’t part of the installer: the library lists them, and Simulate needs the files, so run from a folder that has the model library or point BSPICE_MODELS at it (Environment variables and files). A file a model includes is looked for next to it, in its folder and collection, in LTspice's standard libraries and in BetterSPICE's own generic library.

43.2How every model is checked

  1. Parse. The file is read in any of the usual encodings, and each .model or .subckt becomes an entry with its part number, maker, format (PSpice, LTspice, HSPICE or generic SPICE), pins and kind.
  2. Classify. The kind (diode, Zener, Schottky, LED, NPN, PNP, N or P MOSFET, JFET, op-amp, comparator, regulator, reference, timer, logic, other) comes from the card type, the part number, the pin names and the vendor's comments. Pins win over names: a "MOSFET" with VDD and VOUT pins is an IC.
  3. Extract. The definition is cut out with everything it uses, so it runs on its own.
  4. Run in a test circuit for its kind in ngspice, first exactly as the vendor wrote it, then converted to ngspice syntax if that fails.
  5. Check the behaviour. Running isn’t enough: a MOSFET must switch, an op-amp must follow as a buffer, a regulator must regulate. If the named pin order doesn’t work, BetterSPICE searches for the pins electrically.
  6. Fit the live model. The measurements give the parameters the live engine uses for that part.

43.3The test circuits

The test circuits
KindTestWhat is measured
DiodeForward sweep 0 to 5 V, reverse sweep past the breakdownVf at 1 mA, 10 mA, 100 mA and 1 A, reverse current at 5 V, breakdown at 1 mA
BJTGummel plot at Vce = 2 V, output curve at Ib = 100 µAVbe at 1 mA, hFE at 1 mA and 10 mA, Early voltage
MOSFETTransfer and output curves at 5 or 10 V, both polarities, with 10, 15 and 20 V gate drive for power partsThreshold, maximum current, Rds(on)
JFETTransfer at Vds = 10 VIdss, Vgs(off)
Op-ampUnity buffer at ±5, ±15, ±2.5 V and single 5 V, open loop, stepOffset, supply current, swing, gain, gain-bandwidth, phase margin, output impedance, slew rate
ComparatorThreshold sweep and step with a pull-upThreshold, output levels, delay
RegulatorLine and load sweeps, with enables tied activeOutput voltage, dropout, line regulation, supply current, output resistance
ReferenceShunt or series sweepVoltage, dynamic resistance or line regulation
LogicInputs driven with a binary count, outputs pulled upLevels, toggling, delay, truth table for named gates
Timer555 astable at a known frequencyFrequency within a factor of two
OtherEvery pin to ground through 1 MΩ, operating pointThat it runs

Runs that do not converge are retried with gentler solver settings. Discrete models (.model cards) are also run in BetterSPICE's own engine and compared point by point with ngspice.

43.4How models are filed

The catalogue files each model under the kind of part it is. Zener and TVS diodes are filed as Zeners even when their subcircuit holds only plain diodes. In the library, the TVS families (SMAJ, SMBJ, P6KE, 1.5KE, SMF, TPSMx, Würth WE-TVS and others) are listed under Protection › TVS, ESD diodes (ESDxx, PESD) under Protection › ESD, and the rest under Diodes › Zener. Tantalum, polymer and niobium oxide capacitor models (AVX TAJ, TPS, TCJ, NOJ) are listed under Passives › Capacitors and not as diodes. Power MOSFETs whose vendor model calls an inner subcircuit (Infineon OptiMOS, CoolMOS and CoolSiC) are listed under Transistors › MOSFET.

The Protection family of the library, with its TVS and ESD groups.
Figure 43.1The Protection family of the library, with its TVS and ESD groups.

43.5Status

Status
StatusDot in the libraryMeaningModels
WorksgreenRuns in ngspice exactly as the vendor wrote it.150,546
ConvertedamberRuns after conversion to ngspice syntax. Simulate runs the converted text.15,832
Verified in PSpicegreenCadence-encrypted, runs in PSpice for TI. Simulate runs it in PSpice.3,084
Replacedred, with "replaced by"Doesn’t run, but a working model of the same part stands in for it.33

A model whose file has a problem the catalogue check found, such as a missing include, shows a red dot with the reason. Fit classes in the model dialog: exact (the live engine uses the vendor card with ngspice's equations), approx (a behavioural fit from the measurements, with its error), accurate-only (Simulate only).

43.6Dialects and conversion

Vendor models are written for PSpice, LTspice, HSPICE, TINA and Micro-Cap. Each is tried as written first. If ngspice rejects it, BetterSPICE converts it to native ngspice syntax, one definition at a time, and records which rules it used. Some of the rules:

Dialects and conversion
ConstructBecomes
HSPICE 'expr', nested bracesngspice {expr}
PSpice IF, LIMIT, PWR, PWRS, STP, &, |Ternaries, min/max, pow with the sign kept, logical operators
LTspice uplim, dnlim, buf, inv, uramp, table()Equivalent expressions, a clamped pwl() for tables
E and G sources with VALUE, TABLE, LAPLACEB-sources, clamped tables, an exact state-space network for rational Laplace functions
PSpice voltage and current switchesA B-source with PSpice's switch law
LTspice Rser, Lser, Rpar, CparExplicit elements
PSpice U digital devices, LTspice A devicesXSPICE digital primitives with interface bridges
Vendor values ngspice rejects (BV = 0, NSUB = 0, division by a zero parameter)Repaired, each repair named

When Simulate has to use the converted text, it says so in a warning. Constructs with no ngspice equivalent (for example a PSpice Chebyshev filter or a delay in a Laplace function) make the model fail with that reason.

43.7PSpice for encrypted models

Many Texas Instruments models are encrypted by Cadence, readable only by PSpice. BetterSPICE never decrypts them. On the desktop, with PSpice for TI installed, the catalogue check ran each one in PSpice, hidden, through the same test circuits, and fitted the live simulation from the results. Simulate runs a circuit with such a model in PSpice (PSpice for encrypted models). Models encrypted for other simulators (LTspice encrypted files, HSPICE .protect) cannot run in either engine.

43.8Replacements

A model that doesn’t run, but whose part exists elsewhere in a form that does, is replaced: the library row says "replaced by X from Y" and placing it places the working one. Same part means the same part number (ignoring case, spaces, dashes and a package suffix), the same device class and compatible pins. Vendor downloads rank above other libraries, and models that work as written rank above converted ones.

43.9Retired models

A model that doesn’t run in ngspice, doesn’t pass in PSpice and has no working replacement is retired after every fix has been tried: it’s removed from the app and recorded in library/broken. The last run retired 3,094 models.

Retired models
FileWhat it holds
library/broken/README.mdCounts per kind, the main causes and examples.
library/broken/index.csvOne row per retired model: id, part number, kind, maker, source, file, line, status, reason, and what was tried.
library/broken/catalog/The full records, so a rebuild can restore them.
library/broken/files/Copies of the model files. The originals are never moved or deleted.

What was tried is listed per model: the dependency search, the conversion, running the tests again with every current fix, PSpice for encrypted models, the replacement search and the vendor download. Every rebuild of the catalogue first puts the retired models back and judges them again, so a model that a later fix makes runnable returns to the library by itself.

43.10Commands for the catalogue

Commands for the catalogue
CommandWhat it does
bspice models show <part or id>The catalogue entry, its status with the reason, and its live-view parameters.
bspice models stats --mdCounts per kind and status.
bspice models convert <file> <name>The ngspice-native text of one model, with the rules used.
bspice models validate --mpn <part> --forceRuns one model's tests again.
bspice models checkChecks the whole catalogue for missing files, definitions and includes.
python tools/model-index/rebuild.py --retireRebuilds the catalogue from the sources, tests everything that changed, and retires what still fails.
Try it
Find out why a model was replaced
  1. Search the library for the part. The row says "replaced by …".
  2. Run bspice models show <part number> in a terminal.

You should seeThe JSON shows the status, the reason with the ngspice message and the vendor file and line, and the replacement it points to.