minor corrections to Router

parent 6b9275fd
...@@ -203,7 +203,6 @@ class Router(ObjectInterruption): ...@@ -203,7 +203,6 @@ class Router(ObjectInterruption):
# # testing # # testing
# print 'router found objects to be signalled' # print 'router found objects to be signalled'
# print [str(object.id) for object in self.toBeSignalled] # print [str(object.id) for object in self.toBeSignalled]
# print [str(object.exitIsAssignedTo().id) for object in self.toBeSignalled if object.exitIsAssignedTo()]
#=================================================================== #===================================================================
# ======================================================================= # =======================================================================
...@@ -249,7 +248,7 @@ class Router(ObjectInterruption): ...@@ -249,7 +248,7 @@ class Router(ObjectInterruption):
# signal this station's broker that the resource is available # signal this station's broker that the resource is available
#=========================================================== #===========================================================
# # testing # # testing
# print now(), 'router signalling broker of', operator.isAssignedTo().id # print now(), 'router signalling broker of ', operator.isAssignedTo().id
#=========================================================== #===========================================================
station.broker.resourceAvailable.signal(now()) station.broker.resourceAvailable.signal(now())
else: else:
...@@ -258,7 +257,7 @@ class Router(ObjectInterruption): ...@@ -258,7 +257,7 @@ class Router(ObjectInterruption):
and any(type=='Load' for type in station.multOperationTypeList): and any(type=='Load' for type in station.multOperationTypeList):
#======================================================= #=======================================================
# # testing # # testing
# print now(), 'router signalling', operator.isAssignedTo().id # print now(), 'router signalling ', operator.isAssignedTo().id
#======================================================= #=======================================================
station.loadOperatorAvailable.signal(now()) station.loadOperatorAvailable.signal(now())
# in case the router deals with managed entities # in case the router deals with managed entities
...@@ -300,7 +299,7 @@ class Router(ObjectInterruption): ...@@ -300,7 +299,7 @@ class Router(ObjectInterruption):
self.clearPending() self.clearPending()
for entity in G.pendingEntities: for entity in G.pendingEntities:
for machine in entity.currentStation.next: for machine in entity.currentStation.next:
if any(type=='Load' for type in machine.multOperationTypeList): if any(type=='Load' for type in machine.multOperationTypeList) and not entity.currentStation in self.pendingQueues:
self.pendingQueues.append(entity.currentStation) self.pendingQueues.append(entity.currentStation)
self.pendingObjects.append(entity.currentStation) self.pendingObjects.append(entity.currentStation)
break break
...@@ -331,8 +330,9 @@ class Router(ObjectInterruption): ...@@ -331,8 +330,9 @@ class Router(ObjectInterruption):
self.managed=True self.managed=True
#======================================================================= #=======================================================================
# # testing # # testing
# print 'found pending entities' # if self.managed:
# print [entity.id for entity in self.pending if not entity.type=='Part'] # print 'found pending entities'
# print [entity.id for entity in self.pending if not entity.type=='Part']
#======================================================================= #=======================================================================
#======================================================================== #========================================================================
...@@ -365,7 +365,7 @@ class Router(ObjectInterruption): ...@@ -365,7 +365,7 @@ class Router(ObjectInterruption):
candidateOperator=nextobject.operatorPool.findAvailableOperator() candidateOperator=nextobject.operatorPool.findAvailableOperator()
if not candidateOperator in self.candidateOperators: if not candidateOperator in self.candidateOperators:
self.candidateOperators.append(candidateOperator) self.candidateOperators.append(candidateOperator)
candidateOperator.candidateStations.append(object) candidateOperator.candidateStations.append(nextobject)
# update the schedulingRule/multipleCriterionList of the Router # update the schedulingRule/multipleCriterionList of the Router
if self.sorting: if self.sorting:
self.updateSchedulingRule() self.updateSchedulingRule()
...@@ -407,7 +407,10 @@ class Router(ObjectInterruption): ...@@ -407,7 +407,10 @@ class Router(ObjectInterruption):
#======================================================================= #=======================================================================
# # testing # # testing
# print 'router found candidate operators' # print 'router found candidate operators'
# print [operator.id for operator in self.candidateOperators] # if self.managed:
# print [operator.id for operator in self.candidateOperators]
# else:
# print [(operator.id, [station.id for station in operator.candidateStations]) for operator in self.candidateOperators]
#======================================================================= #=======================================================================
#======================================================================= #=======================================================================
...@@ -507,10 +510,11 @@ class Router(ObjectInterruption): ...@@ -507,10 +510,11 @@ class Router(ObjectInterruption):
self.candidateOperators.sort(key=lambda x: x in operatorsWithOneOption, reverse=True) self.candidateOperators.sort(key=lambda x: x in operatorsWithOneOption, reverse=True)
#======================================================================= #=======================================================================
# # testing # # testing
# print 'router found the candidate entities for each operator' # if self.managed:
# print [(str(operator.id),\ # print 'router found the candidate entities for each operator'
# [str(x.id) for x in operator.candidateEntities]) # print [(str(operator.id),\
# for operator in self.candidateOperators] # [str(x.id) for x in operator.candidateEntities])
# for operator in self.candidateOperators]
#======================================================================= #=======================================================================
#======================================================================= #=======================================================================
...@@ -700,10 +704,11 @@ class Router(ObjectInterruption): ...@@ -700,10 +704,11 @@ class Router(ObjectInterruption):
#======================================================================= #=======================================================================
# # testing # # testing
# print 'router found candidate receivers for each entity' # if self.managed:
# print [(str(entity.id),\ # print 'router found candidate receivers for each entity'
# str(entity.candidateReceiver.id)) # print [(str(entity.id),\
# for entity in self.pending if entity.candidateReceiver] # str(entity.candidateReceiver.id))
# for entity in self.pending if entity.candidateReceiver]
#======================================================================= #=======================================================================
# ======================================================================= # =======================================================================
......
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