def outputResultsJSON(self): from Globals import G from Globals import getConfidenceIntervals json = { '_class': 'Dream.%s' % self.__class__.__name__, 'id': self.id, 'family': self.family, 'results': {} } if(G.numberOfReplications==1): json['results']['throughput']=self.numOfExits if self.totalNumberOfUnitsExited!=self.numOfExits: #output this only if there was variability in units json['results']['unitsThroughput']=self.totalNumberOfUnitsExited if len(self.intervalThroughPutList): #output this only if there is an interval throughput #TODO - check how to output in stochastic cases json['results']['intervalThroughputList']=self.intervalThroughPutList json['results']['lifespan']=self.Lifespan[0] json['results']['takt_time']=self.TaktTime[0] else: # json['results']['throughput'] =self.Exits # json['results']['lifespan'] = self.Lifespan # json['results']['takt_time'] = self.TaktTime # if self.Exits!=self.UnitExits: #output this only if there was variability in units # json['results']['unitsThroughput'] = self.UnitExits json['results']['throughput'] = getConfidenceIntervals(self.Exits) json['results']['lifespan'] = getConfidenceIntervals(self.Lifespan) json['results']['takt_time'] = getConfidenceIntervals(self.TaktTime) if self.Exits!=self.UnitExits: #output this only if there was variability in units json['results']['unitsThroughput'] = getConfidenceIntervals(self.UnitExits) G.outputJSON['elementList'].append(json)
def outputResultsXL(self, MaxSimtime=None): from Globals import G from Globals import getConfidenceIntervals 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:") 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 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
def outputResultsJSON(self): from Globals import G from Globals import getConfidenceIntervals json = { '_class': 'Dream.%s' % self.__class__.__name__, 'id': self.id, 'family': self.family, 'results': {} } if(G.numberOfReplications==1): json['results']['throughput']=self.numOfExits if self.totalNumberOfUnitsExited!=self.numOfExits: #output this only if there was variability in units json['results']['unitsThroughput']=self.totalNumberOfUnitsExited if len(self.intervalThroughPutList): #output this only if there is an interval throughput #TODO - check how to output in stochastic cases json['results']['intervalThroughputList']=self.intervalThroughPutList json['results']['lifespan']=self.Lifespan[0] json['results']['takt_time']=self.TaktTime[0] else: # json['results']['throughput'] =self.Exits # json['results']['lifespan'] = self.Lifespan # json['results']['takt_time'] = self.TaktTime # if self.Exits!=self.UnitExits: #output this only if there was variability in units # json['results']['unitsThroughput'] = self.UnitExits json['results']['throughput'] = getConfidenceIntervals(self.Exits) json['results']['lifespan'] = getConfidenceIntervals(self.Lifespan) json['results']['takt_time'] = getConfidenceIntervals(self.TaktTime) if self.Exits!=self.UnitExits: #output this only if there was variability in units json['results']['unitsThroughput'] = getConfidenceIntervals(self.UnitExits) G.outputJSON['elementList'].append(json)
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
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
def outputResultsJSON(self): from Globals import G from Globals import getConfidenceIntervals json = {'_class': self.class_name, 'id': self.id, 'results': {}} if(G.numberOfReplications==1): json['results']['working_ratio']=100*self.totalWorkingTime/G.maxSimTime json['results']['waiting_ratio']=100*self.totalWaitingTime/G.maxSimTime else: json['results']['working_ratio'] = getConfidenceIntervals(self.Working) json['results']['waiting_ratio'] = getConfidenceIntervals(self.Waiting) G.outputJSON['elementList'].append(json)
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
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
def outputResultsJSON(self): from Globals import G from Globals import getConfidenceIntervals json = { '_class': 'Dream.%s' % self.__class__.__name__, 'id': self.id, 'family': self.family, 'results': {} } if (G.numberOfReplications == 1): json['results'][ 'working_ratio'] = 100 * self.totalWorkingTime / G.maxSimTime json['results'][ 'waiting_ratio'] = 100 * self.totalWaitingTime / G.maxSimTime #output the off-shift time only if there is any if self.totalOffShiftTime: json['results'][ 'off_shift_ratio'] = 100 * self.totalOffShiftTime / G.maxSimTime else: json['results']['working_ratio'] = getConfidenceIntervals( self.Working) json['results']['waiting_ratio'] = getConfidenceIntervals( self.Waiting) json['results']['off_shift_ratio'] = getConfidenceIntervals( self.OffShift) if self.ouputSchedule: if self.schedule: json['results']['schedule'] = [] for record in self.schedule: if len(record) == 3: json['results']['schedule'].append({ 'stationId': record[0].id, 'entranceTime': record[1], 'exitTime': record[2] }) else: json['results']['schedule'].append({ 'stationId': record[0].id, 'entranceTime': record[1] }) G.outputJSON['elementList'].append(json)
def outputResultsJSON(self): from Globals import G from Globals import getConfidenceIntervals json = {'_class': 'Dream.%s' % self.__class__.__name__, 'id': self.id, 'family': self.family, 'results': {}} if(G.numberOfReplications==1): json['results']['working_ratio']=100*self.totalWorkingTime/G.maxSimTime json['results']['waiting_ratio']=100*self.totalWaitingTime/G.maxSimTime #output the off-shift time only if there is any if self.totalOffShiftTime: json['results']['off_shift_ratio']=100*self.totalOffShiftTime/G.maxSimTime else: json['results']['working_ratio'] = getConfidenceIntervals(self.Working) json['results']['waiting_ratio'] = getConfidenceIntervals(self.Waiting) json['results']['off_shift_ratio'] = getConfidenceIntervals(self.OffShift) G.outputJSON['elementList'].append(json)
def outputResultsJSON(self): from Globals import G from Globals import getConfidenceIntervals json = {'_class': self.class_name, 'id': self.id, 'results': {}} if (G.numberOfReplications == 1): json['results'][ 'working_ratio'] = 100 * self.totalWorkingTime / G.maxSimTime json['results'][ 'blockage_ratio'] = 100 * self.totalBlockageTime / G.maxSimTime json['results'][ 'waiting_ratio'] = 100 * self.totalWaitingTime / G.maxSimTime else: json['results']['working_ratio'] = getConfidenceIntervals( self.Working) json['results']['blockage_ratio'] = getConfidenceIntervals( self.Blockage) json['results']['waiting_ratio'] = getConfidenceIntervals( self.Waiting) G.outputJSON['elementList'].append(json)
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
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, 'results': {} } if (G.numberOfReplications == 1): # if we had just one replication output the results as numbers json['results'][ 'failure_ratio'] = 100 * self.totalFailureTime / G.maxSimTime json['results'][ 'working_ratio'] = 100 * self.totalWorkingTime / G.maxSimTime json['results'][ 'blockage_ratio'] = 100 * self.totalBlockageTime / G.maxSimTime json['results'][ 'waiting_ratio'] = 100 * self.totalWaitingTime / G.maxSimTime #output the off-shift time only if there is any if self.totalOffShiftTime: json['results'][ 'off_shift_ratio'] = 100 * self.totalOffShiftTime / G.maxSimTime else: json['results']['failure_ratio'] = getConfidenceIntervals( self.Failure) json['results']['working_ratio'] = getConfidenceIntervals( self.Working) json['results']['blockage_ratio'] = getConfidenceIntervals( self.Blockage) json['results']['waiting_ratio'] = getConfidenceIntervals( self.Waiting) json['results']['off_shift_ratio'] = getConfidenceIntervals( self.OffShift) G.outputJSON['elementList'].append(json)