EvenNumberGen_experiment.py 832 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/python3
  2. # This file was automatically generated from drawio2cbd with the command:
  3. # /home/red/git/DrawioConvert/__main__.py EvenNumberGen.xml -av -F CBD -e LCG -t 30 -f
  4. from CBD.src.lib.endpoints import SignalCollectorBlock
  5. from EvenNumberGen import *
  6. from CBD.simulator import Simulator
  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("gen", sinGen.findBlock('collector')[0], (fig, ax), ScatterPlot())
  14. manager.connect('gen', '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