https://github.com/diordany/spicemill
Tool for plotting Ngspice simulation results with Pyplot.
https://github.com/diordany/spicemill
analysis data electrical-engineering electronics frontend integrated-circuit integrated-circuits ngspice plot plotting post-processing pyplot python raw simulation spice
Last synced: 5 months ago
JSON representation
Tool for plotting Ngspice simulation results with Pyplot.
- Host: GitHub
- URL: https://github.com/diordany/spicemill
- Owner: Diordany
- License: mit
- Created: 2023-12-21T16:11:52.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-03-28T12:56:41.000Z (about 2 years ago)
- Last Synced: 2024-12-30T00:47:56.860Z (over 1 year ago)
- Topics: analysis, data, electrical-engineering, electronics, frontend, integrated-circuit, integrated-circuits, ngspice, plot, plotting, post-processing, pyplot, python, raw, simulation, spice
- Language: Python
- Homepage:
- Size: 51.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.txt
- License: LICENSE.txt
Awesome Lists containing this project
README
# Spice Mill
[](https://opensource.org/licenses/MIT)
I'm working on Spice Mill to aid me in circuit analysis. Spice Mill focuses primarily on post processing ASCII raw files generated Ngspice. This is intended for my personal use, but I'm releasing it for anyone who's interested. Keep in mind that everything here is subject to change.
## Generating Test Data with Ngspice
Here's a quick example on how to generate test data with Ngspice for use with Spice Mill. First you'll need to define a test circuit. For this example we'll use a sine signal:
$$v_s(t) = A \cdot sin(2\pi ft) + V_0$$
Where the amplitude $A = 2.5 V$, the offset $V_0 = 2.5 V$ and the frequency $f = 1 kHz$. For this example we'll run a transient analysis over the interval $0 \le t \le 10 ms$ with timesteps of $\Delta t = 10 \mu s$. We get the following netlist:
```
.title Sine Wave
vs vout 0 sin(2.5, 2.5, 1k)
.tran 10u 10m
.end
```
We save this to a file named `test.cir` and run the following command to generate the test data:
```
SPICE_ASCIIRAWFILE=1 ngspice -b -r test.raw test.cir
```
Ngspice should now write the simulation data to a file named `test.raw`.
## Plotting Simulation Results
To plot the simulation results provided by an ASCII .raw file, run the following command:
```
python spicemill.py --raw
```
If no filename was given with the `--raw` option, it defaults to `data.raw`.

To plot specific variables, use the `--vars` option. The variable names (`v(vout)` and `i(vs)` for example) should be separated by a semicolon `;`.
```
python spicemill.py --vars ";;"
```