Python bindings for the ngspice simulation engine
This is a library that allows Python applications to talk to Ngspice, an engine for simulating electronic circuits. Currently it supports sending commands to the engine and reading the results into numpy arrays, for plotting and analysis. Future goals include voltage and current sources defined by Python functions, and the possibility of stepping through a simulation in order to inspect results and modify the circuit mid-run.
This library requires libngspice.
On Linux, this means you have to download the source package for ngspice and compile it like this:
./configure --with-ngshared make sudo make install
On Windows, it currently assumes that
ngspice.dll is installed in
C:\Spice\bin_dll (32-bit Python) or
C:\Spice64\bin_dll (64-bit Python).
Go to Ngspice Download and
choose one of the packages (such as
ngspice.dll, and extract it to
C:\. (To support all features,
this folder structure must also include
One fast way to produce SPICE netlists is to draw the schematic with GSchem and then export a netlist with
gnetlist -g spice-sdb schematic.sch -o netlist.net
For details on simulation commands, check out the Ngspice manual.