Commit da936b96 authored by Georgios Dagkakis's avatar Georgios Dagkakis

comments added

parent d0a0926c
...@@ -106,8 +106,10 @@ class Failure(ObjectInterruption): ...@@ -106,8 +106,10 @@ class Failure(ObjectInterruption):
remainingTimeToFailure=timeToFailure remainingTimeToFailure=timeToFailure
failureNotTriggered=True failureNotTriggered=True
# if time to failure counts not matter the state of the victim
if self.deteriorationType=='constant': if self.deteriorationType=='constant':
yield self.env.timeout(remainingTimeToFailure) yield self.env.timeout(remainingTimeToFailure)
# if time to failure counts only in onShift time
elif self.deteriorationType=='onShift': elif self.deteriorationType=='onShift':
while failureNotTriggered: while failureNotTriggered:
timeRestartedCounting=self.env.now timeRestartedCounting=self.env.now
...@@ -125,16 +127,20 @@ class Failure(ObjectInterruption): ...@@ -125,16 +127,20 @@ class Failure(ObjectInterruption):
# TODO: the signal interruptionStart is reset by the time it is received by the victim. not sure if will be still triggered when it is checked here # TODO: the signal interruptionStart is reset by the time it is received by the victim. not sure if will be still triggered when it is checked here
else: else:
failureNotTriggered=False failureNotTriggered=False
# if time to failure counts only in working time
elif self.deteriorationType=='working': elif self.deteriorationType=='working':
# wait for victim to start process
yield self.victimStartsProcess yield self.victimStartsProcess
self.victimStartsProcess=self.env.event() self.victimStartsProcess=self.env.event()
while failureNotTriggered: while failureNotTriggered:
timeRestartedCounting=self.env.now timeRestartedCounting=self.env.now
# wait either for the failure or end of process
receivedEvent=yield self.env.timeout(remainingTimeToFailure) | self.victimEndsProcess receivedEvent=yield self.env.timeout(remainingTimeToFailure) | self.victimEndsProcess
if self.victimEndsProcess in receivedEvent: if self.victimEndsProcess in receivedEvent:
self.victimEndsProcess=self.env.event() self.victimEndsProcess=self.env.event()
remainingTimeToFailure=remainingTimeToFailure-(self.env.now-timeRestartedCounting) remainingTimeToFailure=remainingTimeToFailure-(self.env.now-timeRestartedCounting)
yield self.victimStartsProcess yield self.victimStartsProcess
# wait for victim to start again processing
self.victimStartsProcess=self.env.event() self.victimStartsProcess=self.env.event()
else: else:
failureNotTriggered=False failureNotTriggered=False
......
...@@ -450,7 +450,9 @@ class Machine(CoreObject): ...@@ -450,7 +450,9 @@ class Machine(CoreObject):
# timers to follow up the failure time of the machine while on current Entity # timers to follow up the failure time of the machine while on current Entity
self.downTimeInCurrentEntity=0 #holds the total time that the self.downTimeInCurrentEntity=0 #holds the total time that the
#object was down while holding current entity #object was down while holding current entity
# if there is a failure that depends on the working time of the Machine
# send it the victimStartsProcess signal
for oi in self.objectInterruptions: for oi in self.objectInterruptions:
if oi.type=='Failure': if oi.type=='Failure':
if oi.deteriorationType=='working': if oi.deteriorationType=='working':
...@@ -630,6 +632,8 @@ class Machine(CoreObject): ...@@ -630,6 +632,8 @@ class Machine(CoreObject):
self.shouldPreempt=False self.shouldPreempt=False
self.isProcessingInitialWIP=False self.isProcessingInitialWIP=False
# if there is a failure that depends on the working time of the Machine
# send it the victimEndsProcess signal
for oi in self.objectInterruptions: for oi in self.objectInterruptions:
if oi.type=='Failure': if oi.type=='Failure':
if oi.deteriorationType=='working': if oi.deteriorationType=='working':
......
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