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,7 +68,48 @@
"_class": "Dream.QueueJobShop",
"name": "Queue1",
"isDummy": "0",
"capacity": "1000"
"capacity": "1000",
"wip": [
{
"_class": "Dream.Job",
"name": "Job1",
"id": "J1",
"route": [
{
"stepNumber": "0",
"stationId": "Q1",
"processingTime": {
"distributionType": "Fixed",
"mean": "1"
}
},
{
"stepNumber": "1",
"stationId": "Q3",
"processingTime": {
"distributionType": "Fixed",
"mean": "3"
}
},
{
"stepNumber": "2",
"stationId": "Q2",
"processingTime": {
"distributionType": "Fixed",
"mean": "2"
}
},
{
"stepNumber": "3",
"stationId": "E1",
"processingTime": {
"distributionType": "Fixed",
"mean": "0"
}
}
]
}
]
},
"Q2": {
"_class": "Dream.QueueJobShop",
......@@ -86,44 +127,6 @@
"E1": {
"_class": "Dream.ExitJobShop",
"name": "Exit"
},
"J1": {
"_class": "Dream.Job",
"name": "Job1",
"route": [
{
"stepNumber": "0",
"stationId": "Q1",
"processingTime": {
"distributionType": "Fixed",
"mean": "1"
}
},
{
"stepNumber": "1",
"stationId": "Q3",
"processingTime": {
"distributionType": "Fixed",
"mean": "3"
}
},
{
"stepNumber": "2",
"stationId": "Q2",
"processingTime": {
"distributionType": "Fixed",
"mean": "2"
}
},
{
"stepNumber": "3",
"stationId": "E1",
"processingTime": {
"distributionType": "Fixed",
"mean": "0"
}
}
]
}
}
}
\ No newline at end of file
......@@ -68,14 +68,96 @@
"_class": "Dream.QueueJobShop",
"name": "Queue1",
"isDummy": "0",
"capacity": "1000"
"capacity": "1000",
"wip": [
{
"id": "J1",
"_class": "Dream.Job",
"name": "Job1",
"route": [
{
"stepNumber": "0",
"stationId": "Q1",
"processingTime": {
"distributionType": "Fixed",
"mean": "1"
}
},
{
"stepNumber": "1",
"stationId": "Q3",
"processingTime": {
"distributionType": "Fixed",
"mean": "3"
}
},
{
"stepNumber": "2",
"stationId": "Q2",
"processingTime": {
"distributionType": "Fixed",
"mean": "2"
}
},
{
"stepNumber": "3",
"stationId": "E1",
"processingTime": {
"distributionType": "Fixed",
"mean": "0"
}
}
]
}
]
},
"Q2": {
"_class": "Dream.QueueJobShop",
"id": "Q2",
"name": "Queue2",
"isDummy": "0",
"capacity": "1000"
"capacity": "1000",
"wip": [
{
"id": "J2",
"_class": "Dream.Job",
"name": "Job2",
"route": [
{
"stepNumber": "0",
"stationId": "Q2",
"processingTime": {
"distributionType": "Fixed",
"mean": "3"
}
},
{
"stepNumber": "1",
"stationId": "Q3",
"processingTime": {
"distributionType": "Fixed",
"mean": "1"
}
},
{
"stepNumber": "2",
"stationId": "Q2",
"processingTime": {
"distributionType": "Fixed",
"mean": "7"
}
},
{
"stepNumber": "3",
"stationId": "E1",
"processingTime": {
"distributionType": "Fixed",
"mean": "0"
}
}
]
}
]
},
"Q3": {
"_class": "Dream.QueueJobShop",
......@@ -86,82 +168,6 @@
"E1": {
"_class": "Dream.ExitJobShop",
"name": "Exit"
},
"J1": {
"_class": "Dream.Job",
"name": "Job1",
"route": [
{
"stepNumber": "0",
"stationId": "Q1",
"processingTime": {
"distributionType": "Fixed",
"mean": "1"
}
},
{
"stepNumber": "1",
"stationId": "Q3",
"processingTime": {
"distributionType": "Fixed",
"mean": "3"
}
},
{
"stepNumber": "2",
"stationId": "Q2",
"processingTime": {
"distributionType": "Fixed",
"mean": "2"
}
},
{
"stepNumber": "3",
"stationId": "E1",
"processingTime": {
"distributionType": "Fixed",
"mean": "0"
}
}
]
},
"J2": {
"_class": "Dream.Job",
"name": "Job2",
"route": [
{
"stepNumber": "0",
"stationId": "Q2",
"processingTime": {
"distributionType": "Fixed",
"mean": "3"
}
},
{
"stepNumber": "1",
"stationId": "Q3",
"processingTime": {
"distributionType": "Fixed",
"mean": "1"
}
},
{
"stepNumber": "2",
"stationId": "Q2",
"processingTime": {
"distributionType": "Fixed",
"mean": "7"
}
},
{
"stepNumber": "3",
"stationId": "E1",
"processingTime": {
"distributionType": "Fixed",
"mean": "0"
}
}
]
}
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -132,9 +132,6 @@ def createObjects():
G.AssemblyList=[]
G.DismantleList=[]
G.ConveyerList=[]
G.JobList=[]
G.WipList=[]
G.EntityList=[]
G.MachineJobShopList=[]
G.QueueJobShopList=[]
G.ExitJobShopList=[]
......@@ -374,34 +371,7 @@ def createObjects():
C.nextIds=getSuccessorList(id)
G.ObjList.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':
id=element.get('id', 'not found')
name=element.get('name', 'not found')
......@@ -525,6 +495,56 @@ def activateObjects():
except AttributeError:
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
# ===========================================================================
......@@ -538,7 +558,7 @@ def setWIP():
object=obj # find the object in the 'G.ObjList
object.getActiveObjectQueue().append(entity) # append the entity to its Queue
entity.remainingRoute[0][0]="" # remove data from the remaining route.
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
# ===========================================================================
......@@ -568,15 +588,15 @@ def main(argv=[], input_data=None):
G.JSONData=json.loads(G.InputData) # create the dictionary JSONData
readGeneralInput()
createObjects()
createWIP()
setTopology()
#run the experiment (replications)
for i in xrange(G.numberOfReplications):
logger.info("start run number "+str(i+1))
G.seed+=1
G.Rnd=Random(G.seed)
G.Rnd=Random(G.seed)
initialize() #initialize the simulation
initializeObjects()
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