File size: 1,992 Bytes
09363f2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | #!/usr/bin/python3
import simpy
from modules.process.production_line import ProductionLine
from modules.process.fas_instance import FASInstance
from modules.components.clock import Clock
from simulator.logger import Logger
# Initializing
env = simpy.Environment()
logger = Logger(env)
production_line = ProductionLine(env, logger)
clock = Clock(env, logger)
clock.spawn()
# Doing a couple of global repeats
for i in range(0,20):
# First running through with one item.
fas_instance = FASInstance(env, production_line, logger)
last_item = fas_instance.spawn()
env.run(last_item)
# Then 2 items spaced a bit.
fas_instance = FASInstance(env, production_line, logger)
fas_instance.spawn()
for j in range(0, 5):
env.step()
fas_instance = FASInstance(env, production_line, logger)
last_item = fas_instance.spawn()
env.run(last_item)
# Then 2 items spaced more.
fas_instance = FASInstance(env, production_line, logger)
fas_instance.spawn()
for j in range(0, 8):
env.step()
fas_instance = FASInstance(env, production_line, logger)
last_item = fas_instance.spawn()
env.run(last_item)
# Then 2 items spaced less.
fas_instance = FASInstance(env, production_line, logger)
fas_instance.spawn()
for j in range(0, 3):
env.step()
fas_instance = FASInstance(env, production_line, logger)
last_item = fas_instance.spawn()
env.run(last_item)
# Then 3 items spaced a bit.
fas_instance = FASInstance(env, production_line, logger)
fas_instance.spawn()
for j in range(0, 5):
env.step()
fas_instance = FASInstance(env, production_line, logger)
fas_instance.spawn()
for j in range(0, 5):
env.step()
fas_instance = FASInstance(env, production_line, logger)
last_item = fas_instance.spawn()
env.run(last_item)
print("Done.")
f = open("data/output_sparse.json", "w")
f.write(logger.getLoglines())
f.close()
|