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

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.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.0.0.tar.gz (26.9 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.0.0-cp313-cp313-win_amd64.whl (803.5 kB view details)

Uploaded CPython 3.13Windows x86-64

pulsim-1.0.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

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

pulsim-1.0.0-cp313-cp313-macosx_13_0_arm64.whl (795.5 kB view details)

Uploaded CPython 3.13macOS 13.0+ ARM64

pulsim-1.0.0-cp312-cp312-win_amd64.whl (803.5 kB view details)

Uploaded CPython 3.12Windows x86-64

pulsim-1.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

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

pulsim-1.0.0-cp312-cp312-macosx_13_0_arm64.whl (795.5 kB view details)

Uploaded CPython 3.12macOS 13.0+ ARM64

pulsim-1.0.0-cp311-cp311-win_amd64.whl (799.6 kB view details)

Uploaded CPython 3.11Windows x86-64

pulsim-1.0.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

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

pulsim-1.0.0-cp311-cp311-macosx_13_0_arm64.whl (792.5 kB view details)

Uploaded CPython 3.11macOS 13.0+ ARM64

pulsim-1.0.0-cp310-cp310-win_amd64.whl (797.6 kB view details)

Uploaded CPython 3.10Windows x86-64

pulsim-1.0.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

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

pulsim-1.0.0-cp310-cp310-macosx_13_0_arm64.whl (791.3 kB view details)

Uploaded CPython 3.10macOS 13.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for pulsim-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5cad25eeb3c0030944580917a25888f6a41eacba6db4966c17eb1956e8f82841
MD5 75b99f9849c62bcd9154a180fca99951
BLAKE2b-256 f44a011063b539f1dc4224268871a11b9e75dfd3583f0f463ff627a658284abe

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.0.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.0.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pulsim-1.0.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 803.5 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.0.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3f84cc9f7afc3e34f7914b57a0b0b9041537365420a472d7b5b6516f84a527c9
MD5 bd3b5f84614ab0e2c6254fb9182f817b
BLAKE2b-256 9966f6027ab578e1fc30264832692293ec51832e57b36100695f158f35d1ee3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.0.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.0.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pulsim-1.0.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b9f231a2e71096d2349845fee46ebe2aa9f11eb6af7b30ebfcc6d06c382b7f84
MD5 52550187c4795eaf545d0c559406f4e1
BLAKE2b-256 dc18845e80965fd218071c98c4740a21377be5d7097f9100a0a943789b476c13

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.0.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.0.0-cp313-cp313-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for pulsim-1.0.0-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 10d641dabe7fc978c181491e765f150feb7277f88bd5c9795d16f2cccc27529e
MD5 62392f4eafe4d370ae53959ff833affd
BLAKE2b-256 f178d35e21d05a166fab04de766bb59979ebbf18213f3f8dfd568251f6496b42

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.0.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.0.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pulsim-1.0.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 803.5 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.0.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bb7d877c37e1e751c229b0d02e9eab8ba580eec0c0b34534dc569e3db1c1bbf9
MD5 54547936f9c10c264c6b7d9e366ae328
BLAKE2b-256 fa5d85051bd11cdedfb3744f60f16a1e8d1cf9911fa38bd2da28ae2546c30df7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.0.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.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pulsim-1.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 65fda075ada5cba33048d3ebb3e697ea99b74f23043bd983196c58d0d436545c
MD5 127ae0c428f7ba8f9895092a6645c1ea
BLAKE2b-256 a53282a350077b54976269f1418518894e666eea0597d8d2acf2d10105f78bea

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.0.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.0.0-cp312-cp312-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for pulsim-1.0.0-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 8610ef63385efd9b7fd0f80530b9034e921e849d7f28be77a8f5fb7b06d9380f
MD5 cfce145e55662e766a6c8fb6b2823d98
BLAKE2b-256 76012dc1f495aa8763653835a301957a6d05b47cb1299a8fd477d28b0382e36f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.0.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.0.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pulsim-1.0.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 799.6 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.0.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b7b1473187a5d605e2b61521e5fe450144ec47d97c0a8b36759ab411c429bf50
MD5 1e2f665e2d3e0c3865bb10d58b1c5893
BLAKE2b-256 10aeaffe2e2dffbf4735128b716033b44e2af5b74b881e29c95d8b280de87b5e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.0.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.0.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pulsim-1.0.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f10acb31817ad38aceb731e5d48586847c3a3bff317172b3666c9ad42d5ece58
MD5 3e4fb3cc21ccc6bfa960479b16b8de9f
BLAKE2b-256 2b05dcc6277863d8b9aae55b9932985754e375dafadeb61ebda99a8862da8a90

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.0.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.0.0-cp311-cp311-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for pulsim-1.0.0-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 2f40d44658abb99ce8bfd0d7ee24f7dc1715c075b330e8e4c2ee56dbd9d27a37
MD5 180acc63800f6d0611308ec8f0b76908
BLAKE2b-256 fd966c00b63329f3eeba0c656cf7edbf419af1b8d16505af36cd04868b730c6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.0.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.0.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pulsim-1.0.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 797.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.0.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8c23517f1dbfc8b7279de30638c9efc22e59137a1491b19a86ed9f1c15836733
MD5 723b1f562fb294fdb8d3042540f0a5bd
BLAKE2b-256 380a2f7b6173973193ac0696d4e04862f05d63abcd0e510990dce614f0f5cb11

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.0.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.0.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pulsim-1.0.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 372ec6e3a17db4084a9f1de8ee45a699fae2d1896eed519a4c1c4a49d884e827
MD5 6e894efbcf74142becd6f03623e7c30c
BLAKE2b-256 518d2cf41222a66596a2602b65a2f01ce75d918beb4a5351d2d0edee9a271f45

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.0.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.0.0-cp310-cp310-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for pulsim-1.0.0-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 160481c4aac4da7603d221f9a70d1c3c43d537b7c514a19da794490c8a16cb0a
MD5 f28619b86cb12d1cfa0505dbfb7a1956
BLAKE2b-256 dfc243feefdae54b7b0d14463888f76a4ae906fb32e5c1b43b4a62d8d8ac19c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-1.0.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