Block diagrams 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])

This Python package enables modelling and simulation of dynamic systems conceptualized in block diagram form, but represented in terms of Python class and method calls.

Unlike Simulink® or LabView®, we write Python code rather than drawing boxes and wires. Wires can communicate any Python type such as scalars, strings, lists, dictionaries, numpy arrays, other objects, and even functions.