new CoreObject method initialSignalReceiver. Invoked as the generator of the...

new CoreObject method initialSignalReceiver. Invoked as the generator of the objects starts and control if there is WIP assigned to them and signals receivers
parent ea7fa32a
...@@ -75,6 +75,8 @@ class BatchDecomposition(CoreObject): ...@@ -75,6 +75,8 @@ class BatchDecomposition(CoreObject):
# the run method of the BatchDecomposition # the run method of the BatchDecomposition
# ======================================================================= # =======================================================================
def run(self): def run(self):
# check if there is WIP and signal receiver
self.initialSignalReceiver()
while 1: while 1:
# wait for an event or an interruption # wait for an event or an interruption
while 1: while 1:
......
...@@ -73,7 +73,8 @@ class BatchReassembly(CoreObject): ...@@ -73,7 +73,8 @@ class BatchReassembly(CoreObject):
# ======================================================================= # =======================================================================
def run(self): def run(self):
activeObjectQueue=self.getActiveObjectQueue() activeObjectQueue=self.getActiveObjectQueue()
# check if there is WIP and signal receiver
self.initialSignalReceiver()
while 1: while 1:
while 1: while 1:
yield waitevent, self, [self.isRequested, self.interruptionStart] yield waitevent, self, [self.isRequested, self.interruptionStart]
......
...@@ -140,6 +140,15 @@ class CoreObject(Process): ...@@ -140,6 +140,15 @@ class CoreObject(Process):
def defineRouting(self, predecessorList=[], successorList=[]): def defineRouting(self, predecessorList=[], successorList=[]):
self.next=successorList self.next=successorList
self.previous=predecessorList self.previous=predecessorList
# =======================================================================
# checks if there is anything set as WIP at the begging of the simulation
# and sends an event to initialize the simulation
# =======================================================================
def initialSignalReceiver(self):
activeObject=self.getActiveObject()
if self.haveToDispose():
self.signalReceiver()
# ======================================================================= # =======================================================================
# removes an Entity from the Object the Entity to be removed is passed # removes an Entity from the Object the Entity to be removed is passed
......
...@@ -209,6 +209,8 @@ class Machine(CoreObject): ...@@ -209,6 +209,8 @@ class Machine(CoreObject):
# the main process of the machine # the main process of the machine
# ======================================================================= # =======================================================================
def run(self): def run(self):
# check if there is WIP and signal receiver
self.initialSignalReceiver()
# execute all through simulation time # execute all through simulation time
while 1: while 1:
# waitEvent isRequested or interruption start # waitEvent isRequested or interruption start
......
...@@ -88,7 +88,8 @@ class Queue(CoreObject): ...@@ -88,7 +88,8 @@ class Queue(CoreObject):
#=========================================================================== #===========================================================================
def run(self): def run(self):
activeObjectQueue=self.getActiveObjectQueue() activeObjectQueue=self.getActiveObjectQueue()
# check if there is WIP and signal receiver
self.initialSignalReceiver()
while 1: while 1:
# wait until the Queue can accept an entity and one predecessor requests it # wait until the Queue can accept an entity and one predecessor requests it
yield waitevent, self, [self.isRequested,self.canDispose] yield waitevent, self, [self.isRequested,self.canDispose]
......
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