@@ -27,6 +27,8 @@ from ReplaceMissingValues import HandleMissingValues
fromDistributionFittingimportDistributions
fromDistributionFittingimportDistFittest
fromExcelOutputimportOutput
fromJSONOutputimportJSONOutput
importdream.simulation.LineGenerationJSONasManPyMain#import ManPy main JSON script
importxlrd
importjson
...
...
@@ -59,29 +61,20 @@ D = DistFittest() #Call the DistFittest object
ProcTime_dist=D.ks_test(ProcTime)
MTTF_dist=C.Exponential_distrfit(MTTF)
MTTR_dist=C.Exponential_distrfit(MTTR)
#================================= Output preparation: output the updated values in the JSON file of this example =========================================================#
jsonFile=open('JSON_AssembleDismantle.json','r')#It opens the JSON file
data=json.load(jsonFile)#It loads the file
jsonFile.close()
nodes=data.get('nodes',[])#It creates a variable that holds the 'nodes' dictionary
forelementinnodes:
processingTime=nodes[element].get('processingTime',{})#It creates a variable that gets the element attribute 'processingTime'
MTTF_Nodes=nodes[element].get('MTTF',{})#It creates a variable that gets the element attribute 'MTTF'
MTTR_Nodes=nodes[element].get('MTTR',{})#It creates a variable that gets the element attribute 'MTTR'
ifelement=='M1':
nodes['M1']['processingTime']=ProcTime_dist#It checks using if syntax if the element is 'M1'
jsonFile=open('JSON_AssembleDismantle_Output.json',"w")#It opens the JSON file
jsonFile.write(json.dumps(data,indent=True))#It writes the updated data to the JSON file
jsonFile.close()#It closes the file
jsonFile=open('JSON_AssembleDismantle_Output.json',"w")#It opens the JSON file
jsonFile.write(json.dumps(data2,indent=True))#It writes the updated data to the JSON file
jsonFile.close()#It closes the file
#================================ Calling the ExcelOutput object, outputs the outcomes of the statistical analysis in xls files =============================================#