Skip to content

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 .MODEL cards — 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

  1. Getting started — install, run the first transient, see a plot.
  2. Mental model — what the Graph, DevicePool, PwlStateSpaceCache, and Newton refresh do.
  3. Tutorials — six walk-throughs from simplest to most involved:
  4. 01 — RC charging from a pulse source
  5. 02 — Buck converter (YAML + switch_fn)
  6. 03 — Isolated flyback (transformer + commutation)
  7. 04 — Three-phase voltage-source inverter (SPWM)
  8. 05 — LDO with op-amp feedback (VCVS + MOSFET)
  9. 06 — IGBT boost with realistic gate drive
  10. API reference — Python surface, one page.
  11. 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 (PSIM E_on / E_off), and switched diodes (Q_rr / E_rr_ref); pipes the per-device loss through a Foster network for T_j(t).
  • @fast_block — Pulsim's PSIM-Custom C Block / PLECS-C-Script workalike 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_inductor in circuit: plus wire_chain_from_yaml(loaded, chain_spec) for the control layer (IM mechanical, JA observer, SMO/MRAS sensorless; see Sensorless observers).
  • Control graph: order, rates and delay — in which order a MixedDomainBlockChain runs its blocks (algebraic loops are build errors), Rate groups with integer tick counters, and compute_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/archive/*-pulsim-* Historical change proposals