Commit 4e6513f6 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Jérome Perrin

update so that parts can be also set as wip of Queues. Two tests also added with simple examples

parent 416957ad
...@@ -95,8 +95,11 @@ def findObjectById(id): ...@@ -95,8 +95,11 @@ def findObjectById(id):
def setWIP(entityList): def setWIP(entityList):
for entity in entityList: for entity in entityList:
if entity.type=='Job': if entity.type=='Part':
objectId=entity.currentStation # get the id of the object where the entity currently seats object=entity.currentStation #identify the object
object.getActiveObjectQueue().append(entity) #append the entity to its Queue
entity.schedule.append([object,now()]) #append the time to schedule so that it can be read in the result
elif entity.type=='Job':
object=findObjectById(entity.remainingRoute[0][0]) # find the object in the 'G.ObjList object=findObjectById(entity.remainingRoute[0][0]) # find the object in the 'G.ObjList
object.getActiveObjectQueue().append(entity) # append the entity to its Queue object.getActiveObjectQueue().append(entity) # append the entity to its Queue
object.receiver=findObjectById(entity.remainingRoute[1][0]) object.receiver=findObjectById(entity.remainingRoute[1][0])
...@@ -104,4 +107,6 @@ def setWIP(entityList): ...@@ -104,4 +107,6 @@ def setWIP(entityList):
entity.schedule.append([object,now()]) #append the time to schedule so that it can be read in the result entity.schedule.append([object,now()]) #append the time to schedule so that it can be read in the result
entity.currentStation=object # update the current station of the entity entity.currentStation=object # update the current station of the entity
{
"_class": "Dream.Simulation",
"edges": {
"0": [
"M1",
"Q2",
{}
],
"1": [
"M2",
"E1",
{}
],
"2": [
"Q1",
"M1",
{}
],
"3": [
"Q2",
"M2",
{}
]
},
"general": {
"_class": "Dream.Configuration",
"numberOfReplications": "1",
"maxSimTime": "-1",
"trace": "Yes",
"confidenceLevel": "0.95"
},
"nodes": {
"M1": {
"_class": "Dream.Machine",
"id": "M1",
"name": "Machine1",
"processingTime": {
"distributionType": "Fixed",
"mean": "0.25"
},
"failures": {}
},
"M2": {
"_class": "Dream.Machine",
"id": "M2",
"name": "Machine2",
"processingTime": {
"distributionType": "Fixed",
"mean": "1.5"
},
"failures": {}
},
"Q1": {
"_class": "Dream.Queue",
"id": "Q1",
"name": "Queue1",
"isDummy": "0",
"capacity": "1",
"wip": [
{
"_class": "Dream.Part",
"id": "P1",
"name": "Part1"
}
]
},
"Q2": {
"_class": "Dream.Queue",
"id": "Q2",
"name": "Queue2",
"isDummy": "0",
"capacity": "1"
},
"E1": {
"_class": "Dream.Exit",
"id": "E1",
"name": "Stock"
}
}
}
\ No newline at end of file
{
"_class": "Dream.Simulation",
"edges": {
"0": [
"M1",
"Q2",
{}
],
"1": [
"M2",
"E1",
{}
],
"2": [
"Q1",
"M1",
{}
],
"3": [
"Q2",
"M2",
{}
]
},
"general": {
"_class": "Dream.Configuration",
"numberOfReplications": "1",
"maxSimTime": "-1",
"trace": "Yes",
"confidenceLevel": "0.95"
},
"nodes": {
"M1": {
"_class": "Dream.Machine",
"id": "M1",
"name": "Machine1",
"processingTime": {
"distributionType": "Fixed",
"mean": "0.25"
},
"failures": {}
},
"M2": {
"_class": "Dream.Machine",
"id": "M2",
"name": "Machine2",
"processingTime": {
"distributionType": "Fixed",
"mean": "1.5"
},
"failures": {}
},
"Q1": {
"_class": "Dream.Queue",
"id": "Q1",
"name": "Queue1",
"isDummy": "0",
"capacity": "1",
"wip": [
{
"_class": "Dream.Part",
"id": "P1",
"name": "Part1"
},
{
"_class": "Dream.Part",
"id": "P2",
"name": "Part2"
}
]
},
"Q2": {
"_class": "Dream.Queue",
"id": "Q2",
"name": "Queue2",
"isDummy": "0",
"capacity": "1",
"wip": [
{
"_class": "Dream.Part",
"id": "P3",
"name": "Part3"
}
]
},
"E1": {
"_class": "Dream.Exit",
"id": "E1",
"name": "Stock"
}
}
}
\ No newline at end of file
...@@ -705,6 +705,7 @@ def createWIP(): ...@@ -705,6 +705,7 @@ def createWIP():
G.JobList=[] G.JobList=[]
G.WipList=[] G.WipList=[]
G.EntityList=[] G.EntityList=[]
G.PartList=[]
json_data = G.JSONData json_data = G.JSONData
#Read the json data #Read the json data
...@@ -718,7 +719,7 @@ def createWIP(): ...@@ -718,7 +719,7 @@ def createWIP():
entityClass=entity.get('_class', None) entityClass=entity.get('_class', None)
except IndexError: except IndexError:
continue continue
if entityClass=='Dream.Job': if entityClass=='Dream.Job':
id=entity.get('id', 'not found') id=entity.get('id', 'not found')
name=entity.get('name', 'not found') name=entity.get('name', 'not found')
...@@ -768,7 +769,17 @@ def createWIP(): ...@@ -768,7 +769,17 @@ def createWIP():
orderDate=orderDate, extraPropertyDict=extraPropertyDict) orderDate=orderDate, extraPropertyDict=extraPropertyDict)
G.JobList.append(J) G.JobList.append(J)
G.WipList.append(J) G.WipList.append(J)
G.EntityList.append(J) G.EntityList.append(J)
elif entityClass=='Dream.Part':
id=entity.get('id', 'not found')
name=entity.get('name', 'not found')
P=Part(id,name)
G.PartList.append(P)
G.WipList.append(P)
G.EntityList.append(P)
object=Globals.findObjectById(element['id'])
P.currentStation=object
# =========================================================================== # ===========================================================================
# used to convert a string read from the input to object type # used to convert a string read from the input to object type
...@@ -804,7 +815,7 @@ def main(argv=[], input_data=None): ...@@ -804,7 +815,7 @@ def main(argv=[], input_data=None):
G.JSONData=json.loads(G.InputData) # create the dictionary JSONData G.JSONData=json.loads(G.InputData) # create the dictionary JSONData
readGeneralInput() readGeneralInput()
createObjects() createObjects()
createWIP() #createWIP()
setTopology() setTopology()
#run the experiment (replications) #run the experiment (replications)
......
{
"elementList": [
{
"_class": "Dream.Exit",
"id": "E1",
"results": {
"throughput": 1,
"takt_time": 1.75,
"lifespan": 1.75
}
},
{
"_class": "Dream.Machine",
"id": "M1",
"results": {
"working_ratio": 14.285714285714286,
"blockage_ratio": 0.0,
"failure_ratio": 0.0,
"waiting_ratio": 85.71428571428571
}
},
{
"_class": "Dream.Machine",
"id": "M2",
"results": {
"working_ratio": 85.71428571428571,
"blockage_ratio": 0.0,
"failure_ratio": 0.0,
"waiting_ratio": 14.285714285714286
}
}
],
"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
{
"elementList": [
{
"_class": "Dream.Exit",
"id": "E1",
"results": {
"throughput": 3,
"takt_time": 1.5,
"lifespan": 3.0
}
},
{
"_class": "Dream.Machine",
"id": "M1",
"results": {
"working_ratio": 11.11111111111111,
"blockage_ratio": 22.22222222222222,
"failure_ratio": 0.0,
"waiting_ratio": 66.66666666666667
}
},
{
"_class": "Dream.Machine",
"id": "M2",
"results": {
"working_ratio": 100.0,
"blockage_ratio": 0.0,
"failure_ratio": 0.0,
"waiting_ratio": 0.0
}
}
],
"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
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