From abe94972619bcd48fa928ccefdff9a814971a5a5 Mon Sep 17 00:00:00 2001 From: Vaino Kauppila Date: Sun, 11 Oct 2026 15:21:53 +0300 Subject: examples: runnable RC low-pass demo on a plain netlist (no KiCad) rc_lp.cir + rc_lp.py: 5 V step into 1k + 100n, prints V(out) at one time constant and writes a plot. README updated for netlist support; results/ output dir ignored. --- README.md | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index da5996c..b44856e 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ -# kisim — run KiCad schematics in ngspice from Python +# kisim — run KiCad schematics or plain netlists in ngspice from Python `kisim.py` is a single-file simulation framework with no project knowledge. It: -1. exports a `.kicad_sch` to a SPICE netlist with `kicad-cli`, +1. exports a `.kicad_sch` to a SPICE netlist with `kicad-cli` (or takes a plain + ngspice netlist — `.cir`/`.spice`/`.net` — and uses it as-is), 2. edits the netlist (instance parameters, source waveforms, regex substitutions), 3. runs `ngspice -b`, and 4. hands the results back as numpy arrays addressed by the schematic's own net @@ -26,7 +27,8 @@ micromamba run -n kicad_work python my_sim.py Required on the system (not in the env): -- `kicad-cli` — schematic → SPICE netlist export (KiCad ≥ 7; developed on 10.0.6) +- `kicad-cli` — schematic → SPICE netlist export (KiCad ≥ 7; developed on 10.0.6). + Only needed for `.kicad_sch` inputs. - `ngspice` — the simulator (developed on ngspice-47) ## Usage @@ -49,8 +51,19 @@ r.plot(["+28V", "i(V1)", "Q2:power"]) using for big vendor models, where thousands of internal nodes make huge, slow raw files. +## Example + +`examples/` is a small runnable demo: + +- `rc_lp.cir` — a plain ngspice netlist: 5 V step into 1 kΩ + 100 nF +- `rc_lp.py` — runs it with kisim and plots V(in)/V(out) + +```sh +micromamba run -n kicad_work python examples/rc_lp.py +``` + ## Notes -- `results/*.raw` and regenerated `results/*.cir` files are gitignored; they - are rebuilt by running the sims. +- `results/` directories (sim output, plots) are gitignored; rebuilt by running + the sims. - Initially developed for the ASPECT+ payload board sims (2026). -- cgit v1.3