currentStep is used by broker to update operators shedule (task_id)

parent 199044fd
......@@ -162,28 +162,20 @@ class Broker(ObjectInterruption):
"entranceTime": self.env.now})
# if the victim holds an entity (load is already performed)
if self.victim.getActiveObjectQueue():
activeEntity = self.victim.getActiveObjectQueue()[0]
# print self.env.now, "the victim", self.victim.id, "holds an entity and requests an operator"
# update the entity value of the schedule current step dict
if self.victim.currentOperator.schedule[-1].get("entity", None) == None:
self.victim.currentOperator.schedule[-1]["entity"] = self.victim.getActiveObjectQueue()[0]
# update the task_id of the current schedule step dict
currentStep = None
# if the task_id of the last step is not already updated
if self.victim.currentOperator.schedule[-1].get("task_id", None) == None:
# find the currentStep within the entity's route
try:
if self.victim.getActiveObjectQueue()[0].remainingRoute:
nextStep = self.victim.getActiveObjectQueue()[0].remainingRoute[0]
# if the steps have a task_id key
if nextStep.get("task_id", None):
for step in self.victim.getActiveObjectQueue()[0].route:
if step["task_id"] == nextStep["task_id"] and\
step.get("technology", None) != None:
currentStep = step
break
except:
pass
if currentStep:
self.victim.currentOperator.schedule[-1]["task_id"] = currentStep["task_id"]
self.victim.currentOperator.schedule[-1]["entity"] = activeEntity
# if the entity held by the station has a currentStep
try:
if activeEntity.currentStep:
if activeEntity.currentStep.get("task_id", None):
# print " ", self.env.now
# print " broker is updating the task_id of the operator", self.victim.currentOperator.id, activeEntity.currentStep["task_id"]
self.victim.currentOperator.schedule[-1]["task_id"] = activeEntity.currentStep["task_id"]
except AttributeError:
pass
# wait till the processing is over
self.expectedSignals['isCalled']=1
......
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