Commit 447d62f8 authored by Georgios Dagkakis's avatar Georgios Dagkakis

failure to be able to wait for other events to happen at the same time before...

failure to be able to wait for other events to happen at the same time before interrupting the victim
parent fb4a4ff1
...@@ -35,7 +35,8 @@ from ObjectInterruption import ObjectInterruption ...@@ -35,7 +35,8 @@ from ObjectInterruption import ObjectInterruption
class Failure(ObjectInterruption): class Failure(ObjectInterruption):
def __init__(self, id='',name='',victim=None, distribution=None, index=0, repairman=None, offshift=False, def __init__(self, id='',name='',victim=None, distribution=None, index=0, repairman=None, offshift=False,
deteriorationType='constant',**kw): deteriorationType='constant',
waitOnTie=False,**kw):
ObjectInterruption.__init__(self,id,name,victim=victim) ObjectInterruption.__init__(self,id,name,victim=victim)
if distribution: if distribution:
self.distType=distribution.get('distributionType','No') # the distribution that the failure duration follows self.distType=distribution.get('distributionType','No') # the distribution that the failure duration follows
...@@ -87,6 +88,8 @@ class Failure(ObjectInterruption): ...@@ -87,6 +88,8 @@ class Failure(ObjectInterruption):
self.rngTTR.mean=self.MTTR self.rngTTR.mean=self.MTTR
# flag used to identify if the time between failures should be counted while the victim is off-shift # flag used to identify if the time between failures should be counted while the victim is off-shift
self.offshift=offshift self.offshift=offshift
# flag to show if the failure will wait on tie with other events before interrupting the victim
self.waitOnTie=waitOnTie
def initialize(self): def initialize(self):
ObjectInterruption.initialize(self) ObjectInterruption.initialize(self)
...@@ -162,7 +165,13 @@ class Failure(ObjectInterruption): ...@@ -162,7 +165,13 @@ class Failure(ObjectInterruption):
self.victimStartsProcess=self.env.event() self.victimStartsProcess=self.env.event()
else: else:
failureNotTriggered=False failureNotTriggered=False
# if the mode is to wait on tie before interruption add a dummy hold for 0
# this is done so that if processing finishes exactly at the time of interruption
# the processing will finish first (if this mode is selected)
if self.waitOnTie:
yield self.env.timeout(0)
# interrupt the victim # interrupt the victim
self.interruptVictim() # interrupt the victim self.interruptVictim() # interrupt the victim
......
...@@ -295,7 +295,9 @@ def createObjectInterruptions(): ...@@ -295,7 +295,9 @@ def createObjectInterruptions():
else: else:
victim=Globals.findObjectById(element['id']) victim=Globals.findObjectById(element['id'])
deteriorationType=failure.get('deteriorationType', 'constant') deteriorationType=failure.get('deteriorationType', 'constant')
F=Failure(victim=victim, distribution=failure, repairman=victim.repairman, deteriorationType=deteriorationType) waitOnTie=failure.get('waitOnTie', False)
F=Failure(victim=victim, distribution=failure, repairman=victim.repairman, deteriorationType=deteriorationType,
waitOnTie=waitOnTie)
G.ObjectInterruptionList.append(F) G.ObjectInterruptionList.append(F)
G.FailureList.append(F) G.FailureList.append(F)
# if there are periodic maintenances assigned # if there are periodic maintenances assigned
......
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