Commit df5712d6 authored by Georgios Dagkakis's avatar Georgios Dagkakis

Machine and operatedPoolBroker updated

parent b77c5256
......@@ -329,8 +329,6 @@ class Machine(CoreObject):
yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
transmitter, eventTime=self.brokerIsSet.value
assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker'
assert eventTime==self.env.now, 'brokerIsSet is not received on time'
......@@ -358,13 +356,8 @@ class Machine(CoreObject):
# machine has to release the operator
self.releaseOperator()
# wait until the Broker has finished processing
self.expectedSignals['brokerIsSet']=1
yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
transmitter, eventTime=self.brokerIsSet.value
assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker'
assert eventTime==self.env.now, 'brokerIsSet is not received on time'
......@@ -452,8 +445,6 @@ class Machine(CoreObject):
yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
transmitter, eventTime=self.brokerIsSet.value
assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker'
assert eventTime==self.env.now, 'brokerIsSet is not received on time'
......@@ -486,8 +477,6 @@ class Machine(CoreObject):
yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
transmitter, eventTime=self.brokerIsSet.value
assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker'
assert eventTime==self.env.now, 'brokerIsSet is not received on time'
......@@ -519,8 +508,6 @@ class Machine(CoreObject):
yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
transmitter, eventTime=self.brokerIsSet.value
assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker'
assert eventTime==self.env.now, 'brokerIsSet is not received on time'
......@@ -572,8 +559,6 @@ class Machine(CoreObject):
yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
transmitter, eventTime=self.brokerIsSet.value
assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker'
assert eventTime==self.env.now, 'brokerIsSet is not received on time'
......@@ -594,6 +579,7 @@ class Machine(CoreObject):
if oi.expectedSignals['victimStartsProcess']:
succeedTuple=(self,self.env.now)
oi.victimStartsProcess.succeed(succeedTuple)
oi.expectedSignals['victimStartsProcess']=0
# this loop is repeated until the processing time is expired with no failure
......@@ -629,7 +615,6 @@ class Machine(CoreObject):
self.expectedSignals['brokerIsSet']=1
yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
transmitter, eventTime=self.brokerIsSet.value
assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker'
......@@ -664,8 +649,6 @@ class Machine(CoreObject):
yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
transmitter, eventTime=self.brokerIsSet.value
assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker'
assert eventTime==self.env.now, 'brokerIsSet is not received on time'
......@@ -683,7 +666,6 @@ class Machine(CoreObject):
self.releaseOperator()
self.expectedSignals['brokerIsSet']=1
yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
self.brokerIsSet=self.env.event()
from Globals import G
# append the entity that was stopped to the pending ones
......@@ -693,7 +675,6 @@ class Machine(CoreObject):
self.requestOperator()
self.expectedSignals['brokerIsSet']=1
yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
self.brokerIsSet=self.env.event()
# carry post interruption actions
self.postInterruptionActions()
......@@ -715,8 +696,6 @@ class Machine(CoreObject):
yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
transmitter, eventTime=self.brokerIsSet.value
assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker'
assert eventTime==self.env.now, 'brokerIsSet is not received on time'
......@@ -746,8 +725,6 @@ class Machine(CoreObject):
yield self.brokerIsSet
self.expectedSignals['brokerIsSet']=0
transmitter, eventTime=self.brokerIsSet.value
assert transmitter==self.broker, 'brokerIsSet is not sent by the stations broker'
assert eventTime==self.env.now, 'brokerIsSet is not received on time'
......@@ -890,6 +867,7 @@ class Machine(CoreObject):
if oi.expectedSignals['victimEndsProcess']:
succeedTuple=(self,self.env.now)
oi.victimEndsProcess.succeed(succeedTuple)
oi.expectedSignals['victimEndsProcess']=0
# in case Machine just performed the last work before the scheduled maintenance signal the corresponding object
if self.isWorkingOnTheLast:
......@@ -902,7 +880,8 @@ class Machine(CoreObject):
if interruption.expectedSignals['endedLastProcessing']:
succeedTuple=(self,self.env.now)
self.endedLastProcessing.succeed(succeedTuple)
interruption.waitinSignal=False
interruption.waitingSignal=False
interruption.expectedSignals['endedLastProcessing']=0
self.isWorkingOnTheLast=False
# set timeLastShiftEnded attribute so that if it is overtime working it is not counted as off-shift time
if self.interruptedBy=='ShiftScheduler':
......
......@@ -103,6 +103,7 @@ class Broker(ObjectInterruption):
G.Router.invoked=True
succeedTuple=(self,self.env.now)
G.Router.isCalled.succeed(succeedTuple)
G.Router.expectedSignals['isCalled']=0
self.waitForOperator=True
self.victim.printTrace(self.victim.id, waitEvent='(resourceIsAvailable broker)')
......@@ -157,6 +158,7 @@ class Broker(ObjectInterruption):
if self.victim.expectedSignals['brokerIsSet']:
succeedTuple=(self,self.env.now)
self.victim.brokerIsSet.succeed(succeedTuple)
self.victim.expectedSignals['brokerIsSet']=0
# update the schedule of the operator
self.victim.currentOperator.schedule.append([self.victim, self.env.now])
......@@ -184,6 +186,7 @@ class Broker(ObjectInterruption):
G.Router.invoked=True
succeedTuple=(self,self.env.now)
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.
# 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.
......@@ -201,4 +204,5 @@ class Broker(ObjectInterruption):
if self.victim.expectedSignals['brokerIsSet']:
succeedTuple=(self,self.env.now)
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