Pulsim — User Guide¶
Pulsim is a header-only C++23 circuit simulator with a Python frontend, designed for power electronics and SMPS workloads. The whole solver lives in a few .hpp files; the engine pre-factors every reachable switch configuration into a piecewise-linear state-space cache, then steps through time at near-machine-speed.
If you've used SPICE before, the mental model is similar but the implementation is very different — see the mental model page for the one-page summary.
When to use Pulsim¶
- You're building power-electronics converters (buck, boost, flyback, full-bridge, 3-φ VSI, LDO, …).
- You want a scriptable, Python-first workflow with full access to the solver internals.
- You need to run thousands of duty-cycle / load-line sweeps quickly — the kernel's PWL cache makes each switch combo essentially free after the first solve.
- You're OK driving things from a
CircuitBuilder(Python or C++) or YAML — there is no schematic GUI yet.
When NOT to use Pulsim¶
- You need a full SPICE language frontend with
.MODELcards — Pulsim has its own device catalogue, not SPICE-compatible. - You're doing RF / high-frequency PCB simulations with distributed elements — Pulsim is lumped-only.
- You need built-in convergence retries that mask physically dubious circuits — the kernel's Newton is principled but unforgiving; expect to think about your circuit.
New in 2.1¶
New engines, devices and analyses behind options that default off, and many silent wrong answers corrected. Some 2.0 results move and some 2.0 calls now raise a named error: read the 2.0 → 2.1 migration notes and the known limitations before upgrading a study.
Using Pulsim with AI assistants¶
AI coding assistants were trained on Pulsim 1.x and on other simulators.
Point them at the guide that ships with the package, python -m
pulsim.guide (also on the AI assistants page), and at the
llms.txt index of these docs.
Reading order¶
- Getting started — install, run the first transient, see a plot.
- Mental model — what the Graph, DevicePool, PwlStateSpaceCache, and Newton refresh do.
- Tutorials — six walk-throughs from simplest to most involved:
- 01 — RC charging from a pulse source
- 02 — Buck converter (YAML + switch_fn)
- 03 — Isolated flyback (transformer + commutation)
- 04 — Three-phase voltage-source inverter (SPWM)
- 05 — LDO with op-amp feedback (VCVS + MOSFET)
- 06 — IGBT boost with realistic gate drive
- API reference — Python surface, one page.
- Gotchas — Newton convergence corner cases and the workarounds that ship in 1.0.
Post-hoc analysis (v1.5)¶
- Losses & junction temperature —
device_loss_summary+device_thermal_summary. Reads resistors, inductors (with optional Steinmetz / iGSE core loss), ideal switches (PSIME_on/E_off), and switched diodes (Q_rr/E_rr_ref); pipes the per-device loss through a Foster network forT_j(t). @fast_block— Pulsim's PSIM-Custom C Block/ PLECS-C-Scriptworkalike via Numba LLVM JIT. Write the control law in Python, get native-speed code without a C compiler in the user's PATH.- YAML composite devices + chain wiring —
induction_motor/hysteretic_inductorincircuit:pluswire_chain_from_yaml(loaded, chain_spec)for the control layer (IM mechanical, JA observer, SMO/MRAS sensorless). - Control graph: order, rates and delay — in which order a
MixedDomainBlockChainruns its blocks (algebraic loops are build errors),Rategroups with integer tick counters, andcompute_delay; the migration note for chains that relied on insertion order.
Where the source lives¶
| Tree | What's inside |
|---|---|
core/include/pulsim/ |
The entire C++23 solver (header-only) |
core/tests/ |
Catch2 unit + integration tests |
python/pulsim/__init__.py |
Python re-export module + simulate() helper |
python/bindings.cpp |
pybind11 bindings |
examples/*.yaml |
YAML showcases referenced from these tutorials |
openspec/specs/pulsim-* |
Authoritative capability specs |
openspec/changes/pulsim-* |
Historical change proposals |