Commit 0f6e6f6a authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Georgios Dagkakis

findCandidateStation updated

parent 53315db5
...@@ -93,6 +93,7 @@ class Operator(ObjectResource): ...@@ -93,6 +93,7 @@ class Operator(ObjectResource):
self.totalOffShiftTime=0 #holds the total off-shift time self.totalOffShiftTime=0 #holds the total off-shift time
self.timeLastShiftStarted=0 #holds the time that the last shift of the object started self.timeLastShiftStarted=0 #holds the time that the last shift of the object started
self.timeLastShiftEnded=0 #holds the time that the last shift of the object ended self.timeLastShiftEnded=0 #holds the time that the last shift of the object ended
self.candidateStation=None #holds the candidate receiver of the entity the resource will work on - used by router
@staticmethod @staticmethod
def getSupportedSchedulingRules(): def getSupportedSchedulingRules():
...@@ -138,11 +139,13 @@ class Operator(ObjectResource): ...@@ -138,11 +139,13 @@ class Operator(ObjectResource):
def findCandidateStation(self): def findCandidateStation(self):
from Globals import G from Globals import G
router=G.Router router=G.Router
candidateStation=next(x for x in self.candidateStations if not x in router.conflictingStations) candidateStation=None
if not router.sorting: possibleReceivers=[x for x in self.candidateStations if not x in router.conflictingStations and not x in router.getReceivers()]
if not candidateStation: if possibleReceivers:
candidateStation=next(x for x in self.candidateStations) candidateStation=next(x for x in possibleReceivers)
router.conflictingStations.append(candidateStation) if not candidateStation:
candidateStation=next(x for x in self.candidateStations)
router.conflictingStations.append(candidateStation)
return candidateStation return candidateStation
#=========================================================================== #===========================================================================
......
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