Commit 2a418615 authored by Georgios Dagkakis's avatar Georgios Dagkakis

operators to keep also off-shift and exit times on schedule

parent 5ac9990b
......@@ -1148,6 +1148,7 @@ class Machine(CoreObject):
# this checks if the operator is working on the last element.
# If yes the time that he was set off-shift should be updated
operator=self.currentOperator
operator.schedule[-1].append(self.env.now)
if not self.currentOperator.onShift:
operator.timeLastShiftEnded=self.env.now
operator.unAssign() # set the flag operatorAssignedTo to None
......
......@@ -286,14 +286,18 @@ class Operator(ObjectResource):
if self.ouputSchedule:
json['results']['schedule']=[]
for record in self.schedule:
try:
stationId=record[0].id
except AttributeError:
stationId=record[0]['id']
if len(record)==3:
json['results']['schedule'].append({
'stationId':record[0].id,
'stationId':stationId,
'entranceTime':record[1],
'exitTime':record[2]})
else:
json['results']['schedule'].append({
'stationId':record[0].id,
'stationId':stationId,
'entranceTime':record[1]})
G.outputJSON['elementList'].append(json)
......
......@@ -78,6 +78,10 @@ class ShiftScheduler(ObjectInterruption):
# interrupt the victim only if it was not previously interrupted
self.interruptVictim() # interrupt the victim
else:
if self.victim.schedule:
if len(self.victim.schedule[-1])==2:
self.victim.schedule[-1].append(self.env.now)
self.victim.schedule.append([{'id':'off-shift'},self.env.now])
self.requestAllocation()
self.victim.timeLastShiftEnded=self.env.now
......@@ -98,6 +102,9 @@ class ShiftScheduler(ObjectInterruption):
if issubclass(self.victim.__class__, CoreObject):
self.reactivateVictim() # re-activate the victim in case it was interrupted
else:
if self.victim.schedule:
if len(self.victim.schedule[-1])==2:
self.victim.schedule[-1].append(self.env.now)
self.requestAllocation()
# if the victim has interruptions that measure only the on-shift time, they have to be notified
......@@ -149,6 +156,10 @@ class ShiftScheduler(ObjectInterruption):
if station:
if not self.endUnfinished and station.expectedSignals['processOperatorUnavailable']:
self.sendSignal(receiver=station, signal=station.processOperatorUnavailable)
if self.victim.schedule:
if len(self.victim.schedule[-1])==2:
self.victim.schedule[-1].append(self.env.now)
self.victim.schedule.append([{'id':'off-shift'},self.env.now])
self.requestAllocation()
# if the victim has interruptions that measure only the on-shift time, they have to be notified
......
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