Commit df5712d6 authored by Georgios Dagkakis's avatar Georgios Dagkakis

Machine and operatedPoolBroker updated

parent b77c5256
...@@ -328,9 +328,7 @@ class Machine(CoreObject): ...@@ -328,9 +328,7 @@ class Machine(CoreObject):
self.expectedSignals['brokerIsSet']=1 self.expectedSignals['brokerIsSet']=1
yield self.brokerIsSet yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
transmitter, eventTime=self.brokerIsSet.value transmitter, eventTime=self.brokerIsSet.value
assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker' assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker'
assert eventTime==self.env.now, 'brokerIsSet is not received on time' assert eventTime==self.env.now, 'brokerIsSet is not received on time'
...@@ -358,13 +356,8 @@ class Machine(CoreObject): ...@@ -358,13 +356,8 @@ class Machine(CoreObject):
# machine has to release the operator # machine has to release the operator
self.releaseOperator() self.releaseOperator()
# wait until the Broker has finished processing # wait until the Broker has finished processing
self.expectedSignals['brokerIsSet']=1 self.expectedSignals['brokerIsSet']=1
yield self.brokerIsSet
yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
transmitter, eventTime=self.brokerIsSet.value transmitter, eventTime=self.brokerIsSet.value
assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker' assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker'
assert eventTime==self.env.now, 'brokerIsSet is not received on time' assert eventTime==self.env.now, 'brokerIsSet is not received on time'
...@@ -451,9 +444,7 @@ class Machine(CoreObject): ...@@ -451,9 +444,7 @@ class Machine(CoreObject):
self.expectedSignals['brokerIsSet']=1 self.expectedSignals['brokerIsSet']=1
yield self.brokerIsSet yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
transmitter, eventTime=self.brokerIsSet.value transmitter, eventTime=self.brokerIsSet.value
assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker' assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker'
assert eventTime==self.env.now, 'brokerIsSet is not received on time' assert eventTime==self.env.now, 'brokerIsSet is not received on time'
...@@ -485,9 +476,7 @@ class Machine(CoreObject): ...@@ -485,9 +476,7 @@ class Machine(CoreObject):
self.expectedSignals['brokerIsSet']=1 self.expectedSignals['brokerIsSet']=1
yield self.brokerIsSet yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
transmitter, eventTime=self.brokerIsSet.value transmitter, eventTime=self.brokerIsSet.value
assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker' assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker'
assert eventTime==self.env.now, 'brokerIsSet is not received on time' assert eventTime==self.env.now, 'brokerIsSet is not received on time'
...@@ -518,9 +507,7 @@ class Machine(CoreObject): ...@@ -518,9 +507,7 @@ class Machine(CoreObject):
self.expectedSignals['brokerIsSet']=1 self.expectedSignals['brokerIsSet']=1
yield self.brokerIsSet yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
transmitter, eventTime=self.brokerIsSet.value transmitter, eventTime=self.brokerIsSet.value
assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker' assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker'
assert eventTime==self.env.now, 'brokerIsSet is not received on time' assert eventTime==self.env.now, 'brokerIsSet is not received on time'
...@@ -571,9 +558,7 @@ class Machine(CoreObject): ...@@ -571,9 +558,7 @@ class Machine(CoreObject):
self.expectedSignals['brokerIsSet']=1 self.expectedSignals['brokerIsSet']=1
yield self.brokerIsSet yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
transmitter, eventTime=self.brokerIsSet.value transmitter, eventTime=self.brokerIsSet.value
assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker' assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker'
assert eventTime==self.env.now, 'brokerIsSet is not received on time' assert eventTime==self.env.now, 'brokerIsSet is not received on time'
...@@ -594,6 +579,7 @@ class Machine(CoreObject): ...@@ -594,6 +579,7 @@ class Machine(CoreObject):
if oi.expectedSignals['victimStartsProcess']: if oi.expectedSignals['victimStartsProcess']:
succeedTuple=(self,self.env.now) succeedTuple=(self,self.env.now)
oi.victimStartsProcess.succeed(succeedTuple) oi.victimStartsProcess.succeed(succeedTuple)
oi.expectedSignals['victimStartsProcess']=0
# this loop is repeated until the processing time is expired with no failure # this loop is repeated until the processing time is expired with no failure
...@@ -629,7 +615,6 @@ class Machine(CoreObject): ...@@ -629,7 +615,6 @@ class Machine(CoreObject):
self.expectedSignals['brokerIsSet']=1 self.expectedSignals['brokerIsSet']=1
yield self.brokerIsSet yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
transmitter, eventTime=self.brokerIsSet.value transmitter, eventTime=self.brokerIsSet.value
assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker' assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker'
...@@ -663,9 +648,7 @@ class Machine(CoreObject): ...@@ -663,9 +648,7 @@ class Machine(CoreObject):
self.expectedSignals['brokerIsSet']=1 self.expectedSignals['brokerIsSet']=1
yield self.brokerIsSet yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
transmitter, eventTime=self.brokerIsSet.value transmitter, eventTime=self.brokerIsSet.value
assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker' assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker'
assert eventTime==self.env.now, 'brokerIsSet is not received on time' assert eventTime==self.env.now, 'brokerIsSet is not received on time'
...@@ -683,7 +666,6 @@ class Machine(CoreObject): ...@@ -683,7 +666,6 @@ class Machine(CoreObject):
self.releaseOperator() self.releaseOperator()
self.expectedSignals['brokerIsSet']=1 self.expectedSignals['brokerIsSet']=1
yield self.brokerIsSet yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
self.brokerIsSet=self.env.event() self.brokerIsSet=self.env.event()
from Globals import G from Globals import G
# append the entity that was stopped to the pending ones # append the entity that was stopped to the pending ones
...@@ -693,7 +675,6 @@ class Machine(CoreObject): ...@@ -693,7 +675,6 @@ class Machine(CoreObject):
self.requestOperator() self.requestOperator()
self.expectedSignals['brokerIsSet']=1 self.expectedSignals['brokerIsSet']=1
yield self.brokerIsSet yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
self.brokerIsSet=self.env.event() self.brokerIsSet=self.env.event()
# carry post interruption actions # carry post interruption actions
self.postInterruptionActions() self.postInterruptionActions()
...@@ -714,9 +695,7 @@ class Machine(CoreObject): ...@@ -714,9 +695,7 @@ class Machine(CoreObject):
self.expectedSignals['brokerIsSet']=1 self.expectedSignals['brokerIsSet']=1
yield self.brokerIsSet yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
transmitter, eventTime=self.brokerIsSet.value transmitter, eventTime=self.brokerIsSet.value
assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker' assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker'
assert eventTime==self.env.now, 'brokerIsSet is not received on time' assert eventTime==self.env.now, 'brokerIsSet is not received on time'
...@@ -745,9 +724,7 @@ class Machine(CoreObject): ...@@ -745,9 +724,7 @@ class Machine(CoreObject):
self.expectedSignals['brokerIsSet']=1 self.expectedSignals['brokerIsSet']=1
yield self.brokerIsSet yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
transmitter, eventTime=self.brokerIsSet.value transmitter, eventTime=self.brokerIsSet.value
assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker' assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker'
assert eventTime==self.env.now, 'brokerIsSet is not received on time' assert eventTime==self.env.now, 'brokerIsSet is not received on time'
...@@ -890,6 +867,7 @@ class Machine(CoreObject): ...@@ -890,6 +867,7 @@ class Machine(CoreObject):
if oi.expectedSignals['victimEndsProcess']: if oi.expectedSignals['victimEndsProcess']:
succeedTuple=(self,self.env.now) succeedTuple=(self,self.env.now)
oi.victimEndsProcess.succeed(succeedTuple) oi.victimEndsProcess.succeed(succeedTuple)
oi.expectedSignals['victimEndsProcess']=0
# in case Machine just performed the last work before the scheduled maintenance signal the corresponding object # in case Machine just performed the last work before the scheduled maintenance signal the corresponding object
if self.isWorkingOnTheLast: if self.isWorkingOnTheLast:
...@@ -902,7 +880,8 @@ class Machine(CoreObject): ...@@ -902,7 +880,8 @@ class Machine(CoreObject):
if interruption.expectedSignals['endedLastProcessing']: if interruption.expectedSignals['endedLastProcessing']:
succeedTuple=(self,self.env.now) succeedTuple=(self,self.env.now)
self.endedLastProcessing.succeed(succeedTuple) self.endedLastProcessing.succeed(succeedTuple)
interruption.waitinSignal=False interruption.waitingSignal=False
interruption.expectedSignals['endedLastProcessing']=0
self.isWorkingOnTheLast=False self.isWorkingOnTheLast=False
# set timeLastShiftEnded attribute so that if it is overtime working it is not counted as off-shift time # set timeLastShiftEnded attribute so that if it is overtime working it is not counted as off-shift time
if self.interruptedBy=='ShiftScheduler': if self.interruptedBy=='ShiftScheduler':
......
...@@ -103,7 +103,8 @@ class Broker(ObjectInterruption): ...@@ -103,7 +103,8 @@ class Broker(ObjectInterruption):
G.Router.invoked=True G.Router.invoked=True
succeedTuple=(self,self.env.now) succeedTuple=(self,self.env.now)
G.Router.isCalled.succeed(succeedTuple) G.Router.isCalled.succeed(succeedTuple)
G.Router.expectedSignals['isCalled']=0
self.waitForOperator=True self.waitForOperator=True
self.victim.printTrace(self.victim.id, waitEvent='(resourceIsAvailable broker)') self.victim.printTrace(self.victim.id, waitEvent='(resourceIsAvailable broker)')
...@@ -157,12 +158,13 @@ class Broker(ObjectInterruption): ...@@ -157,12 +158,13 @@ class Broker(ObjectInterruption):
if self.victim.expectedSignals['brokerIsSet']: if self.victim.expectedSignals['brokerIsSet']:
succeedTuple=(self,self.env.now) succeedTuple=(self,self.env.now)
self.victim.brokerIsSet.succeed(succeedTuple) self.victim.brokerIsSet.succeed(succeedTuple)
self.victim.expectedSignals['brokerIsSet']=0
# update the schedule of the operator # update the schedule of the operator
self.victim.currentOperator.schedule.append([self.victim, self.env.now]) self.victim.currentOperator.schedule.append([self.victim, self.env.now])
# wait till the processing is over # wait till the processing is over
self.expectedSignals['isCalled']=1 self.expectedSignals['isCalled']=1
yield self.isCalled yield self.isCalled
self.expectedSignals['isCalled']=0 self.expectedSignals['isCalled']=0
...@@ -184,6 +186,7 @@ class Broker(ObjectInterruption): ...@@ -184,6 +186,7 @@ class Broker(ObjectInterruption):
G.Router.invoked=True G.Router.invoked=True
succeedTuple=(self,self.env.now) succeedTuple=(self,self.env.now)
G.Router.isCalled.succeed(succeedTuple) G.Router.isCalled.succeed(succeedTuple)
G.Router.expectedSignals['isCalled']=0
# TODO: signalling the router will give the chance to it to take the control, but when will it eventually receive it. # TODO: signalling the router will give the chance to it to take the control, but when will it eventually receive it.
# after signalling the broker will signal it's victim that it has finished it's processes # after signalling the broker will signal it's victim that it has finished it's processes
# TODO: this wont work for the moment. The actions that follow must be performed by all operated brokers. # TODO: this wont work for the moment. The actions that follow must be performed by all operated brokers.
...@@ -201,4 +204,5 @@ class Broker(ObjectInterruption): ...@@ -201,4 +204,5 @@ class Broker(ObjectInterruption):
if self.victim.expectedSignals['brokerIsSet']: if self.victim.expectedSignals['brokerIsSet']:
succeedTuple=(self,self.env.now) succeedTuple=(self,self.env.now)
self.victim.brokerIsSet.succeed(succeedTuple) self.victim.brokerIsSet.succeed(succeedTuple)
self.victim.expectedSignals['brokerIsSet']=0
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