Commit 9e42059a authored by Georgios Dagkakis's avatar Georgios Dagkakis

Operator able to finish current work before getting off-shift

parent 0a80309c
...@@ -1152,8 +1152,13 @@ class Machine(CoreObject): ...@@ -1152,8 +1152,13 @@ class Machine(CoreObject):
self.outputTrace(self.currentOperator.objName, "released from "+ self.objName) self.outputTrace(self.currentOperator.objName, "released from "+ self.objName)
# set the flag operatorAssignedTo to None # set the flag operatorAssignedTo to None
# XXX in case of skilled operators which stay at the same station should that change # XXX in case of skilled operators which stay at the same station should that change
# TODO I think this control should be moved before the method is called
if not self.checkForDedicatedOperators(): if not self.checkForDedicatedOperators():
self.currentOperator.unAssign() self.currentOperator.unAssign()
# this checks if the operator is working on the last element.
# If yes the time that he was set off-shift should be updated
if not self.currentOperator.onShift:
self.currentOperator.timeLastShiftEnded=self.env.now
self.broker.invoke() self.broker.invoke()
self.toBeOperated = False self.toBeOperated = False
......
...@@ -316,12 +316,13 @@ class Operator(ObjectResource): ...@@ -316,12 +316,13 @@ class Operator(ObjectResource):
if MaxSimtime==None: if MaxSimtime==None:
from Globals import G from Globals import G
MaxSimtime=G.maxSimTime MaxSimtime=G.maxSimTime
# if the Operator is currently working we have to count the time of this work # if the Operator is currently working we have to count the time of this work
if len(self.getResourceQueue())>0: if len(self.getResourceQueue())>0:
self.totalWorkingTime+=self.env.now-self.timeLastOperationStarted self.totalWorkingTime+=self.env.now-self.timeLastOperationStarted
# if the Operator is currently off-shift we have to count the time of this work # if the Operator is currently off-shift we have to count the time of this work
if not self.onShift: if not self.onShift and len(self.getResourceQueue())==0:
self.totalOffShiftTime+=self.env.now-self.timeLastShiftEnded self.totalOffShiftTime+=self.env.now-self.timeLastShiftEnded
# Repairman was idle when he was not in any other state # Repairman was idle when he was not in any other state
......
...@@ -109,6 +109,7 @@ class ShiftScheduler(ObjectInterruption): ...@@ -109,6 +109,7 @@ class ShiftScheduler(ObjectInterruption):
self.victim.isLocked=False # unlock the entry of the victim self.victim.isLocked=False # unlock the entry of the victim
# if the mode is to end current work before going off-shift and there is current work, wait for victimEndedLastProcessing # if the mode is to end current work before going off-shift and there is current work, wait for victimEndedLastProcessing
# signal before going off-shift # signal before going off-shift
if issubclass(self.victim.__class__, CoreObject):
if self.endUnfinished and len(self.victim.getActiveObjectQueue())==1 and (not self.victim.waitToDispose): if self.endUnfinished and len(self.victim.getActiveObjectQueue())==1 and (not self.victim.waitToDispose):
self.victim.isWorkingOnTheLast=True self.victim.isWorkingOnTheLast=True
self.waitingSignal=True self.waitingSignal=True
......
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