Skip to content

Yunfei/fix sumo cosim - #58

Open
Yunfei-Zhang wants to merge 2 commits into
dev/merge_to_masterfrom
yunfei/fix_sumo_cosim
Open

Yunfei-Zhang wants to merge 2 commits into
dev/merge_to_masterfrom
yunfei/fix_sumo_cosim

Conversation

@Yunfei-Zhang

Copy link
Copy Markdown
Collaborator

Two independent bugs in SUMOFleetPyServer.py, one commit each.

  1. SUMOFleetPyServer cannot be imported (f405e07)

Line 24 imports run_scenarios from run_examples, but run_examples.py moved into studies/example_study/ in 55c9d04 and the import was never updated.

python -c "import src.coupling.SUMO.SUMOFleetPyServer"
ModuleNotFoundError: No module named 'run_examples'
Repointed at run_scenarios.py, which is where the symbol lives and what studies/example_study/run_examples.py itself imports.

  1. The co-sim silently drops every scenario's additional files (0ec35c8)

SUMO's -a replaces the list from the sumocfg rather than extending it. setup_sumo_simulation() passes -a with its generated edgeData config, so traffic-light programs, WAUT switching, PT stops and schedules are all discarded.

Nothing fails: the simulation runs to completion and produces plausible output, just with no signal control and no transit. Reproduce on any scenario with additional files:

sumo -c scenario.sumocfg -a generated.add.xml --save-configuration effective.cfg
effective.cfg lists only generated.add.xml.

New sumocfg_utils.merge_additional_files() reads what the sumocfg declares, resolves paths relative to the config's directory as SUMO does, and appends the generated file, preserving order and dropping duplicates. Kept free of FleetPy and traci imports so it can be tested standalone.

Verified on the Ingolstadt scenario over TraCI: 123 traffic lights load after the fix, 0 before.

Branched off current dev/merge_to_master. Touches only the two files; no study or data changes.

SUMOFleetPyServer.py cannot be imported at all: line 24 imports
run_scenarios from run_examples, but run_examples.py was moved into
studies/example_study/ by 55c9d04 and this import was never updated, so
the module does not exist at the repo root.

Point it at run_scenarios.py, which is where the symbol actually lives
and is what studies/example_study/run_examples.py itself imports.

Reproduce on a clean checkout:
    python -c "import src.coupling.SUMO.SUMOFleetPyServer"
    ModuleNotFoundError: No module named 'run_examples'
SUMO's command-line -a REPLACES the <additional-files> list from the
configuration file rather than extending it. setup_sumo_simulation()
passes -a with the generated edgeData config, so every scenario's own
additional files are silently discarded: traffic-light programs, WAUT
switching, public-transport stops and schedules.

Nothing fails. The simulation runs to completion and produces
plausible-looking output, just with no signal control and no transit,
which makes this easy to miss in results.

Reproduce on any scenario whose sumocfg declares additional files:

    sumo -c scenario.sumocfg -a generated.add.xml \
         --save-configuration effective.cfg

effective.cfg lists only generated.add.xml.

sumocfg_utils.merge_additional_files() reads the additional files the
sumocfg declares, resolves them relative to the config's own directory
as SUMO does, and appends the generated one, preserving order and
dropping duplicates. It is kept free of FleetPy and traci imports so it
can be tested standalone.

Verified on the Ingolstadt 365 scenario over TraCI: 123 traffic lights
load after the fix and none before it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant