FAS_reproduce/fas可视化.py

24 lines
1.0 KiB
Python
Raw Normal View History

2023-01-30 14:26:29 +08:00
import salabim as sim
from fas复现.fas_instance import q
from fas复现.fas_instance import ItemGenerator
env = sim.Environment()
ItemGenerator()
env.background_color('20%gray')
qa0 = sim.AnimateQueue(q, x=100, y=250, title='queue, normal', direction='e', id='blue')
qa1 = sim.AnimateQueue(q, x=100, y=350, title='queue, maximum 6 components', direction='e', max_length=6, id='red')
qa2 = sim.AnimateQueue(q, x=100, y=150, title='queue, reversed', direction='e', reverse=True, id='green')
sim.AnimateMonitor(q.length, x=10, y=450, width=480, height=100, horizontal_scale=3, vertical_scale=3)
sim.AnimateMonitor(q.length_of_stay, x=10, y=570, width=480, height=100, horizontal_scale=5, vertical_scale=5)
sim.AnimateText(text=lambda: q.length.print_histogram(as_str=True), x=500, y=750,
text_anchor='nw', font='narrow', fontsize=10)
sim.AnimateText(text=lambda: q.print_info(as_str=True), x=500, y=340,
text_anchor='nw', font='narrow', fontsize=10)
env.animate(True)
env.modelname('Demo queue animation')
env.run()