Commit 1f141783 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Ioannis Papagiannopoulos

PeriodicMaintenance updated

parent 82ad6cee
......@@ -24,12 +24,20 @@
"mean": 10
}
},
"periodicMaintenance": {
"MTTR": 2,
"MTTF": 8,
"distributionType": "Fixed"
"interruptions": {
"periodicMaintenance": {
"TTR": {
"Fixed": {
"mean": 2
}
},
"TTF": {
"Fixed": {
"mean": 8
}
}
}
},
"interruptions": {},
"_class": "Dream.Machine",
"left": 0.5
},
......
......@@ -304,16 +304,13 @@ def createObjectInterruptions():
G.FailureList.append(F)
# if there are periodic maintenances assigned
# initiate them
periodicMaintenance=element.get('periodicMaintenance', None)
periodicMaintenance=element.get('interruptions',{}).get('periodicMaintenance', None)
if periodicMaintenance:
distributionType=periodicMaintenance.get('distributionType', 'No')
if distributionType=='No':
pass
else:
victim=Globals.findObjectById(element['id'])
PM=PeriodicMaintenance(victim=victim, distribution=periodicMaintenance, repairman=victim.repairman)
G.ObjectInterruptionList.append(PM)
G.PeriodicMaintenanceList.append(PM)
victim=Globals.findObjectById(element['id'])
PM=PeriodicMaintenance(victim=victim, distribution=periodicMaintenance, repairman=victim.repairman)
G.ObjectInterruptionList.append(PM)
G.PeriodicMaintenanceList.append(PM)
# if there is a shift pattern defined
# initiate them
shift=element.get('shift', {})
......
......@@ -36,49 +36,13 @@ class PeriodicMaintenance(ObjectInterruption):
def __init__(self, id='',name='',victim=None, distribution=None, index=0, repairman=None,**kw):
ObjectInterruption.__init__(self,id,name,victim=victim)
if distribution:
self.distType=distribution.get('distributionType','No') # the distribution that the failure duration follows
self.MTTF=distribution.get('MTTF',60) # the MTTF
self.MTTR=distribution.get('MTTR',5) # the MTTR
self.availability=distribution.get('availability',100) # the availability
else:
self.distType='No'
self.MTTF=60
self.MTTR=5
self.availability=100
self.rngTTF=RandomNumberGenerator(self, distribution.get('TTF',{'Fixed':{'mean':100}}))
self.rngTTR=RandomNumberGenerator(self, distribution.get('TTR',{'Fixed':{'mean':10}}))
self.name="F"+str(index)
self.repairman=repairman # the resource that may be needed to fix the failure
# if now resource is needed this will be "None"
self.type="PeriodicMaintenance"
if(self.distType=="Availability"):
# --------------------------------------------------------------
# the following are used if we have availability defined
# (as in plant) the erlang is a special case of Gamma.
# To model the Mu and sigma (that is given in plant)
# as alpha and beta for gamma you should do the following:
# beta=(sigma^2)/Mu
# alpha=Mu/beta
# --------------------------------------------------------------
self.AvailabilityMTTF=self.MTTR*(float(availability)/100)/(1-(float(availability)/100))
self.sigma=0.707106781185547*self.MTTR
self.theta=(pow(self.sigma,2))/float(self.MTTR)
self.beta=self.theta
self.alpha=(float(self.MTTR)/self.theta)
self.rngTTF=RandomNumberGenerator(self, "Exp")
self.rngTTF.avg=self.AvailabilityMTTF
self.rngTTR=RandomNumberGenerator(self, "Erlang")
self.rngTTR.alpha=self.alpha
self.rngTTR.beta=self.beta
else:
# --------------------------------------------------------------
# if the distribution is fixed
# --------------------------------------------------------------
self.rngTTF=RandomNumberGenerator(self, self.distType)
self.rngTTF.mean=self.MTTF
self.rngTTR=RandomNumberGenerator(self, self.distType)
self.rngTTR.mean=self.MTTR
def initialize(self):
ObjectInterruption.initialize(self)
......
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