new method added to Machine, searching for candidate operators. Clean-up in operator

parent 6d3b4df6
...@@ -779,6 +779,18 @@ class Machine(CoreObject): ...@@ -779,6 +779,18 @@ class Machine(CoreObject):
if not self.router.isCalled(): if not self.router.isCalled():
self.router.invoke() self.router.invoke()
#===========================================================================
# find candidate operators within the free operators
#===========================================================================
def findCandidateOperator(self):
activeObject=self.getActiveObject()
# TODO: this way no sorting is performed
# find an available operator
candidateOperator=activeObject.operatorPool.findAvailableOperator()
# append the station into its candidateStations
candidateOperator.candidateStations.append(activeObject)
return candidateOperator
# ======================================================================= # =======================================================================
# prepare the machine to be operated # prepare the machine to be operated
# ======================================================================= # =======================================================================
......
...@@ -357,28 +357,20 @@ class Router(ObjectInterruption): ...@@ -357,28 +357,20 @@ class Router(ObjectInterruption):
# if we are not dealing with managed entities # if we are not dealing with managed entities
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
if not self.managed: if not self.managed:
# if there are pendingEntities
if self.pendingObjects:
# for each pendingObject
# for each pendingMachine # for each pendingMachine
for object in self.pendingMachines: for object in self.pendingMachines:
# if object in self.pendingMachines: # find candidateOperators for each object operator
# find an available operator candidateOperator=object.findCandidateOperator()
candidateOperator=object.operatorPool.findAvailableOperator()
# TODO: this way no sorting is performed # TODO: this way no sorting is performed
if not candidateOperator in self.candidateOperators: if not candidateOperator in self.candidateOperators:
self.candidateOperators.append(candidateOperator) self.candidateOperators.append(candidateOperator)
# for each operator append the station into its candidateStations
candidateOperator.candidateStations.append(object)
# for each pendingQueue # for each pendingQueue
for object in self.pendingQueues: for object in self.pendingQueues:
# elif object in self.pendingQueues:
# find available operator for then machines that follow # find available operator for then machines that follow
for nextobject in object.findReceivers(): for nextobject in object.findReceivers():
candidateOperator=nextobject.operatorPool.findAvailableOperator() candidateOperator=nextobject.findCandidateOperator()
if not candidateOperator in self.candidateOperators: if not candidateOperator in self.candidateOperators:
self.candidateOperators.append(candidateOperator) self.candidateOperators.append(candidateOperator)
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()
......
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