interruption objects updated for the new type of signalling

parent c6f3cf34
...@@ -83,7 +83,8 @@ class ScheduledMaintenance(ObjectInterruption): ...@@ -83,7 +83,8 @@ class ScheduledMaintenance(ObjectInterruption):
self.waitingSignal=True self.waitingSignal=True
# TODO: signal to be triggered by postProcessingActions of Machines # TODO: signal to be triggered by postProcessingActions of Machines
yield self.victim.endedLastProcessing # there is no signal yet that signals the change of such state (an object getting empty) yield self.victim.endedLastProcessing # there is no signal yet that signals the change of such state (an object getting empty)
assert self.victim.endedLastProcessing.value==self.env.now, 'the processing end signal is not received by maintenance on time' transmitter, eventTime=self.victim.endedLastProcessing.value
assert eventTime==self.env.now, 'the processing end signal is not received by maintenance on time'
self.victim.endedLastProcessing=self.env.event() self.victim.endedLastProcessing=self.env.event()
waitTime=self.env.now-waitStartTime waitTime=self.env.now-waitStartTime
self.interruptVictim() self.interruptVictim()
...@@ -93,7 +94,8 @@ class ScheduledMaintenance(ObjectInterruption): ...@@ -93,7 +94,8 @@ class ScheduledMaintenance(ObjectInterruption):
self.waitingSignal=True self.waitingSignal=True
# TODO: signal to be triggered by removeEntity of Machines # TODO: signal to be triggered by removeEntity of Machines
yield self.victimIsEmptyBeforeMaintenance # there is no signal yet that signals the change of such state (an object getting empty) yield self.victimIsEmptyBeforeMaintenance # there is no signal yet that signals the change of such state (an object getting empty)
assert self.victimIsEmptyBeforeMaintenance.value==self.env.now, 'the processing end signal is not received by maintenance on time' transmitter, eventTime=self.victimIsEmptyBeforeMaintenance.value
assert eventTime==self.env.now, 'the processing end signal is not received by maintenance on time'
self.victimIsEmptyBeforeMaintenance=self.env.event() self.victimIsEmptyBeforeMaintenance=self.env.event()
waitTime=self.env.now-waitStartTime waitTime=self.env.now-waitStartTime
self.interruptVictim() self.interruptVictim()
......
...@@ -78,7 +78,8 @@ class ShiftScheduler(ObjectInterruption): ...@@ -78,7 +78,8 @@ class ShiftScheduler(ObjectInterruption):
# 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:
if oi.isWaitingForVictimOnShift: if oi.isWaitingForVictimOnShift:
oi.victimOnShift.succeed() succeedTuple=(self,self.env.now)
oi.victimOnShift.succeed(succeedTuple)
self.victim.totalOffShiftTime+=self.env.now-self.victim.timeLastShiftEnded self.victim.totalOffShiftTime+=self.env.now-self.victim.timeLastShiftEnded
self.victim.onShift=True self.victim.onShift=True
...@@ -96,13 +97,15 @@ class ShiftScheduler(ObjectInterruption): ...@@ -96,13 +97,15 @@ class ShiftScheduler(ObjectInterruption):
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
yield self.victim.endedLastProcessing yield self.victim.endedLastProcessing
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 # 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:
if oi.isWaitingForVictimOffShift: if oi.isWaitingForVictimOffShift:
oi.victimOffShift.succeed() succeedTuple=(self, self.env.now)
oi.victimOffShift.succeed(succeedTuple)
# interrupt the victim only if it was not previously interrupted # interrupt the victim only if it was not previously interrupted
if not self.victim.interruptionStart.triggered: if not self.victim.interruptionStart.triggered:
......
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