Commit e39066a0 authored by Georgios Dagkakis's avatar Georgios Dagkakis

correction on how BatchReassemblyBlocking calculates the blocking time

parent 2259bd6a
...@@ -134,6 +134,7 @@ class BatchReassembly(CoreObject): ...@@ -134,6 +134,7 @@ class BatchReassembly(CoreObject):
self.isProcessingInitialWIP=False self.isProcessingInitialWIP=False
# signal the receiver that the activeObject has something to dispose of # signal the receiver that the activeObject has something to dispose of
self.timeLastBlockageStarted=self.env.now self.timeLastBlockageStarted=self.env.now
self.isBlocked=True
if not self.signalReceiver(): if not self.signalReceiver():
# if there was no available receiver, get into blocking control # if there was no available receiver, get into blocking control
while 1: while 1:
......
...@@ -58,27 +58,25 @@ class BatchReassemblyBlocking(BatchReassembly): ...@@ -58,27 +58,25 @@ class BatchReassemblyBlocking(BatchReassembly):
station=self.previous[0] station=self.previous[0]
from Globals import G from Globals import G
from ShiftScheduler import ShiftScheduler from ShiftScheduler import ShiftScheduler
shift=[]
# find the shiftPattern of the previous station
for oi in G.ObjectInterruptionList:
if issubclass(oi.__class__,ShiftScheduler):
if oi.victim is station:
shift=oi.shiftPattern
break
if self.timeLastBlockageStarted: if self.timeLastBlockageStarted:
# calculate how much time the previous station was offShift # calculate how much time the previous station was offShift
offShift=0 offShift=0
for i, record in enumerate(shift): for endShiftTime in station.endShiftTimes:
start=record[0] # if there was end of shift while the station was blocked
end=record[1] if endShiftTime>=self.timeLastBlockageStarted:
if start>self.env.now: end=endShiftTime
lastShift=True
# find the start of the next shift
for startShiftTime in station.startShiftTimes:
if startShiftTime>end:
lastShift=False
nextStart=startShiftTime
break break
if end<self.timeLastBlockageStarted: # if there is not start of next shift, then it was the last shift, so
continue # the station is currently off. Subtract this off-shift time
# if the there is offShift time in the blockage if lastShift:
if end<self.env.now: offShift+=self.env.now-end
try: # else, subtract the whole off-shift time of that shift
offShift+=shift[i+1][0]-end else:
except IndexError: offShift+=nextStart-end
pass
self.totalBlockageTime+=self.env.now-self.timeLastBlockageStarted-offShift self.totalBlockageTime+=self.env.now-self.timeLastBlockageStarted-offShift
...@@ -223,6 +223,9 @@ class CoreObject(ManPyObject): ...@@ -223,6 +223,9 @@ class CoreObject(ManPyObject):
"entityCreated":0, "entityCreated":0,
"moveEnd":0 "moveEnd":0
} }
# lists that keep the start/endShiftTimes of the victim
self.endShiftTimes=[]
self.startShiftTimes=[]
# ======================================================================= # =======================================================================
# the main process of the core object # the main process of the core object
......
...@@ -58,6 +58,9 @@ class ObjectResource(ManPyObject): ...@@ -58,6 +58,9 @@ class ObjectResource(ManPyObject):
self.coreObjects=[] self.coreObjects=[]
# flag that locks the resource so that it cannot get new jobs # flag that locks the resource so that it cannot get new jobs
self.isLocked=False self.isLocked=False
# lists that keep the start/endShiftTimes of the victim
self.endShiftTimes=[]
self.startShiftTimes=[]
# ======================================================================= # =======================================================================
# checks if the worker is available # checks if the worker is available
......
...@@ -81,6 +81,7 @@ class ShiftScheduler(ObjectInterruption): ...@@ -81,6 +81,7 @@ class ShiftScheduler(ObjectInterruption):
self.requestAllocation() self.requestAllocation()
self.victim.timeLastShiftEnded=self.env.now self.victim.timeLastShiftEnded=self.env.now
self.victim.endShiftTimes.append(self.env.now)
self.outputTrace(self.victim.name,"is off shift") self.outputTrace(self.victim.name,"is off shift")
while 1: while 1:
...@@ -91,6 +92,7 @@ class ShiftScheduler(ObjectInterruption): ...@@ -91,6 +92,7 @@ class ShiftScheduler(ObjectInterruption):
self.victim.onShift=True self.victim.onShift=True
self.victim.totalOffShiftTime+=self.env.now-self.victim.timeLastShiftEnded self.victim.totalOffShiftTime+=self.env.now-self.victim.timeLastShiftEnded
self.victim.timeLastShiftStarted=self.env.now self.victim.timeLastShiftStarted=self.env.now
self.victim.startShiftTimes.append(self.env.now)
self.outputTrace(self.victim.name,"is on shift") self.outputTrace(self.victim.name,"is on shift")
startShift=self.env.now startShift=self.env.now
if issubclass(self.victim.__class__, CoreObject): if issubclass(self.victim.__class__, CoreObject):
...@@ -143,6 +145,7 @@ class ShiftScheduler(ObjectInterruption): ...@@ -143,6 +145,7 @@ class ShiftScheduler(ObjectInterruption):
self.victim.onShift=False # get the victim off-shift self.victim.onShift=False # get the victim off-shift
self.victim.timeLastShiftEnded=self.env.now self.victim.timeLastShiftEnded=self.env.now
self.victim.endShiftTimes.append(self.env.now)
self.outputTrace(self.victim.name,"is off shift") self.outputTrace(self.victim.name,"is off shift")
self.remainingShiftPattern.pop(0) self.remainingShiftPattern.pop(0)
......
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