ScheduledMaintenance updated

parent 91b8bce2
...@@ -26,7 +26,8 @@ Created on 3 Jan 2014 ...@@ -26,7 +26,8 @@ Created on 3 Jan 2014
models an one time scheduled maintenance. It happens and stops at fixed times and it is also deterministic models an one time scheduled maintenance. It happens and stops at fixed times and it is also deterministic
''' '''
from SimPy.Simulation import now, Process, hold, request, release, infinity # from SimPy.Simulation import now, Process, hold, request, release, infinity
import simpy
from RandomNumberGenerator import RandomNumberGenerator from RandomNumberGenerator import RandomNumberGenerator
from ObjectInterruption import ObjectInterruption from ObjectInterruption import ObjectInterruption
...@@ -48,17 +49,17 @@ class ScheduledMaintenance(ObjectInterruption): ...@@ -48,17 +49,17 @@ class ScheduledMaintenance(ObjectInterruption):
# holds for the maintenance duration, and finally reactivates the victim # holds for the maintenance duration, and finally reactivates the victim
# ======================================================================= # =======================================================================
def run(self): def run(self):
yield hold,self,self.start #wait until the start time yield self.env.timeout(self.start) #wait until the start time
try: try:
if(len(self.getVictimQueue())>0): # when a Machine gets failure if(len(self.getVictimQueue())>0): # when a Machine gets failure
self.interruptVictim() # while in process it is interrupted self.interruptVictim() # while in process it is interrupted
self.victim.Up=False self.victim.Up=False
self.victim.timeLastFailure=now() self.victim.timeLastFailure=self.env.now
self.outputTrace("is down") self.outputTrace("is down")
except AttributeError: except AttributeError:
print "AttributeError1" print "AttributeError1"
yield hold,self,self.duration # wait for the defined duration of the interruption yield self.env.timeout(self.duration) # wait for the defined duration of the interruption
self.victim.totalFailureTime+=self.duration self.victim.totalFailureTime+=self.duration
try: try:
......
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