Commit bb621d9c authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Sebastien Robin

postprocessing and outputresultsxls updated so that maxSimTime is optional

parent 635f593b
...@@ -211,7 +211,10 @@ class Assembly(CoreObject): ...@@ -211,7 +211,10 @@ class Assembly(CoreObject):
self.timeLastEntityEntered=now() self.timeLastEntityEntered=now()
#actions to be taken after the simulation ends #actions to be taken after the simulation ends
def postProcessing(self, MaxSimtime): def postProcessing(self, MaxSimtime=None):
if MaxSimtime==None:
from Globals import G
MaxSimtime=G.maxSimTime
activeObjectQueue=self.getActiveObjectQueue() activeObjectQueue=self.getActiveObjectQueue()
#checks all the successors. If no one can accept an Entity then the machine might be blocked #checks all the successors. If no one can accept an Entity then the machine might be blocked
...@@ -253,8 +256,10 @@ class Assembly(CoreObject): ...@@ -253,8 +256,10 @@ class Assembly(CoreObject):
#outputs data to "output.xls" #outputs data to "output.xls"
def outputResultsXL(self, MaxSimtime): def outputResultsXL(self, MaxSimtime=None):
from Globals import G from Globals import G
if MaxSimtime==None:
MaxSimtime=G.maxSimTime
if(G.numberOfReplications==1): #if we had just one replication output the results to excel 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,0, "The percentage of Working of "+self.objName +" is:")
G.outputSheet.write(G.outputIndex,1,100*self.totalWorkingTime/MaxSimtime) G.outputSheet.write(G.outputIndex,1,100*self.totalWorkingTime/MaxSimtime)
......
...@@ -272,7 +272,10 @@ class Conveyer(CoreObject): ...@@ -272,7 +272,10 @@ class Conveyer(CoreObject):
return self.canAcceptAndIsRequested() return self.canAcceptAndIsRequested()
#actions to be taken after the simulation ends #actions to be taken after the simulation ends
def postProcessing(self, MaxSimtime): def postProcessing(self, MaxSimtime=None):
if MaxSimtime==None:
from Globals import G
MaxSimtime=G.maxSimTime
self.moveEntities() #move the entities to count the working time self.moveEntities() #move the entities to count the working time
#if the conveyer is full count the blockage time #if the conveyer is full count the blockage time
if self.isFull(): if self.isFull():
...@@ -303,8 +306,10 @@ class Conveyer(CoreObject): ...@@ -303,8 +306,10 @@ class Conveyer(CoreObject):
#outputs data to "output.xls" #outputs data to "output.xls"
def outputResultsXL(self, MaxSimtime): def outputResultsXL(self, MaxSimtime=None):
from Globals import G from Globals import G
if MaxSimtime==None:
MaxSimtime=G.maxSimTime
if(G.numberOfReplications==1): #if we had just one replication output the results to excel 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,0, "The percentage of Working of "+self.objName +" is:")
G.outputSheet.write(G.outputIndex,1,100*self.totalWorkingTime/MaxSimtime) G.outputSheet.write(G.outputIndex,1,100*self.totalWorkingTime/MaxSimtime)
......
...@@ -90,7 +90,7 @@ class CoreObject(Process): ...@@ -90,7 +90,7 @@ class CoreObject(Process):
activeEntity.schedule.append([activeObject.id,now()]) #append the time to schedule so that it can be read in the result activeEntity.schedule.append([activeObject.id,now()]) #append the time to schedule so that it can be read in the result
#actions to be taken after the simulation ends #actions to be taken after the simulation ends
def postProcessing(self, MaxSimtime): def postProcessing(self, MaxSimtime=None):
pass pass
#outputs message to the trace.xls #outputs message to the trace.xls
...@@ -98,7 +98,7 @@ class CoreObject(Process): ...@@ -98,7 +98,7 @@ class CoreObject(Process):
pass pass
#outputs data to "output.xls" #outputs data to "output.xls"
def outputResultsXL(self, MaxSimtime): def outputResultsXL(self, MaxSimtime=None):
pass pass
#outputs results to JSON File #outputs results to JSON File
......
...@@ -214,7 +214,10 @@ class Dismantle(CoreObject): ...@@ -214,7 +214,10 @@ class Dismantle(CoreObject):
#actions to be taken after the simulation ends #actions to be taken after the simulation ends
def postProcessing(self, MaxSimtime): def postProcessing(self, MaxSimtime=None):
if MaxSimtime==None:
from Globals import G
MaxSimtime=G.maxSimTime
#if there is an entity that finished processing in Dismantle but did not get to reach #if there is an entity that finished processing in Dismantle but did not get to reach
#the following Object #the following Object
...@@ -251,8 +254,10 @@ class Dismantle(CoreObject): ...@@ -251,8 +254,10 @@ class Dismantle(CoreObject):
#outputs data to "output.xls" #outputs data to "output.xls"
def outputResultsXL(self, MaxSimtime): def outputResultsXL(self, MaxSimtime=None):
from Globals import G from Globals import G
if MaxSimtime==None:
MaxSimtime=G.maxSimTime
if(G.numberOfReplications==1): #if we had just one replication output the results to excel 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,0, "The percentage of Working of "+self.objName +" is:")
G.outputSheet.write(G.outputIndex,1,100*self.totalWorkingTime/MaxSimtime) G.outputSheet.write(G.outputIndex,1,100*self.totalWorkingTime/MaxSimtime)
......
...@@ -33,7 +33,7 @@ simulate(until=G.maxSimTime) #run the simulation ...@@ -33,7 +33,7 @@ simulate(until=G.maxSimTime) #run the simulation
#carry on the post processing operations for every object in the topology #carry on the post processing operations for every object in the topology
for object in G.ObjList: for object in G.ObjList:
object.postProcessing(G.maxSimTime) object.postProcessing()
#print the results #print the results
print "the system produced", E.numOfExits, "parts" print "the system produced", E.numOfExits, "parts"
......
...@@ -139,8 +139,10 @@ class Exit(CoreObject): ...@@ -139,8 +139,10 @@ class Exit(CoreObject):
self.outputTrace(name) self.outputTrace(name)
#actions to be taken after the simulation ends #actions to be taken after the simulation ends
def postProcessing(self, MaxSimtime): def postProcessing(self, MaxSimtime=None):
from Globals import G from Globals import G
if MaxSimtime==None:
MaxSimtime=G.maxSimTime
self.Exits.append(self.numOfExits) self.Exits.append(self.numOfExits)
try: try:
self.Lifespan.append(((self.totalLifespan)/self.numOfExits)/G.Base) self.Lifespan.append(((self.totalLifespan)/self.numOfExits)/G.Base)
...@@ -168,8 +170,10 @@ class Exit(CoreObject): ...@@ -168,8 +170,10 @@ class Exit(CoreObject):
G.traceSheet=G.traceFile.add_sheet('sheet '+str(G.sheetIndex), cell_overwrite_ok=True) G.traceSheet=G.traceFile.add_sheet('sheet '+str(G.sheetIndex), cell_overwrite_ok=True)
#outputs data to "output.xls" #outputs data to "output.xls"
def outputResultsXL(self, MaxSimtime): def outputResultsXL(self, MaxSimtime=None):
from Globals import G from Globals import G
if MaxSimtime==None:
MaxSimtime=G.maxSimTime
if(G.numberOfReplications==1): #if we had just one replication output the results to excel 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,0, "The Throughput in " +self.objName + " is:")
G.outputSheet.write(G.outputIndex,1,self.numOfExits) G.outputSheet.write(G.outputIndex,1,self.numOfExits)
......
...@@ -450,11 +450,11 @@ def main(argv=[], input_data=None): ...@@ -450,11 +450,11 @@ def main(argv=[], input_data=None):
#carry on the post processing operations for every object in the topology #carry on the post processing operations for every object in the topology
for element in G.ObjList: for element in G.ObjList:
element.postProcessing(G.maxSimTime) element.postProcessing()
#carry on the post processing operations for every model resource in the topology #carry on the post processing operations for every model resource in the topology
for model_resource in G.RepairmanList: for model_resource in G.RepairmanList:
model_resource.postProcessing(G.maxSimTime) model_resource.postProcessing()
#output trace to excel #output trace to excel
if(G.trace=="Yes"): if(G.trace=="Yes"):
......
...@@ -295,7 +295,11 @@ class Machine(CoreObject): ...@@ -295,7 +295,11 @@ class Machine(CoreObject):
#actions to be taken after the simulation ends #actions to be taken after the simulation ends
def postProcessing(self, MaxSimtime): def postProcessing(self, MaxSimtime=None):
if MaxSimtime==None:
from Globals import G
MaxSimtime=G.maxSimTime
activeObject=self.getActiveObject() activeObject=self.getActiveObject()
activeObjectQueue=self.getActiveObjectQueue() activeObjectQueue=self.getActiveObjectQueue()
...@@ -365,8 +369,11 @@ class Machine(CoreObject): ...@@ -365,8 +369,11 @@ class Machine(CoreObject):
G.traceSheet=G.traceFile.add_sheet('sheet '+str(G.sheetIndex), cell_overwrite_ok=True) G.traceSheet=G.traceFile.add_sheet('sheet '+str(G.sheetIndex), cell_overwrite_ok=True)
#outputs the the "output.xls" #outputs the the "output.xls"
def outputResultsXL(self, MaxSimtime): def outputResultsXL(self, MaxSimtime=None):
from Globals import G from Globals import G
if MaxSimtime==None:
MaxSimtime=G.maxSimTime
if(G.numberOfReplications==1): #if we had just one replication output the results to excel 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,0, "The percentage of Failure of " +self.objName+ " is:")
G.outputSheet.write(G.outputIndex,1,100*self.totalFailureTime/MaxSimtime) G.outputSheet.write(G.outputIndex,1,100*self.totalFailureTime/MaxSimtime)
......
...@@ -40,7 +40,7 @@ class ObjectResource(object): ...@@ -40,7 +40,7 @@ class ObjectResource(object):
return len(self.Res.activeQ)<self.capacity return len(self.Res.activeQ)<self.capacity
#actions to be taken after the simulation ends #actions to be taken after the simulation ends
def postProcessing(self, MaxSimtime): def postProcessing(self, MaxSimtime=None):
pass pass
#outputs message to the trace.xls #outputs message to the trace.xls
...@@ -48,7 +48,7 @@ class ObjectResource(object): ...@@ -48,7 +48,7 @@ class ObjectResource(object):
pass pass
#outputs data to "output.xls" #outputs data to "output.xls"
def outputResultsXL(self, MaxSimtime): def outputResultsXL(self, MaxSimtime=None):
pass pass
#outputs results to JSON File #outputs results to JSON File
......
...@@ -49,7 +49,10 @@ class Repairman(ObjectResource): ...@@ -49,7 +49,10 @@ class Repairman(ObjectResource):
#actions to be taken after the simulation ends #actions to be taken after the simulation ends
def postProcessing(self, MaxSimtime): def postProcessing(self, MaxSimtime=None):
if MaxSimtime==None:
from Globals import G
MaxSimtime=G.maxSimTime
#if the repairman is currently working we have to count the time of this work #if the repairman is currently working we have to count the time of this work
if len(self.getResourceQueue())>0: if len(self.getResourceQueue())>0:
self.totalWorkingTime+=now()-self.timeLastRepairStarted self.totalWorkingTime+=now()-self.timeLastRepairStarted
...@@ -61,8 +64,10 @@ class Repairman(ObjectResource): ...@@ -61,8 +64,10 @@ class Repairman(ObjectResource):
self.Working.append(100*self.totalWorkingTime/MaxSimtime) self.Working.append(100*self.totalWorkingTime/MaxSimtime)
#outputs data to "output.xls" #outputs data to "output.xls"
def outputResultsXL(self, MaxSimtime): def outputResultsXL(self, MaxSimtime=None):
from Globals import G from Globals import G
if MaxSimtime==None:
MaxSimtime=G.maxSimTime
if(G.numberOfReplications==1): #if we had just one replication output the results to excel 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,0, "The percentage of working of "+self.objName +" is:")
G.outputSheet.write(G.outputIndex,1,100*self.totalWorkingTime/MaxSimtime) G.outputSheet.write(G.outputIndex,1,100*self.totalWorkingTime/MaxSimtime)
......
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