Skip to main content

A block-diagram simulation environment with PySide6 editor

Project description

pySimBlocks

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
  • Optional SOFA and hardware integration

pySimBlocks graphical editor

Features

  • Block-based modeling (Simulink-like)
  • Deterministic discrete-time simulation engine
  • PySide6 graphical editor
  • YAML-based project serialization
  • Exportable Python runner (run.py)
  • Extensible block architecture

Installation

From GitHub

Install directly from GitHub using pip:

pip install git+https://github.com/AlessandriniAntoine/pySimBlocks

Locally

Clone the repository and install locally:

git clone https://github.com/AlessandriniAntoine/pySimBlocks.git
cd pySimBlocks
pip install .

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 detailed in the guide:

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 v24.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

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

pysimblocks-0.1.0.tar.gz (181.3 kB view details)

Uploaded Source

Built Distribution

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

pysimblocks-0.1.0-py3-none-any.whl (358.4 kB view details)

Uploaded Python 3

File details

Details for the file pysimblocks-0.1.0.tar.gz.

File metadata

  • Download URL: pysimblocks-0.1.0.tar.gz
  • Upload date:
  • Size: 181.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for pysimblocks-0.1.0.tar.gz
Algorithm Hash digest
SHA256 239081cb9bd216e5c067311d8c13655e8007518381482ab2c1a8944a98f939bd
MD5 2bbf4a6a45c55c8b67936317beae1d08
BLAKE2b-256 aceac4394995602354b8f699e080d55c187ba9f60c7c1b727c7a757dd8cbf5d2

See more details on using hashes here.

File details

Details for the file pysimblocks-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pysimblocks-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 358.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for pysimblocks-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 93572c966802b8b3661914778e4bcbf676613b4426c6e74b6938a8484dbf706b
MD5 0f9b700b9e85b5b5bad05a51c98c634b
BLAKE2b-256 d9e93ff8add88dc6938c01b1dee76857ab769c47781ba4069e3fcb58fc31614b

See more details on using hashes here.

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