Commit 71bfe7c7 authored by Georgios Dagkakis's avatar Georgios Dagkakis

Machine to be able to continue when operator is back

parent fb12ec3f
......@@ -615,7 +615,6 @@ class Machine(CoreObject):
# else (if interrupted()) set interruption flag to true (only if tinM==0),
# and recalculate the processing time left tinM, passivate while waiting for repair.
# if a preemption has occurred then react accordingly (proceed with getting the critical entity)
# receivedEvent = yield self.env.timeout(self.tinM) | self.interruptionStart | self.preemptQueue
receivedEvent = yield self.env.any_of([self.interruptionStart, self.env.timeout(self.tinM) ,
self.preemptQueue, self.processOperatorUnavailable])
if self.interruptionStart in receivedEvent: # if a failure occurs while processing the machine is interrupted.
......@@ -682,19 +681,20 @@ class Machine(CoreObject):
assert self.env.now==self.processOperatorUnavailable.value, 'the operator leaving has not been processed at \
the time it should'
self.processOperatorUnavailable=self.env.event()
# carry interruption actions
self.interruptionActions()
# machine has to release the operator
self.releaseOperator()
# request for allocation
self.requestAllocation()
# wait until the Broker has finished processing
yield self.brokerIsSet
self.brokerIsSet=self.env.event()
# carry interruption actions
self.interruptionActions()
# wait until there is available processing operator (to be sent by Router)
yield self.processOperatorAvailable # interruptionEnd to be triggered by ObjectInterruption
assert self.env.now==self.processOperatorAvailable.value, 'the operator available has not been received in time'
self.processOperatorAvailable=self.env.event()
from Globals import G
# append the entity that was stopped to the pending ones
if G.Router:
G.pendingEntities.append(self.currentEntity)
# machine has to request again for operaror
self.requestOperator()
yield self.brokerIsSet
self.brokerIsSet=self.env.event()
# carry post interruption actions
self.postInterruptionActions()
# if the station is reactivated by the preempt method
......@@ -922,15 +922,11 @@ class Machine(CoreObject):
if self.isBlocked:
self.addBlockage()
# set isProcessing to False
self.isProcessing=False
# set isBlocked to False
self.isBlocked=False
activeObjectQueue=self.Res.users
activeEntity=activeObjectQueue[0]
self.printTrace(activeEntity.name, interrupted=self.objName)
# if the interrupt occurred while processing an entity
if not self.waitToDispose:
if self.isProcessing:
# output to trace that the Machine (self.objName) got interrupted
try:
self.outputTrace(activeObjectQueue[0].name, "Interrupted at "+self.objName)
......@@ -945,6 +941,10 @@ class Machine(CoreObject):
self.interruption=True
# start counting the down time at breatTime dummy variable
self.breakTime=self.env.now # dummy variable that the interruption happened
# set isProcessing to False
self.isProcessing=False
# set isBlocked to False
self.isBlocked=False
# =======================================================================
# actions to be carried out when the processing of an Entity ends
......
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