LCG_experiment.py 799 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/python3
  2. # This file was automatically generated from drawio2cbd with the command:
  3. # /home/red/git/DrawioConvert/__main__.py LCG.xml -av -F CBD -e LCG -t 30
  4. # from CBD.lib.plotting import SignalPlotBlock
  5. from CBD.simulator import Simulator
  6. from LCG import *
  7. import matplotlib.pyplot as plt
  8. from CBD.realtime.plotting import PlotManager, ScatterPlot, follow
  9. fig = plt.figure(figsize=(15, 5), dpi=100)
  10. ax = fig.add_subplot(1, 1, 1)
  11. cbd = LCG("LCG")
  12. manager = PlotManager()
  13. manager.register("lcg", cbd.findBlock('collector')[0], (fig, ax), ScatterPlot())
  14. manager.connect('lcg', 'update', lambda d, axis=ax: axis.set_xlim(follow(d[0], 10.0, lower_bound=0.0)))
  15. # Run the Simulation
  16. sim = Simulator(cbd)
  17. sim.setRealTime()
  18. sim.setProgressBar()
  19. sim.run(30.0)
  20. while sim.is_running(): pass