{"id":17322051,"url":"https://github.com/petercorke/bdsim","last_synced_at":"2025-04-05T05:03:37.428Z","repository":{"id":37434290,"uuid":"266439104","full_name":"petercorke/bdsim","owner":"petercorke","description":"Simulate dynamic systems expressed in block diagram form using Python","archived":false,"fork":false,"pushed_at":"2024-08-06T21:23:51.000Z","size":28495,"stargazers_count":197,"open_issues_count":8,"forks_count":33,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-28T17:24:36.481Z","etag":null,"topics":["block-diagram","diagram-form","dynamical-systems","dynamics-simulation","numpy","python","robotics","simulation"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/petercorke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-23T23:52:35.000Z","updated_at":"2025-03-28T11:44:11.000Z","dependencies_parsed_at":"2023-02-13T18:31:32.125Z","dependency_job_id":"76395a66-84e0-45f6-9ce5-6586e3ae94d3","html_url":"https://github.com/petercorke/bdsim","commit_stats":{"total_commits":652,"total_committers":5,"mean_commits":130.4,"dds":0.09355828220858897,"last_synced_commit":"b69c2c67c4a5df327e62ca9c7c2081611060b661"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petercorke%2Fbdsim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petercorke%2Fbdsim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petercorke%2Fbdsim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petercorke%2Fbdsim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/petercorke","download_url":"https://codeload.github.com/petercorke/bdsim/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247289409,"owners_count":20914464,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["block-diagram","diagram-form","dynamical-systems","dynamics-simulation","numpy","python","robotics","simulation"],"created_at":"2024-10-15T13:40:49.047Z","updated_at":"2025-04-05T05:03:37.408Z","avatar_url":"https://github.com/petercorke.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![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)\n[![QUT Centre for Robotics Open Source](https://github.com/qcr/qcr.github.io/raw/master/misc/badge.svg)](https://qcr.github.io)\n\n[![PyPI version](https://badge.fury.io/py/bdsim.svg)](https://badge.fury.io/py/bdsim)\n![Python Version](https://img.shields.io/pypi/pyversions/bdsim.svg)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n[![Build Status](https://github.com/petercorke/bdsim/workflows/build/badge.svg?branch=master)](https://github.com/petercorke/bdsim/actions?query=workflow%3Abuild)\n[![Coverage](https://codecov.io/gh/petercorke/bdsim/branch/master/graph/badge.svg)](https://codecov.io/gh/petercorke/bdsim)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/bdsim)](https://pypistats.org/packages/bdsim)\n[![GitHub stars](https://img.shields.io/github/stars/petercorke/bdsim.svg?style=social\u0026label=Star)](https://GitHub.com/petercorke/bdsim/stargazers/)\n\n\u003ctable style=\"border:0px\"\u003e\n\u003ctr style=\"border:0px\"\u003e\n\u003ctd style=\"border:0px\"\u003e\n\u003cimg src=\"https://github.com/petercorke/bdsim/raw/master/figs/BDSimLogo_NoBackgnd@2x.png\" width=\"300\"\u003e\u003c/td\u003e\n\u003ctd style=\"border:0px\"\u003e\nA Python block diagram simulation package\u003c/a\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/petercorke/bdsim\"\u003eGitHub repository \u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://petercorke.github.io/bdsim\"\u003eDocumentation\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/petercorke/bdsim/wiki\"\u003eWiki (examples and details)\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"installation#\"\u003eInstallation\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003eDependencies: numpy, scipy, matplotlib, \u003ca href=\"https://github.com/petercorke/ansitable\"\u003eansitable\u003c/a\u003e, ffmpeg (if rendering animations as a movie)\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n`bdsim` is Python 3 package that enables modelling and simulation of continuous-time, discrete-time or hybrid dynamic systems.  Systems are conceptualized in block diagram form, but represented in terms of Python objects. \n\n  \u003ctable\u003e\n  \u003ctr\u003e\n  \u003ctd\u003e\n  \u003cimg width=450 src=\"https://github.com/petercorke/bdsim/raw/master/figs/bd1-sketch.png\"\u003e\n  \u003c/td\u003e\n  \u003ctd style=\"padding-left: 20px;\"\u003e\n  \u003cpre style=\"font-size:10px;\"\u003e\n  # define the blocks\n  demand = bd.STEP(T=1, name='demand')\n  sum = bd.SUM('+-')\n  gain = bd.GAIN(10)\n  plant = bd.LTI_SISO(0.5, [2, 1])\n  scope = bd.SCOPE(styles=['k', 'r--'])\n  # connect the blocks\n  bd.connect(demand, sum[0], scope[1])\n  bd.connect(plant, sum[1])\n  bd.connect(sum, gain)\n  bd.connect(gain, plant)\n  bd.connect(plant, scope[0])\n  \u003c/pre\u003e\n  \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003c/table\u003e\n\nKey features include:\n\n* The block diagram can be created easily using Python code, rather than drawing boxes and wires. This enables use of your favourite IDE, standard version control tools and development workflows.\n* Wires can communicate *any* Python type such as scalars, lists, dicts, NumPy arrays, objects, and functions. For robotics and vision applications using the [Spatial Maths Toolbox for Python](https://github.com/petercorke/spatialmath-python) wires could send values such as `SE3`, `UnitQuaternion` or `Twist3` objects.\n* Over 70 blocks for linear, nonlinear functions, display blocks, as well as continuous- and discrete-time dynamics\n  * Easy to add your own block, it's simply a class\n  * Subsystems are supported, and a subsystem can be independently instantiated multiple times in a system.  Subsystems can also be nested.\n  * Blocks from other toolboxes are automatically discovered and included. There are blocks for some functions in the  [Robotics Toolbox for Python](https://github.com/petercorke/robotics-toolbox-python) (such as arm, ground and aerial robots) and [Machine Vision Toolbox for Python](https://github.com/petercorke/machinevision-toolbox-python) (such as cameras). These are defined in the `blocks` folder of those toolboxes.\n* The diagram can be executed in a headless configuration, particularly useful on an embedded computer like a RaspberryPi.\n* A [python-based graphical editor](bdedit-the-graphical-editing-tool)\n  * allows graphical creation of block diagrams\n  * the diagram is stored in a human readable/editable JSON file with extension `.bd`\n  * creates good-quality graphics for inclusion in publications\n  * can launch `bdsim` to import and execute the model\n  * automatically discovers all bsdim and toolbbox blocks and adds them to the block library menu\n  * icons can be easily created using any image creation tool or a LaTeX expression \n\n# Getting started\n\nWe first sketch the dynamic system we want to simulate as a block diagram, for example this simple first-order system\n\n![block diagram](https://github.com/petercorke/bdsim/raw/master/figs/bd1-sketch.png)\n\nwhich we can express concisely with `bdsim` as (see [`bdsim/examples/eg1.py`](https://github.com/petercorke/bdsim/blob/master/examples/eg1.py))\n\n```python\n     1  #!/usr/bin/env python3\n     2  import bdsim\t\n     4  sim = bdsim.BDSim()  # create simulator\n     5  bd = sim.blockdiagram()  # create an empty block diagram\n     6\t\n     7\t# define the blocks\n     8\tdemand = bd.STEP(T=1, name='demand')\n     9\tsum = bd.SUM('+-')\n    10\tgain = bd.GAIN(10)\n    11\tplant = bd.LTI_SISO(0.5, [2, 1], name='plant')\n    12\tscope = bd.SCOPE(styles=['k', 'r--'])\n    13\t\n    14\t# connect the blocks\n    15\tbd.connect(demand, sum[0], scope[1])\n    17\tbd.connect(sum, gain)\n    18\tbd.connect(gain, plant)\n    19\tbd.connect(plant, sum[1], scope[0])\n    20\t\n    21\tbd.compile()          # check the diagram\n    22\n    23\tsim.report(bd)   # list the system\n    24  out = sim.run(bd, 5)   # simulate for 5s\n```\nwhich is just 15 lines of executable code.\n\nThe red block annotations on the hand-drawn diagram are used as the names of the variables holding references to the block instance. The blocks can also have user-assigned names, see lines 8 and 11, which are used in diagnostics and as labels in plots.\n\nAfter the blocks are created their input and output ports need to be connected. In `bdsim` all wires are point to point, a *one-to-many* connection is implemented by *many* wires,\nfor example\n```\nbd.connect(source, dest1, dest2, ...)\n```\ncreates individual wires from `source` -\u003e `dest1`, `source` -\u003e `dest2` and so on.\nPorts are designated using Python indexing notation, for example `block[2]` is port 2 (the third port) of `block`.  Whether it is an input or output port depends on context.\nIn the example above an index on the first argument refers to an output port, while on the second (or subsequent) arguments it refers to an input port.  If a block has only a single input or output port then no index is required, 0 is assumed.\n\nA group of ports can be denoted using slice notation, for example \n```\nbd.connect(source[2:5], dest[3:6)\n```\nwill connect `source[2]` -\u003e `dest[3]`, `source[3]` -\u003e `dest[4]`, `source[4]` -\u003e `dest[5]`.\nThe number of wires in each slice must be consistent.  You could even do a cross over by connecting `source[2:5]` to `dest[6:3:-1]`.\n\nLine 21 assembles all the blocks and wires, instantiates subsystems, checks connectivity to create a flat wire list, and then builds the dataflow execution plan.\n\nLine 23 generates a report, in tabular form, showing a summary of the block diagram:\n\n```\n┌────────┬──────────┬────────┬────────┬─────────────┐\n│ block  │   type   │ inport │ source │ source type │\n├────────┼──────────┼────────┼────────┼─────────────┤\n│demand@ │ step     │        │        │             │\n├────────┼──────────┼────────┼────────┼─────────────┤\n│gain.0  │ gain     │ 0      │ sum.0  │ float64     │\n├────────┼──────────┼────────┼────────┼─────────────┤\n│plant   │ lti_siso │ 0      │ gain.0 │ float64     │\n├────────┼──────────┼────────┼────────┼─────────────┤\n│scope.0 │ scope    │ 0      │ plant  │ float64     │\n│        │          │ 1      │ demand │ int         │\n├────────┼──────────┼────────┼────────┼─────────────┤\n│sum.0   │ sum      │ 0      │ demand │ int         │\n│        │          │ 1      │ plant  │ float64     │\n└────────┴──────────┴────────┴────────┴─────────────┘\n```\n\nLine 24 runs the simulation for 5 seconds \nusing the default variable-step RK45 solver and saves output values at least every 0.05s.  It\ncauses the following output\n\n```\n\u003e\u003e\u003e Start simulation: T = 5.00, dt = 0.050\n  Continuous state variables: 1\n     x0 =  [0.]\n  Discrete state variables:   0\n\nno graphics backend specified: Qt5Agg found, using instead of MacOSX\n\nbdsim ◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉ 100.0% - 0s\n\n\u003c\u003c\u003c Simulation complete\n  block diagram evaluations: 784\n  block diagram exec time:   0.075 ms\n  time steps:                123\n  integration intervals:     2\n```\n\nThis provides a summary of the number of states for the complete system: the number of continuous states, the number\nof discrete states, and the initial value of the state vectors.\n\nDuring execution a progress bar is updated and scope blocks pops up a graphical window\n\n![bdsim output](https://github.com/petercorke/bdsim/raw/master/figs/Figure_1.png)\n\nThe simulation results are in a container object (`BDStruct`)\n```\n\u003e\u003e\u003e out\nt      = ndarray:float64 (123,)\nx      = ndarray:float64 (123, 1)\nxnames = ['plantx0'] (list)\nynames = [] (list)            \n```\nwhich contains an array of time values, an array of state values, and a list of the\nnames of the state variables.\n\nBy default the `.run()` method at line 24 blocks blocks the script until all figure\nwindows are closed (by pressing the operating system close button or typing \"q\"), or the\nscript is killed with SIGINT. If you want to continue the script with the figures still\nactive then the `hold=False` option should be set.\n\nIf we wished to also record additional outputs, we can add them as _watched_ signals\n```\nout = sim.run(bd, watch=[demand, sum])  # simulate for 5s\n```\nand now the output is\n```\n\u003e\u003e\u003e out\nt      = ndarray:float64 (123,)\nx      = ndarray:float64 (123, 1)\nxnames = ['plantx0'] (list)\ny0     = ndarray:float64 (123,)\ny1     = ndarray:int64 (123,)\nynames = ['plant[0]', 'demand[0]'] (list)\n```\nwhere\n\n- `t` the time vector: ndarray, shape=(M,)\n- `x` is the state vector: ndarray, shape=(M,N), one row per timestep\n- `xnames` is a list of the names of the states corresponding to columns of `x`, eg. \"plant.x0\"\n\nThe `watch` argument is a list of outputs to log, in this case `plant` defaults\nto output port 0.  This information is saved in additional variables `y0`, `y1`\netc.  `ynames` is a list of the names of the watched variables.\n\nAn alternative system report, created by `sim.report(bd, type=\"lists\")` is more detailed\n```\nBlocks::\n\n┌───┬─────────┬─────┬──────┬────────┬─────────┬───────┐\n│id │    name │ nin │ nout │ nstate │ ndstate │ type  │\n├───┼─────────┼─────┼──────┼────────┼─────────┼───────┤\n│ 0 │  demand │   0 │    1 │      0 │       0 │ step  │\n│ 1 │   sum.0 │   2 │    1 │      0 │       0 │ sum   │\n│ 2 │  gain.0 │   1 │    1 │      0 │       0 │ gain  │\n│ 3 │   plant │   1 │    1 │      1 │       0 │ LTI   │\n│ 4 │ scope.0 │   2 │    0 │      0 │       0 │ scope │\n└───┴─────────┴─────┴──────┴────────┴─────────┴───────┘\n\nWires::\n\n┌───┬──────┬──────┬──────────────────────────┬─────────┐\n│id │ from │  to  │       description        │  type   │\n├───┼──────┼──────┼──────────────────────────┼─────────┤\n│ 0 │ 0[0] │ 1[0] │ demand[0] --\u003e sum.0[0]   │ int     │\n│ 1 │ 0[0] │ 4[1] │ demand[0] --\u003e scope.0[1] │ int     │\n│ 2 │ 3[0] │ 1[1] │ plant[0] --\u003e sum.0[1]    │ float64 │\n│ 3 │ 1[0] │ 2[0] │ sum.0[0] --\u003e gain.0[0]   │ float64 │\n│ 4 │ 2[0] │ 3[0] │ gain.0[0] --\u003e plant[0]   │ float64 │\n│ 5 │ 3[0] │ 4[0] │ plant[0] --\u003e scope.0[0]  │ float64 │\n└───┴──────┴──────┴──────────────────────────┴─────────┘\n```\nIn the first table we can see key information about each block, its `id` (used internally), name, the number of input and output ports, the number of\ncontinuous- and discrete-time states, and the type which is the block class.  Note that the name is auto-generated based on the type, except if it has\nbeen set explicitly as for the blocks `demand` and `plant`.\n\nThe second table shows all wires in point-to-point form, showing the start and end block and port (the block is represented here by its `id`) and the type of the object sent along the wire.\n\nTo save figures we need to make two modifications, changing line 4 to\n```\n     4  sim = bdsim.BDSim(hold=False)  # create simulator\n```\nwhich prevents `.run()` from blocking and then deleting all the figures.\nThen, after the `.run()` we add \n```\n     25 scope.savefig()  # save scope figure\n```\nIf the filename is not given it defaults to the block name, in this case `scope.0.pdf`.\n\n\nThe output can be pickled and written to a file\n\n```[shell]\nexamples/eg1.py -o\npython -mpickle bd.out\nt      = ndarray:float64 (123,)\nx      = ndarray:float64 (123, 1)\nxnames = ['plantx0'] (list)\ny0     = ndarray:float64 (123,)\ny1     = ndarray:int64 (123,)\nynames = ['plant[0]', 'demand[0]'] (list)\n```\n\nby default the results are written to `bd.out`, use the option `--out FILE` to set it\nto a specific value.\n\nThe block parameters can also be overridden from the command line without having to \nedit the code.  To increase the loop gain we could write:\n```[shell]\nexamples/eg1.py --set gain.0:K=20\n```\n\nMore details on this Wiki about:\n\n- [Adding blocks](https://github.com/petercorke/bdsim/wiki/Adding-blocks)\n- [Connecting blocks](https://github.com/petercorke/bdsim/wiki/Connecting-blocks)\n- [Running the simulation](https://github.com/petercorke/bdsim/wiki/Running)\n- [Command line options](https://github.com/petercorke/bdsim/wiki/Runtime-options)\n\n## Other examples\n\nIn the folder `bdsim/examples` you can find a few other runnable examples:\n\n- [`eg1.py`](https://github.com/petercorke/bdsim/blob/master/examples/eg1.py) the example given above\n- [`waveform.py`](https://github.com/petercorke/bdsim/blob/master/examples/waveform.py) two signal generators connected to two scopes\n\nExamples from Chapter four of _Robotics, Vision \u0026 Control 2e (2017)_:\n\n- [`rvc4_2.py`](https://github.com/petercorke/bdsim/blob/master/examples/rvc4_2.py) Fig 4.2 - a car-like vehicle with bicycle kinematics driven by a rectangular pulse steering signal\n- [`rvc4_4.py`](https://github.com/petercorke/bdsim/blob/master/examples/rvc4_4.py) Fig 4.4 - a car-like vehicle driving to a point\n\n![RVC Figure 4.4](https://github.com/petercorke/bdsim/raw/master/figs/rvc4_4.gif)\n\n- [`rvc4_6.py`](https://github.com/petercorke/bdsim/blob/master/examples/rvc4_6.py) Fig 4.6 - a car-like vehicle driving to/along a line\n\n![RVC Figure 4.6](https://github.com/petercorke/bdsim/raw/master/figs/rvc4_6.gif)\n\n- [`rvc4_8.py`](https://github.com/petercorke/bdsim/blob/master/examples/rvc4_8.py) Fig 4.8 - a car-like vehicle using pure-pursuit trajectory following\n\n![RVC Figure 4.6](https://github.com/petercorke/bdsim/raw/master/figs/rvc4_8.gif)\n\n- [`rvc4_11.py`](https://github.com/petercorke/bdsim/blob/master/examples/rvc4_11.py) Fig 4.11 a car-like vehicle driving to a pose\n\n![RVC Figure 4.11](https://github.com/petercorke/bdsim/raw/master/figs/rvc4_11.gif)\n\nFigs 4.8 (pure pursuit) and Fig 4.21 (quadrotor control) are yet to be done.\n\n# A more concise way\n\nWiring, and some simple arithmetic blocks like `GAIN`, `SUM` and `PROD` can be implicitly generated by overloaded Python operators.  This strikes a nice balance between block diagram coding and Pythonic programming.\n\n```\n     1  #!/usr/bin/env python3\n     2\n     3  import bdsim\n     4\n     5  sim = bdsim.BDSim()  # create simulator\n     6  bd = sim.blockdiagram()  # create an empty block diagram\n     7\n     8  # define the blocks\n     9  demand = bd.STEP(T=1, name='demand')\n    10  plant = bd.LTI_SISO(0.5, [2, 1], name='plant')\n    11  scope = bd.SCOPE(styles=['k', 'r--'], movie='eg1.mp4')\n    12\n    13  # connect the blocks using Python syntax\n    14  scope[0] = plant\n    15  scope[1] = demand\n    16  plant[0] = 10 * (demand - plant)\n    17\n    18  bd.compile()   # check the diagram\n    19  bd.report()    # list all blocks and wires\n    20\n    22  out = sim.run(bd, 5, watch=[plant,])  # simulate for 5s\n```\nThis requires fewer lines of code and the code is more readable. Importantly, it results in in *exactly the same* block diagram in terms of blocks and wires\n```\nWires::\n\n┌───┬──────┬──────┬──────────────────────────────┬─────────┐\n│id │ from │  to  │         description          │  type   │\n├───┼──────┼──────┼──────────────────────────────┼─────────┤\n│ 0 │ 1[0] │ 2[0] │ plant[0] --\u003e scope.0[0]      │ float64 │\n│ 1 │ 0[0] │ 2[1] │ demand[0] --\u003e scope.0[1]     │ int     │\n│ 2 │ 0[0] │ 3[0] │ demand[0] --\u003e _sum.0[0]      │ int     │\n│ 3 │ 1[0] │ 3[1] │ plant[0] --\u003e _sum.0[1]       │ float64 │\n│ 4 │ 3[0] │ 4[0] │ _sum.0[0] --\u003e _gain.0(10)[0] │ float64 │\n│ 5 │ 4[0] │ 1[0] │ _gain.0(10)[0] --\u003e plant[0]  │ float64 │\n└───┴──────┴──────┴──────────────────────────────┴─────────┘\n```\nThe implicitly created blocks have names prefixed with an underscore.\n\n# bdedit: the graphical editing tool\n\n![block diagram](https://github.com/petercorke/bdsim/raw/master/figs/eg1-bdedit.png)\n\n`bdedit` is a multi-platform PyQt5-based graphical tool to create, edit, render and execute block diagram models.\n\nFrom the examples folder\n```\n% bdedit eg1.bd\n```\nwill create a display like that shown above.  Pushing the run button, top left (triangle in circle) will spawn `bdrun` as a subprocess which will:\n\n* parse the JSON file\n* instantiate all blocks and wires\n* compile and run the diagram\n\n\u003ca href=\"https://www.youtube.com/watch?v=1qM5D0jekjc\"\u003e\u003cimg width=100 style=\"vertical-align:middle\" src=\"https://cdn.mos.cms.futurecdn.net/8gzcr6RpGStvZFA2qRt4v6-1920-80.jpg.webp\"\u003e \u003cspan style=\"\"\u003eScreencast showing bdedit usage.\u003c/span\u003e\u003c/a\u003e\n\n\n# Article\n\nI published [this article on LinkedIn](https://www.linkedin.com/pulse/journey-toward-open-source-block-diagram-simulation-peter-corke/?trackingId=wrJYinHUgAHDq63Nv65PnA%3D%3D), which describes the thought process behind bdsim.\n\n# Limitations\n\nThere are lots!  The biggest is that `bdsim` is based on a very standard variable-step integrator from the scipy library.  For discontinuous inputs (step, square wave, triangle wave, piecewise constant) the transitions get missed.  This also makes it inaccurate to simulate hybrid discrete-continuous time systems.  We really need a better integrator, perhaps [`odedc`](https://help.scilab.org/docs/6.1.0/en_US/odedc.html) from SciLab could be integrated.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetercorke%2Fbdsim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpetercorke%2Fbdsim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetercorke%2Fbdsim/lists"}