Commit b2ece5cf authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Jérome Perrin

changes in the routing of Mould type entity

parent 0fb94fd1
...@@ -854,17 +854,31 @@ def createWIP(): ...@@ -854,17 +854,31 @@ def createWIP():
for key, value in entity.items(): for key, value in entity.items():
if key not in ('_class', 'id'): if key not in ('_class', 'id'):
extraPropertyDict[key] = value extraPropertyDict[key] = value
#Below it is to assign an exit if it was not assigned in JSON # if there is an exit assigned to the component
#have to talk about it with NEX # update the corresponding local flag
# TODO: have to talk about it with NEX
exitAssigned=False exitAssigned=False
for element in route: for element in route:
# elementId=element[0]
elementIds = element.get('stationIdsList',[]) elementIds = element.get('stationIdsList',[])
for obj in G.ObjList: for obj in G.ObjList:
for elementId in elementIds: for elementId in elementIds:
if obj.id==elementId and obj.type=='Exit': if obj.id==elementId and obj.type=='Exit':
exitAssigned=True exitAssigned=True
# Below it is to assign assemblers if there are any in the corresponding Global list
if not exitAssigned:
if len(G.MouldAssemblyList)!=0:
bufferIDlist = []
assemblerIDlist = []
for assemblyBuffer in G.MouldAssemblyBufferList:
bufferIDlist.append(str(assemblyBuffer.id))
for assembler in G.MouldAssemblyList:
assemblerIDlist.append(str(assembler.id))
route.append({'stationIdsList':bufferIDlist}) # assign MouldAssemblyBuffers
route.append({'stationIdsList':assemblerIDlist}) # assign MouldAssemblies
# if assemblers are assigned then an 'exit' is assigned
exitAssigned=True
#Below it is to assign an exit if it was not assigned in JSON and no assemblers are already assigned
if not exitAssigned: if not exitAssigned:
exitId=None exitId=None
for obj in G.ObjList: for obj in G.ObjList:
...@@ -872,7 +886,6 @@ def createWIP(): ...@@ -872,7 +886,6 @@ def createWIP():
exitId=obj.id exitId=obj.id
break break
if exitId: if exitId:
# route.append([exitId, 0])
route.append({'stationIdsList':[exitId],\ route.append({'stationIdsList':[exitId],\
'processingTime':{}}) 'processingTime':{}})
# initiate the job # initiate the job
......
...@@ -29,15 +29,38 @@ inherits from MachinePreemptive. It takes the components of an order and reassem ...@@ -29,15 +29,38 @@ inherits from MachinePreemptive. It takes the components of an order and reassem
the mould should be described in the componentList of the parent order the mould should be described in the componentList of the parent order
as a dictionary with the following layout if the mould is not already in WIP as a dictionary with the following layout if the mould is not already in WIP
{ {
"_class": "Dream.OrderComponent", "_class": "Dream.Mould",
"id": "C1", "id": "M1",
"name": "Component1", "name": "Mould1",
"isCritical": "1", "isCritical": "1",
"processingTime": { "processingTime": {
"distributionType": "Fixed", "distributionType": "Fixed",
"mean": "0" "mean": "0"
} },
"route": [
{
"stepNumber": "0",
"stationIdsList": [
"MA1"
], # the mould assembly stations
"processingTime": {
"distributionType": "Fixed",
"mean": "3"
}
},
{
"stepNumber": "1",
"stationIdsList": [
"IM1"
], # the injection moulding station
"processingTime": {
"distributionType": "Fixed",
"mean": "4.25"
}
}
]
} }
There is no need to assign an exit, exit is assigned automatically by the createMould method
TODOs: check the case when a mould is already in the WIP by the beginning of the simulation TODOs: check the case when a mould is already in the WIP by the beginning of the simulation
''' '''
from MachinePreemptive import MachinePreemptive from MachinePreemptive import MachinePreemptive
...@@ -73,6 +96,9 @@ class MouldAssemble(MachinePreemptive): ...@@ -73,6 +96,9 @@ class MouldAssemble(MachinePreemptive):
activeObject = self.getActiveObject() activeObject = self.getActiveObject()
giverObejct = activeObject.getGiverObject() giverObejct = activeObject.getGiverObject()
# get the first entity from the predecessor # get the first entity from the predecessor
# TODO: each machinePreemtive.getEntity is invoked,
# the self.procTime is updated. Have to decide where to assign
# the processing time of the assembler
activeEntity=MachinePreemptive.getEntity(self) activeEntity=MachinePreemptive.getEntity(self)
# check weather the activeEntity is of type Mould # check weather the activeEntity is of type Mould
if activeEntity.type=='Mould': if activeEntity.type=='Mould':
...@@ -154,6 +180,7 @@ class MouldAssemble(MachinePreemptive): ...@@ -154,6 +180,7 @@ class MouldAssemble(MachinePreemptive):
try: try:
if self.mouldParent: if self.mouldParent:
# find the component which is of type Mould # find the component which is of type Mould
# there must be only one mould component
for entity in mouldParent.componentsList: for entity in mouldParent.componentsList:
entityClass=entity.get('_class', None) entityClass=entity.get('_class', None)
if entityClass=='Dream.Mould': if entityClass=='Dream.Mould':
...@@ -182,28 +209,44 @@ class MouldAssemble(MachinePreemptive): ...@@ -182,28 +209,44 @@ class MouldAssemble(MachinePreemptive):
id=component.get('id', 'not found') id=component.get('id', 'not found')
name=component.get('name', 'not found') name=component.get('name', 'not found')
try: try:
# read the processing time of the mould in the mouldInjection station
processingTime=component.get('processingTime','not found') # dummy variable that holds the routes of the jobs the route from the JSON file is a sequence of dictionaries
distType=processingTime.get('distributionType','not found') JSONRoute=component.get('route', [])
procTime=float(processingTime.get('mean', 0))
# TODOs: update when there is an object list with the moulding stations
nextIds=[] #
# variable that holds the argument used in the Job initiation hold None for each entry in the 'route' list # variable that holds the argument used in the Job initiation hold None for each entry in the 'route' list
route = [] route = [None for i in range(len(JSONRoute))]
# create a route for the mouldToBeCreated
route.insert(0, {'stationIdsList':[str(self.id)],'processingTime':{}}) for routeentity in JSONRoute: # for each 'step' dictionary in the JSONRoute
# insert the moulding stations' List to the route of the mould with the corresponding processing times stepNumber=int(routeentity.get('stepNumber', '0')) # get the stepNumbe
if nextIds!=[]: route[stepNumber]=routeentity
route.append({'stationIdsList':[str(nextIds)],'processingTime':{'distributionType':str(distType),\ # assert that the assembler is in the moulds route and update the initial step of the mould's route
'mean':str(procType)}}) firstStep = route.pop(0)
assert self.id in route[0].get('stationIdsList',[]),\
'the assembler must be in the mould-to-be-created route\' initial step'
processingTime=firstStep.get('processingTime','not found')
# update the activeObject's processing time according to the readings in the mould's route
self.distType=processingTime.get('distributionType','not found')
self.procTime=float(processingTime.get('mean', 0))
# update the first step of the route with the activeObjects id as sole element of the stationIdsList
route.insert(0, {'stationIdsList':[str(self.id)],'processingTime':{'distributionType':str(self.distType),\
'mean':str(self.procTime)}})
#Below it is to assign an exit if it was not assigned in JSON
#have to talk about it with NEX
exitAssigned=False
for element in route:
elementIds = element.get('stationIdsList',[])
for obj in G.ObjList:
for elementId in elementIds:
if obj.id==elementId and obj.type=='Exit':
exitAssigned=True
# assign an exit to the route of the mould # assign an exit to the route of the mould
exitId=None if not exitAssigned:
for obj in G.ObjList: exitId=None
if obj.type=='Exit': for obj in G.ObjList:
exitId=obj.id if obj.type=='Exit':
break exitId=obj.id
if exitId: break
route.append({'stationIdsList':[str(exitId)],'processingTime':{}}) if exitId:
route.append({'stationIdsList':[str(exitId)],'processingTime':{}})
# keep a reference of all extra properties passed to the job # keep a reference of all extra properties passed to the job
extraPropertyDict = {} extraPropertyDict = {}
for key, value in component.items(): for key, value in component.items():
......
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