This repository provides a Julia wrapper for NgSpice library.
In a Julia REPL,
] add https://github.com/JuliaComputing/NgSpice.jl
using NgSpice
To start an an interactive mode,
using Plots
NgSpice.interactive()
- Hit
~
for initializing the NgSpice
Run the Ngspice simulations commands!
For example:
source /filepath/netlist # without quotes
display # prints all vectors and constants
plot vector1 vector2 # plots the real part of vector by default
Note: It is not necessary for .cir
to be placed in bin
folder as long as full path is specified.
Additional to usual plot parameters, different modes of retrieval can be set with:
plot -x space seperated vectorlist
where x
takes following modes:
Modes | Description |
---|---|
-r, --real | Real part of vector |
-i, --imaginary | Imaginary part of vector |
-m, --magnitude | Magnitude of vector |
-p, --phase | Phase of vector |
For a non-interactive and more Julia-like experience checkout this tutorial.
Additionally, to simulate a complex_circuit.sp
file with multiple plotting statements, run
using NgSpice
using Plots
source_sp("path/to/the/complex_circuit.sp")