Commit 56833666 authored by Georgios Dagkakis's avatar Georgios Dagkakis

method to create a dict to post process results added

parent 643d8c93
...@@ -8,50 +8,48 @@ import xlrd ...@@ -8,50 +8,48 @@ import xlrd
from dream.plugins import plugin from dream.plugins import plugin
class DefaultTabularExit(plugin.OutputPreparationPlugin): class BatchesTabularQueues(plugin.OutputPreparationPlugin):
""" Output the exit stats in a tab """ Output the exit stats in a tab
""" """
def postprocess(self, data): def postprocess(self, data):
numberOfReplications=int(data['general']['numberOfReplications']) numberOfReplications=int(data['general']['numberOfReplications'])
confidenceLevel=float(data['general']['confidenceLevel']) confidenceLevel=float(data['general']['confidenceLevel'])
maxSimTime=float(data['general']['maxSimTime'])
if numberOfReplications==1: if numberOfReplications==1:
# create the titles of the columns # create the titles of the columns
data['result']['result_list'][0]['exit_output'] = [['Exit Id','Throughput', 'Takt Time', 'Lifespan']] data['result']['result_list'][-1]['buffer_output'] = [['Buffer','Final Value','Average',
'Std Dev','Min','Max',]]
# loop the results and search for elements that have 'Exit' as family # loop the results and search for elements that have 'Exit' as family
for record in data['result']['result_list'][0]['elementList']: for record in data['result']['result_list'][-1]['elementList']:
family=record.get('family',None) family=record.get('family',None)
# when found, add a row with the results of the specific exit # when found, add a row with the results of the specific exit
if family=='Exit': if family=='Buffer':
exitId=record['id'] bufferId=record['id']
throughput=record['results'].get('throughput','undefined') wip_stat_list=record['results']['wip_stat_list'][0]
taktTime=record['results'].get('takt_time','undefined') bufferLevels=[int(x[1]) for x in wip_stat_list]
lifespan=record['results'].get('lifespan','undefined') minLevel=min(bufferLevels)
data['result']['result_list'][0]['exit_output'].append([exitId,throughput,taktTime,lifespan]) maxLevel=max(bufferLevels)
self.createTimeListDict(wip_stat_list,maxSimTime)
elif numberOfReplications>1: elif numberOfReplications>1:
# create the titles of the columns # create the titles of the columns
data['result']['result_list'][0]['exit_output'] = [['Exit Id','','Throughput','' , '','Takt Time','','', 'Lifespan',''], pass
['','LB','AVG','RB','LB','AVG','RB','LB','AVG','RB']]
for record in data['result']['result_list'][0]['elementList']:
family=record.get('family',None)
# when found, add a row with the results of the specific exit
if family=='Exit':
exitId=record['id']
throughput=self.getConfidenceInterval(record['results'].get('throughput','undefined'),confidenceLevel)
taktTime=self.getConfidenceInterval(record['results'].get('takt_time','undefined'),confidenceLevel)
lifespan=self.getConfidenceInterval(record['results'].get('lifespan','undefined'),confidenceLevel)
data['result']['result_list'][0]['exit_output'].append([exitId,
throughput['lb'],throughput['avg'],throughput['ub'],
taktTime['lb'],taktTime['avg'],taktTime['ub'],
lifespan['lb'],lifespan['avg'],lifespan['ub']])
return data return data
def getConfidenceInterval(self, value_list, confidenceLevel): # takes the time list that ManPy outputs and creates a dict so that it is easier to get avg etc
from dream.KnowledgeExtraction.ConfidenceIntervals import Intervals def createTimeListDict(self, timeList,maxSimTime):
from dream.KnowledgeExtraction.StatisticalMeasures import BasicStatisticalMeasures timeListDict={}
BSM=BasicStatisticalMeasures() i=0
lb, ub = Intervals().ConfidIntervals(value_list, confidenceLevel) for record in timeList:
return {'lb': lb, time=record[0]
'ub': ub, level=int(record[1])
'avg': BSM.mean(value_list) try:
} nextTime=timeList[i+1][0]
\ No newline at end of file except IndexError:
nextTime=maxSimTime
i+=1
if not (level in timeListDict.keys()):
timeListDict[level]=0
timeListDict[level]+=nextTime-time
print timeListDict
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