See the Simulation section on the KiCad Tips And Tricks page for info specifically involving KiCad and ngspice.
1. Elementary SPICE Components
XXXXXXX syntax in the general form describing elementary SPICE components is to dominate a user chosen alpha-numeric identifier (e.g.
RXXXXXXX could stand for
2. Voltage And Current Sources
The current direction convention for voltage sources is that a positive current is when the current is flowing into the positive pin of the voltage source.
3. Voltage And Current Controlled Switches
Two types of switches in SPICE, voltage and current controlled. They are not ideal switches, and are modelled with a finite on and off resistance, as well as finite turn on and off times. However, you can usually set these to the extremes so that they act almost like an ideal switch, in relation to everything else in your circuit.
They are great for seeing what effect a short with have on your circuit (e.g. shorting out one LED in a string of LEDs controlled by a constant-current driver).
SPICE prefix for switches is S.
The general form for a switch is:
SXXXXXXX N+ N- NC+ NC- MODEL <ON><OFF> WYYYYYYY N+ N- VNAM MODEL <ON><OFF>
The most basic syntax to create a voltage-controlled switch is:
.model VSW SW()
4. Smoke Analysis
Smoke analysis is when the SPICE software performs a simulation and checks that all the components are not exceeding maximum voltages, currents or power dissipation levels (among other things). Only a small number of the available SPICE software packages support smoke analysis, including PSPICE (commercial) and Micro-Cap (now free).
For example, the Micro-Cap implementation checks the following parameters[bib-micro-cap-reference-man-v12]:
display to print a list of all currently defined vectors.
source to load a netlist file. This is called the input file:
run to run the simulation --- this will run any control lines specified in the input file. Control lines are commands such as
let to create new variables.
AC analysis creates complex vectors.
.control to create a control block which can contain executable statements such as
plot within a circuit netlist file.
As of 2019-04-07, Spectrum Software closed and released Micro-Cap for free (at version 12)[bib-micro-cap-download-page]. You can download it at http://www.spectrum-soft.com/download/download.shtm.
One of the only free SPICE simulation packages that supports smoke analysis.
7. The Best SPICE Resources Out There
National Instruments SPICE Simulation Fundamentals ([http://zone.ni.com/devzone/cda/tut/p/id/5413#toc3](http://zone.ni.com/devzone/cda/tut/p/id/5413#toc3)) - Helpful, professional resources covering most aspects of SPICE simulation
[Intusoft: Solving SPICE Convergence Problems](http://www.intusoft.com/articles/converg.pdf): Explains the common reasons for no convergence and the many ways to try and fix this.
[bib-micro-cap-download-page] http://www.spectrum-soft.com/download/download.shtm, accessed 2021-06-20.
[bib-micro-cap-reference-man-v12]: http://www.spectrum-soft.com/download/rm12.pdf, accessed 2021-06-20.
This work is licensed under a Creative Commons Attribution 4.0 International License .
- Silicon Controlled Rectifiers (SCRs)
- Shift Registers
- Peltiers (Thermoelectric Cooler)
- Electropermanent Magnets (EPMs)
- Altium Simulation
- voltage sources
- current sources
- smoke analysis