Commit a5a2e52b authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Georgios Dagkakis

OperatorRouterManaged clean-up

parent ea495c4f
...@@ -120,13 +120,6 @@ class Job(Entity): # inherits from the Entity c ...@@ -120,13 +120,6 @@ class Job(Entity): # inherits from the Entity c
except SetWipTypeError as setWipError: except SetWipTypeError as setWipError:
print 'WIP definition error: {0}'.format(setWipError) print 'WIP definition error: {0}'.format(setWipError)
#===========================================================================
# check if the entity can proceed to an operated machine, for use by Router
#===========================================================================
def canProceed(self):
activeObject=self.currentStation
return activeObject.canDeliver(self)
#=========================================================================== #===========================================================================
# check if the requireParts of the entity next step sequence (route) have # check if the requireParts of the entity next step sequence (route) have
# have concluded the steps with sequence numbers smaller than the sequence # have concluded the steps with sequence numbers smaller than the sequence
...@@ -236,7 +229,7 @@ class Job(Entity): # inherits from the Entity c ...@@ -236,7 +229,7 @@ class Job(Entity): # inherits from the Entity c
router.entitiesWithOccupiedReceivers.append(self) router.entitiesWithOccupiedReceivers.append(self)
availableReceiver=None availableReceiver=None
# if the sorting flag is not set then the sorting of each queue must prevail in case of operators conflict # if the sorting flag is not set then the sorting of each queue must prevail in case of operators conflict
if not router.sorting and not availableReceiver and bool(availableReceivers): if not availableReceiver and bool(availableReceivers):
availableReceiver=self.currentStation.selectReceiver(self.candidateReceivers) availableReceiver=self.currentStation.selectReceiver(self.candidateReceivers)
if not self in router.conflictingEntities: if not self in router.conflictingEntities:
router.conflictingEntities.append(self) router.conflictingEntities.append(self)
......
...@@ -84,7 +84,7 @@ class OperatorManagedJob(Operator): ...@@ -84,7 +84,7 @@ class OperatorManagedJob(Operator):
#======================================================================= #=======================================================================
def findCandidateEntities(self, pendingEntities=[]): def findCandidateEntities(self, pendingEntities=[]):
if pendingEntities: if pendingEntities:
for entity in [x for x in pendingEntities if x.canProceed and x.manager==self]: for entity in [x for x in pendingEntities if x.currentStation.canDeliver(x) and x.manager==self]:
self.candidateEntities.append(entity) self.candidateEntities.append(entity)
#=========================================================================== #===========================================================================
...@@ -117,10 +117,9 @@ class OperatorManagedJob(Operator): ...@@ -117,10 +117,9 @@ class OperatorManagedJob(Operator):
router=G.Router router=G.Router
# pick a candidateEntity # pick a candidateEntity
candidateEntity=self.findAvailableEntity() candidateEntity=self.findAvailableEntity()
if not router.sorting: if not candidateEntity:
if not candidateEntity: candidateEntity=next(x for x in self.candidateEntities)
candidateEntity=next(x for x in self.candidateEntities) router.conflictingEntities.append(candidateEntity)
router.conflictingEntities.append(candidateEntity)
return candidateEntity return candidateEntity
# ======================================================================= # =======================================================================
......
...@@ -39,14 +39,12 @@ class Router(ObjectInterruption): ...@@ -39,14 +39,12 @@ class Router(ObjectInterruption):
# The Broker is initiated within the Machine and considered as # The Broker is initiated within the Machine and considered as
# black box for the ManPy end Developer # black box for the ManPy end Developer
# ======================================================================= # =======================================================================
def __init__(self,sorting=False): def __init__(self):
ObjectInterruption.__init__(self) ObjectInterruption.__init__(self)
self.type = "Router" self.type = "Router"
self.isInitialized=False self.isInitialized=False
self.isActivated=False self.isActivated=False
self.candidateOperators=[] self.candidateOperators=[]
# boolean flag to check whether the Router should perform sorting on operators and on pendingEntities
self.sorting=sorting
# list of objects to be signalled by the Router # list of objects to be signalled by the Router
self.toBeSignalled=[] self.toBeSignalled=[]
# flag to notify whether the router is already invoked # flag to notify whether the router is already invoked
......
This diff is collapsed.
...@@ -58,7 +58,6 @@ class SkilledRouter(Router): ...@@ -58,7 +58,6 @@ class SkilledRouter(Router):
self.waitEndProcess=False self.waitEndProcess=False
self.pendingQueues=[] self.pendingQueues=[]
self.pendingMachines=[] self.pendingMachines=[]
self.pendingObjects=[]
self.previousSolution={} self.previousSolution={}
# ======================================================================= # =======================================================================
...@@ -268,32 +267,14 @@ class SkilledRouter(Router): ...@@ -268,32 +267,14 @@ class SkilledRouter(Router):
# default behaviour # default behaviour
#=================================================================== #===================================================================
else: else:
# find the pending objects # entry actions
self.findPendingObjects() self.entry()
# find the pending entities # run the routine that allocates operators to machines
self.findPendingEntities() self.allocateOperators()
# find the operators that can start working now
self.findCandidateOperators()
# sort the pendingEntities list
if self.sorting:
self.sortPendingEntities()
# find the operators candidateEntities
self.sortCandidateEntities()
# find the entity that will occupy the resource, and the station that will receive it (if any available)
# entities that are already in stations have already a receiver
self.findCandidateReceivers()
# assign operators to stations # assign operators to stations
self.assignOperators() self.assignOperators()
# unAssign exits
for operator in [x for x in self.candidateOperators if x.isAssignedTo()]: self.unAssignExits()
if not operator.isAssignedTo() in self.pendingObjects:
for object in [x for x in operator.isAssignedTo().previous if x.exitIsAssignedTo()]:
if object.exitIsAssignedTo()!=operator.isAssignedTo():
object.unAssignExit()
# if an object cannot proceed with getEntity, unAssign the exit of its giver
for object in self.pendingQueues:
if not object in self.toBeSignalled:
object.unAssignExit()
# signal the stations that ought to be signalled # signal the stations that ought to be signalled
self.signalOperatedStations() self.signalOperatedStations()
......
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