Commit 3c61c2c9 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Jérome Perrin

CapacityStations capacity can be defined as rolling

parent 26e6122b
...@@ -114,7 +114,8 @@ class CapacityStationController(EventGenerator): ...@@ -114,7 +114,8 @@ class CapacityStationController(EventGenerator):
periodDict['period']=self.env.now periodDict['period']=self.env.now
# loop though the entities # loop though the entities
entitiesToCheck=list(buffer.getActiveObjectQueue()) entitiesToCheck=list(buffer.getActiveObjectQueue())
capacityAvailable=station.intervalCapacity[int(self.env.now)] #capacityAvailable=station.intervalCapacity[int(self.env.now)]
capacityAvailable=station.remainingIntervalCapacity[0]
capacityAllocated=0 capacityAllocated=0
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
...@@ -157,8 +158,11 @@ class CapacityStationController(EventGenerator): ...@@ -157,8 +158,11 @@ class CapacityStationController(EventGenerator):
# for every station update the remaining interval capacity so that it is ready for next loop # for every station update the remaining interval capacity so that it is ready for next loop
for station in G.CapacityStationList: for station in G.CapacityStationList:
station.remainingIntervalCapacity.pop(0) station.remainingIntervalCapacity.pop(0)
# if remainingIntervalCapacity is empty reset it (to obtain rolling capacity)
if len(station.remainingIntervalCapacity)==0:
station.remainingIntervalCapacity=list(station.intervalCapacity)
# invoked after entities have exited one station to create # invoked after entities have exited one station to create
# the corresponding entities to the following buffer # the corresponding entities to the following buffer
def createInCapacityStationBuffers(self): def createInCapacityStationBuffers(self):
...@@ -247,6 +251,7 @@ class CapacityStationController(EventGenerator): ...@@ -247,6 +251,7 @@ class CapacityStationController(EventGenerator):
totalAvailableCapacity=station.remainingIntervalCapacity[0] # get the available capacity of the station totalAvailableCapacity=station.remainingIntervalCapacity[0] # get the available capacity of the station
# for this interval # for this interval
# list to keep entities that have not been already allocated # list to keep entities that have not been already allocated
entitiesNotAllocated=list(entitiesConsidered) entitiesNotAllocated=list(entitiesConsidered)
......
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