Commit 338a0241 authored by Georgios Dagkakis's avatar Georgios Dagkakis

ShiftScheduler may count threshold time as off-shift or waiting

parent e7db559a
...@@ -39,13 +39,15 @@ class ShiftScheduler(ObjectInterruption): ...@@ -39,13 +39,15 @@ class ShiftScheduler(ObjectInterruption):
# ======================================================================= # =======================================================================
# the __init__() method of the class # the __init__() method of the class
# ======================================================================= # =======================================================================
def __init__(self, id='', name='', victim=None, shiftPattern=[], endUnfinished=False, receiveBeforeEndThreshold=0.0,**kw): def __init__(self, id='', name='', victim=None, shiftPattern=[], endUnfinished=False, receiveBeforeEndThreshold=0.0,
thresholdTimeIsOnShift=True,**kw):
ObjectInterruption.__init__(self,victim=victim) ObjectInterruption.__init__(self,victim=victim)
self.type='ShiftScheduler' self.type='ShiftScheduler'
self.shiftPattern=shiftPattern self.shiftPattern=shiftPattern
self.endUnfinished=endUnfinished #flag that shows if half processed Jobs should end after the shift ends self.endUnfinished=endUnfinished #flag that shows if half processed Jobs should end after the shift ends
# if the end of shift is below this threshold then the victim is on shift but does not accept new entities # if the end of shift is below this threshold then the victim is on shift but does not accept new entities
self.receiveBeforeEndThreshold=receiveBeforeEndThreshold self.receiveBeforeEndThreshold=receiveBeforeEndThreshold
self.thresholdTimeIsOnShift=thresholdTimeIsOnShift
# ======================================================================= # =======================================================================
# initialize for every replications # initialize for every replications
...@@ -103,6 +105,7 @@ class ShiftScheduler(ObjectInterruption): ...@@ -103,6 +105,7 @@ class ShiftScheduler(ObjectInterruption):
else: else:
timeToEndShift=float(self.remainingShiftPattern[0][1]-self.env.now) timeToEndShift=float(self.remainingShiftPattern[0][1]-self.env.now)
yield self.env.timeout(timeToEndShift-self.receiveBeforeEndThreshold) # wait until the entry threshold yield self.env.timeout(timeToEndShift-self.receiveBeforeEndThreshold) # wait until the entry threshold
if self.thresholdTimeIsOnShift:
self.victim.isLocked=True # lock the entry of the victim self.victim.isLocked=True # lock the entry of the victim
yield self.env.timeout(self.receiveBeforeEndThreshold) # wait until the shift is over yield self.env.timeout(self.receiveBeforeEndThreshold) # wait until the shift is over
self.victim.isLocked=False # unlock the entry of the victim self.victim.isLocked=False # unlock the entry of the victim
......
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