Commit 7ca7e5ee authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Jérome Perrin

update so that the failures are not activated by the machine but by the main script

parent 81c4ff68
...@@ -86,6 +86,7 @@ from BatchDecompositionStartTime import BatchDecompositionStartTime ...@@ -86,6 +86,7 @@ from BatchDecompositionStartTime import BatchDecompositionStartTime
from M3 import M3 from M3 import M3
from OrderComponent import OrderComponent from OrderComponent import OrderComponent
from ScheduledMaintenance import ScheduledMaintenance from ScheduledMaintenance import ScheduledMaintenance
from Failure import Failure
import ExcelHandler import ExcelHandler
import time import time
...@@ -900,6 +901,7 @@ def createWIP(): ...@@ -900,6 +901,7 @@ def createWIP():
def createObjectInterruptions(): def createObjectInterruptions():
G.ObjectInterruptionList=[] G.ObjectInterruptionList=[]
G.ScheduledMaintenanceList=[] G.ScheduledMaintenanceList=[]
G.FailureList=[]
json_data = G.JSONData json_data = G.JSONData
#Read the json data #Read the json data
...@@ -914,6 +916,21 @@ def createObjectInterruptions(): ...@@ -914,6 +916,21 @@ def createObjectInterruptions():
SM=ScheduledMaintenance(victim=victim, start=start, duration=duration) SM=ScheduledMaintenance(victim=victim, start=start, duration=duration)
G.ObjectInterruptionList.append(SM) G.ObjectInterruptionList.append(SM)
G.ScheduledMaintenanceList.append(SM) G.ScheduledMaintenanceList.append(SM)
failure=element.get('failures', {})
if len(failure):
distributionType=failure.get('failureDistribution', 'No')
if distributionType=='No':
pass
else:
MTTF=float(failure.get('MTTF', '0'))
MTTR=float(failure.get('MTTR', '0'))
availability=float(failure.get('availability', '0'))
victim=Globals.findObjectById(element['id'])
F=Failure(victim, distributionType, MTTF, MTTR, availability, victim.id, victim.repairman)
G.ObjectInterruptionList.append(F)
G.FailureList.append(F)
# =========================================================================== # ===========================================================================
# used to convert a string read from the input to object type # used to convert a string read from the input to object type
......
...@@ -72,12 +72,6 @@ class Machine(CoreObject): ...@@ -72,12 +72,6 @@ class Machine(CoreObject):
def initialize(self): def initialize(self):
# using the Process __init__ and not the CoreObject __init__ # using the Process __init__ and not the CoreObject __init__
CoreObject.initialize(self) CoreObject.initialize(self)
#if the failure distribution for the object is fixed, activate the failure
if(self.failureDistType=="Fixed" or self.failureDistType=="Availability"):
MFailure=Failure(self, self.failureDistType, self.MTTF, self.MTTR, self.availability, self.id, self.repairman)
activate(MFailure,MFailure.run())
# initialize the internal Queue (type Resource) of the Machine # initialize the internal Queue (type Resource) of the Machine
self.Res=Resource(self.capacity) self.Res=Resource(self.capacity)
......
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