Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ graphify-out/
# Playwright CLI output (may contain credentials)
.playwright-cli/
.superpowers/

# Durable local Git history backups
.local-archives/
10 changes: 5 additions & 5 deletions GreenWave_ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,20 @@ Where $V_{\mathrm{ambulance}}(e) = \min(\max(1.3 \cdot V_e \cdot b(e),\; 30\text

One edge-time function (`backend/src/greenwave/routing/edge_times.py`) drives route choice (minimum ambulance edge time), both estimates and simulated motion: on each edge the simulated ambulance moves at the effective speed $L_e / t_a(e)$ with $t_a(e) = L_e / V_{\mathrm{ambulance}}(e) + n_e \cdot s_{\mathrm{ambulance}}$, so calming seconds are spread over the edge and the simulated trip matches $T_{\mathrm{greenwave}}$, including a route ending exactly on a stop line. All factors are `GREENWAVE_SIM_*` settings; 1.0 / 0 s makes an attribute neutral.

In the simulation the ambulance never stops for $D_{\min}$: it spends it as a rolling slowdown over the `greenwave_approach_distance_m` (60 m) before each intersection's first controlled stop line (never before the previous one), at a constant reduced speed that adds exactly $D_{\min}$, never below `greenwave_min_rolling_speed_kmh` (15 km/h); when the window is too short the slowdown continues past the line, and it is cut at the destination, so the trip still takes $T_{\mathrm{greenwave}}$. A safety hold remains: at the first stop line the ambulance leaves only once every route vehicle light there was last **shown** green (section 4, signal phases). Priority normally turns green long before, so this hold changes nothing; it only matters when priority is requested too late (for example a route that starts just before a junction), where the ambulance waits at the line instead of driving through red (ADR 0010).
In both modes (including STANDARD_FALLBACK), the ambulance spends the same common delay once per unique controlled intersection. In the simulation the ambulance never stops for $D_{\min}$: it spends it as a rolling slowdown over the `greenwave_approach_distance_m` (60 m) before each intersection's first controlled stop line (never before the previous one), at a constant reduced speed that adds exactly $D_{\min}$, sized using `greenwave_min_rolling_speed_kmh` (15 km/h) as its rolling floor; when the window is too short the slowdown continues past the line, and it is cut at the destination, so the trip still takes $T_{\mathrm{greenwave}}$. A safety hold remains: at the first stop line the ambulance leaves only once every route vehicle light there was last **shown** green (section 4, signal phases). Priority normally turns green long before, so this hold changes nothing; it only matters when priority is requested too late (for example a route that starts just before a junction), where the ambulance waits at the line instead of driving through red (ADR 0010).

#### 3. Standard-traffic crossing (ER Green Wave disabled)

With `green_wave_mode: "DISABLED"` the route and the open-road motion are exactly those of model 2; only signalised stop lines are crossed differently. At **every** controlled stop line of the route (including lines inside a junction), the engine samples the simulated route movement colour (section 4, signal phases) at the exact simulated time the vehicle reaches the line:

1. **`GREEN`:** the vehicle drives on at $V_{\mathrm{ambulance}}(e)$; no penalty.
1. **`GREEN`:** no additional cautious crossing; the common rolling slowdown continues until its budget is spent.
2. **`RED`, `YELLOW`, or no supported route vehicle signal:** the vehicle rolls one controlled crossing without stopping. Its extra cautious time (cautious red-light entry while traffic forms a life corridor) scales with the wait $w$ until that movement is next green in the ordinary programme ($w = D_u$ for an unknown movement), and is capped:
$$C = \min(c \cdot w \cdot \mu_{\mathrm{traffic}},\; C_{\max})$$
with $c$ = `standard_clearance_factor` (default 1.0) and $C_{\max}$ = `standard_max_red_loss_seconds` (default 15 s). The crossing is at least $L_c$ = `standard_crossing_distance_m` (default 30 m) long and extends so its speed never drops below $v_f$ = `standard_min_rolling_speed_kmh` (default 10 km/h): $L = \max(L_c,\; C / (1/v_f - 1/v_{\min}))$, where $v_{\min}$ is the lowest ordinary limit $\min(V_{\mathrm{ambulance}}(e), V_e)$ over the edges the crossing covers (recomputed until stable). An edge at or below $v_f$ at the line gives $C = 0$; one further on ends the crossing where it starts, with $C$ capped at $(\text{slow start} - \text{line}) \cdot (1/v_f - 1/v_{\min})$ so the edges before it keep the floor. $C$ is spread over $L$: a segment of length $d$ on an edge with ordinary limit $v$ takes
$$\frac{d}{v} + C_{\mathrm{remaining}} \cdot \frac{d}{L_{\mathrm{remaining}}},$$
so the speed is at least $v_f$ (on edges whose limit is above it), never above $v$, and carries across edge ends.

A later stop line replaces an active crossing with its own decision (a fresh crossing if it is not green). Each intersection's route signals share one cycle phase, so the lines of one through movement show the same colour. The crossing is a modelling boundary (the ETL has no junction exit geometry), and $c$, $L_c$, $C_{\max}$, $v_f$ are PoC assumptions, not measured Kraków values; $L_c$ and $v_f$ are strictly positive and all are finite (ADR 0010). The pre-run standard estimate is a dry run of this motion: `standard_run_seconds` drives `move_one_second` in disabled mode against the pure ordinary programme (deterministic from $t = 0$, no ITS) until arrival, so `estimated_standard_time_sec` (start response) and `standard_seconds` (each ranked candidate) equal the disabled run's arrival exactly before rounding (ADR 0011; at most about 12 ms per route on the Kraków sample). `current_time_saved_sec` compares Green Wave elapsed time with this same standard run at the
Common and cautious windows have independent remaining-distance and extra-time budgets. Their time-per-metre contributions add during overlap; combined speed can fall below either component floor, also when destination truncation concentrates the common delay. A later stop line replaces only the signal-dependent active crossing with its own decision (a fresh crossing if it is not green). Each intersection's route signals share one cycle phase, so the lines of one through movement show the same colour. The crossing is a modelling boundary (the ETL has no junction exit geometry), and $c$, $L_c$, $C_{\max}$, $v_f$ are PoC assumptions, not measured Kraków values; $L_c$ and $v_f$ are strictly positive and all are finite (ADR 0010). The pre-run standard estimate is a dry run of this motion: `standard_run_seconds` drives `move_one_second` in disabled mode against the pure ordinary programme (deterministic from $t = 0$, no ITS) until arrival, so `estimated_standard_time_sec` (start response) and `standard_seconds` (each ranked candidate) equal the disabled run's arrival exactly before rounding (ADR 0011; at most about 12 ms per route on the Kraków sample). `current_time_saved_sec` compares Green Wave elapsed time with this same standard run at the
same route position, interpolated between its one-second dry-run samples. At arrival it is
`round(T_standard) - round(T_actual)` so it agrees with the displayed whole-second totals;
post-arrival recovery never changes it. Disabled runs report zero and the UI hides savings.
Expand Down Expand Up @@ -706,8 +706,8 @@ emits it and withdraws the request from the controller, so a late acceptance can
priority) and puts the request's unpassed targets into `STANDARD_FALLBACK` for the rest of the
run (`IntersectionTelemetry.crossing_strategy`; `PRIORITY` otherwise, `null` in disabled runs).
Fallback targets are crossed by disabled-mode rules: the ordinary programme decides at each
route stop line, with no `D_min` slowdown or hold. A hold already waiting ends and decides at
release; a slowdown remainder of the junction itself is replaced by its standard decision. Failed
route stop line, retaining the same once-per-intersection `D_min` slowdown but without a priority hold. A hold already waiting ends and decides at
release; the standard decision changes only the signal-dependent cautious crossing, preserving all unspent common slowdown. Failed
targets are never requested again, never shown as prioritised and, never having held priority,
never enter RECOVERY. A grouped request fails as one. Other junctions keep requesting priority.
Savings stay `round(standard) - round(actual)`, including all waiting and fallback time.
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,26 @@ Intersection phases are separate from the run-level **GreenWave** (`ENABLED`) an
- **Responsive workspaces:** Polish/English copy, light/dark themes, map-follow controls,
Focus Mode, and a phone-oriented driver view without a geolocation requirement.

## Simulation experiment results

A reproducible post-fix experiment on **31 October 2026** covered 200 incident addresses, 600 incident–station routes and **3,000 paired comparisons (6,000 simulations)**, with nominal ITS feedback, cascade enabled and default settings. Both modes drove identical routes and incurred the same common intersection slowdown.

GreenWave arrived sooner in **89%** of comparisons and tied in **11%**; no slower cases occurred in this sample. Mean driving-time saving was **71.94 seconds**, median **62.58 seconds**, and mean per-pair saving **15.01%**. Mean arrival times were **453.49 seconds for Standard** and **381.55 seconds for GreenWave**. For the first GreenWave-ranked station, mean saving across densities was **37.02 seconds (11.66%)**.

Mean savings in seconds, with station choices fixed at density 1.5:

| Density | Rank 1 | Rank 2 | Rank 3 |
| --- | ---: | ---: | ---: |
| 1.0 | 33.9 | 68.6 | 96.8 |
| 1.5 | 36.7 | 72.8 | 102.7 |
| 2.0 | 37.8 | 75.0 | 104.5 |
| 2.5 | 38.2 | 76.9 | 108.8 |
| 3.0 | 38.6 | 78.4 | 109.5 |

There were no failed runs, missing candidates or on-site cases. The sampled routes contained 0–25 unique controlled intersections. Savings exclude walking and post-arrival recovery. These are **model results, not measured real-world benefits**; station/density combinations repeat incidents and are not independent observations. Higher savings from a more distant station do not imply a better dispatch decision, and other scenarios can still produce negative savings.

[Read the experiment report and reproducibility record](https://github.com/fjarmula/GreenWave/blob/main/docs/results/2026-10-31/REPORT.md).

## Tech Stack

| Layer | Technologies | Responsibility |
Expand Down
Empty file.
Loading
Loading