Jobshop objects updated to follow the new signalling

parent bbd3e1c0
...@@ -292,7 +292,8 @@ class MachineJobShop(Machine): ...@@ -292,7 +292,8 @@ 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)
self.preemptQueue.succeed(self.env.now) 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,7 +110,8 @@ class MouldAssemblyBuffer(QueueManagedJob): ...@@ -110,7 +110,8 @@ 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'
secondary.currentStation.canDispose.succeed(self.env.now) 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
......
...@@ -79,6 +79,7 @@ class RouterManaged(Router): ...@@ -79,6 +79,7 @@ class RouterManaged(Router):
while 1: while 1:
# wait until the router is called # wait until the router is called
yield self.isCalled yield self.isCalled
transmitter, eventTime=self.isCalled.value
self.isCalled=self.env.event() self.isCalled=self.env.event()
self.printTrace('','=-'*15) self.printTrace('','=-'*15)
self.printTrace('','router received event') self.printTrace('','router received event')
...@@ -192,7 +193,8 @@ class RouterManaged(Router): ...@@ -192,7 +193,8 @@ class RouterManaged(Router):
if station in self.pendingMachines and station in self.toBeSignalled: if station in self.pendingMachines and station in self.toBeSignalled:
# signal this station's broker that the resource is available # signal this station's broker that the resource is available
self.printTrace('router','signalling broker of'+' '*50+operator.isAssignedTo().id) self.printTrace('router','signalling broker of'+' '*50+operator.isAssignedTo().id)
operator.isAssignedTo().broker.resourceAvailable.succeed(self.env.now) succeedTuple=(self,self.env.now)
operator.isAssignedTo().broker.resourceAvailable.succeed(succeedTuple)
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'
...@@ -202,7 +204,8 @@ class RouterManaged(Router): ...@@ -202,7 +204,8 @@ class RouterManaged(Router):
# if the station is already is already signalled then do not send event # if the station is already is already signalled then do not send event
if not operator.candidateEntity.currentStation.loadOperatorAvailable.triggered: if not operator.candidateEntity.currentStation.loadOperatorAvailable.triggered:
self.printTrace('router','signalling queue'+' '*50+operator.candidateEntity.currentStation.id) self.printTrace('router','signalling queue'+' '*50+operator.candidateEntity.currentStation.id)
operator.candidateEntity.currentStation.loadOperatorAvailable.succeed(self.env.now) succeedTuple=(self,self.env.now)
operator.candidateEntity.currentStation.loadOperatorAvailable.succeed(succeedTuple)
#=========================================================================== #===========================================================================
# clear the pending lists of the router # clear the pending lists of the router
......
...@@ -75,12 +75,14 @@ class OrderDecomposition(CoreObject): ...@@ -75,12 +75,14 @@ class OrderDecomposition(CoreObject):
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:
transmitter, eventTime=self.isRequested.value
self.isRequested=self.env.event() self.isRequested=self.env.event()
# reset the isRequested signal parameter # reset the isRequested signal parameter
self.isRequested.signalparam=None self.isRequested.signalparam=None
self.getEntity() self.getEntity()
self.decompose() self.decompose()
if self.canDispose in receivedEvent: if self.canDispose in receivedEvent:
transmitter, eventTime=self.canDispose.value
self.canDispose=self.env.event() self.canDispose=self.env.event()
# 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():
......
...@@ -120,7 +120,8 @@ class QueueManagedJob(QueueJobShop): ...@@ -120,7 +120,8 @@ class QueueManagedJob(QueueJobShop):
if not G.Router.invoked: if not G.Router.invoked:
# self.printTrace(self.id, signal='router') # self.printTrace(self.id, signal='router')
G.Router.invoked=True G.Router.invoked=True
G.Router.isCalled.succeed(G.env.now) succeedTuple=(G.env, G.env.now)
G.Router.isCalled.succeed(succeedTuple)
return True return True
except: except:
return False return False
......
...@@ -71,6 +71,7 @@ class SkilledRouter(Router): ...@@ -71,6 +71,7 @@ class SkilledRouter(Router):
while 1: while 1:
# wait until the router is called # wait until the router is called
yield self.isCalled yield self.isCalled
transmitter, eventTime=self.isCalled.value
self.isCalled=self.env.event() self.isCalled=self.env.event()
self.printTrace('','=-'*15) self.printTrace('','=-'*15)
self.printTrace('','router received event') self.printTrace('','router received event')
...@@ -128,6 +129,7 @@ class SkilledRouter(Router): ...@@ -128,6 +129,7 @@ class SkilledRouter(Router):
receivedEvent=yield self.env.all_of(self.endProcessingSignals) receivedEvent=yield self.env.all_of(self.endProcessingSignals)
for station in self.busyStations: for station in self.busyStations:
if station.endedLastProcessing in receivedEvent: if station.endedLastProcessing in receivedEvent:
transmitter, eventTime=station.endedLastProcessing.value
station.endedLastProcessing=self.env.event() station.endedLastProcessing=self.env.event()
...@@ -240,13 +242,15 @@ class SkilledRouter(Router): ...@@ -240,13 +242,15 @@ class SkilledRouter(Router):
if station.broker.waitForOperator: if station.broker.waitForOperator:
# signal this station's broker that the resource is available # signal this station's broker that the resource is available
self.printTrace('router', 'signalling broker of'+' '*50+station.id) self.printTrace('router', 'signalling broker of'+' '*50+station.id)
station.broker.resourceAvailable.succeed(self.env.now) succeedTuple=(self,self.env.now)
station.broker.resourceAvailable.succeed(succeedTuple)
else: else:
# signal the queue proceeding the station # signal the queue proceeding the station
if station.canAccept()\ if station.canAccept()\
and any(type=='Load' for type in station.multOperationTypeList): and any(type=='Load' for type in station.multOperationTypeList):
self.printTrace('router', 'signalling'+' '*50+station.id) self.printTrace('router', 'signalling'+' '*50+station.id)
station.loadOperatorAvailable.succeed(self.env.now) succeedTuple=(self,self.env.now)
station.loadOperatorAvailable.succeed(succeedTuple)
#=================================================================== #===================================================================
# default behaviour # default behaviour
......
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