corrections in order to update correctly the task_id and other attributes of...

corrections in order to update correctly the task_id and other attributes of its first route step after it is assembled
parent 37c93128
...@@ -255,11 +255,20 @@ def setWIP(entityList): ...@@ -255,11 +255,20 @@ def setWIP(entityList):
# append only if not already in the list # append only if not already in the list
if nextObject not in object.next: if nextObject not in object.next:
object.next.append(nextObject) object.next.append(nextObject)
# update the task_id of the current schedule step dict
# find the currentStep within the entity's route
try:
currentTaskId = None
if entity.remainingRoute:
currentTaskId = entity.remainingRoute[0].get("task_id", None)
except AttributeError:
pass
entity.remainingRoute.pop(0) # remove data from the remaining route. entity.remainingRoute.pop(0) # remove data from the remaining route.
entity.schedule.append({"station": object, entity.schedule.append({"station": object,
"entranceTime": G.env.now}) #append the time to schedule so that it can be read in the result "entranceTime": G.env.now}) #append the time to schedule so that it can be read in the result
# if there is currentTaskId then append it to the schedule
if currentTaskId:
entity.schedule[-1]["task_id"] = currentTaskId
# if the currentStation of the entity is of type Machine then the entity # if the currentStation of the entity is of type Machine then the entity
# must be processed first and then added to the pendingEntities list # must be processed first and then added to the pendingEntities list
# Its hot flag is not raised # Its hot flag is not raised
......
...@@ -246,7 +246,16 @@ class MouldAssembly(MachineJobShop): ...@@ -246,7 +246,16 @@ class MouldAssembly(MachineJobShop):
processDistType=processingTime.keys()[0] processDistType=processingTime.keys()[0]
procTime=float(processingTime[processDistType].get('mean', 0)) procTime=float(processingTime[processDistType].get('mean', 0))
processOpType=firstStep.get('operationType',{}).get('Processing','not found') # can be manual/automatic processOpType=firstStep.get('operationType',{}).get('Processing','not found') # can be manual/automatic
# task_id
task_id = firstStep.get('task_id', None)
# sequence
sequence = firstStep.get('sequence', None)
# operator
operator = firstStep.get('operator', {})
# technology
technology = firstStep.get('technology', None)
# quantity
quantity = firstStep.get('quantity', None)
# setup operation # setup operation
setupTime=firstStep.get('setupTime',None) setupTime=firstStep.get('setupTime',None)
if setupTime: if setupTime:
...@@ -257,13 +266,30 @@ class MouldAssembly(MachineJobShop): ...@@ -257,13 +266,30 @@ class MouldAssembly(MachineJobShop):
setTime=float(setupTime[setupDistType].get('mean', 0)) setTime=float(setupTime[setupDistType].get('mean', 0))
setupOpType=firstStep.get('operationType',{}).get('Setup','not found') # can be manual/automatic setupOpType=firstStep.get('operationType',{}).get('Setup','not found') # can be manual/automatic
# update the first step of the route with the activeObjects id as sole element of the stationIdsList # 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':{str(processDistType):{'mean':str(procTime)}},\ route.insert(0, {'stationIdsList':[str(self.id)],
'setupTime':{str(setupDistType):{'mean':str(setupTime)}}, 'processingTime':{str(processDistType):{'mean':str(procTime)}},\
'operationType':{'Processing':processOpType,'Setup':setupOpType}}) 'setupTime':{str(setupDistType):{'mean':str(setupTime)}},
'operationType':{'Processing':processOpType,'Setup':setupOpType}})
else: else:
# update the first step of the route with the activeObjects id as sole element of the stationIdsList # 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':{str(processDistType):{'mean':str(procTime)}}, route.insert(0, {'stationIdsList':[str(self.id)],
'processingTime':{str(processDistType):{'mean':str(procTime)}},
'operationType':{'Processing':processOpType}}) 'operationType':{'Processing':processOpType}})
# if there is task_id then add it to the route
if task_id:
route[0]["task_id"] = task_id
# if there is sequence then add it to the route
if sequence:
route[0]["sequence"] = sequence
# if there is operator then add it to the route
if operator:
route[0]["operator"] = operator
# if there is technology then add it to the route
if technology:
route[0]["technology"] = technology
# if there is quantity then add it to the route
if quantity!=None:
route[0]["quantity"] = quantity
#Below it is to assign an exit if it was not assigned in JSON #Below it is to assign an exit if it was not assigned in JSON
#have to talk about it with NEX #have to talk about it with NEX
exitAssigned=False exitAssigned=False
......
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