Commit 5e5158f9 authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Georgios Dagkakis

CapacityStationController also updated

parent 85a340ff
...@@ -62,11 +62,18 @@ class CapacityStationController(EventGenerator): ...@@ -62,11 +62,18 @@ class CapacityStationController(EventGenerator):
entitiesToCheck=list(station.getActiveObjectQueue()) entitiesToCheck=list(station.getActiveObjectQueue())
for entity in entitiesToCheck: for entity in entitiesToCheck:
if not exit.isRequested.triggered: # this is needed because the signal can be triggered also by the buffer if not exit.isRequested.triggered: # this is needed because the signal can be triggered also by the buffer
succeedTuple=(station,self.env.now) if exit.expectedSignals['isRequested']:
exit.isRequested.succeed(succeedTuple) # send is requested to station succeedTuple=(station,self.env.now)
exit.isRequested.succeed(succeedTuple) # send is requested to station
# wait until the entity is removed # wait until the entity is removed
station.waitEntityRemoval=True station.waitEntityRemoval=True
station.expectedSignals['entityRemoved']=1
yield station.entityRemoved yield station.entityRemoved
station.expectedSignals['entityRemoved']=0
transmitter, eventTime=station.entityRemoved.value transmitter, eventTime=station.entityRemoved.value
station.waitEntityRemoval=False station.waitEntityRemoval=False
exit.currentlyObtainedEntities.append(entity) exit.currentlyObtainedEntities.append(entity)
...@@ -115,11 +122,18 @@ class CapacityStationController(EventGenerator): ...@@ -115,11 +122,18 @@ class CapacityStationController(EventGenerator):
for entity in entitiesToCheck: for entity in entitiesToCheck:
if not entity.shouldMove: # when the first entity that should not move is reached break if not entity.shouldMove: # when the first entity that should not move is reached break
break break
succeedTuple=(buffer,self.env.now) if station.expectedSignals['isRequested']:
station.isRequested.succeed(succeedTuple) # send is requested to station succeedTuple=(buffer,self.env.now)
station.isRequested.succeed(succeedTuple) # send is requested to station
# wait until the entity is removed # wait until the entity is removed
buffer.waitEntityRemoval=True buffer.waitEntityRemoval=True
buffer.expectedSignals['entityRemoved']=1
yield buffer.entityRemoved yield buffer.entityRemoved
buffer.expectedSignals['entityRemoved']=0
transmitter, eventTime=buffer.entityRemoved.value transmitter, eventTime=buffer.entityRemoved.value
buffer.waitEntityRemoval=False buffer.waitEntityRemoval=False
buffer.entityRemoved=self.env.event() buffer.entityRemoved=self.env.event()
......
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