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

main script updated to read the wip as CoreObject attribute

parent cedfdae2
...@@ -68,28 +68,12 @@ ...@@ -68,28 +68,12 @@
"_class": "Dream.QueueJobShop", "_class": "Dream.QueueJobShop",
"name": "Queue1", "name": "Queue1",
"isDummy": "0", "isDummy": "0",
"capacity": "1000" "capacity": "1000",
}, "wip": [
"Q2": { {
"_class": "Dream.QueueJobShop",
"id": "Q2",
"name": "Queue2",
"isDummy": "0",
"capacity": "1000"
},
"Q3": {
"_class": "Dream.QueueJobShop",
"name": "Queue3",
"isDummy": "0",
"capacity": "1000"
},
"E1": {
"_class": "Dream.ExitJobShop",
"name": "Exit"
},
"J1": {
"_class": "Dream.Job", "_class": "Dream.Job",
"name": "Job1", "name": "Job1",
"id": "J1",
"route": [ "route": [
{ {
"stepNumber": "0", "stepNumber": "0",
...@@ -125,5 +109,24 @@ ...@@ -125,5 +109,24 @@
} }
] ]
} }
]
},
"Q2": {
"_class": "Dream.QueueJobShop",
"id": "Q2",
"name": "Queue2",
"isDummy": "0",
"capacity": "1000"
},
"Q3": {
"_class": "Dream.QueueJobShop",
"name": "Queue3",
"isDummy": "0",
"capacity": "1000"
},
"E1": {
"_class": "Dream.ExitJobShop",
"name": "Exit"
}
} }
} }
\ No newline at end of file
...@@ -68,26 +68,10 @@ ...@@ -68,26 +68,10 @@
"_class": "Dream.QueueJobShop", "_class": "Dream.QueueJobShop",
"name": "Queue1", "name": "Queue1",
"isDummy": "0", "isDummy": "0",
"capacity": "1000" "capacity": "1000",
}, "wip": [
"Q2": { {
"_class": "Dream.QueueJobShop", "id": "J1",
"id": "Q2",
"name": "Queue2",
"isDummy": "0",
"capacity": "1000"
},
"Q3": {
"_class": "Dream.QueueJobShop",
"name": "Queue3",
"isDummy": "0",
"capacity": "1000"
},
"E1": {
"_class": "Dream.ExitJobShop",
"name": "Exit"
},
"J1": {
"_class": "Dream.Job", "_class": "Dream.Job",
"name": "Job1", "name": "Job1",
"route": [ "route": [
...@@ -124,8 +108,18 @@ ...@@ -124,8 +108,18 @@
} }
} }
] ]
}
]
}, },
"J2": { "Q2": {
"_class": "Dream.QueueJobShop",
"id": "Q2",
"name": "Queue2",
"isDummy": "0",
"capacity": "1000",
"wip": [
{
"id": "J2",
"_class": "Dream.Job", "_class": "Dream.Job",
"name": "Job2", "name": "Job2",
"route": [ "route": [
...@@ -163,5 +157,17 @@ ...@@ -163,5 +157,17 @@
} }
] ]
} }
]
},
"Q3": {
"_class": "Dream.QueueJobShop",
"name": "Queue3",
"isDummy": "0",
"capacity": "1000"
},
"E1": {
"_class": "Dream.ExitJobShop",
"name": "Exit"
}
} }
} }
\ No newline at end of file
...@@ -69,27 +69,10 @@ ...@@ -69,27 +69,10 @@
"name": "Queue1", "name": "Queue1",
"schedulingRule": "FIFO", "schedulingRule": "FIFO",
"isDummy": "0", "isDummy": "0",
"capacity": "-1" "capacity": "-1",
}, "wip": [
"Q2": { {
"_class": "Dream.QueueJobShop", "id": "J1",
"name": "Queue2",
"schedulingRule": "MC-Priority-EDD",
"isDummy": "0",
"capacity": "-1"
},
"Q3": {
"_class": "Dream.QueueJobShop",
"name": "Queue3",
"schedulingRule": "FIFO",
"isDummy": "0",
"capacity": "-1"
},
"E1": {
"_class": "Dream.ExitJobShop",
"name": "Exit"
},
"J1": {
"_class": "Dream.Job", "_class": "Dream.Job",
"name": "Job1", "name": "Job1",
"priority": "1", "priority": "1",
...@@ -129,8 +112,18 @@ ...@@ -129,8 +112,18 @@
} }
} }
] ]
}
]
}, },
"J2": { "Q2": {
"_class": "Dream.QueueJobShop",
"name": "Queue2",
"schedulingRule": "MC-Priority-EDD",
"isDummy": "0",
"capacity": "-1",
"wip": [
{
"id": "J2",
"_class": "Dream.Job", "_class": "Dream.Job",
"name": "Job2", "name": "Job2",
"priority": "-7", "priority": "-7",
...@@ -171,7 +164,8 @@ ...@@ -171,7 +164,8 @@
} }
] ]
}, },
"J3": { {
"id": "J3",
"_class": "Dream.Job", "_class": "Dream.Job",
"name": "Job3", "name": "Job3",
"priority": "-12", "priority": "-12",
...@@ -204,7 +198,8 @@ ...@@ -204,7 +198,8 @@
} }
] ]
}, },
"J4": { {
"id": "J4",
"_class": "Dream.Job", "_class": "Dream.Job",
"name": "Job4", "name": "Job4",
"priority": "0", "priority": "0",
...@@ -229,5 +224,18 @@ ...@@ -229,5 +224,18 @@
} }
] ]
} }
]
},
"Q3": {
"_class": "Dream.QueueJobShop",
"name": "Queue3",
"schedulingRule": "FIFO",
"isDummy": "0",
"capacity": "-1"
},
"E1": {
"_class": "Dream.ExitJobShop",
"name": "Exit"
}
} }
} }
\ No newline at end of file
...@@ -132,9 +132,6 @@ def createObjects(): ...@@ -132,9 +132,6 @@ def createObjects():
G.AssemblyList=[] G.AssemblyList=[]
G.DismantleList=[] G.DismantleList=[]
G.ConveyerList=[] G.ConveyerList=[]
G.JobList=[]
G.WipList=[]
G.EntityList=[]
G.MachineJobShopList=[] G.MachineJobShopList=[]
G.QueueJobShopList=[] G.QueueJobShopList=[]
G.ExitJobShopList=[] G.ExitJobShopList=[]
...@@ -375,33 +372,6 @@ def createObjects(): ...@@ -375,33 +372,6 @@ def createObjects():
G.ObjList.append(C) G.ObjList.append(C)
G.ConveyerList.append(C) G.ConveyerList.append(C)
elif objClass=='Dream.Job':
id=element.get('id', 'not found')
name=element.get('name', 'not found')
priority=int(element.get('priority', '0'))
dueDate=float(element.get('dueDate', '0'))
orderDate=float(element.get('orderDate', '0'))
JSONRoute=element.get('route', []) # dummy variable that holds the routes of the jobs
# the route from the JSON file
# is a sequence of dictionaries
route = [None for i in range(len(JSONRoute))] # variable that holds the argument used in the Job initiation
# hold None for each entry in the 'route' list
for routeElement in JSONRoute: # for each 'step' dictionary in the JSONRoute
stepNumber=int(routeElement.get('stepNumber', '0')) # get the stepNumber
nextId=routeElement.get('stationId', 'not found') # the stationId
processingTime=routeElement.get('processingTime', 'not found') # and the 'processingTime' dictionary
distributionType=processingTime.get('distributionType', 'not found')# and from that dictionary
# get the 'mean'
mean=float(processingTime.get('mean', 'not found'))
route[stepNumber]=[nextId, mean] # finally add the 'nextId' and 'mean'
# to the job route
# initiate the job
J=Job(id, name, route, priority=priority, dueDate=dueDate, orderDate=orderDate)
G.JobList.append(J)
G.WipList.append(J)
G.EntityList.append(J)
elif objClass=='Dream.BatchDecomposition': elif objClass=='Dream.BatchDecomposition':
id=element.get('id', 'not found') id=element.get('id', 'not found')
name=element.get('name', 'not found') name=element.get('name', 'not found')
...@@ -525,6 +495,56 @@ def activateObjects(): ...@@ -525,6 +495,56 @@ def activateObjects():
except AttributeError: except AttributeError:
pass pass
# ===========================================================================
# reads the WIP of the stations
# ===========================================================================
def createWIP():
G.JobList=[]
G.WipList=[]
G.EntityList=[]
json_data = G.JSONData
#Read the json data
nodes = json_data['nodes'] # read from the dictionary the dicts with key 'nodes'
for (element_id, element) in nodes.iteritems():
element['id'] = element_id
wip=element.get('wip', [])
for entity in wip:
entityClass=None
try:
entityClass=entity.get('_class', None)
except IndexError:
continue
if entityClass=='Dream.Job':
id=entity.get('id', 'not found')
name=entity.get('name', 'not found')
priority=int(entity.get('priority', '0'))
dueDate=float(entity.get('dueDate', '0'))
orderDate=float(entity.get('orderDate', '0'))
JSONRoute=entity.get('route', []) # dummy variable that holds the routes of the jobs
# the route from the JSON file
# is a sequence of dictionaries
route = [None for i in range(len(JSONRoute))] # variable that holds the argument used in the Job initiation
# hold None for each entry in the 'route' list
for routeentity in JSONRoute: # for each 'step' dictionary in the JSONRoute
stepNumber=int(routeentity.get('stepNumber', '0')) # get the stepNumber
nextId=routeentity.get('stationId', 'not found') # the stationId
processingTime=routeentity.get('processingTime', 'not found') # and the 'processingTime' dictionary
distributionType=processingTime.get('distributionType', 'not found')# and from that dictionary
# get the 'mean'
mean=float(processingTime.get('mean', 'not found'))
route[stepNumber]=[nextId, mean] # finally add the 'nextId' and 'mean'
# to the job route
# initiate the job
J=Job(id, name, route, priority=priority, dueDate=dueDate, orderDate=orderDate)
G.JobList.append(J)
G.WipList.append(J)
G.EntityList.append(J)
# =========================================================================== # ===========================================================================
# sets the WIP in the corresponding stations # sets the WIP in the corresponding stations
# =========================================================================== # ===========================================================================
...@@ -568,6 +588,7 @@ def main(argv=[], input_data=None): ...@@ -568,6 +588,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()
setTopology() setTopology()
...@@ -576,7 +597,6 @@ def main(argv=[], input_data=None): ...@@ -576,7 +597,6 @@ def main(argv=[], input_data=None):
logger.info("start run number "+str(i+1)) logger.info("start run number "+str(i+1))
G.seed+=1 G.seed+=1
G.Rnd=Random(G.seed) G.Rnd=Random(G.seed)
initialize() #initialize the simulation initialize() #initialize the simulation
initializeObjects() initializeObjects()
setWIP() setWIP()
......
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