Skip to main content

pySimBlocks

PyPI version Python License Documentation


A deterministic block-diagram simulation framework for discrete-time modeling, co-simulation and research prototyping in Python.

pySimBlocks allows you to build, configure, and execute discrete-time systems using either:

  • A pure Python API
  • A graphical editor (PySide6)
  • YAML project configuration with exportable Python runner (run.py)
  • Optional SOFA and hardware integration

pySimBlocks graphical editor

Installation

pip install pySimBlocks

Full documentation — user guide, tutorials, and API reference — is available on Read the Docs.

Getting Started

Quick Example

The following example models a simple first-order low-pass filter, defined by the difference equation:

$$ y[k] = \alpha x[k] + (1-\alpha) y[k-1] $$

It can be implemented in pySimBlocks using the following code:

from pySimBlocks import Model, Simulator, SimulationConfig, PlotConfig
from pySimBlocks.blocks.operators import Gain, Sum, Delay
from pySimBlocks.blocks.sources import WhiteNoise
from pySimBlocks.project.plot_from_config import plot_from_config

# 1. Create the blocks
noise = WhiteNoise(name="noise", std=1.0)
delay = Delay(name="delay")
filtered = Sum("filtered", signs="++")
alpha_gain = Gain(name="alpha", gain=0.1)
complement = Gain(name="complement", gain=0.9)

# 2. Build the model
model = Model("Example")
for block in [noise, delay, filtered, alpha_gain, complement]:
    model.add_block(block)

model.connect("noise", "out", "alpha", "in")
model.connect("delay", "out", "complement", "in")
model.connect("alpha", "out", "filtered", "in1")
model.connect("complement", "out", "filtered", "in2")
model.connect("filtered", "out", "delay", "in")

# 3. Simulate the model
sim_cfg = SimulationConfig(dt=0.05, T=30.)
sim = Simulator(model, sim_cfg)
logs = sim.run(logging=["noise.outputs.out", "filtered.outputs.out"])

# 4. Plot the results
plot_cfg = PlotConfig([
    {"title": "Noisy signal vs Filtered",
     "signals": ["noise.outputs.out", "filtered.outputs.out"],},
    ])
plot_from_config(logs, plot_cfg)

The resulting plot should look like this:

Noise filtered

See examples/quick_start/filter.py to run the example yourself.

Graphical Editor

The exact same model can be constructed visually using the graphical editor (as shown in the image above of this README).

To open the graphical editor, run:

pysimblocks gui examples/quick_start/gui

The quick-start GUI project is stored in a single examples/quick_start/gui/project.yaml file.

Learning Resources

Tutorials

Three step-by-step tutorials are available in the documentation:

Tutorial Description
1 Python API Build a closed-loop PI control system in pure Python
2 GUI Build the same system visually with the graphical editor
3 SOFA Replace the plant with a SOFA physics simulation

Other Examples

A collection of basic and advanced examples is available in the examples directory, including:

  • Control system demonstrations
  • SOFA-based simulations (tested with SOFA v26.06 and later.)
  • Hardware and real-time use cases
  • Comparisons with external tools

See examples/README.md for an overview.

Information

License

pySimBlocks is licensed under LGPL-3.0-or-later.


© 2026 Université de Lille & INRIA – Licensed under LGPL-3.0-or-later

Metadata

Release files for pySimBlocks 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pySimBlocks 0.2.0
File Size Uploaded Provenance Actions
pysimblocks-0.2.0.tar.gz 241.3 kB Without provenance Details for pysimblocks-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pySimBlocks 0.2.0
File Interpreter ABI Platform Actions
pysimblocks-0.2.0-py3-none-any.whl Python 3 none any Details for pysimblocks-0.2.0-py3-none-any.whl

Total release size: 649.9 kB

Release files / pysimblocks-0.2.0.tar.gz

Download URL pysimblocks-0.2.0.tar.gz
Size 241.3 kB
Tags Source
SHA-256 checksum
How to use checksums
23bf0d243ab3bd290cda8e255ce1fa2d5863b5c566fb0b6fd6aa95ca0713bb53
BLAKE2b-256 checksum
How to use checksums
4e6249da42515096127cc81a0a7b6b1d6a4991c7941b89385ede9d23942e1b17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

Release files / pysimblocks-0.2.0-py3-none-any.whl

Download URL pysimblocks-0.2.0-py3-none-any.whl
Size 408.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bcda7212f809bec7c8ae193c11888b66d5aacd061cb89ece49cc8f3672116277
BLAKE2b-256 checksum
How to use checksums
d0c29b7137262d65667138f7201cb9fb3359c122f0bbc4a15ce26b63a493778d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

Security for pySimBlocks 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page