
# This file was automatically generated from drawio2cbd with the command:
#   C:\Users\randy\Documents\git\DrawioConvert\__main__.py -F CBD .\myCBD.drawio -e myCBD

from myCBD import *
from pyCBD.realtime.plotting import PlotManager, LinePlot, follow
from pyCBD.simulator import Simulator
import matplotlib.pyplot as plt

fig = plt.figure(figsize=(8, 5), dpi=100)
ax = fig.add_subplot(111)
ax.set_ylim((-1.1, 1.1))

cbd = myCBD("myCBD")

manager = PlotManager()
manager.register("signal", cbd.find('signal')[0], (fig, ax), LinePlot(color='red'))
manager.connect('signal', 'update', lambda d, axis=ax: axis.set_xlim(follow(d[0], 15.0, lower_bound=0.0, perc_keep=0.75)))

# Run the Simulation
sim = Simulator(cbd)
sim.setRealTime()
sim.setDeltaT(0.05)
sim.run(150)

plt.show()
