# Big Bend corridor: data + simulation pipeline (CSE 5403 traffic-signal project) Gabriel + Diego's part: real corridor data, the SUMO simulation, plan → SUMO, Study 1, report tables. Corridor: **Big Bend Blvd, St. Louis County MO: Forest Park Pkwy (#051) → Forsyth (#040) → Wydown (#063) → Clayton Rd (#034)**, PM weekday peak (5:00–6:00 PM). ## Rerun everything (one command) ``` ./run_all.sh # 10 seeds per plan; ./run_all.sh 4 for a quick run .venv/bin/python src/study1.py --n-random 30 --budget 120 # Study 1 (≈15-20 min) ``` First run creates `.venv` from `requirements.txt` (SUMO 1.28 comes from the `eclipse-sumo` pip package, no separate install). Outputs: `build/results_summary.json`, `build/validation.json`, `build/report/*.md|png`, `build/study1/`. ## Pipeline | step | script | reads | writes | |---|---|---|---| | 1 | `parse_county_counts.py`, `parse_county_timing.py`, `verify_counts.py` | County PDFs in `data/measured/county-timing/` | `data/measured/county-counts/*.csv`, `county_timing.json`; checks every count against the sheet's printed totals | | 2 | `derive.py` | config + raw + measured | `build/corridor.json`: the canonical dataset, every number tagged measured / derived / assumed with evidence | | 3 | `to_optimizer.py` | corridor.json | `build/optimizer_input.json/.csv` (Michael + Noah's input) | | 4 | `build_network.py` (`build_network_gen.py`) | corridor.json | `build/sumo/net.net.xml` | | 5 | `build_demand.py` | corridor.json | flows, turn ratios, routes, mid-block balancing flows | | 6 | `plans.py` | corridor.json | `plans/*.json`: baselines + County current + formula optimum | | 7 | `run_sumo.py` | plans | `build/runs/`, `build/results_summary.json` | | 8 | `validate.py` | runs | `build/validation.json` (GEH vs counts) | | 9 | `report_tables.py` | all of build/ | `build/report/` | | - | `study1.py` | corridor, plans | `build/study1/`, `plans/study1-sumo-loop.json` | ## How to change things (built to be updated) - **New measurement** (field count, newer County sheet): drop the PDF in `data/measured/county-timing/` (named `-.pdf`) or a CSV in `data/measured/county-counts/` (same columns + a `.totals.csv` for verification), rerun. Measured always wins. - **Different lights / hour / timing pattern**: `config/corridor.toml` (`order`, `[counts] design_hour`, `[timing] pattern`). - **Any assumption** (bay length, turn shares, sat flow, model parameters): `config/assumptions.toml` / `config/corridor.toml`, each with its evidence. - **Michael + Noah's formats**: input → `src/to_optimizer.py::write_theirs`; their plan files → `src/plans.py::from_their_format`. Nothing else knows their format. - **Plan format** (`plans/*.json`): `C`, per light `g_main` (Big Bend green, s) and `offset_s` (start of the Big Bend block relative to Forest Park Pkwy); side green = C − L − g_main. ## Data sources (see `build/report/provenance.md` for every number) - **Measured:** St. Louis County timing sheets for all 4 signals (PM pattern 37: 120 s cycle, splits, offsets, yellow/all-red, phase sequence) and County turning-movement counts (Forsyth 3/3/2017, Forest Park Pkwy 6/30/2021, Wydown 9/26/2025, Clayton 6/24/2026). Scanned count pages (Forsyth, FPP) were transcribed by hand and verified against printed totals. MoDOT 2025 lanes/speeds; County signal inventory; OpenStreetMap approach lanes and geometry. - **Derived:** link lengths (County coordinates), effective saturation flows along the real phase sequence, lost time along the phase sequence, mid-block balancing flows (counted volume into a light minus volume propagated from the previous light). - **Assumed (sensitivity-test):** 1,800 veh/h/lane, platoon share p = 0.8, g_min, cycle range, x_max = 0.9, 90 m left bays. ## Modelling choices (state these in the report) 1. **Generated network** (`[network] source = "generated"`): 4 signals at real spacing, real approach lanes + left bays, posted speeds. The raw OpenStreetMap network (`source = "osm"`, still supported) jams on unsignalized merges/slip lanes outside the model's scope. 2. **SUMO runs the County's real phase sequence** (`[sumo] signal_program = "nema"`), scaled to each plan: the plan sets cycle, Big Bend vs cross-street block, offsets; inside a block the protected-left and through phases keep the County's proportions, left arrows sized to measured left-turn demand (what the actuated controller does). `two_phase` reproduces the model literally. 3. **Model inputs consistent with that sequence** (`[model] lost_time_basis`, `capacity_basis` = `signal_sequence`): L and s are computed along the real phase sequence. Set both to the 2-phase values to reproduce the model's original inputs. 4. Right turn on red allowed (Missouri default). Mid-block balancing flows enter/leave by right turns only. 5. Delay = time lost on corridor edges + time waiting to enter, during the measured hour after a 15-min warm-up. ## Status - `formula-optimum-standin` is OUR implementation of the Nov 10 model (`src/formula.py`) until Michael + Noah's `signal_opt.py` is plugged in. Their results replace it. ## Browser mini-simulator (Simulation + Code page) `sim/core.js` is a small simulator we wrote (Krauss car-following, County phase sequence ported from `src/nema.py`, same data and plans as SUMO); `sim/ui.js` draws it. `src/sim_export.py` writes its input (`build/site/sim/data.json`); `node sim/validate.js 5` compares every plan with SUMO (rank agreement, Spearman ≈ 0.77). SUMO screenshots: `data/screenshots/` (taken in SUMO's viewer). The page is `build/site/code.html`, generated by `src/code_page.py`; publish with the wrangler command printed by run_all.sh.