Commit 3c902673 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Sebastien Robin

all objects updated in order to output JSON also in multiple runs

parent 82ae41c1
...@@ -250,7 +250,46 @@ class Assembly(Process): ...@@ -250,7 +250,46 @@ class Assembly(Process):
json['results']['working_ratio']=100*self.totalWorkingTime/G.maxSimTime json['results']['working_ratio']=100*self.totalWorkingTime/G.maxSimTime
json['results']['blockage_ratio']=100*self.totalBlockageTime/G.maxSimTime json['results']['blockage_ratio']=100*self.totalBlockageTime/G.maxSimTime
json['results']['waiting_ratio']=100*self.totalWaitingTime/G.maxSimTime json['results']['waiting_ratio']=100*self.totalWaitingTime/G.maxSimTime
G.outputJSON['coreObject'].append(json) else: #if we had multiple replications we output confidence intervals to excel
#for some outputs the results may be the same for each run (eg model is stochastic but failures fixed
#so failurePortion will be exactly the same in each run). That will give 0 variability and errors.
#so for each output value we check if there was difference in the runs' results
#if yes we output the Confidence Intervals. if not we output just the fix value
json={}
json['_class'] = 'Dream.Assembly';
json['id'] = str(self.id)
json['results'] = {}
json['results']['working_ratio']={}
if self.checkIfArrayHasDifValues(self.Working):
json['results']['working_ratio']['min']=stat.bayes_mvs(self.Working, G.confidenceLevel)[0][1][0]
json['results']['working_ratio']['avg']=stat.bayes_mvs(self.Working, G.confidenceLevel)[0][0]
json['results']['working_ratio']['max']=stat.bayes_mvs(self.Working, G.confidenceLevel)[0][1][1]
else:
json['results']['working_ratio']['min']=self.Working[0]
json['results']['working_ratio']['avg']=self.Working[0]
json['results']['working_ratio']['max']=self.Working[0]
json['results']['blockage_ratio']={}
if self.checkIfArrayHasDifValues(self.Blockage):
json['results']['blockage_ratio']['min']=stat.bayes_mvs(self.Blockage, G.confidenceLevel)[0][1][0]
json['results']['blockage_ratio']['avg']=stat.bayes_mvs(self.Blockage, G.confidenceLevel)[0][0]
json['results']['blockage_ratio']['max']=stat.bayes_mvs(self.Blockage, G.confidenceLevel)[0][1][1]
else:
json['results']['blockage_ratio']['min']=self.Blockage[0]
json['results']['blockage_ratio']['avg']=self.Blockage[0]
json['results']['blockage_ratio']['max']=self.Blockage[0]
json['results']['waiting_ratio']={}
if self.checkIfArrayHasDifValues(self.Waiting):
json['results']['waiting_ratio']['min']=stat.bayes_mvs(self.Waiting, G.confidenceLevel)[0][1][0]
json['results']['waiting_ratio']['avg']=stat.bayes_mvs(self.Waiting, G.confidenceLevel)[0][0]
json['results']['waiting_ratio']['max']=stat.bayes_mvs(self.Waiting, G.confidenceLevel)[0][1][1]
else:
json['results']['waiting_ratio']['min']=self.Waiting[0]
json['results']['waiting_ratio']['avg']=self.Waiting[0]
json['results']['waiting_ratio']['max']=self.Waiting[0]
G.outputJSON['coreObject'].append(json)
#takes the array and checks if all its values are identical (returns false) or not (returns true) #takes the array and checks if all its values are identical (returns false) or not (returns true)
#needed because if somebody runs multiple runs in deterministic case it would crash! #needed because if somebody runs multiple runs in deterministic case it would crash!
......
...@@ -328,7 +328,43 @@ class Conveyer(Process): ...@@ -328,7 +328,43 @@ class Conveyer(Process):
json['results']['working_ratio']=100*self.totalWorkingTime/G.maxSimTime json['results']['working_ratio']=100*self.totalWorkingTime/G.maxSimTime
json['results']['blockage_ratio']=100*self.totalBlockageTime/G.maxSimTime json['results']['blockage_ratio']=100*self.totalBlockageTime/G.maxSimTime
json['results']['waiting_ratio']=100*self.totalWaitingTime/G.maxSimTime json['results']['waiting_ratio']=100*self.totalWaitingTime/G.maxSimTime
G.outputJSON['coreObject'].append(json) else: #if we had multiple replications we output confidence intervals to excel
#for some outputs the results may be the same for each run (eg model is stochastic but failures fixed
#so failurePortion will be exactly the same in each run). That will give 0 variability and errors.
#so for each output value we check if there was difference in the runs' results
#if yes we output the Confidence Intervals. if not we output just the fix value
json={}
json['_class'] = 'Dream.Conveyer';
json['id'] = str(self.id)
json['results'] = {}
json['results']['working_ratio']={}
if self.checkIfArrayHasDifValues(self.Working):
json['results']['working_ratio']['min']=stat.bayes_mvs(self.Working, G.confidenceLevel)[0][1][0]
json['results']['working_ratio']['avg']=stat.bayes_mvs(self.Working, G.confidenceLevel)[0][0]
json['results']['working_ratio']['max']=stat.bayes_mvs(self.Working, G.confidenceLevel)[0][1][1]
else:
json['results']['working_ratio']['min']=self.Working[0]
json['results']['working_ratio']['avg']=self.Working[0]
json['results']['working_ratio']['max']=self.Working[0]
json['results']['blockage_ratio']={}
if self.checkIfArrayHasDifValues(self.Blockage):
json['results']['blockage_ratio']['min']=stat.bayes_mvs(self.Blockage, G.confidenceLevel)[0][1][0]
json['results']['blockage_ratio']['avg']=stat.bayes_mvs(self.Blockage, G.confidenceLevel)[0][0]
json['results']['blockage_ratio']['max']=stat.bayes_mvs(self.Blockage, G.confidenceLevel)[0][1][1]
else:
json['results']['blockage_ratio']['min']=self.Blockage[0]
json['results']['blockage_ratio']['avg']=self.Blockage[0]
json['results']['blockage_ratio']['max']=self.Blockage[0]
json['results']['waiting_ratio']={}
if self.checkIfArrayHasDifValues(self.Waiting):
json['results']['waiting_ratio']['min']=stat.bayes_mvs(self.Waiting, G.confidenceLevel)[0][1][0]
json['results']['waiting_ratio']['avg']=stat.bayes_mvs(self.Waiting, G.confidenceLevel)[0][0]
json['results']['waiting_ratio']['max']=stat.bayes_mvs(self.Waiting, G.confidenceLevel)[0][1][1]
else:
json['results']['waiting_ratio']['min']=self.Waiting[0]
json['results']['waiting_ratio']['avg']=self.Waiting[0]
json['results']['waiting_ratio']['max']=self.Waiting[0]
G.outputJSON['coreObject'].append(json)
#takes the array and checks if all its values are identical (returns false) or not (returns true) #takes the array and checks if all its values are identical (returns false) or not (returns true)
#needed because if somebody runs multiple runs in deterministic case it would crash! #needed because if somebody runs multiple runs in deterministic case it would crash!
......
...@@ -284,7 +284,44 @@ class Dismantle(Process): ...@@ -284,7 +284,44 @@ class Dismantle(Process):
json['results']['working_ratio']=100*self.totalWorkingTime/G.maxSimTime json['results']['working_ratio']=100*self.totalWorkingTime/G.maxSimTime
json['results']['blockage_ratio']=100*self.totalBlockageTime/G.maxSimTime json['results']['blockage_ratio']=100*self.totalBlockageTime/G.maxSimTime
json['results']['waiting_ratio']=100*self.totalWaitingTime/G.maxSimTime json['results']['waiting_ratio']=100*self.totalWaitingTime/G.maxSimTime
G.outputJSON['coreObject'].append(json) else: #if we had multiple replications we output confidence intervals to excel
#for some outputs the results may be the same for each run (eg model is stochastic but failures fixed
#so failurePortion will be exactly the same in each run). That will give 0 variability and errors.
#so for each output value we check if there was difference in the runs' results
#if yes we output the Confidence Intervals. if not we output just the fix value
json={}
json['_class'] = 'Dream.Dismantle';
json['id'] = str(self.id)
json['results'] = {}
json['results']['working_ratio']={}
if self.checkIfArrayHasDifValues(self.Working):
json['results']['working_ratio']['min']=stat.bayes_mvs(self.Working, G.confidenceLevel)[0][1][0]
json['results']['working_ratio']['avg']=stat.bayes_mvs(self.Working, G.confidenceLevel)[0][0]
json['results']['working_ratio']['max']=stat.bayes_mvs(self.Working, G.confidenceLevel)[0][1][1]
else:
json['results']['working_ratio']['min']=self.Working[0]
json['results']['working_ratio']['avg']=self.Working[0]
json['results']['working_ratio']['max']=self.Working[0]
json['results']['blockage_ratio']={}
if self.checkIfArrayHasDifValues(self.Blockage):
json['results']['blockage_ratio']['min']=stat.bayes_mvs(self.Blockage, G.confidenceLevel)[0][1][0]
json['results']['blockage_ratio']['avg']=stat.bayes_mvs(self.Blockage, G.confidenceLevel)[0][0]
json['results']['blockage_ratio']['max']=stat.bayes_mvs(self.Blockage, G.confidenceLevel)[0][1][1]
else:
json['results']['blockage_ratio']['min']=self.Blockage[0]
json['results']['blockage_ratio']['avg']=self.Blockage[0]
json['results']['blockage_ratio']['max']=self.Blockage[0]
json['results']['waiting_ratio']={}
if self.checkIfArrayHasDifValues(self.Waiting):
json['results']['waiting_ratio']['min']=stat.bayes_mvs(self.Waiting, G.confidenceLevel)[0][1][0]
json['results']['waiting_ratio']['avg']=stat.bayes_mvs(self.Waiting, G.confidenceLevel)[0][0]
json['results']['waiting_ratio']['max']=stat.bayes_mvs(self.Waiting, G.confidenceLevel)[0][1][1]
else:
json['results']['waiting_ratio']['min']=self.Waiting[0]
json['results']['waiting_ratio']['avg']=self.Waiting[0]
json['results']['waiting_ratio']['max']=self.Waiting[0]
G.outputJSON['coreObject'].append(json)
#takes the array and checks if all its values are identical (returns false) or not (returns true) #takes the array and checks if all its values are identical (returns false) or not (returns true)
#needed because if somebody runs multiple runs in deterministic case it would crash! #needed because if somebody runs multiple runs in deterministic case it would crash!
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"_class": "Dream.Configuration", "_class": "Dream.Configuration",
"numberOfReplications": "10", "numberOfReplications": "10",
"maxSimTime": "1440", "maxSimTime": "1440",
"trace": "Yes", "trace": "No",
"confidenceLevel": "0.95" "confidenceLevel": "0.95"
}, },
"modelResource": [ "modelResource": [
......
{"_class": "Dream.Simulation", {"_class": "Dream.Simulation",
"general": { "general": {
"_class": "Dream.Configuration", "_class": "Dream.Configuration",
"numberOfReplications": "1", "numberOfReplications": "10",
"maxSimTime": "1440", "maxSimTime": "1440",
"trace": "Yes", "trace": "No",
"confidenceLevel": "0.95" "confidenceLevel": "0.95"
}, },
"modelResource": [ "modelResource": [
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
"interarrivalTime": "interarrivalTime":
{ {
"distributionType": "Fixed", "distributionType": "Fixed",
"mean": "2" "mean": "2"
}, },
"entity": "Frame", "entity": "Frame",
"successorList": ["Α1"] "successorList": ["Α1"]
...@@ -34,10 +34,14 @@ ...@@ -34,10 +34,14 @@
{"_class": "Dream.Assembly", {"_class": "Dream.Assembly",
"id": "A1", "id": "A1",
"name": "Assembly", "name": "Assembly",
"processingTime": { "processingTime":
"distributionType": "Fixed", {
"mean": "2" "distributionType": "Normal",
}, "mean": "2",
"stdev": "0.8",
"min": "1",
"max": "4"
},
"predecessorPartList": ["S1"], "predecessorPartList": ["S1"],
"predecessorFrameList": ["S2"], "predecessorFrameList": ["S2"],
"successorList": ["M1"] "successorList": ["M1"]
......
{"_class": "Dream.Simulation", {"_class": "Dream.Simulation",
"general": { "general": {
"_class": "Dream.Configuration", "_class": "Dream.Configuration",
"numberOfReplications": "1", "numberOfReplications": "8",
"maxSimTime": "1440", "maxSimTime": "1440",
"trace": "Yes", "trace": "No",
"confidenceLevel": "0.95" "confidenceLevel": "0.95"
}, },
"modelResource": [ "modelResource": [
...@@ -62,8 +62,11 @@ ...@@ -62,8 +62,11 @@
"id": "D1", "id": "D1",
"name": "Dismantle", "name": "Dismantle",
"processingTime": { "processingTime": {
"distributionType": "Fixed", "distributionType": "Normal",
"mean": "1" "mean": "1",
"stdev": "0.3",
"min": "0.1",
"max": "4"
}, },
"successorPartList": ["E2"], "successorPartList": ["E2"],
"successorFrameList": ["E1"], "successorFrameList": ["E1"],
......
{"_class": "Dream.Simulation", {"_class": "Dream.Simulation",
"general": { "general": {
"_class": "Dream.Configuration", "_class": "Dream.Configuration",
"numberOfReplications": "1", "numberOfReplications": "5",
"maxSimTime": "1440", "maxSimTime": "1440",
"trace": "Yes", "trace": "No",
"confidenceLevel": "0.95" "confidenceLevel": "0.95"
}, },
"modelResource": [ "modelResource": [
...@@ -45,8 +45,11 @@ ...@@ -45,8 +45,11 @@
"id": "M2", "id": "M2",
"name": "Machine2", "name": "Machine2",
"processingTime": { "processingTime": {
"distributionType": "Fixed", "distributionType": "Normal",
"mean": "1.5" "mean": "1.5",
"stdev": "0.3",
"min": "0.1",
"max": "4"
}, },
"failures":{ "failures":{
"failureDistribution": "Fixed", "failureDistribution": "Fixed",
......
...@@ -141,7 +141,7 @@ def createObjects(): ...@@ -141,7 +141,7 @@ def createObjects():
mean=float(processingTime.get('mean', '0')) mean=float(processingTime.get('mean', '0'))
stdev=float(processingTime.get('stdev', '0')) stdev=float(processingTime.get('stdev', '0'))
min=float(processingTime.get('min', '0')) min=float(processingTime.get('min', '0'))
max=float(processingTime.get('stdev', '0')) max=float(processingTime.get('max', '0'))
predecessorPartList=core_object.get('predecessorPartList', 'not found') predecessorPartList=core_object.get('predecessorPartList', 'not found')
predecessorFrameList=core_object.get('predecessorFrameList', 'not found') predecessorFrameList=core_object.get('predecessorFrameList', 'not found')
successorList=core_object.get('successorList', 'not found') successorList=core_object.get('successorList', 'not found')
...@@ -160,7 +160,7 @@ def createObjects(): ...@@ -160,7 +160,7 @@ def createObjects():
mean=float(processingTime.get('mean', '0')) mean=float(processingTime.get('mean', '0'))
stdev=float(processingTime.get('stdev', '0')) stdev=float(processingTime.get('stdev', '0'))
min=float(processingTime.get('min', '0')) min=float(processingTime.get('min', '0'))
max=float(processingTime.get('stdev', '0')) max=float(processingTime.get('max', '0'))
successorPartList=core_object.get('successorPartList', 'not found') successorPartList=core_object.get('successorPartList', 'not found')
successorFrameList=core_object.get('successorFrameList', 'not found') successorFrameList=core_object.get('successorFrameList', 'not found')
predecessorList=core_object.get('predecessorList', 'not found') predecessorList=core_object.get('predecessorList', 'not found')
......
...@@ -94,7 +94,35 @@ class Repairman(object): ...@@ -94,7 +94,35 @@ class Repairman(object):
json['results'] = {} json['results'] = {}
json['results']['working_ratio']=100*self.totalWorkingTime/G.maxSimTime json['results']['working_ratio']=100*self.totalWorkingTime/G.maxSimTime
json['results']['waiting_ratio']=100*self.totalWaitingTime/G.maxSimTime json['results']['waiting_ratio']=100*self.totalWaitingTime/G.maxSimTime
G.outputJSON['modelResource'].append(json) else: #if we had multiple replications we output confidence intervals to excel
#for some outputs the results may be the same for each run (eg model is stochastic but failures fixed
#so failurePortion will be exactly the same in each run). That will give 0 variability and errors.
#so for each output value we check if there was difference in the runs' results
#if yes we output the Confidence Intervals. if not we output just the fix value
json={}
json['_class'] = 'Dream.Repairman';
json['id'] = str(self.id)
json['results'] = {}
json['results']['working_ratio']={}
if self.checkIfArrayHasDifValues(self.Working):
json['results']['working_ratio']['min']=stat.bayes_mvs(self.Working, G.confidenceLevel)[0][1][0]
json['results']['working_ratio']['avg']=stat.bayes_mvs(self.Working, G.confidenceLevel)[0][0]
json['results']['working_ratio']['max']=stat.bayes_mvs(self.Working, G.confidenceLevel)[0][1][1]
else:
json['results']['working_ratio']['min']=self.Working[0]
json['results']['working_ratio']['avg']=self.Working[0]
json['results']['working_ratio']['max']=self.Working[0]
json['results']['waiting_ratio']={}
if self.checkIfArrayHasDifValues(self.Waiting):
json['results']['waiting_ratio']['min']=stat.bayes_mvs(self.Waiting, G.confidenceLevel)[0][1][0]
json['results']['waiting_ratio']['avg']=stat.bayes_mvs(self.Waiting, G.confidenceLevel)[0][0]
json['results']['waiting_ratio']['max']=stat.bayes_mvs(self.Waiting, G.confidenceLevel)[0][1][1]
else:
json['results']['waiting_ratio']['min']=self.Waiting[0]
json['results']['waiting_ratio']['avg']=self.Waiting[0]
json['results']['waiting_ratio']['max']=self.Waiting[0]
G.outputJSON['coreObject'].append(json)
#takes the array and checks if all its values are identical (returns false) or not (returns true) #takes the array and checks if all its values are identical (returns false) or not (returns true)
#needed because if somebody runs multiple runs in deterministic case it would crash! #needed because if somebody runs multiple runs in deterministic case it would crash!
......
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