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
except SetWipTypeError as 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
# have concluded the steps with sequence numbers smaller than the sequence
......@@ -236,7 +229,7 @@ class Job(Entity): # inherits from the Entity c
router.entitiesWithOccupiedReceivers.append(self)
availableReceiver=None
# 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)
if not self in router.conflictingEntities:
router.conflictingEntities.append(self)
......
......@@ -84,7 +84,7 @@ class OperatorManagedJob(Operator):
#=======================================================================
def findCandidateEntities(self, 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)
#===========================================================================
......@@ -117,10 +117,9 @@ class OperatorManagedJob(Operator):
router=G.Router
# pick a candidateEntity
candidateEntity=self.findAvailableEntity()
if not router.sorting:
if not candidateEntity:
candidateEntity=next(x for x in self.candidateEntities)
router.conflictingEntities.append(candidateEntity)
if not candidateEntity:
candidateEntity=next(x for x in self.candidateEntities)
router.conflictingEntities.append(candidateEntity)
return candidateEntity
# =======================================================================
......
......@@ -39,14 +39,12 @@ class Router(ObjectInterruption):
# The Broker is initiated within the Machine and considered as
# black box for the ManPy end Developer
# =======================================================================
def __init__(self,sorting=False):
def __init__(self):
ObjectInterruption.__init__(self)
self.type = "Router"
self.isInitialized=False
self.isActivated=False
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
self.toBeSignalled=[]
# flag to notify whether the router is already invoked
......
This diff is collapsed.
......@@ -58,7 +58,6 @@ class SkilledRouter(Router):
self.waitEndProcess=False
self.pendingQueues=[]
self.pendingMachines=[]
self.pendingObjects=[]
self.previousSolution={}
# =======================================================================
......@@ -268,32 +267,14 @@ class SkilledRouter(Router):
# default behaviour
#===================================================================
else:
# find the pending objects
self.findPendingObjects()
# find the pending entities
self.findPendingEntities()
# 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()
# entry actions
self.entry()
# run the routine that allocates operators to machines
self.allocateOperators()
# assign operators to stations
self.assignOperators()
for operator in [x for x in self.candidateOperators if x.isAssignedTo()]:
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()
# unAssign exits
self.unAssignExits()
# signal the stations that ought to be signalled
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