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