Skip to main content

High-performance circuit simulator for power electronics

Project description

Pulsim

Power-electronics circuit simulator — C++23 kernel with a Python-first API.

Pulsim is a header-only C++ simulation engine (pulsim) wrapped by a flat Python module (import pulsim). It is built around a PWL state-space cache (for fast switched-converter dynamics), a Newton refinement on top of the cached linear factor (for non-linear devices), and a built-in event detector for diode/MOSFET commutations.

If you have legacy code from the pre-1.0 cycle (the old Circuit / Simulator / YamlParser surface), see docs/migration-guide.md for the device / analysis mapping table.

Why Pulsim

  • PLECS-style PWL cache — switched-converter steady-state in milliseconds instead of minutes.
  • Header-only C++23 kernel — drop pulsim/ into your own CMake target via pulsim::core; no static-library link step.
  • Python-first ergonomicsCircuitBuilder API takes string node names and SI-unit parameters, returns the same SimulationResult whether you run a transient, an AC sweep, or a parameter sweep.
  • Mixed-domain composable controlMixedDomainBlockChain runs PI/PID, comparators, rate limiters, op-amps, FOC blocks and thermal networks at kernel speed (no Python interpreter cost per step).
  • Frequency-domain analysis included — small-signal MNA Bode + swept-sine FRA + closed-loop GM/PM measurement, all in the same surface.

Quick start

Build prerequisites

Pulsim has just two native dependencies — Eigen 3.4+ and a C++23 compiler. Everything else (sparse LU, YAML parser, tests) is header-only or vendored at configure time:

Dependency Why
Eigen 3.4+ Header-only sparse linear algebra (matrices, vectors). Pulsim ships its own sparse LU solver on top — no third-party LU library is linked.
C++23 compiler AppleClang 15+ / Clang 17+ / GCC 13+

Install on the supported platforms:

# macOS (Homebrew)
brew install cmake ninja eigen

# Debian / Ubuntu
sudo apt-get install -y cmake ninja-build libeigen3-dev

# Fedora
sudo dnf install cmake ninja-build eigen3-devel

Build + run

git clone https://github.com/lgili/Pulsim.git
cd Pulsim

# Build kernel + Python extension
cmake -S . -B build -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DPULSIM_BUILD_PYTHON=ON
cmake --build build -j

# Use Pulsim from the source tree (no `pip install` required)
export PYTHONPATH="$(pwd)/build/python:$PYTHONPATH"

# First run — open-loop buck
python3 examples/scripts/run_buck.py

# Print available components + helpers
python3 -c "import pulsim as p; p.catalog()"

First simulation — 8 lines

import pulsim as p

b = p.CircuitBuilder()
b.add_voltage_source("Vin", "n0", "gnd", 5.0)
b.add_resistor      ("R1", "n0", "vc",   1000.0)
b.add_capacitor     ("C1", "vc", "gnd",  1e-6)

res = p.simulate(b, t_end=5e-3, dt=1e-5)
p.plot.scope(b, res, signals=["vc"])      # one-liner plot

What ships

  • Builder: CircuitBuilder with 20+ helpers covering passives, sources, MOSFETs (SH1), IGBTs (Level 1), saturable inductors, transformers, op-amps, three-phase sources, …
  • YAML loader: same surface, 13 ready-made example circuits in examples/.
  • Solver: PWL state-space cache + Newton refresh + event detection + optional state-aware step_observer(t, x) callback for closed loops.
  • Control library: PIController, PIDController, Comparator, RateLimiter, FirstOrderLowPass, …
  • AC analysis: swept-sine Bode + auto-tuning (tune_pi_from_bode) with phase-margin / gain-margin extraction.
  • Frequency-response analyser (FRA): closed-loop / nonlinear-Bode via the time-domain swept-sine path.
  • Plot helpers: p.scope(), p.plot_bode() — one-line waveform + Bode plots with sensible defaults.

Where to learn more

Validation

# Python runtime tests
PYTHONPATH=build/python pytest python/tests -v

# C++ kernel tests (layer-by-layer Catch2 binaries)
ctest --test-dir build --output-on-failure

Reference CSV traces for the converter showcases live in benchmarks/baselines/; a 1.0-native regression runner that consumes them is not yet wired up.

Documentation

Docs deployment (GitHub Pages)

Docs are published by .github/workflows/docs.yml using MkDocs Material + mike:

  • PR: strict docs build
  • main: deploy dev docs channel
  • vX.Y.Z tag: deploy release docs and update latest

In repository settings, set Pages Source to GitHub Actions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pulsim-1.3.0.tar.gz (32.5 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pulsim-1.3.0-cp313-cp313-win_amd64.whl (840.8 kB view details)

Uploaded CPython 3.13Windows x86-64

pulsim-1.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pulsim-1.3.0-cp313-cp313-macosx_13_0_arm64.whl (835.1 kB view details)

Uploaded CPython 3.13macOS 13.0+ ARM64

pulsim-1.3.0-cp312-cp312-win_amd64.whl (840.6 kB view details)

Uploaded CPython 3.12Windows x86-64

pulsim-1.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pulsim-1.3.0-cp312-cp312-macosx_13_0_arm64.whl (835.1 kB view details)

Uploaded CPython 3.12macOS 13.0+ ARM64

pulsim-1.3.0-cp311-cp311-win_amd64.whl (836.7 kB view details)

Uploaded CPython 3.11Windows x86-64

pulsim-1.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pulsim-1.3.0-cp311-cp311-macosx_13_0_arm64.whl (831.5 kB view details)

Uploaded CPython 3.11macOS 13.0+ ARM64

pulsim-1.3.0-cp310-cp310-win_amd64.whl (834.6 kB view details)

Uploaded CPython 3.10Windows x86-64

pulsim-1.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pulsim-1.3.0-cp310-cp310-macosx_13_0_arm64.whl (830.1 kB view details)

Uploaded CPython 3.10macOS 13.0+ ARM64

File details

Details for the file pulsim-1.3.0.tar.gz.

File metadata

  • Download URL: pulsim-1.3.0.tar.gz
  • Upload date:
  • Size: 32.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pulsim-1.3.0.tar.gz
Algorithm Hash digest
SHA256 51791b7d5995212790b804aea199ef753a59a906a34e9ba1f6ebc211cb5476b8
MD5 4d6639aba13fce016c8583d4ffc1d081
BLAKE2b-256 ba085d7929634083d480f2b5d5af9e9c596ef3dab17ea6daeaf3c546b938e4c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.3.0.tar.gz:

Publisher: publish.yml on lgili/Pulsim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pulsim-1.3.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pulsim-1.3.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 840.8 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pulsim-1.3.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 80fcba97869672bdcc04f9cbf673d39c4d032094b29c406a18ba75bc8bb4a908
MD5 9d6fc4afa37bb68fd8ab2911140d9fcc
BLAKE2b-256 ec887cac26df267a60481134d12473416a13cba3d97de4ed62a35b9edfa612f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.3.0-cp313-cp313-win_amd64.whl:

Publisher: publish.yml on lgili/Pulsim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pulsim-1.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pulsim-1.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8479c18717fac17da7a044e2a29c0fb807941db88e545f4d889a2504cdef64d5
MD5 eb928d4587cad7795581af49b2526eb2
BLAKE2b-256 9582cc0afaa82de3b605f4cd7a7963bc52c1e25703c64fb795640a6c9c2998e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on lgili/Pulsim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pulsim-1.3.0-cp313-cp313-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for pulsim-1.3.0-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 2b03068711f091b5b9113bdbb92ec69d2635139bc811742cd2d4335a1b46051f
MD5 65e33936965787cc2335ff5403b83486
BLAKE2b-256 9830f93af651a0838409137da7058c4facdf4f7fd4ca41777137ebe012e18214

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.3.0-cp313-cp313-macosx_13_0_arm64.whl:

Publisher: publish.yml on lgili/Pulsim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pulsim-1.3.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pulsim-1.3.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 840.6 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pulsim-1.3.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1439b8d6a3ec4228fdaa52819391fbd16270a4768a3e96b8e2414948b7b62a36
MD5 257400aa0b2041f342c86e9bedd548db
BLAKE2b-256 0fe6f8e0eb0cdfe67e767ec221b30e2abf4833d48ed65c76c7ca8302bdc24d84

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.3.0-cp312-cp312-win_amd64.whl:

Publisher: publish.yml on lgili/Pulsim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pulsim-1.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pulsim-1.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1483c091ef50ec9ca2c05cc8ea8d990e746f897506ad86c24e9e2cb0d284ff1f
MD5 8be110216864db5aa5b9ae82ed16f087
BLAKE2b-256 8daa40642071613452e27c3294626bb99ea7b4c7fa9705a1e019a1eabd75f4ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on lgili/Pulsim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pulsim-1.3.0-cp312-cp312-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for pulsim-1.3.0-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 b55cc75cd9642bffa31a02543b3c24ee25871669f6faf771152b817370e8e4e9
MD5 3f93ac87a2b26643751448ed7abc0a44
BLAKE2b-256 2699195e0c7a9eb78d31237e64cd6f179ab18dc8146f916f503fb6e33120a9e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.3.0-cp312-cp312-macosx_13_0_arm64.whl:

Publisher: publish.yml on lgili/Pulsim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pulsim-1.3.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pulsim-1.3.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 836.7 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pulsim-1.3.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e47feb30e8dafc33764ba10cf1629b68e980d6a4c713f968a593473d2a74c080
MD5 77814ec40e1deb9998d8efe7a8541c5c
BLAKE2b-256 4cf5afb21be689b5aca66166745523d07f4b8313716254cf0bc162a88230c3d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.3.0-cp311-cp311-win_amd64.whl:

Publisher: publish.yml on lgili/Pulsim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pulsim-1.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pulsim-1.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 099a8bd3620cbdf32798496fc65c9bb75a4f5a7657cabc347e85144d2732277c
MD5 40cc0da5e7f035edc5ab0c5dbfbaa74c
BLAKE2b-256 b1f60e957849ec768724e899d5be606fb835df12016873c4fd1b4b3a1c77d91a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on lgili/Pulsim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pulsim-1.3.0-cp311-cp311-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for pulsim-1.3.0-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 e4a84fe445dfd5eff358cf9cbecdebeaf6c687187cba7b3f4df75f11fce680e6
MD5 295b86dc1ad7309bc9c56c604901b9f8
BLAKE2b-256 2a3dbf4d1adba86d197736468c8ba2dadf92dacfb8f74406068dd020e08a4509

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.3.0-cp311-cp311-macosx_13_0_arm64.whl:

Publisher: publish.yml on lgili/Pulsim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pulsim-1.3.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pulsim-1.3.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 834.6 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pulsim-1.3.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 98d1f5832b2cf892523c520bbbc94b3ecc6af99277a579041eca3a92cd03ee83
MD5 0ea3ae32d8ef139e68baf2f7ed6106b8
BLAKE2b-256 22e2d21a4a0d59fea863b674b9f196584130b55d1d9091e5a31130b5f862dd9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.3.0-cp310-cp310-win_amd64.whl:

Publisher: publish.yml on lgili/Pulsim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pulsim-1.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pulsim-1.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1456e13e96d3f6f2738cd3627617948b74b55a718bc2a466346a6a325f5870ef
MD5 2c9f2dc77452e0440fb833551326e84e
BLAKE2b-256 d6d470513c0737b51995978b1a176cb2ac4d62e1235373c8fc313dbbc53815b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on lgili/Pulsim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pulsim-1.3.0-cp310-cp310-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for pulsim-1.3.0-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 c148aa94f4ce01f91562c695abc9eda44b8616848afd949de06a6adecb7f6262
MD5 ade43a591f4a2deb65513cfee8c9a802
BLAKE2b-256 0578a9ba645d0b5ffe9183f03f1375bf4b77850018b907e66777c708359ebf4d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.3.0-cp310-cp310-macosx_13_0_arm64.whl:

Publisher: publish.yml on lgili/Pulsim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page