SinGen_gameloop_experiment.py 667 B

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/python3
  2. # This file was automatically generated from drawio2cbd with the command:
  3. # /home/red/git/DrawioConvert/__main__.py Fibonacci.xml -F CBD -e FibonacciGen -gvaf
  4. from SinGen import *
  5. from CBD.simulator import Simulator
  6. import matplotlib.pyplot as plt
  7. sinGen = SinGen("SinGen")
  8. sim = Simulator(sinGen)
  9. sim.setProgressBar()
  10. sim.setRealTime()
  11. sim.setRealTimePlatformGameLoop()
  12. sim.setDeltaT(0.3)
  13. sim.run(100.0)
  14. while sim.is_running():
  15. # DO SOME THINGS
  16. # advance the model's state
  17. sim.realtime_gameloop_call()
  18. print("FINISHED!")
  19. data = sinGen.getSignalHistory('OUT1')
  20. x, y = [x for x, _ in data], [y for _, y in data]
  21. plt.plot(x, y)
  22. plt.show()