Commit fbe6ccea authored by Georgios Dagkakis's avatar Georgios Dagkakis

Machine and operatedPoolBroker updated

parent 68af2fcc
...@@ -329,8 +329,6 @@ class Machine(CoreObject): ...@@ -329,8 +329,6 @@ class Machine(CoreObject):
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'
...@@ -452,8 +445,6 @@ class Machine(CoreObject): ...@@ -452,8 +445,6 @@ class Machine(CoreObject):
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'
...@@ -486,8 +477,6 @@ class Machine(CoreObject): ...@@ -486,8 +477,6 @@ class Machine(CoreObject):
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'
...@@ -519,8 +508,6 @@ class Machine(CoreObject): ...@@ -519,8 +508,6 @@ class Machine(CoreObject):
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'
...@@ -572,8 +559,6 @@ class Machine(CoreObject): ...@@ -572,8 +559,6 @@ class Machine(CoreObject):
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'
...@@ -664,8 +649,6 @@ class Machine(CoreObject): ...@@ -664,8 +649,6 @@ class Machine(CoreObject):
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()
...@@ -715,8 +696,6 @@ class Machine(CoreObject): ...@@ -715,8 +696,6 @@ class Machine(CoreObject):
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'
...@@ -746,8 +725,6 @@ class Machine(CoreObject): ...@@ -746,8 +725,6 @@ class Machine(CoreObject):
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,6 +103,7 @@ class Broker(ObjectInterruption): ...@@ -103,6 +103,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
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,6 +158,7 @@ class Broker(ObjectInterruption): ...@@ -157,6 +158,7 @@ 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])
...@@ -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