Commit ba373891 authored by Georgios Dagkakis's avatar Georgios Dagkakis

outputResultXL and getConfidenceInterval removed, they should both be post processing

parent b8b90acf
......@@ -383,53 +383,12 @@ class Assembly(CoreObject):
activeObjectQueue.append(entity) #get the frame and append it to the internal queue
#===========================================================================
# outputs data to "output.xls"
#===========================================================================
def outputResultsXL(self, MaxSimtime=None):
from Globals import G
from Globals import getConfidenceIntervals
if MaxSimtime==None:
MaxSimtime=G.maxSimTime
if(G.numberOfReplications==1): #if we had just one replication output the results to excel
G.outputSheet.write(G.outputIndex,0, "The percentage of Working of "+self.objName +" is:")
G.outputSheet.write(G.outputIndex,1,100*self.totalWorkingTime/MaxSimtime)
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "The percentage of Blockage of "+self.objName +" is:")
G.outputSheet.write(G.outputIndex,1,100*self.totalBlockageTime/MaxSimtime)
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "The percentage of Waiting of "+self.objName +" is:")
G.outputSheet.write(G.outputIndex,1,100*self.totalWaitingTime/MaxSimtime)
G.outputIndex+=1
else:
G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the mean percentage of Working of "+ self.objName+" is:")
working_ci = getConfidenceIntervals(self.Working)
G.outputSheet.write(G.outputIndex, 1, working_ci['min'])
G.outputSheet.write(G.outputIndex, 2, working_ci['avg'])
G.outputSheet.write(G.outputIndex, 3, working_ci['max'])
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the mean percentage of Blockage of "+ self.objName+" is:")
blockage_ci = getConfidenceIntervals(self.Blockage)
G.outputSheet.write(G.outputIndex, 1, blockage_ci['min'])
G.outputSheet.write(G.outputIndex, 2, blockage_ci['avg'])
G.outputSheet.write(G.outputIndex, 3, blockage_ci['max'])
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the mean percentage of Waiting of "+ self.objName+" is:")
waiting_ci = getConfidenceIntervals(self.Waiting)
G.outputSheet.write(G.outputIndex, 1, waiting_ci['min'])
G.outputSheet.write(G.outputIndex, 2, waiting_ci['avg'])
G.outputSheet.write(G.outputIndex, 3, waiting_ci['max'])
G.outputIndex+=1
G.outputIndex+=1
#===========================================================================
# outputs results to JSON File
#===========================================================================
def outputResultsJSON(self):
from Globals import G
from Globals import getConfidenceIntervals
json = {'_class': self.class_name,
'id': self.id,
'results': {}}
......
......@@ -336,7 +336,6 @@ class BatchReassembly(CoreObject):
def outputResultsJSON(self):
if self.outputResults:
from Globals import G
from Globals import getConfidenceIntervals
json = {'_class': 'Dream.%s' % self.__class__.__name__,
'id': self.id,
'family': self.family,
......
......@@ -442,57 +442,11 @@ class Conveyer(CoreObject):
self.Working.append(100*self.totalWorkingTime/MaxSimtime)
self.Blockage.append(100*self.totalBlockageTime/MaxSimtime)
#===========================================================================
# outputs data to "output.xls"
#===========================================================================
def outputResultsXL(self, MaxSimtime=None):
from Globals import G
from Globals import getConfidenceIntervals
if MaxSimtime==None:
MaxSimtime=G.maxSimTime
if(G.numberOfReplications==1): #if we had just one replication output the results to excel
G.outputSheet.write(G.outputIndex,0, "The percentage of Working of "+self.objName +" is:")
G.outputSheet.write(G.outputIndex,1,100*self.totalWorkingTime/MaxSimtime)
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "The percentage of Blockage of "+self.objName +" is:")
G.outputSheet.write(G.outputIndex,1,100*self.totalBlockageTime/MaxSimtime)
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "The percentage of Waiting of "+self.objName +" is:")
G.outputSheet.write(G.outputIndex,1,100*self.totalWaitingTime/MaxSimtime)
G.outputIndex+=1
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
G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the mean percentage of Working of "+self.objName +" is:")
working_ci = getConfidenceIntervals(self.Working)
G.outputSheet.write(G.outputIndex, 1, working_ci['min'])
G.outputSheet.write(G.outputIndex, 2, working_ci['avg'])
G.outputSheet.write(G.outputIndex, 3, working_ci['max'])
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the mean percentage of Blockage of "+ self.objName+" is:")
blockage_ci = getConfidenceIntervals(self.Blockage)
G.outputSheet.write(G.outputIndex, 1, blockage_ci['min'])
G.outputSheet.write(G.outputIndex, 2, blockage_ci['avg'])
G.outputSheet.write(G.outputIndex, 3, blockage_ci['max'])
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the mean percentage of Waiting of "+ self.objName+" is:")
waiting_ci = getConfidenceIntervals(self.Waiting)
G.outputSheet.write(G.outputIndex, 1, waiting_ci['min'])
G.outputSheet.write(G.outputIndex, 2, waiting_ci['avg'])
G.outputSheet.write(G.outputIndex, 3, waiting_ci['max'])
G.outputIndex+=1
G.outputIndex+=1
#===========================================================================
# outputs results to JSON File
#===========================================================================
def outputResultsJSON(self):
from Globals import G
from Globals import getConfidenceIntervals
json = {'_class': self.class_name,
'id': self.id,
'results': {}}
......
......@@ -661,13 +661,6 @@ class CoreObject(ManPyObject):
activeObject.SettingUp.append(100*self.totalSetupTime/MaxSimtime)
activeObject.OffShift.append(100*self.totalOffShiftTime/MaxSimtime)
# =======================================================================
# outputs data to "output.xls"
# =======================================================================
def outputResultsXL(self, MaxSimtime=None):
pass
# =======================================================================
# outputs results to JSON File
# =======================================================================
......
......@@ -320,53 +320,12 @@ class Dismantle(CoreObject):
G.sheetIndex+=1
G.traceSheet=G.traceFile.add_sheet('sheet '+str(G.sheetIndex), cell_overwrite_ok=True)
#===========================================================================
# outputs data to "output.xls"
#===========================================================================
def outputResultsXL(self, MaxSimtime=None):
from Globals import G
from Globals import getConfidenceIntervals
if MaxSimtime==None:
MaxSimtime=G.maxSimTime
if(G.numberOfReplications==1): #if we had just one replication output the results to excel
G.outputSheet.write(G.outputIndex,0, "The percentage of Working of "+self.objName +" is:")
G.outputSheet.write(G.outputIndex,1,100*self.totalWorkingTime/MaxSimtime)
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "The percentage of Blockage of "+self.objName +" is:")
G.outputSheet.write(G.outputIndex,1,100*self.totalBlockageTime/MaxSimtime)
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "The percentage of Waiting of "+self.objName +" is:")
G.outputSheet.write(G.outputIndex,1,100*self.totalWaitingTime/MaxSimtime)
G.outputIndex+=1
else:
G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the mean percentage of Working of "+ self.objName+" is:")
working_ci = getConfidenceIntervals(self.Working)
G.outputSheet.write(G.outputIndex, 1, working_ci['min'])
G.outputSheet.write(G.outputIndex, 2, working_ci['avg'])
G.outputSheet.write(G.outputIndex, 3, working_ci['max'])
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the mean percentage of Blockage of "+ self.objName+" is:")
blockage_ci = getConfidenceIntervals(self.Blockage)
G.outputSheet.write(G.outputIndex, 1, blockage_ci['min'])
G.outputSheet.write(G.outputIndex, 2, blockage_ci['avg'])
G.outputSheet.write(G.outputIndex, 3, blockage_ci['max'])
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the mean percentage of Waiting of "+ self.objName+" is:")
waiting_ci = getConfidenceIntervals(self.Waiting)
G.outputSheet.write(G.outputIndex, 1, waiting_ci['min'])
G.outputSheet.write(G.outputIndex, 2, waiting_ci['avg'])
G.outputSheet.write(G.outputIndex, 3, waiting_ci['max'])
G.outputIndex+=1
G.outputIndex+=1
#===========================================================================
# outputs results to JSON File
#===========================================================================
def outputResultsJSON(self):
from Globals import G
from Globals import getConfidenceIntervals
json = {'_class': self.class_name,
'id': self.id,
'results': {}}
......
......@@ -162,61 +162,10 @@ class Exit(CoreObject):
self.TaktTime.append(0)
# =======================================================================
# outputs data to "output.xls"
# =======================================================================
def outputResultsXL(self, MaxSimtime=None):
from Globals import G
from Globals import getConfidenceIntervals
if MaxSimtime==None:
MaxSimtime=G.maxSimTime
if(G.numberOfReplications==1): #if we had just one replication output the results to excel
G.outputSheet.write(G.outputIndex,0, "The Throughput in " +self.objName + " is:")
G.outputSheet.write(G.outputIndex,1,self.numOfExits)
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "The average lifespan of an entity that exited from "+ self.objName +" is:")
try:
G.outputSheet.write(G.outputIndex,1,((self.totalLifespan)/self.numOfExits)/G.Base)
except ZeroDivisionError:
G.outputSheet.write(G.outputIndex,1,0)
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "The average takt time in "+ self.objName +" is:")
try:
G.outputSheet.write(G.outputIndex,1,((self.totalTaktTime)/self.numOfExits)/G.Base)
except ZeroDivisionError:
G.outputSheet.write(G.outputIndex,1,0)
G.outputIndex+=1
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
G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the mean Throughput in " +self.objName + " is:")
throughput_ci = getConfidenceIntervals(self.Exits)
G.outputSheet.write(G.outputIndex, 1, throughput_ci['min'])
G.outputSheet.write(G.outputIndex, 2, throughput_ci['avg'])
G.outputSheet.write(G.outputIndex, 3, throughput_ci['max'])
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the mean Lifespan of an entity that exited from "+ self.objName + " is:")
lifespan_ci = getConfidenceIntervals(self.Lifespan)
G.outputSheet.write(G.outputIndex, 1, lifespan_ci['min'])
G.outputSheet.write(G.outputIndex, 2, lifespan_ci['avg'])
G.outputSheet.write(G.outputIndex, 3, lifespan_ci['max'])
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the avg takt time in "+ self.objName + " is:")
takt_time_ci = getConfidenceIntervals(self.TaktTime)
G.outputSheet.write(G.outputIndex, 1, takt_time_ci['min'])
G.outputSheet.write(G.outputIndex, 2, takt_time_ci['avg'])
G.outputSheet.write(G.outputIndex, 3, takt_time_ci['max'])
G.outputIndex+=1
G.outputIndex+=1
# =======================================================================
# outputs results to JSON File
# =======================================================================
def outputResultsJSON(self):
from Globals import G
from Globals import getConfidenceIntervals
json = { '_class': 'Dream.%s' % self.__class__.__name__,
'id': self.id,
'family': self.family,
......
......@@ -306,24 +306,6 @@ def countIntervalThroughput(**kw):
currentExited+=totalExited-previouslyExited
obj.intervalThroughPutList.append(currentExited)
# =======================================================================
# Helper function to calculate the confidence intervals of a serie.
# =======================================================================
def getConfidenceIntervals(value_list):
from Globals import G
if len(set(value_list)) == 1:
# All values are same, no need to perform statistical analysis
return { 'lb': value_list[0],
'ub': value_list[0],
'avg': value_list[0], }
from dream.KnowledgeExtraction.ConfidenceIntervals import Intervals
from dream.KnowledgeExtraction.StatisticalMeasures import BasicStatisticalMeasures
BSM=BasicStatisticalMeasures()
lb, ub = Intervals().ConfidIntervals(value_list, G.confidenceLevel)
return {'lb': lb,
'ub': ub,
'avg': BSM.mean(value_list) }
# #===========================================================================
# # printTrace
......
......@@ -1171,70 +1171,12 @@ class Machine(CoreObject):
# =======================================================================
def isOperated(self):
return self.toBeOperated
# =======================================================================
# outputs the the "output.xls"
# =======================================================================
def outputResultsXL(self, MaxSimtime=None):
from Globals import G
from Globals import getConfidenceIntervals
if MaxSimtime==None:
MaxSimtime=G.maxSimTime
if(G.numberOfReplications==1): #if we had just one replication output the results to excel
G.outputSheet.write(G.outputIndex,0, "The percentage of Failure of " +self.objName+ " is:")
G.outputSheet.write(G.outputIndex,1,100*self.totalFailureTime/MaxSimtime)
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "The percentage of Working of " +self.objName+ " is:")
G.outputSheet.write(G.outputIndex,1,100*self.totalWorkingTime/MaxSimtime)
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "The percentage of Blockage of " +self.objName+ " is:")
G.outputSheet.write(G.outputIndex,1,100*self.totalBlockageTime/MaxSimtime)
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "The percentage of Waiting of " +self.objName+ " is:")
G.outputSheet.write(G.outputIndex,1,100*self.totalWaitingTime/MaxSimtime)
G.outputIndex+=1
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
G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the mean percentage of Failure of "+ self.objName+" is:")
failure_ci = getConfidenceIntervals(self.Failure)
G.outputSheet.write(G.outputIndex, 1, failure_ci['min'])
G.outputSheet.write(G.outputIndex, 2, failure_ci['avg'])
G.outputSheet.write(G.outputIndex, 3, failure_ci['max'])
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the mean percentage of Working of "+ self.objName+" is:")
working_ci = getConfidenceIntervals(self.Working)
G.outputSheet.write(G.outputIndex, 1, working_ci['min'])
G.outputSheet.write(G.outputIndex, 2, working_ci['avg'])
G.outputSheet.write(G.outputIndex, 3, working_ci['max'])
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the mean percentage of Blockage of "+ self.objName+" is:")
blockage_ci = getConfidenceIntervals(self.Blockage)
G.outputSheet.write(G.outputIndex, 1, blockage_ci['min'])
G.outputSheet.write(G.outputIndex, 2, blockage_ci['avg'])
G.outputSheet.write(G.outputIndex, 3, blockage_ci['max'])
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the mean percentage of Waiting of "+ self.objName+" is:")
waiting_ci = getConfidenceIntervals(self.Waiting)
G.outputSheet.write(G.outputIndex, 1, waiting_ci['min'])
G.outputSheet.write(G.outputIndex, 2, waiting_ci['avg'])
G.outputSheet.write(G.outputIndex, 3, waiting_ci['max'])
G.outputIndex+=1
G.outputIndex+=1
# =======================================================================
# outputs results to JSON File
# =======================================================================
def outputResultsJSON(self):
from Globals import G
from Globals import getConfidenceIntervals
json = {'_class': 'Dream.%s' % self.__class__.__name__,
'id': self.id,
'family': self.family,
......
......@@ -167,13 +167,7 @@ class ManPyObject(object):
#===========================================================================
def postProcessing(self):
pass
# =======================================================================
# outputs data to "output.xls"
# =======================================================================
def outputResultsXL(self, MaxSimtime=None):
pass
# =======================================================================
# outputs results to JSON File
# =======================================================================
......
......@@ -270,56 +270,12 @@ class Operator(ObjectResource):
self.Waiting.append(100*self.totalWaitingTime/MaxSimtime)
self.Working.append(100*self.totalWorkingTime/MaxSimtime)
self.OffShift.append(100*self.totalOffShiftTime/MaxSimtime)
# =======================================================================
# outputs data to "output.xls"
# =======================================================================
def outputResultsXL(self, MaxSimtime=None):
from Globals import G
if MaxSimtime==None:
MaxSimtime=G.maxSimTime
# if we had just one replication output the results to excel
if(G.numberOfReplications==1):
G.outputSheet.write(G.outputIndex,0, "The percentage of working of "+self.objName +" is:")
G.outputSheet.write(G.outputIndex,1,100*self.totalWorkingTime/MaxSimtime)
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "The percentage of waiting of "+self.objName +" is:")
G.outputSheet.write(G.outputIndex,1,100*self.totalWaitingTime/MaxSimtime)
G.outputIndex+=1
#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
else:
G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the mean percentage of Working of "+self.objName +" is:")
if self.checkIfArrayHasDifValues(self.Working):
G.outputSheet.write(G.outputIndex,1,stat.bayes_mvs(self.Working, G.confidenceLevel)[0][1][0])
G.outputSheet.write(G.outputIndex,2,stat.bayes_mvs(self.Working, G.confidenceLevel)[0][0])
G.outputSheet.write(G.outputIndex,3,stat.bayes_mvs(self.Working, G.confidenceLevel)[0][1][1])
else:
G.outputSheet.write(G.outputIndex,1,self.Working[0])
G.outputSheet.write(G.outputIndex,2,self.Working[0])
G.outputSheet.write(G.outputIndex,3,self.Working[0])
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the mean percentage of Waiting of "+self.objName +" is:")
if self.checkIfArrayHasDifValues(self.Waiting):
G.outputSheet.write(G.outputIndex,1,stat.bayes_mvs(self.Waiting, G.confidenceLevel)[0][1][0])
G.outputSheet.write(G.outputIndex,2,stat.bayes_mvs(self.Waiting, G.confidenceLevel)[0][0])
G.outputSheet.write(G.outputIndex,3,stat.bayes_mvs(self.Waiting, G.confidenceLevel)[0][1][1])
else:
G.outputSheet.write(G.outputIndex,1,self.Waiting[0])
G.outputSheet.write(G.outputIndex,2,self.Waiting[0])
G.outputSheet.write(G.outputIndex,3,self.Waiting[0])
G.outputIndex+=1
G.outputIndex+=1
# =======================================================================
# outputs results to JSON File
# =======================================================================
def outputResultsJSON(self):
from Globals import G
from Globals import getConfidenceIntervals
json = {'_class': 'Dream.%s' % self.__class__.__name__,
'id': self.id,
'family': self.family,
......
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