Metadata-Version: 2.4
Name: bdsim
Version: 1.2.1
Summary: Simulate dynamic systems expressed in block diagram form using Python
Project-URL: homepage, https://github.com/petercorke/bdsim
Project-URL: documentation, https://petercorke.github.io/bdsim/
Project-URL: repository, https://github.com/petercorke/bdsim
Author-email: Peter Corke <rvc@petercorke.com>
License: MIT License
        
        Copyright (c) 2020 Peter Corke
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: block diagram,dynamic simulation,python
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.7
Requires-Dist: ansitable
Requires-Dist: matplotlib
Requires-Dist: numpy>=1.17.4
Requires-Dist: progress
Requires-Dist: scipy
Requires-Dist: spatialmath-python
Provides-Extra: all
Requires-Dist: ipympl; extra == 'all'
Requires-Dist: ipywidgets; extra == 'all'
Requires-Dist: pillow; extra == 'all'
Requires-Dist: pyside6; extra == 'all'
Provides-Extra: bdedit
Requires-Dist: pillow; extra == 'bdedit'
Requires-Dist: pyside6; extra == 'bdedit'
Provides-Extra: bdweb
Requires-Dist: fastapi>=0.111; extra == 'bdweb'
Requires-Dist: uvicorn[standard]>=0.29; extra == 'bdweb'
Provides-Extra: dev
Requires-Dist: coverage; extra == 'dev'
Requires-Dist: flake8; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-qt; extra == 'dev'
Requires-Dist: pytest-timeout; extra == 'dev'
Requires-Dist: pytest-xvfb; extra == 'dev'
Requires-Dist: sympy; extra == 'dev'
Provides-Extra: docs
Requires-Dist: sphinx; extra == 'docs'
Requires-Dist: sphinx-autodoc-typehints; extra == 'docs'
Requires-Dist: sphinx-favicon; extra == 'docs'
Requires-Dist: sphinx-rtd-theme; extra == 'docs'
Requires-Dist: sphinxcontrib-jquery; extra == 'docs'
Provides-Extra: jupyter
Requires-Dist: ipympl; extra == 'jupyter'
Requires-Dist: ipywidgets; extra == 'jupyter'
Description-Content-Type: text/markdown

# bdsim: Block Diagram Simulation for Python


<div align="center">
  <img src="https://raw.githubusercontent.com/petercorke/bdsim/master/figs/BDSimLogo_NoBackgnd@2x.png" width="500" alt="bdsim logo">
  <br>
  <strong>A Pythonic block-diagram environment for the simulation and analysis of dynamic systems.</strong>
  <br><br>


[![JupyterLite](https://img.shields.io/badge/Try_it_Now-JupyterLite-orange?style=for-the-badge&logo=jupyter)](https://petercorke.github.io/bdsim/lite/lab?path=index.ipynb)
  [![PyPI version](https://img.shields.io/pypi/v/machinevision-toolbox-python?style=for-the-badge&color=blue)](https://pypi.org/project/bdsim/)
  [![Documentation](https://img.shields.io/badge/Docs-View_Online-blue?style=for-the-badge)](https://petercorke.github.io/bdsim/)

  <p>
    <a href="https://github.com/petercorke/bdsim">GitHub</a> •
    <a href="https://github.com/petercorke/bdsim/wiki">Wiki</a> •
    <a href="https://github.com/petercorke/bdsim/blob/main/CHANGELOG.md">Changelog</a> •
    <a href="https://petercorke.github.io/bdsim/installation.html">Installation</a>
  </p>
</div>


---
### Status & Ecosystem
[![A Python Robotics Package](https://raw.githubusercontent.com/petercorke/robotics-toolbox-python/master/.github/svg/py_collection.min.svg)](https://github.com/petercorke/robotics-toolbox-python)
[![QUT Centre for Robotics Open Source](https://github.com/qcr/qcr.github.io/raw/master/misc/badge.svg)](https://qcr.github.io)
[![Build Status](https://github.com/petercorke/bdsim/actions/workflows/ci.yml/badge.svg)](https://github.com/petercorke/bdsim/actions/workflows/ci.yml)
[![Coverage](https://codecov.io/gh/petercorke/bdsim/branch/main/graph/badge.svg)](https://codecov.io/gh/petercorke/bdsim)
![Python Version](https://img.shields.io/pypi/pyversions/bdsim.svg)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![PyPI - Downloads](https://img.shields.io/pypi/dw/bdsim)](https://pypistats.org/packages/bdsim)

### Powered by
[![Powered by NumPy](https://img.shields.io/badge/powered_by-NumPy-013243?logo=numpy&logoColor=white)](https://numpy.org)
[![Powered by Spatial Maths](https://raw.githubusercontent.com/petercorke/spatialmath-python/master/.github/svg/sm_powered.min.svg)](https://github.com/petercorke/spatialmath-python)

## Synopsis

**bdsim** bridges the gap between mathematical block diagrams and executable Python code. Unlike traditional graphical-only tools, it treats modelling as code, allowing you to define, simulate, and analyze continuous-time, discrete-time, or hybrid systems within a modern software engineering workflow. Wires in bdsim aren't limited to scalars; they pass NumPy arrays, dictionaries, or even SpatialMath objects seamlessly through your system, integrating directly with the Robotics and Machine Vision toolboxes.

## 🚀 Key Features

* **Python-First Workflow**: Define your systems in pure Python code. Use your preferred IDE (like VS Code), manage versions with Git, and integrate with standard unit-testing frameworks.
* **Rich Data Types**: Wires in `bdsim` aren't limited to scalars. Seamlessly pass NumPy arrays, dictionaries, or complex objects like `SE3` and `SO3` from the `spatialmath-python` library.
* **Modular & Extensible**: Adding new functionality is straightforward. Create custom blocks by simply subclassing the `Block` class.
* **Hybrid Ecosystem**: Native integration with the **Robotics Toolbox** and **Machine Vision Toolbox** for Python.
* **Powerful Editor**: Includes `bdedit`, a PySide-based graphical editor for visual system design and discovery.
* **Publication Ready**: Export diagrams or simulation data to to high-quality formats such as PDF or SVG for use in publications.

## 💻  Quick start

You can install `bdsim` directly from PyPI:

```bash
pip install bdsim
To include the graphical editor (bdedit) and its dependencies:

Bash
pip install bdsim[editor]
```

Install locally with help from the [detailed installation guide](https://petercorke.github.io/bdsim/installation.html).

Or skip setup and run the [browser-based JupyterLite examples](https://petercorke.github.io/bdsim/lite/lab/index.html?path=index.ipynb).

## Example

The power of bdsim lies in its conciseness. The step response of a simple first-order system can be defined and simulated in just a few lines of code:

```python
Python
import bdsim

sim = bdsim.BDSim()
bd = sim.blockdiagram()

# Define blocks
step = bd.STEP(T=1, pos=1)
plant = bd.LTI_SISO(1, [1, 1]) # 1/(s+1)
scope = bd.SCOPE()

# Connect blocks
bd.connect(step, plant)
bd.connect(plant, scope)

bd.compile()
out = sim.run(bd, T=5)
```

## 🔍 Why bdsim?

In contrast to traditional graphical simulation tools, bdsim treats modelling as code. This ensures:

* Better Version Control: No more opaque binary blobs. Your models are searchable, diffable text.

* Seamless Integration: Incorporate SciPy solvers, PyTorch models, or custom computer vision pipelines directly into your simulation loops.

* Scalability: Programmatically generate massive block diagrams or run large-scale batch simulations on headless servers.

## 📚 Documentation
Full Documentation: https://petercorke.github.io/bdsim/

Wiki: Access the community wiki for deep dives into specific block behaviours and tutorials.