expectectedSignals dict added to ObjectInterruption for describing its state...

expectectedSignals dict added to ObjectInterruption for describing its state regarding the event signalling
parent fd166d7b
...@@ -46,6 +46,17 @@ class ObjectInterruption(ManPyObject): ...@@ -46,6 +46,17 @@ class ObjectInterruption(ManPyObject):
if self.victim: if self.victim:
if isinstance(self.victim.objectInterruptions, list): if isinstance(self.victim.objectInterruptions, list):
self.victim.objectInterruptions.append(self) self.victim.objectInterruptions.append(self)
# list of expected signals of an interruption (values can be used as flags to inform on which signals is the interruption currently yielding)
self.expectedSignals={
"victimOffShift":0,
"victimOnShift":0,
"victimStartsProcessing":0,
"victimEndsProcessing":0,
"isCalled":0,
"endedLastProcessing":0,
"victimIsEmptyBeforeMaintenance":0,
"resourceAvailable":0,
}
def initialize(self): def initialize(self):
from Globals import G from Globals import G
...@@ -57,6 +68,17 @@ class ObjectInterruption(ManPyObject): ...@@ -57,6 +68,17 @@ class ObjectInterruption(ManPyObject):
# flags that show if the interruption waits for the event # flags that show if the interruption waits for the event
self.isWaitingForVictimOffShift=False self.isWaitingForVictimOffShift=False
self.isWaitingForVictimOnShift=False self.isWaitingForVictimOnShift=False
# list of expected signals of an interruption (values can be used as flags to inform on which signals is the interruption currently yielding)
self.expectedSignals={
"victimOffShift":0,
"victimOnShift":0,
"victimStartsProcessing":0,
"victimEndsProcessing":0,
"isCalled":0,
"endedLastProcessing":0,
"victimIsEmptyBeforeMaintenance":0,
"resourceAvailable":0,
}
#=========================================================================== #===========================================================================
# the main process of the core object # the main process of the core object
...@@ -72,8 +94,9 @@ class ObjectInterruption(ManPyObject): ...@@ -72,8 +94,9 @@ class ObjectInterruption(ManPyObject):
# signalling can be done via Machine request/releaseOperator # signalling can be done via Machine request/releaseOperator
# ======================================================================= # =======================================================================
def invoke(self): def invoke(self):
succeedTuple=(self.victim,self.env.now) if self.expectedSignals['isCalled']:
self.isCalled.succeed(succeedTuple) succeedTuple=(self.victim,self.env.now)
self.isCalled.succeed(succeedTuple)
#=========================================================================== #===========================================================================
# returns the internal queue of the victim # returns the internal queue of the victim
...@@ -94,9 +117,10 @@ class ObjectInterruption(ManPyObject): ...@@ -94,9 +117,10 @@ class ObjectInterruption(ManPyObject):
def interruptVictim(self): def interruptVictim(self):
# inform the victim by whom will it be interrupted # inform the victim by whom will it be interrupted
# TODO: reconsider what happens when failure and ShiftScheduler (e.g.) signal simultaneously # TODO: reconsider what happens when failure and ShiftScheduler (e.g.) signal simultaneously
self.victim.interruptedBy=self.type if self.victim.expectedSignals['interruptionStart']:
succeedTuple=(self,self.env.now) self.victim.interruptedBy=self.type
self.victim.interruptionStart.succeed(succeedTuple) succeedTuple=(self,self.env.now)
self.victim.interruptionStart.succeed(succeedTuple)
# if the machines are operated by dedicated operators # if the machines are operated by dedicated operators
if self.victim.dedicatedOperator: if self.victim.dedicatedOperator:
# request allocation # request allocation
...@@ -106,12 +130,13 @@ class ObjectInterruption(ManPyObject): ...@@ -106,12 +130,13 @@ class ObjectInterruption(ManPyObject):
# reactivate the victim # reactivate the victim
#=========================================================================== #===========================================================================
def reactivateVictim(self): def reactivateVictim(self):
succeedTuple=(self,self.env.now) if self.victim.expectedSignals['interruptionEnd']:
self.victim.interruptionEnd.succeed(succeedTuple) succeedTuple=(self,self.env.now)
#reset the interruptionStart event of the victim self.victim.interruptionEnd.succeed(succeedTuple)
self.victim.interruptionStart=self.env.event() #reset the interruptionStart event of the victim
# TODO: reconsider what happens when failure and ShiftScheduler (e.g.) signal simultaneously self.victim.interruptionStart=self.env.event()
self.victim.interruptedBy=None # TODO: reconsider what happens when failure and ShiftScheduler (e.g.) signal simultaneously
self.victim.interruptedBy=None
# if the machines are operated by dedicated operators # if the machines are operated by dedicated operators
if self.victim.dedicatedOperator: if self.victim.dedicatedOperator:
# request allocation # request allocation
......
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