Commit 8f7596f9 authored by Georgios Dagkakis's avatar Georgios Dagkakis

operator totalWorkingTime to be updated by Machine

parent c0477e69
...@@ -440,7 +440,10 @@ class Machine(CoreObject): ...@@ -440,7 +440,10 @@ class Machine(CoreObject):
self.expectedSignals['preemptQueue']=1 self.expectedSignals['preemptQueue']=1
self.expectedSignals['processOperatorUnavailable']=1 self.expectedSignals['processOperatorUnavailable']=1
# dummy variable to keep track of the time that the operation starts after every interruption # dummy variable to keep track of the time that the operation starts after every interruption
self.timeLastOperationStarted=self.env.now self.timeLastOperationStarted=self.env.now
if self.currentOperator:
self.currentOperator.timeLastOperationStarted=self.env.now
# # if the type is setup then the time to record is timeLastProcessingStarted # # if the type is setup then the time to record is timeLastProcessingStarted
# if type=='Setup': # if type=='Setup':
# self.timeLastSetupStarted=self.timeLastOperationStarted # self.timeLastSetupStarted=self.timeLastOperationStarted
...@@ -466,7 +469,7 @@ class Machine(CoreObject): ...@@ -466,7 +469,7 @@ class Machine(CoreObject):
# # release the operator if there is interruption # # release the operator if there is interruption
#=========================================================== #===========================================================
if self.shouldYield(operationTypes={str(self.currentlyPerforming):1},methods={'isOperated':1}): if self.shouldYield(operationTypes={str(self.currentlyPerforming):1},methods={'isOperated':1}):
yield self.env.process(self.release()) yield self.env.process(self.release())
# loop until we reach at a state that there is no interruption # loop until we reach at a state that there is no interruption
while 1: while 1:
self.expectedSignals['interruptionEnd']=1 self.expectedSignals['interruptionEnd']=1
...@@ -495,6 +498,7 @@ class Machine(CoreObject): ...@@ -495,6 +498,7 @@ class Machine(CoreObject):
#=========================================================== #===========================================================
# # release the operator # # release the operator
#=========================================================== #===========================================================
self.currentOperator.totalWorkingTime+=self.env.now-self.currentOperator.timeLastOperationStarted
yield self.env.process(self.release()) yield self.env.process(self.release())
from Globals import G from Globals import G
# append the entity that was stopped to the pending ones # append the entity that was stopped to the pending ones
...@@ -834,6 +838,10 @@ class Machine(CoreObject): ...@@ -834,6 +838,10 @@ class Machine(CoreObject):
self.shouldPreempt=False self.shouldPreempt=False
# reset the variables used to handle the interruptions timing # reset the variables used to handle the interruptions timing
self.breakTime=0 self.breakTime=0
if self.currentOperator:
operator=self.currentOperator
self.outputTrace(operator.name, "ended a process in "+ self.objName)
operator.totalWorkingTime+=self.env.now-operator.timeLastOperationStarted
# if the station has just concluded a processing turn then # if the station has just concluded a processing turn then
if type=='Processing': if type=='Processing':
# blocking starts # blocking starts
...@@ -1138,9 +1146,6 @@ class Machine(CoreObject): ...@@ -1138,9 +1146,6 @@ class Machine(CoreObject):
if self.id in G.Router.expectedFinishSignalsDict: if self.id in G.Router.expectedFinishSignalsDict:
signal=G.Router.expectedFinishSignalsDict[self.id] signal=G.Router.expectedFinishSignalsDict[self.id]
self.sendSignal(receiver=G.Router, signal=signal) self.sendSignal(receiver=G.Router, signal=signal)
else:
self.outputTrace(operator.name, "ended a process in "+ self.objName)
operator.totalWorkingTime+=self.env.now-operator.timeLastOperationStarted
self.broker.invoke() self.broker.invoke()
self.toBeOperated = False self.toBeOperated = False
......
...@@ -171,7 +171,6 @@ class Broker(ObjectInterruption): ...@@ -171,7 +171,6 @@ class Broker(ObjectInterruption):
# The operator is released (the router is not called in the case of skilled ops that work constantly on the same machine) # The operator is released (the router is not called in the case of skilled ops that work constantly on the same machine)
if not self.victim.checkForDedicatedOperators(): if not self.victim.checkForDedicatedOperators():
if not self.victim.isOperated(): if not self.victim.isOperated():
self.victim.currentOperator.totalWorkingTime+=self.env.now-self.victim.currentOperator.timeLastOperationStarted
# signal the other brokers waiting for the same operators that they are now free # signal the other brokers waiting for the same operators that they are now free
# also signal the stations that were not requested to receive because the operator was occupied # also signal the stations that were not requested to receive because the operator was occupied
......
...@@ -259,7 +259,6 @@ class SkilledRouter(Router): ...@@ -259,7 +259,6 @@ class SkilledRouter(Router):
for id in solution.keys(): for id in solution.keys():
operator=findObjectById(id) operator=findObjectById(id)
station=findObjectById(solution[id]) station=findObjectById(solution[id])
operator.totalWorkingTime+=self.env.now-operator.timeLastOperationStarted
# signal the station so that it gets the operator # signal the station so that it gets the operator
self.signalStation(station, operator) self.signalStation(station, operator)
......
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