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):
self.outputTrace(self.currentOperator.objName, "released from "+ self.objName)
# set the flag operatorAssignedTo to None
# 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():
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.toBeOperated = False
......
......@@ -316,12 +316,13 @@ class Operator(ObjectResource):
if MaxSimtime==None:
from Globals import G
MaxSimtime=G.maxSimTime
# if the Operator is currently working we have to count the time of this work
if len(self.getResourceQueue())>0:
self.totalWorkingTime+=self.env.now-self.timeLastOperationStarted
# 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
# Repairman was idle when he was not in any other state
......
......@@ -109,9 +109,10 @@ class ShiftScheduler(ObjectInterruption):
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
# signal before going off-shift
if self.endUnfinished and len(self.victim.getActiveObjectQueue())==1 and (not self.victim.waitToDispose):
self.victim.isWorkingOnTheLast=True
self.waitingSignal=True
if issubclass(self.victim.__class__, CoreObject):
if self.endUnfinished and len(self.victim.getActiveObjectQueue())==1 and (not self.victim.waitToDispose):
self.victim.isWorkingOnTheLast=True
self.waitingSignal=True
self.expectedSignals['endedLastProcessing']=1
......@@ -120,7 +121,7 @@ class ShiftScheduler(ObjectInterruption):
self.expectedSignals['endedLastProcessing']=0
transmitter, eventTime=self.victim.endedLastProcessing.value
self.victim.endedLastProcessing=self.env.event()
self.victim.endedLastProcessing=self.env.event()
# if the victim has interruptions that measure only the on-shift time, they have to be notified
for oi in self.victim.objectInterruptions:
......
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