Commit a1556795 authored by Georgios Dagkakis's avatar Georgios Dagkakis

first version of Dismantle object added to the library

parent cab0f78e
...@@ -115,11 +115,11 @@ class Assembly(Process): ...@@ -115,11 +115,11 @@ class Assembly(Process):
def canAccept(self): def canAccept(self):
return len(self.Res.activeQ)==0 return len(self.Res.activeQ)==0
#checks if the machine can accept an entity and there is a Frame waiting for it #checks if the Assembly can accept an entity and there is a Frame waiting for it
def canAcceptAndIsRequested(self): def canAcceptAndIsRequested(self):
return len(self.Res.activeQ)==0 and self.previousFrame[0].haveToDispose() return len(self.Res.activeQ)==0 and self.previousFrame[0].haveToDispose()
#checks if the machine can accept an entity and there is a Frame waiting for it #checks if the Assembly can accept an entity and there is a Frame waiting for it
def isRequestedFromPart(self): def isRequestedFromPart(self):
return len(self.Res.activeQ)==1 and self.previousPart[0].haveToDispose() return len(self.Res.activeQ)==1 and self.previousPart[0].haveToDispose()
...@@ -127,7 +127,7 @@ class Assembly(Process): ...@@ -127,7 +127,7 @@ class Assembly(Process):
def haveToDispose(self): def haveToDispose(self):
return len(self.Res.activeQ)>0 and self.waitToDispose return len(self.Res.activeQ)>0 and self.waitToDispose
#sets the routing in and out elements for the queue #sets the routing in and out elements for the Assembly
def defineRouting(self, pp, pf, n): def defineRouting(self, pp, pf, n):
self.next=n self.next=n
self.previousPart=pp self.previousPart=pp
......
This diff is collapsed.
...@@ -3,7 +3,6 @@ Created on 6 Feb 2013 ...@@ -3,7 +3,6 @@ Created on 6 Feb 2013
@author: George @author: George
''' '''
''' '''
models the exit of the model models the exit of the model
''' '''
...@@ -130,10 +129,10 @@ class Exit(Process): ...@@ -130,10 +129,10 @@ class Exit(Process):
def outputResultsXL(self, MaxSimtime): def outputResultsXL(self, MaxSimtime):
from Globals import G from Globals import G
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 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)
G.outputIndex+=1 G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "The average lifespan of an entity is:") G.outputSheet.write(G.outputIndex,0, "The average lifespan of an entity that exited from "+ self.objName +" is:")
G.outputSheet.write(G.outputIndex,1,((self.totalLifespan)/self.numOfExits)/G.Base) G.outputSheet.write(G.outputIndex,1,((self.totalLifespan)/self.numOfExits)/G.Base)
G.outputIndex+=1 G.outputIndex+=1
else: #if we had multiple replications we output confidence intervals to excel else: #if we had multiple replications we output confidence intervals to excel
...@@ -141,7 +140,7 @@ class Exit(Process): ...@@ -141,7 +140,7 @@ class Exit(Process):
#so failurePortion will be exactly the same in each run). That will give 0 variability and errors. #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 #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 #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 is:") G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the mean Throughput in " +self.objName + " is:")
if self.checkIfArrayHasDifValues(self.Exits): if self.checkIfArrayHasDifValues(self.Exits):
G.outputSheet.write(G.outputIndex,1,stat.bayes_mvs(self.Exits, G.confidenceLevel)[0][1][0]) G.outputSheet.write(G.outputIndex,1,stat.bayes_mvs(self.Exits, G.confidenceLevel)[0][1][0])
G.outputSheet.write(G.outputIndex,2,stat.bayes_mvs(self.Exits, G.confidenceLevel)[0][0]) G.outputSheet.write(G.outputIndex,2,stat.bayes_mvs(self.Exits, G.confidenceLevel)[0][0])
...@@ -151,7 +150,7 @@ class Exit(Process): ...@@ -151,7 +150,7 @@ class Exit(Process):
G.outputSheet.write(G.outputIndex,2,self.Exits[0]) G.outputSheet.write(G.outputIndex,2,self.Exits[0])
G.outputSheet.write(G.outputIndex,3,self.Exits[0]) G.outputSheet.write(G.outputIndex,3,self.Exits[0])
G.outputIndex+=1 G.outputIndex+=1
G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the mean Lifespan of an entity is:") G.outputSheet.write(G.outputIndex,0, "CI "+str(G.confidenceLevel*100)+"% for the mean Lifespan of an entity that exited from "+ self.objName + " is:")
if self.checkIfArrayHasDifValues(self.Lifespan): if self.checkIfArrayHasDifValues(self.Lifespan):
G.outputSheet.write(G.outputIndex,1,stat.bayes_mvs(self.Lifespan, G.confidenceLevel)[0][1][0]) G.outputSheet.write(G.outputIndex,1,stat.bayes_mvs(self.Lifespan, G.confidenceLevel)[0][1][0])
G.outputSheet.write(G.outputIndex,2,stat.bayes_mvs(self.Lifespan, G.confidenceLevel)[0][0]) G.outputSheet.write(G.outputIndex,2,stat.bayes_mvs(self.Lifespan, G.confidenceLevel)[0][0])
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
"distributionType": "Fixed", "distributionType": "Fixed",
"mean": "2" "mean": "2"
}, },
"entity": "Frame",
"predecessorPartList": ["S1"], "predecessorPartList": ["S1"],
"predecessorFrameList": ["S2"], "predecessorFrameList": ["S2"],
"successorList": ["M1"] "successorList": ["M1"]
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
"distributionType": "Fixed", "distributionType": "Fixed",
"mean": "2" "mean": "2"
}, },
"entity": "Frame",
"predecessorPartList": ["S1"], "predecessorPartList": ["S1"],
"predecessorFrameList": ["S2"], "predecessorFrameList": ["S2"],
"successorList": ["M1"] "successorList": ["M1"]
......
{"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration",
"numberOfReplications": "1",
"maxSimTime": "1440",
"trace": "Yes",
"confidenceLevel": "0.95"
},
"modelResource": [
],
"coreObject": [
{"_class": "Dream.Source",
"id": "S1",
"name": "Parts",
"interarrivalTime":
{
"distributionType": "Fixed",
"mean": "0.5"
},
"entity": "Part",
"successorList": ["Α1"]
},
{"_class": "Dream.Source",
"id": "S2",
"name": "Frames",
"interarrivalTime":
{
"distributionType": "Fixed",
"mean": "2"
},
"entity": "Frame",
"successorList": ["Α1"]
},
{"_class": "Dream.Assembly",
"id": "A1",
"name": "Assembly",
"processingTime": {
"distributionType": "Fixed",
"mean": "2"
},
"predecessorPartList": ["S1"],
"predecessorFrameList": ["S2"],
"successorList": ["M1"]
},
{"_class": "Dream.Machine",
"id": "M1",
"name": "Moulding",
"processingTime": {
"distributionType": "Fixed",
"mean": "0.25"
},
"failures":{
"failureDistribution": "Fixed",
"MTTF": "60",
"MTTR": "5",
"repairman": "None"
},
"predecessorList": ["A1"],
"successorList": ["D1"]
},
{"_class": "Dream.Dismantle",
"id": "D1",
"name": "Dismantle",
"processingTime": {
"distributionType": "Fixed",
"mean": "1"
},
"successorPartList": ["E1"],
"successorFrameList": ["E2"],
"predecessorList": ["M1"]
},
{"_class": "Dream.Exit",
"id": "E1",
"name": "Parts Stock",
"predecessorList": ["D1"]
},
{"_class": "Dream.Exit",
"id": "E2",
"name": "Frames Stock",
"predecessorList": ["D1"]
}
]
}
...@@ -18,6 +18,7 @@ from Repairman import Repairman ...@@ -18,6 +18,7 @@ from Repairman import Repairman
from Part import Part from Part import Part
from Frame import Frame from Frame import Frame
from Assembly import Assembly from Assembly import Assembly
from Dismantle import Dismantle
import xlwt import xlwt
import xlrd import xlrd
import time import time
...@@ -47,6 +48,7 @@ def createObjects(): ...@@ -47,6 +48,7 @@ def createObjects():
G.QueueList=[] G.QueueList=[]
G.RepairmanList=[] G.RepairmanList=[]
G.AssemblyList=[] G.AssemblyList=[]
G.DismantleList=[]
#loop through all the model resources #loop through all the model resources
#read the data and create them #read the data and create them
...@@ -146,6 +148,25 @@ def createObjects(): ...@@ -146,6 +148,25 @@ def createObjects():
A.nextIds=successorList A.nextIds=successorList
G.AssemblyList.append(A) G.AssemblyList.append(A)
G.ObjList.append(A) G.ObjList.append(A)
elif objClass=='Dream.Dismantle':
id=coreObject[i].get('id', 'not found')
name=coreObject[i].get('name', 'not found')
processingTime=coreObject[i].get('processingTime', 'not found')
distributionType=processingTime.get('distributionType', 'not found')
mean=float(processingTime.get('mean', '0'))
stdev=float(processingTime.get('stdev', '0'))
min=float(processingTime.get('min', '0'))
max=float(processingTime.get('stdev', '0'))
successorPartList=coreObject[i].get('successorPartList', 'not found')
successorFrameList=coreObject[i].get('successorFrameList', 'not found')
predecessorList=coreObject[i].get('predecessorList', 'not found')
D=Dismantle(id, name, distributionType, [mean,stdev,min,max])
D.nextPartIds=successorPartList
D.nextFrameIds=successorFrameList
D.previousIds=predecessorList
G.DismantleList.append(D)
G.ObjList.append(D)
#defines the topology (predecessors and successors for all the objects) #defines the topology (predecessors and successors for all the objects)
def setTopology(): def setTopology():
...@@ -169,6 +190,7 @@ def setTopology(): ...@@ -169,6 +190,7 @@ def setTopology():
G.ObjList[i].defineRouting(next) G.ObjList[i].defineRouting(next)
elif G.ObjList[i].type=="Exit": elif G.ObjList[i].type=="Exit":
G.ObjList[i].defineRouting(previous) G.ObjList[i].defineRouting(previous)
#Assembly should be changed to identify what the entity that it receives is. #Assembly should be changed to identify what the entity that it receives is.
#previousPart and previousFrame will become problematic #previousPart and previousFrame will become problematic
elif G.ObjList[i].type=="Assembly": elif G.ObjList[i].type=="Assembly":
...@@ -183,6 +205,20 @@ def setTopology(): ...@@ -183,6 +205,20 @@ def setTopology():
if G.ObjList[q].id==G.ObjList[i].previousFrameIds[j]: if G.ObjList[q].id==G.ObjList[i].previousFrameIds[j]:
previousFrame.append(G.ObjList[q]) previousFrame.append(G.ObjList[q])
G.ObjList[i].defineRouting(previousPart, previousFrame, next) G.ObjList[i].defineRouting(previousPart, previousFrame, next)
#Assembly should be changed to identify what the entity that it receives is.
#previousPart and previousFrame will become problematic
elif G.ObjList[i].type=="Dismantle":
nextPart=[]
nextFrame=[]
for j in range(len(G.ObjList[i].nextPartIds)):
for q in range(len(G.ObjList)):
if G.ObjList[q].id==G.ObjList[i].nextPartIds[j]:
nextPart.append(G.ObjList[q])
for j in range(len(G.ObjList[i].nextFrameIds)):
for q in range(len(G.ObjList)):
if G.ObjList[q].id==G.ObjList[i].nextFrameIds[j]:
nextFrame.append(G.ObjList[q])
G.ObjList[i].defineRouting(previous, nextPart, nextFrame)
else: else:
G.ObjList[i].defineRouting(previous, next) G.ObjList[i].defineRouting(previous, next)
......
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