BDSim: Block Diagram Simulation for Python
|
# define the blocks
demand = bd.STEP(T=1, name='demand')
sum = bd.SUM('+-')
gain = bd.GAIN(10)
plant = bd.LTI_SISO(0.5, [2, 1])
scope = bd.SCOPE(styles=['k', 'r--'])
# connect the blocks
bd.connect(demand, sum[0], scope[1])
bd.connect(plant, sum[1])
bd.connect(sum, gain)
bd.connect(gain, plant)
bd.connect(plant, scope[0])
|
Forget the frustration of dragging boxes and managing rigid GUIs. bdsim allows you to harness the full expressiveness of Python to build, simulate, and analyze dynamic systems. Unlike traditional tools like Simulink® or LabView®, we use a “code-first” approach where the system is represented through native Python class and method calls.
This architecture means your “wires” are no longer limited to simple numeric signals. In
bdsim, wires can communicate any Python type—including scalars, strings, lists,
dictionaries, NumPy arrays, custom objects, and even functions—enabling a level of
architectural flexibility and complexity that is difficult to achieve in graphical
environments.
Code documentation:
- Overview
- Installing bdsim
- Notebooks & examples
- Block library
- Simulation-user API
- Developer API
BDSimBDSim.DEBUG()BDSim.__init__()BDSim.block_libraryBDSim.blockdiagram()BDSim.blockinfo()BDSim.blocks()BDSim.closefigs()BDSim.done()BDSim.fatal()BDSim.load_blocks()BDSim.report()BDSim.run()BDSim.savefig()BDSim.savefigs()BDSim.set_globals()BDSim.set_options()BDSim.showgraph()BDSim.submit()BDSim.update_parameters()
BDStructBlockDiagram- Wire
- Plug
- Blocks