Commit 35007c2a authored by Georgios Dagkakis's avatar Georgios Dagkakis

all objects now reset flags of the receiver after they sent the signal. Other resets to be erased

parent cdd097f6
......@@ -113,6 +113,7 @@ class MouldAssemblyBuffer(QueueManagedJob):
if secondary.currentStation.expectedSignals['canDispose']:
succeedTuple=(self,self.env.now)
secondary.currentStation.canDispose.succeed(succeedTuple)
secondary.currentStation.expectedSignals['canDispose']=0
break
# for all the components that have the same parent Order as the activeEntity
activeEntity.order.componentsReadyForAssembly = 1
......
......@@ -83,4 +83,5 @@ class NonStarvingEntry(Queue):
if self.expectedSignals['canDispose']:
succeedTuple=(self, self.env.now)
self.canDispose.succeed(succeedTuple)
self.expectedSignals['canDispose']=0
\ No newline at end of file
......@@ -97,6 +97,7 @@ class ObjectInterruption(ManPyObject):
if self.expectedSignals['isCalled']:
succeedTuple=(self.victim,self.env.now)
self.isCalled.succeed(succeedTuple)
self.expectedSignals['isCalled']=0
#===========================================================================
# returns the internal queue of the victim
......@@ -134,6 +135,7 @@ class ObjectInterruption(ManPyObject):
if self.victim.expectedSignals['interruptionEnd']:
succeedTuple=(self,self.env.now)
self.victim.interruptionEnd.succeed(succeedTuple)
self.victim.expectedSignals['interruptionEnd']=0
#reset the interruptionStart event of the victim
self.victim.interruptionStart=self.env.event()
# TODO: reconsider what happens when failure and ShiftScheduler (e.g.) signal simultaneously
......
......@@ -248,6 +248,7 @@ class Router(ObjectInterruption):
self.printTrace('router', 'signalling broker of'+' '*50+operator.isAssignedTo().id)
succeedTuple=(self,self.env.now)
station.broker.resourceAvailable.succeed(succeedTuple)
station.broker.expectedSignals['resourceAvailable']=0
else:
# signal the queue proceeding the station
if station.canAccept()\
......@@ -256,6 +257,7 @@ class Router(ObjectInterruption):
self.printTrace('router', 'signalling'+' '*50+operator.isAssignedTo().id)
succeedTuple=(self,self.env.now)
station.loadOperatorAvailable.succeed(succeedTuple)
station.expectedSignals['loadOperatorAvailable']=0
#===========================================================================
# clear the pending lists of the router
......
......@@ -202,6 +202,7 @@ class RouterManaged(Router):
if operator.isAssignedTo().broker.expectedSignals['resourceAvailable']:
succeedTuple=(self,self.env.now)
operator.isAssignedTo().broker.resourceAvailable.succeed(succeedTuple)
operator.isAssignedTo().broker.expectedSignals['resourceAvailable']=0
elif (not station in self.pendingMachines) or (not station in self.toBeSignalled):
# signal the queue proceeding the station
assert operator.candidateEntity.currentStation in self.toBeSignalled, 'the candidateEntity currentStation is not picked by the Router'
......@@ -214,6 +215,7 @@ class RouterManaged(Router):
if operator.candidateEntity.currentStation.expectedSignals['loadOperatorAvailable']:
succeedTuple=(self,self.env.now)
operator.candidateEntity.currentStation.loadOperatorAvailable.succeed(succeedTuple)
operator.candidateEntity.currentStation.expectedSignals['loadOperatorAvailable']=0
#===========================================================================
# clear the pending lists of the router
......
......@@ -117,11 +117,12 @@ class QueueManagedJob(QueueJobShop):
if receiver.identifyEntityToGet().manager.isAssignedTo()!=receiver:
try:
from Globals import G
if not G.Router.invoked:
if not G.Router.invoked and G.Router.expectedSignals['isCalled']:
# self.printTrace(self.id, signal='router')
G.Router.invoked=True
succeedTuple=(G.env, G.env.now)
G.Router.isCalled.succeed(succeedTuple)
G.Router.expectedSignals['isCalled']=0
return True
except:
return False
......
......@@ -101,6 +101,7 @@ class ShiftScheduler(ObjectInterruption):
if oi.expectedSignals['victimOnShift']:
succeedTuple=(self,self.env.now)
oi.victimOnShift.succeed(succeedTuple)
oi.expectedSignals['victimOnShift']=0
else:
timeToEndShift=float(self.remainingShiftPattern[0][1]-self.env.now)
yield self.env.timeout(timeToEndShift-self.receiveBeforeEndThreshold) # wait until the entry threshold
......@@ -139,6 +140,7 @@ class ShiftScheduler(ObjectInterruption):
if oi.expectedSignals['victimOffShift']:
succeedTuple=(self, self.env.now)
oi.victimOffShift.succeed(succeedTuple)
oi.expectedSignals['victimOnShift']=0
self.victim.onShift=False # get the victim off-shift
......
......@@ -257,6 +257,7 @@ class SkilledRouter(Router):
self.printTrace('router', 'signalling broker of'+' '*50+station.id)
succeedTuple=(self,self.env.now)
station.broker.resourceAvailable.succeed(succeedTuple)
station.broker.expectedSignals['resourceAvailable']=0
else:
# signal the queue proceeding the station
if station.canAccept()\
......@@ -265,6 +266,7 @@ class SkilledRouter(Router):
self.printTrace('router', 'signalling'+' '*50+station.id)
succeedTuple=(self,self.env.now)
station.loadOperatorAvailable.succeed(succeedTuple)
station.expectedSignals['loadOperatorAvailable']=0
#===================================================================
# default behaviour
......
......@@ -66,6 +66,7 @@ class EntityGenerator(object):
if self.victim.expectedSignals['entityCreated']:
succeedTupple=(entity,self.env.now)
self.victim.entityCreated.succeed(succeedTupple)
self.victim.expectedSignals['entityCreated']=0
# else put it on the time list for scheduled Entities
else:
entityCounter=G.numberOfEntities+len(self.victim.scheduledEntities) # this is used just ot output the trace correctly
......@@ -208,4 +209,5 @@ class Source(CoreObject):
if self.expectedSignals['entityCreated']:
succeedTuple=(newEntity,self.env.now)
self.entityCreated.succeed(succeedTuple)
self.expectedSignals['entityCreated']=0
return activeEntity
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