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

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