Commit 96febac7 authored by Jérome Perrin's avatar Jérome Perrin

Capacity Project: only set the wip in the proper buffer.

The same WIP was set in all buffers
parent 30540540
...@@ -65,6 +65,13 @@ class Simulation(DefaultSimulation): ...@@ -65,6 +65,13 @@ class Simulation(DefaultSimulation):
required_capacity_by_project[project_id][capacity_station] = \ required_capacity_by_project[project_id][capacity_station] = \
float(requirement_sequence.split('-')[idx]) float(requirement_sequence.split('-')[idx])
# a mapping project id -> first station
first_station_by_project = dict()
for project_id, station_sequence, requirement_sequence \
in data['capacity_by_project_spreadsheet'][1:]:
if station_sequence:
first_station_by_project[project_id] = station_sequence.split('-')[0]
# implicitly add a Queue for wip # implicitly add a Queue for wip
assert 'Qstart' not in new_data['nodes'], "reserved ID used" assert 'Qstart' not in new_data['nodes'], "reserved ID used"
wip = [] wip = []
...@@ -107,15 +114,18 @@ class Simulation(DefaultSimulation): ...@@ -107,15 +114,18 @@ class Simulation(DefaultSimulation):
del new_data['edges'][edge_id] del new_data['edges'][edge_id]
wip = [] wip = []
# set as wip all projects that have to be processed in this station
# firts
for project, requirement_dict in required_capacity_by_project.items(): for project, requirement_dict in required_capacity_by_project.items():
requirement = requirement_dict['%s_Station' % node_id] if first_station_by_project[project] == node_id:
name = '%s_%s_%s' % (project, node_id, requirement) requirement = requirement_dict['%s_Station' % node_id]
wip.append( name = '%s_%s_%s' % (project, node_id, requirement)
dict(_class='Dream.CapacityEntity', wip.append(
id=name, dict(_class='Dream.CapacityEntity',
name=name, id=name,
capacityProjectId=project, name=name,
requiredCapacity=requirement)) capacityProjectId=project,
requiredCapacity=requirement))
new_data['nodes']["%s_Buffer" % node_id] = dict( new_data['nodes']["%s_Buffer" % node_id] = dict(
_class='Dream.CapacityStationBuffer', _class='Dream.CapacityStationBuffer',
......
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