Commit 623ed13b authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Georgios Dagkakis

jobShop objects make use of expectedSignals dict

parent 14bb3fc6
...@@ -292,8 +292,9 @@ class MachineJobShop(Machine): ...@@ -292,8 +292,9 @@ class MachineJobShop(Machine):
self.receiver.timeLastEntityEnded=self.env.now #required to count blockage correctly in the preemptied station self.receiver.timeLastEntityEnded=self.env.now #required to count blockage correctly in the preemptied station
# TODO: use a signal and wait for it, reactivation is not recognised as interruption # TODO: use a signal and wait for it, reactivation is not recognised as interruption
# reactivate(self) # reactivate(self)
succeedTuple=(self,self.env.now) if self.expectedSignals['preemptQueue']:
self.preemptQueue.succeed(succeedTuple) succeedTuple=(self,self.env.now)
self.preemptQueue.succeed(succeedTuple)
# TODO: consider the case when a failure has the Station down. The event preempt will not be received now() # TODO: consider the case when a failure has the Station down. The event preempt will not be received now()
# but at a later simulation time. # but at a later simulation time.
......
...@@ -110,8 +110,9 @@ class MouldAssemblyBuffer(QueueManagedJob): ...@@ -110,8 +110,9 @@ class MouldAssemblyBuffer(QueueManagedJob):
for secondary in [x for x in activeEntity.order.secondaryComponentsList if activeEntity.order.basicsEnded]: for secondary in [x for x in activeEntity.order.secondaryComponentsList if activeEntity.order.basicsEnded]:
if secondary.currentStation.__class__.__name__=='ConditionalBuffer': if secondary.currentStation.__class__.__name__=='ConditionalBuffer':
# print now(), self.id, ' signalling conditional buffer' # print now(), self.id, ' signalling conditional buffer'
succeedTuple=(self,self.env.now) if secondary.currentStation.expectedSignals['canDispose']:
secondary.currentStation.canDispose.succeed(succeedTuple) succeedTuple=(self,self.env.now)
secondary.currentStation.canDispose.succeed(succeedTuple)
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
......
...@@ -72,6 +72,10 @@ class OrderDecomposition(CoreObject): ...@@ -72,6 +72,10 @@ class OrderDecomposition(CoreObject):
self.initialSignalReceiver() 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
self.expectedSignals['isRequested']=1
self.expectedSignals['canDispose']=1
receivedEvent=yield self.env.any_of([self.isRequested , self.canDispose]) receivedEvent=yield self.env.any_of([self.isRequested , self.canDispose])
# if the event that activated the thread is isRequested then getEntity # if the event that activated the thread is isRequested then getEntity
if self.isRequested in receivedEvent: if self.isRequested in receivedEvent:
...@@ -84,6 +88,10 @@ class OrderDecomposition(CoreObject): ...@@ -84,6 +88,10 @@ class OrderDecomposition(CoreObject):
if self.canDispose in receivedEvent: if self.canDispose in receivedEvent:
transmitter, eventTime=self.canDispose.value transmitter, eventTime=self.canDispose.value
self.canDispose=self.env.event() self.canDispose=self.env.event()
self.expectedSignals['isRequested']=0
self.expectedSignals['canDispose']=0
# if the event that activated the thread is canDispose then signalReceiver # if the event that activated the thread is canDispose then signalReceiver
if self.haveToDispose(): if self.haveToDispose():
# print now(), self.id, 'will try to signal a receiver from generator' # print now(), self.id, 'will try to signal a receiver from generator'
......
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