Skip to main content

High-performance circuit simulator for power electronics

Project description

Pulsim

Power electronics simulation, simplified.

High-performance circuit simulator focused on power electronics.

Features

  • High-performance C++20 kernel with sparse matrix solvers
  • Modified Nodal Analysis (MNA) for circuit formulation
  • Multiple integration methods (Backward Euler, Trapezoidal, BDF2, GEAR2)
  • Newton-Raphson nonlinear solver with damping and adaptive timestep
  • JSON netlist format with schematic position storage
  • CLI tool for batch simulation
  • Python bindings for scripting and GUI integration
  • GUI integration API with pause/resume/stop, progress callbacks, and validation

Quick Start

Build

# Configure
cmake -B build -DCMAKE_BUILD_TYPE=Release

# Build
cmake --build build -j

# Run tests
ctest --test-dir build --output-on-failure

Usage

# Run a simulation
./build/cli/pulsim run examples/rc_circuit.json -o result.csv

# Validate a netlist
./build/cli/pulsim validate examples/voltage_divider.json

# Get circuit info
./build/cli/pulsim info examples/rlc_circuit.json

Netlist Format

Pulsim uses a JSON-based netlist format:

{
    "components": [
        {"type": "voltage_source", "name": "V1", "npos": "in", "nneg": "0", "waveform": 5.0},
        {"type": "resistor", "name": "R1", "n1": "in", "n2": "out", "value": "1k"},
        {"type": "capacitor", "name": "C1", "n1": "out", "n2": "0", "value": "1u"}
    ]
}

Supported Components

Component Type Parameters
Resistor resistor, R value (ohms)
Capacitor capacitor, C value (F), ic (initial voltage)
Inductor inductor, L value (H), ic (initial current)
Voltage Source voltage_source, V waveform
Current Source current_source, I waveform
Diode diode, D is, n, ideal
Switch switch, S ron, roff, vth, ctrl_pos, ctrl_neg
MOSFET mosfet, nmos, pmos, M vth, kp, lambda, w, l, rds_on, body_diode
Transformer transformer, T turns_ratio, lm (magnetizing inductance)

Waveform Types

  • DC: 5.0 or {"type": "dc", "value": 5.0}
  • Pulse: {"type": "pulse", "v1": 0, "v2": 5, "period": 1e-3, ...}
  • Sine: {"type": "sin", "amplitude": 2.5, "frequency": 1000, ...}
  • PWL: {"type": "pwl", "points": [[0, 0], [1e-3, 5], [2e-3, 0]]}

SI Prefixes

Values support SI prefixes: f, p, n, u, m, k, meg, g, t

Examples: "1k" = 1000, "100n" = 100e-9, "4.7u" = 4.7e-6

CLI Options

pulsim run <netlist> [options]
  -o, --output    Output file (CSV)
  --tstop         Stop time (default: 1e-3)
  --dt            Time step (default: 1e-6)
  --tstart        Start time (default: 0)
  --abstol        Absolute tolerance (default: 1e-12)
  --reltol        Relative tolerance (default: 1e-3)
  -v, --verbose   Verbose output
  -q, --quiet     Quiet mode

pulsim validate <netlist>
  Validates netlist syntax and circuit topology

pulsim info <netlist>
  Shows circuit information

Project Structure

pulsim-core/
├── core/               # C++ kernel library
│   ├── include/        # Public headers
│   ├── src/            # Implementation
│   └── tests/          # Unit tests
├── cli/                # Command-line interface
├── examples/           # Example circuits
└── openspec/           # Specifications

Python Bindings

Pulsim includes Python bindings for scripting and GUI integration.

Installation

# Build with Python bindings
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j

# Install (or add build/python to PYTHONPATH)
pip install build/python

Basic Usage

import pulsim

# Create a circuit
circuit = pulsim.Circuit()
circuit.add_voltage_source("V1", "in", "0", 5.0)
circuit.add_resistor("R1", "in", "out", 1000.0)
circuit.add_capacitor("C1", "out", "0", 1e-6)

# Validate the circuit
result = pulsim.validate_circuit(circuit)
if not result.is_valid:
    for error in result.errors():
        print(f"Error: {error.message}")

# Run simulation
opts = pulsim.SimulationOptions()
opts.tstop = 0.01  # 10ms
opts.dt = 1e-7     # 100ns timestep

sim = pulsim.Simulator(circuit, opts)
result = sim.run_transient()

print(f"Simulated {result.num_points()} points in {result.total_time_seconds:.2f}s")

GUI Integration

Pulsim provides a complete API for GUI integration:

import pulsim
import threading

# Create a simulation controller for pause/resume/stop
controller = pulsim.SimulationController()

# Progress callback for progress bars
def update_progress(progress):
    print(f"Progress: {progress.progress_percent:.1f}%")
    if progress.convergence_warning:
        print("Warning: Convergence issues detected")

# Run simulation with progress tracking
sim = pulsim.Simulator(circuit, opts)
result = sim.run_transient_with_progress(
    control=controller,
    progress_callback=update_progress,
    min_interval_ms=100  # Update every 100ms
)

# From another thread (GUI button handlers):
controller.request_pause()   # Pause simulation
controller.request_resume()  # Resume simulation
controller.request_stop()    # Stop simulation

Component Metadata for Palettes

# Build component palette from metadata
registry = pulsim.ComponentRegistry.instance()

for category in registry.all_categories():
    print(f"[{category}]")
    for comp_type in registry.types_in_category(category):
        meta = registry.get(comp_type)
        print(f"  - {meta.display_name}")
        for param in meta.parameters:
            print(f"      {param.display_name} [{param.unit}]")

Schematic Position Storage

# Store component positions for layout persistence
circuit.set_position("R1", pulsim.SchematicPosition(x=100, y=50, orientation=90))

# Export circuit with positions
json_str = pulsim.circuit_to_json(circuit, include_positions=True)

# Import circuit (positions preserved)
loaded = pulsim.parse_netlist_string(json_str)
pos = loaded.get_position("R1")  # Returns the saved position

See examples/gui_integration_example.py for more examples.

Roadmap

  • MVP-0: Basic kernel (R, L, C, sources, transient)
  • MVP-1: Power electronics (switches, events, losses)
  • MVP-2: Advanced devices (MOSFETs, transformers)
  • MVP-2b: GUI integration API (validation, progress, metadata)
  • MVP-3: Performance (SUNDIALS, parallel)

License

MIT License

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-0.1.11.tar.gz (656.9 kB view details)

Uploaded Source

Built Distributions

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

pulsim-0.1.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (624.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pulsim-0.1.11-cp313-cp313-macosx_11_0_x86_64.whl (502.3 kB view details)

Uploaded CPython 3.13macOS 11.0+ x86-64

pulsim-0.1.11-cp313-cp313-macosx_11_0_arm64.whl (476.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pulsim-0.1.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (623.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pulsim-0.1.11-cp312-cp312-macosx_11_0_x86_64.whl (502.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ x86-64

pulsim-0.1.11-cp312-cp312-macosx_11_0_arm64.whl (476.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pulsim-0.1.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (624.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pulsim-0.1.11-cp311-cp311-macosx_11_0_x86_64.whl (496.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ x86-64

pulsim-0.1.11-cp311-cp311-macosx_11_0_arm64.whl (473.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pulsim-0.1.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (621.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pulsim-0.1.11-cp310-cp310-macosx_11_0_x86_64.whl (494.8 kB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

pulsim-0.1.11-cp310-cp310-macosx_11_0_arm64.whl (471.8 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: pulsim-0.1.11.tar.gz
  • Upload date:
  • Size: 656.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pulsim-0.1.11.tar.gz
Algorithm Hash digest
SHA256 f8ef9ba2fb2848cdb79aaea75faf5dc223ec6b5615c05139c851f6c9bffca4b0
MD5 ca2596f4eb24d4a9851df7494ec41870
BLAKE2b-256 e6996cdc67c1c02879b4ab56d2adef77712b39bc0ebdd1556700c0eed4bb39d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-0.1.11.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-0.1.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pulsim-0.1.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 952d0c50b30b664392301c3f72a4cc72cc7b2945ab3edae4aacb1317dd8b79e9
MD5 982c6ba8e1ca40c0b46aeba9475ca45c
BLAKE2b-256 327287ce2899506b70186dac3c68285e2676bb43775d09abc5002ce3115d26e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-0.1.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_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-0.1.11-cp313-cp313-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for pulsim-0.1.11-cp313-cp313-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 d77c504ef63f893b1cff0100a7c2f29801cf6a4b24c7ea9ba76731914eb85e47
MD5 201f1bb8a28a3ccba752e75d4ccf4bb6
BLAKE2b-256 030116bc84a16dd8ba72fb1166093c2b28865ca03cbe83be63669c44599e84d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-0.1.11-cp313-cp313-macosx_11_0_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-0.1.11-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pulsim-0.1.11-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c4783440fb78ee96703dee7c59a5a84feb3da842d5279329b8de7e91bd92f7bb
MD5 aee67dd7a2241a3575c37cb054492b3c
BLAKE2b-256 23946510c52cda354169bab5dea68a25051f6fcc1c5fbe6cd52bea48db99c1b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-0.1.11-cp313-cp313-macosx_11_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-0.1.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pulsim-0.1.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0bf5017a98164f49237c26ad67b744adf1036a3701593748729890c8952dd15b
MD5 b27867695673199a76ff0af8c9dfe22c
BLAKE2b-256 4102335f25e68fa30690f9822ec00c9ae87fd077f95df743b336f631de8282d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-0.1.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_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-0.1.11-cp312-cp312-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for pulsim-0.1.11-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 bec92ac48745da82f6189150390d2b070fa5f64e6d1654b4949bbe576ea74965
MD5 db9141ae31801d702e0cc1845aed1b6b
BLAKE2b-256 00a6c4718bc9a1c77afb6e2ee8f9a790a6eb6d281f4da9898789506476358610

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-0.1.11-cp312-cp312-macosx_11_0_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-0.1.11-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pulsim-0.1.11-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cb26f68c01c4b829351a6ee0e7467c6fb23e680b0c3256bc58e3e4beb3e1ea7c
MD5 8467fa8cd7bd088d064b1cb5eca7c0f2
BLAKE2b-256 1081c74da229bf32798a3f90ac70bea83ccf7f986c8f89dedcad47bf52cdcf54

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-0.1.11-cp312-cp312-macosx_11_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-0.1.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pulsim-0.1.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2d9bd6f487bc9b56177087c3320d6ddf3f3b6a884265857a96d3d5151f511ec5
MD5 22a95c32217b00e46d79b90114535309
BLAKE2b-256 2c7ef8c012131ecc0c844750d8c3cf991f21a06d8e843de9ef25f61f927c1f39

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-0.1.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_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-0.1.11-cp311-cp311-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for pulsim-0.1.11-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 a3fc02d39ad5dd62065205b675352b314dd02e36637b08e36d884c8f28a9dc8b
MD5 4487ced1f2c70ef5a5a8b0a310bc2904
BLAKE2b-256 2b15cabbfe9f7111ebdc78e06c468e2176bda6f818c1b6f1559a4cc58d805e36

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-0.1.11-cp311-cp311-macosx_11_0_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-0.1.11-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pulsim-0.1.11-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 da064c3b4e3e924123fbdfe1e0dc89247c7040bd45f87dc7c729615e00739c8d
MD5 36d3ab1404ae7900bc2e1d9280807e21
BLAKE2b-256 318479f5817417eb6412d2a6de23c7a31e0df6828115886d55dd5737ea5d57a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-0.1.11-cp311-cp311-macosx_11_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-0.1.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pulsim-0.1.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d9eaa7958706da33cd43db68e5b78934e66f6c8f8839a7e8078be34eb4514e27
MD5 03f20bcf6210453ea283e520e9a79e57
BLAKE2b-256 ca85a1d09269a725d4b109922fa875bb8f9a8caf3097d3a921bda79b3a244c76

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-0.1.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_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-0.1.11-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for pulsim-0.1.11-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 4a818bc7d7911cdc5ed9e38948d98b88d97ca5016d77908962bdc81512711f83
MD5 d5fb6eb962b79dcbf18063b8852e6310
BLAKE2b-256 c700d5e0efa8666391483c10d3b538d7b164cd34470c7d9196f96e32dcea9bbe

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-0.1.11-cp310-cp310-macosx_11_0_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-0.1.11-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pulsim-0.1.11-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8a14f9ad3fb52a160f04e780cef3ef85a4eda690ac2dec987563c12d60d55577
MD5 362efa31e5dc223e0056007dee44b807
BLAKE2b-256 a1be64b5fe7d4f6e1f8d133f6d3e9b1acd754748c82a67703596bdb106de62bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsim-0.1.11-cp310-cp310-macosx_11_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