Commit efe93f63 authored by Georgios Dagkakis's avatar Georgios Dagkakis

Exit object updated to count takt time

parent 4b470bb7
......@@ -57,6 +57,9 @@ class Exit(Process):
self.processingTimeOfCurrentEntity=0 #holds the total processing time that the current entity required
self.totalTaktTime=0 #the total time between to consecutive exits
self.TaktTime=[] #list that holds the avg time between to consecutive exits
self.waitToDispose=False #shows if the object waits to dispose an entity
def run(self):
......@@ -65,6 +68,8 @@ class Exit(Process):
#and one predecessor requests it
self.getEntity()
self.numOfExits+=1 #increase the exits by one
self.totalTaktTime+=now()-self.timeLastEntityLeft #add the takt time
self.timeLastEntityLeft=now() #update the time that the last entity left from the Exit
#sets the routing in element for the Exit
def defineRouting(self, p):
......@@ -88,13 +93,6 @@ class Exit(Process):
#gets an entity from the predecessor
def getEntity(self):
'''
#A=self.previous[0].Res.activeQ[0]
name=self.previous[0].Res.activeQ[0].name #get the name of the entity for the trace
self.totalLifespan+=now()-self.previous[0].Res.activeQ[0].startTime #Add the entity's lifespan to the total one.
self.previous[0].removeEntity() #remove the entity from the previous object
#del A
'''
name=self.previous[self.predecessorIndex].Res.activeQ[0].name #get the name of the entity for the trace
self.totalLifespan+=now()-self.previous[self.predecessorIndex].Res.activeQ[0].startTime #Add the entity's lifespan to the total one.
self.previous[self.predecessorIndex].removeEntity() #remove the entity from the previous object
......@@ -108,6 +106,10 @@ class Exit(Process):
self.Lifespan.append(((self.totalLifespan)/self.numOfExits)/G.Base)
except ZeroDivisionError:
self.Lifespan.append(0)
try:
self.TaktTime.append(((self.totalTaktTime)/self.numOfExits)/G.Base)
except ZeroDivisionError:
self.TaktTime.append(0)
#outputs message to the trace.xls. Format is (Simulation Time | Entity Name | "generated")
......@@ -133,7 +135,16 @@ class Exit(Process):
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 tatk 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
......@@ -160,8 +171,18 @@ class Exit(Process):
G.outputSheet.write(G.outputIndex,2,self.Lifespan[0])
G.outputSheet.write(G.outputIndex,3,self.Lifespan[0])
G.outputIndex+=1
G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the avg takt time in "+ self.objName + " is:")
if self.checkIfArrayHasDifValues(self.TaktTime):
G.outputSheet.write(G.outputIndex,1,stat.bayes_mvs(self.TaktTime, G.confidenceLevel)[0][1][0])
G.outputSheet.write(G.outputIndex,2,stat.bayes_mvs(self.TaktTime, G.confidenceLevel)[0][0])
G.outputSheet.write(G.outputIndex,3,stat.bayes_mvs(self.TaktTime, G.confidenceLevel)[0][1][1])
else:
G.outputSheet.write(G.outputIndex,1,self.TaktTime[0])
G.outputSheet.write(G.outputIndex,2,self.TaktTime[0])
G.outputSheet.write(G.outputIndex,3,self.TaktTime[0])
G.outputIndex+=1
G.outputIndex+=1
#takes the array and checks if all its values are identical (returns false) or not (returns true)
#needed because if somebody runs multiple runs in deterministic case it would crash!
......
......@@ -60,7 +60,7 @@
{"_class": "Dream.Queue",
"id": "DummyQ",
"name": "DummyQ",
"isDummy": "True",
"isDummy": "1",
"capacity": "1",
"predecessorList": ["S1"],
"successorList": ["M1"]
......@@ -68,7 +68,7 @@
{"_class": "Dream.Queue",
"id": "Q1",
"name": "Q1",
"isDummy": "False",
"isDummy": "0",
"capacity": "1",
"predecessorList": ["M1"],
"successorList": ["M2"]
......
......@@ -60,7 +60,7 @@
{"_class": "Dream.Queue",
"id": "DummyQ",
"name": "DummyQ",
"isDummy": "True",
"isDummy": "1",
"capacity": "1",
"predecessorList": ["S1"],
"successorList": ["M1"]
......
......@@ -60,7 +60,7 @@
{"_class": "Dream.Queue",
"id": "DummyQ",
"name": "DummyQ",
"isDummy": "True",
"isDummy": "1",
"capacity": "1",
"predecessorList": ["S1"],
"successorList": ["M2"]
......@@ -68,7 +68,7 @@
{"_class": "Dream.Queue",
"id": "Q1",
"name": "Q1",
"isDummy": "False",
"isDummy": "0",
"capacity": "1",
"predecessorList": ["M2"],
"successorList": ["M1"]
......
......@@ -77,7 +77,7 @@
{"_class": "Dream.Queue",
"id": "Q1",
"name": "Q1",
"isDummy": "False",
"isDummy": "0",
"capacity": "1",
"predecessorList": ["M1"],
"successorList": ["M2"]
......
......@@ -73,7 +73,7 @@
{"_class": "Dream.Queue",
"id": "DummyQ",
"name": "DummyQ",
"isDummy": "True",
"isDummy": "1",
"capacity": "1",
"predecessorList": ["S1"],
"successorList": ["M1"]
......@@ -81,7 +81,7 @@
{"_class": "Dream.Queue",
"id": "Q1",
"name": "Q1",
"isDummy": "False",
"isDummy": "0",
"capacity": "1",
"predecessorList": ["M1"],
"successorList": ["M2"]
......
......@@ -79,7 +79,7 @@
{"_class": "Dream.Queue",
"id": "Q1",
"name": "Q1",
"isDummy": "False",
"isDummy": "0",
"capacity": "1",
"predecessorList": ["M1", "M2"],
"successorList": ["M3"]
......
......@@ -97,7 +97,7 @@
{"_class": "Dream.Queue",
"id": "Q1",
"name": "Q1",
"isDummy": "False",
"isDummy": "0",
"capacity": "1",
"predecessorList": ["M1", "M2","M3"],
"successorList": ["M4"]
......
......@@ -86,7 +86,7 @@
{"_class": "Dream.Queue",
"id": "Q1",
"name": "Q1",
"isDummy": "False",
"isDummy": "0",
"capacity": "1",
"predecessorList": ["M1","M2"],
"successorList": ["M3","M4"]
......
......@@ -79,7 +79,7 @@
"_class": "Dream.Queue",
"id": "DummyQ",
"name": "DummyQ",
"isDummy": "True",
"isDummy": "1",
"capacity": "1",
"predecessorList": ["S1"],
"successorList": ["Q1"]
......@@ -88,7 +88,7 @@
"_class": "Dream.Queue",
"id": "Q1",
"name": "Q1",
"isDummy": "False",
"isDummy": "0",
"capacity": "1",
"predecessorList": ["DummyQ"],
"successorList": ["M1","M2"]
......
......@@ -93,7 +93,7 @@
"_class": "Dream.Queue",
"id": "DummyQ",
"name": "DummyQ",
"isDummy": "True",
"isDummy": "1",
"capacity": "1",
"predecessorList": ["S1"],
"successorList": ["Q1"]
......@@ -102,7 +102,7 @@
"_class": "Dream.Queue",
"id": "Q1",
"name": "Q1",
"isDummy": "False",
"isDummy": "0",
"capacity": "1",
"predecessorList": ["DummyQ"],
"successorList": ["M1","M2"]
......
......@@ -123,7 +123,7 @@ def createObjects():
successorList=coreObject[i].get('successorList', 'not found')
predecessorList=coreObject[i].get('predecessorList', 'not found')
capacity=int(coreObject[i].get('capacity', '1'))
isDummy=bool(coreObject[i].get('isDummy', 'False'))
isDummy=bool(int(coreObject[i].get('isDummy', '0')))
Q=Queue(id, name, capacity, isDummy)
Q.previousIds=predecessorList
Q.nextIds=successorList
......
......@@ -75,6 +75,7 @@ class Source(Process):
#entity=Entity("Ent"+str(i))
entity=self.item(self.item.type+"_"+self.objName+"_"+str(i)) #create the Entity object and assign its name
entity.creationTime=now() #assign the current simulation time as the Entity's creation time
entity.startTime=now() #assign the current simulation time as the Entity's start time
self.outputTrace(self.item.type+"_"+self.objName+"_"+str(i)) #output the trace
self.Res.activeQ.append(entity) #append the entity to the resource
i+=1
......@@ -88,6 +89,7 @@ class Source(Process):
#entity=Entity("Ent"+str(i)) #create the Entity object and assign its name
entity=self.item(self.item.type+str(i)) #create the Entity object and assign its name
entity.creationTime=now() #assign the current simulation time as the Entity's creation time
entity.startTime=now() #assign the current simulation time as the Entity's start time
self.outputTrace(self.item.type+str(i)) #output the trace
i+=1
self.Res.activeQ.append(entity) #append the entity to the resource
......
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