Models and libraries
Where a circuit's parts come from, and how to bring in your Micro-Cap library.
User guide / 6. Models and libraries
Where parts come from
A part in a Micro-Cap circuit is one of three things:
- A built-in part type, such as a resistor, a diode or an opamp. CirSpice simulates these itself: Part types lists every one.
- A model or subcircuit that gives a part its behaviour, such as the
.MODELof a 1N4148 diode or the.SUBCKTof an opamp IC. - A macro: a whole schematic used as a part.
For a model, subcircuit or macro, CirSpice looks first in the circuit file itself, which often holds what it needs, and then in the libraries it can read. Within a library, it searches in the order Micro-Cap uses, so the same name finds the same definition.
Import your Micro-Cap library
Many circuits use models, subcircuits and macros from the library that came with Micro-Cap. CirSpice does not include Micro-Cap, which is Spectrum Software's product. If you have Micro-Cap 12 installed, CirSpice can read its library:
- Choose File > Import Micro-Cap Library.
- Select your Micro-Cap 12 folder, or its LIBRARY folder. If macOS hides the folder above it, CirSpice asks once for that folder too.
CirSpice copies the library files it reads into its own folder on your Mac (~/Library/Application Support/CirSpice/Library), leaves them out of backups, and reads them each time it starts. From then on, every circuit you open can use them. Nothing is uploaded.
"Needs your Micro-Cap library"
A part whose model, subcircuit or macro is in neither the circuit file nor a library CirSpice can read is marked Needs your Micro-Cap library, with the name the circuit uses for it. The circuit still opens, and you can look at it, but it cannot run until the definition is found. Importing your Micro-Cap library, as above, usually fixes this. CirSpice offers no download of the library: install Micro-Cap 12 first, then import it.
Browse the library
The sidebar's Library tab (⌘1) lists what you imported: subcircuits, models, macros and aliases. Search matches every word you type in names and descriptions, and a row opens to show its file, ports and parameters. Drag a part from the list onto the schematic to place it; if it needs a value, such as a model name, CirSpice asks first. Files that could not be read are listed with the reason.
Vendor models
File > Import Vendor Models takes model files from a component maker, in the PSpice dialect (.lib, .mod or .sub), with any files they include. CirSpice translates each subcircuit and model for ngspice, shows what it changed or why it refused one, and can check each by running it once. Imported models are copied to ~/Library/Application Support/CirSpice/Imported and can be placed on the schematic. When you save, CirSpice copies the model's text into the circuit's text page, so the file still opens in Micro-Cap 12.
Models in the circuit file
A .MODEL statement on the circuit's text page defines a model for that circuit; see .MODEL. Double-click a part, then use its Model... button to see and edit the parameters of a model the file defines.