Commit b77c5256 authored by Georgios Dagkakis's avatar Georgios Dagkakis

processOperatorUnavailable signal to work in new way

parent 82a06417
...@@ -681,7 +681,9 @@ class Machine(CoreObject): ...@@ -681,7 +681,9 @@ class Machine(CoreObject):
self.interruptionActions() self.interruptionActions()
# machine has to release the operator # machine has to release the operator
self.releaseOperator() self.releaseOperator()
self.expectedSignals['brokerIsSet']=1
yield self.brokerIsSet yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
self.brokerIsSet=self.env.event() self.brokerIsSet=self.env.event()
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
...@@ -689,7 +691,9 @@ class Machine(CoreObject): ...@@ -689,7 +691,9 @@ class Machine(CoreObject):
G.pendingEntities.append(self.currentEntity) G.pendingEntities.append(self.currentEntity)
# machine has to request again for operaror # machine has to request again for operaror
self.requestOperator() self.requestOperator()
self.expectedSignals['brokerIsSet']=1
yield self.brokerIsSet yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
self.brokerIsSet=self.env.event() self.brokerIsSet=self.env.event()
# carry post interruption actions # carry post interruption actions
self.postInterruptionActions() self.postInterruptionActions()
......
...@@ -75,7 +75,7 @@ class ShiftScheduler(ObjectInterruption): ...@@ -75,7 +75,7 @@ class ShiftScheduler(ObjectInterruption):
# interrupt the victim only if it was not previously interrupted # interrupt the victim only if it was not previously interrupted
self.interruptVictim() # interrupt the victim self.interruptVictim() # interrupt the victim
else: else:
CoreObject.requestAllocation() self.requestAllocation()
self.victim.timeLastShiftEnded=self.env.now self.victim.timeLastShiftEnded=self.env.now
self.outputTrace(self.victim.name,"is off shift") self.outputTrace(self.victim.name,"is off shift")
...@@ -85,10 +85,15 @@ class ShiftScheduler(ObjectInterruption): ...@@ -85,10 +85,15 @@ class ShiftScheduler(ObjectInterruption):
yield self.env.timeout(float(self.remainingShiftPattern[0][0]-self.env.now)) # wait for the onShift yield self.env.timeout(float(self.remainingShiftPattern[0][0]-self.env.now)) # wait for the onShift
# if the victim is CoreObject reactivate it. Else ask the router for allocation of operators # if the victim is CoreObject reactivate it. Else ask the router for allocation of operators
# TODO more generic implementation # TODO more generic implementation
self.victim.onShift=True
self.victim.totalOffShiftTime+=self.env.now-self.victim.timeLastShiftEnded
self.victim.timeLastShiftStarted=self.env.now
self.outputTrace(self.victim.name,"is on shift")
startShift=self.env.now
if issubclass(self.victim.__class__, CoreObject): if issubclass(self.victim.__class__, CoreObject):
self.reactivateVictim() # re-activate the victim in case it was interrupted self.reactivateVictim() # re-activate the victim in case it was interrupted
else: else:
CoreObject.requestAllocation() self.requestAllocation()
# if the victim has interruptions that measure only the on-shift time, they have to be notified # if the victim has interruptions that measure only the on-shift time, they have to be notified
for oi in self.victim.objectInterruptions: for oi in self.victim.objectInterruptions:
...@@ -96,12 +101,6 @@ class ShiftScheduler(ObjectInterruption): ...@@ -96,12 +101,6 @@ class ShiftScheduler(ObjectInterruption):
if oi.expectedSignals['victimOnShift']: if oi.expectedSignals['victimOnShift']:
succeedTuple=(self,self.env.now) succeedTuple=(self,self.env.now)
oi.victimOnShift.succeed(succeedTuple) oi.victimOnShift.succeed(succeedTuple)
self.victim.totalOffShiftTime+=self.env.now-self.victim.timeLastShiftEnded
self.victim.onShift=True
self.victim.timeLastShiftStarted=self.env.now
self.outputTrace(self.victim.name,"is on shift")
startShift=self.env.now
else: else:
timeToEndShift=float(self.remainingShiftPattern[0][1]-self.env.now) timeToEndShift=float(self.remainingShiftPattern[0][1]-self.env.now)
yield self.env.timeout(timeToEndShift-self.receiveBeforeEndThreshold) # wait until the entry threshold yield self.env.timeout(timeToEndShift-self.receiveBeforeEndThreshold) # wait until the entry threshold
...@@ -132,7 +131,7 @@ class ShiftScheduler(ObjectInterruption): ...@@ -132,7 +131,7 @@ class ShiftScheduler(ObjectInterruption):
if not self.endUnfinished and station.isProcessing: if not self.endUnfinished and station.isProcessing:
station.processOperatorUnavailable.succeed(self.env.now) station.processOperatorUnavailable.succeed(self.env.now)
station.expectedSignals['processOperatorUnavailable']=0 station.expectedSignals['processOperatorUnavailable']=0
CoreObject.requestAllocation() self.requestAllocation()
# if the victim has interruptions that measure only the on-shift time, they have to be notified # if the victim has interruptions that measure only the on-shift time, they have to be notified
for oi in self.victim.objectInterruptions: 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