Commit be9501e9 authored by Georgios Dagkakis's avatar Georgios Dagkakis

Router activation works now in multiple runs

parent 82b5b943
...@@ -1274,7 +1274,10 @@ def main(argv=[], input_data=None): ...@@ -1274,7 +1274,10 @@ def main(argv=[], input_data=None):
G.env=simpy.Environment() # initialize the environment G.env=simpy.Environment() # initialize the environment
G.maxSimTime=float(G.JSONData['general'].get('maxSimTime', '100')) # read the maxSimTime in each replication G.maxSimTime=float(G.JSONData['general'].get('maxSimTime', '100')) # read the maxSimTime in each replication
# since it may be changed for infinite ones # since it may be changed for infinite ones
if G.Router:
G.Router.isActivated=False
G.Router.isInitialized=False
if G.seed: if G.seed:
G.Rnd=Random('%s%s' % (G.seed, i)) G.Rnd=Random('%s%s' % (G.seed, i))
else: else:
......
...@@ -142,7 +142,7 @@ class Machine(CoreObject): ...@@ -142,7 +142,7 @@ class Machine(CoreObject):
# otherwise set the already existing router as the machines Router # otherwise set the already existing router as the machines Router
else: else:
self.router=G.Router self.router=G.Router
# lists to hold statistics of multiple runs #lists to hold statistics of multiple runs
self.WaitingForOperator=[] self.WaitingForOperator=[]
self.WaitingForLoadOperator=[] self.WaitingForLoadOperator=[]
self.Loading = [] self.Loading = []
...@@ -172,7 +172,9 @@ class Machine(CoreObject): ...@@ -172,7 +172,9 @@ class Machine(CoreObject):
# initialise the router only once # initialise the router only once
if not self.router.isInitialized: if not self.router.isInitialized:
self.router.initialize() self.router.initialize()
if not self.router.isActivated:
self.env.process(self.router.run()) self.env.process(self.router.run())
self.router.isActivated=True
for operator in self.operatorPool.operators: for operator in self.operatorPool.operators:
operator.coreObjectIds.append(self.id) operator.coreObjectIds.append(self.id)
operator.coreObjects.append(self) operator.coreObjects.append(self)
......
...@@ -64,12 +64,13 @@ class MachineManagedJob(MachineJobShop): ...@@ -64,12 +64,13 @@ class MachineManagedJob(MachineJobShop):
if not G.Router: if not G.Router:
self.router=Router() self.router=Router()
self.router.initialize() self.router.initialize()
self.env.process(self.router.run()) G.Router=self.router
# activate(self.router,self.router.run())
G.Router=self.router
# otherwise set the already existing router as the machines Router # otherwise set the already existing router as the machines Router
else: else:
self.router=G.Router self.router=G.Router
if not self.router.isActivated:
self.env.process(self.router.run())
self.router.isActivated=True
# holds the Entity that is to be obtained and will be updated by canAcceptAndIsRequested # holds the Entity that is to be obtained and will be updated by canAcceptAndIsRequested
self.entityToGet=None self.entityToGet=None
......
...@@ -50,6 +50,7 @@ class Router(ObjectInterruption): ...@@ -50,6 +50,7 @@ class Router(ObjectInterruption):
ObjectInterruption.__init__(self) ObjectInterruption.__init__(self)
self.type = "Router" self.type = "Router"
self.isInitialized=False self.isInitialized=False
self.isActivated=False
self.candidateOperators=[] self.candidateOperators=[]
self.multipleCriterionList=[] self.multipleCriterionList=[]
self.schedulingRule='WT' self.schedulingRule='WT'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment