diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 23 |
1 files changed, 18 insertions, 5 deletions
@@ -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). |
