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