TRAFFIC SIM LAB v1.6

Open dist/index.html in a modern browser to use the lab offline. An internet
connection is only needed for the optional Inter font and external source links.

The hosted lab includes a download of this package. That package-download link
is not recursive: it will not work inside the extracted offline copy.

Contents
  dist/index.html       Animated lab UI
  dist/styles.css       Responsive dark/gold interface
  dist/app.js           Playback, controls, full-trip tables and export
  dist/engine.js        Reproducible point-queue simulation, browser + Node
  dist/METHODS.txt      Complete assumptions, model limits and references
  tests.cjs             Accounting and limiting-case checks
  run-study.cjs         Reproduce baseline, sensitivity and parameter sweep
  analysis/*.json      Saved baseline, pocket and timestep results
  analysis/sweep.csv   32 demand/left-share/lane scenarios, 20 paired runs each

Command-line verification (Node.js):
  node tests.cjs
  node run-study.cjs

Default scenario (20 paired replications): 400 veh/h per approach, 20% left,
10% right, 90 s two-phase cycle, shared conventional lane, unsignalized
Michigan crossovers 660 ft downstream, 35 mph, nominal 30 cruise mpg gasoline car.

                               Standard      Michigan
Mean queue waiting             33.4 s         28.5 s
Mean full-trip time            118.5 s        122.5 s
Fuel per 1,000 trips            32.96 gal      36.35 gal

Paired Michigan-minus-standard differences and 95% Monte Carlo intervals:
  Queue wait:       -4.87 +/- 1.29 seconds/vehicle
  Full trip:        +3.99 +/- 1.31 seconds/vehicle
  Fuel:             +3.39 +/- 0.13 US gallons/1,000 trips

These results are illustrative model outputs, not measured performance or an
engineering recommendation. Changing the lane arrangement can change which
layout has less waiting. In the separate-left-pocket baseline, conventional
waiting is 21.6 s vs Michigan 28.5 s. Congested sweep cases are explicitly
flagged where point queues exceed plausible physical storage.

Validation completed:
  deterministic repeatability and identical demand cohorts
  exact zero-left equivalence in both shared and pocket configurations
  route/event counts and destination preservation for all four left turns
  nonnegative waiting and chronological service records
  trip-time accounting and fuel-component accounting
  idle-rate and cruise-mpg parameter responses
  0.5 s vs 0.25 s time-step sensitivity
  browser parameter recomputation, synchronized driver selection and end scrub
  all 1,561 measured vehicles complete in both default animation replays

The finer timestep shifted the baseline paired wait difference by +0.367 s,
trip difference by +0.349 s, and fuel difference by +0.0179 gal/1,000 trips.
These are model resolution effects, distinct from parameter uncertainty.

Created 2 November 2026.

v1.1 UPDATE
Paired-run sample size is adjustable from 1 to 1,000; 20 remains the default.
The confidence interval uses n-1 degrees of freedom and is unavailable for n=1.
Actual observation entrant counts are shown separately from run count.
The default mean results above are unchanged: detour, idling and all restart
costs were already included; they are now itemized in an additive left-turn ledger.
At baseline, 82.6% of Michigan-left drivers stop at the U-turn, 86.2% stop on
the return intersection visit, and 70.3% stop at both (means over 20 runs).
Extra driving per Michigan left is 0.26864 miles (1,320 ft + 30 m arc),
using 0.008955 gal at 30 cruise mpg. Each full stop/restart at 35 mph costs
approximately 0.006474 gal in the default energy model, before idling.
These components are already included in the total, not added a second time.
Tests cover conditional restart charges, rolling turns, two-stop records,
additive ledger reconciliation, sample sizes, and Student-t critical values.


v1.2 UPDATE
Crash processes, source review and editable assumptions are in the lab.
Use the explicit 1,000x demo to inspect rare incidents and queue closures.
Rate and type shares are historical inputs, not a newly estimated safety
advantage. Scenario closures propagate through wait, return signals and fuel.
The current baseline files remain crash-free references from the original study.
See dist/crash-evidence.html and dist/METHODS.txt for methods and limitations.
Additional files: dist/crashes.js, crash-tests.cjs, analysis/crash-validation.json.
Run node crash-tests.cjs to verify crash scenarios and accounting.

VERSION 1.3 ADDITIONS
- Independent eight-variant module: dist/intersection-lab/index.html.
- Main right-on-red, eligible crossover left-on-red, yield/signal control,
  configurable coordination offset, and a common signal timing display.
- Upstream crossover signal waits and restart fuel, included in the ledger.
- Grouped expected-vs-drawn crash bars, exact values and cumulative live
  per-type incident curves/counters beside the queue chart.
- Chart expectation selector: base input (1x) or applied sampling frequency.
  A 1,000x demonstration must not be interpreted as a real crash forecast.

Additional checks:
  node red-turn-tests.cjs
  node crash-chart-tests.cjs
  node dist/intersection-lab/tests.cjs
Reproduce studies:
  node run-timing-study.cjs
  node dist/intersection-lab/run-study.cjs

VERSION 1.4: ANNUAL COST SCENARIOS
The original two-layout lab now has editable annual exposure, fuel price,
vehicle-hour value and left-only vs all-affected-traffic scopes.
Project assumptions: 550M intended Michigan-left maneuvers/year, 200M and
1.1B sensitivity cases, 1,000 individual crossovers and 12B total lefts.
These are provisional assumptions, not an official inventory or forecast.

At $3.50/US gal and $20/vehicle-hour, the default 20-seed shared-lane,
yield-crossover configuration gives these Michigan-minus-standard costs:
                              200M turns      550M turns      1.1B turns
Left-only fuel + time          +$92.40M        +$254.11M       +$508.21M
All affected traffic           +$33.93M        +$93.32M        +$186.64M
At 550M turns, left-only fuel adds 12.04M gal and full-trip time adds 10.60M
vehicle-hours. Network totals include effects on through/right traffic at
the simulated mix, implying 2.75B external system visits/year. The network
expansion assumes representative traffic and nonoverlapping study systems.

Annual operations use true matched crash-free runs regardless of replay
incident frequency. Detours, queues and restarts are already included.
95% paired-seed intervals exclude statewide-input/model uncertainty.
Optional crash valuation starts blank and requires matching full-system
rates and user-supplied costs; no legacy safety saving is auto-included.
Infrastructure, land, maintenance and other unpriced effects are excluded.

New files:
  dist/annual.js              Pure annual accounting module
  dist/annual-methods.html    Assumptions, formulas, sources and boundaries
  annual-tests.cjs            Arithmetic, denominator and baseline safeguards
  run-annual-study.cjs        Three configurations, 20 paired seeds each
  analysis/annual-study.json  Both scopes and all exposure sensitivity cases

Verify:    node annual-tests.cjs
Reproduce: node run-annual-study.cjs
Use the annual scenario export to retain applied traffic inputs, annual
assumptions, all paired per-seed differences and conditional crash values.


VERSION 1.5: SOURCED CRASH COSTS
FHWA October 2025 national crash-unit costs (2024 USD) now feed expected
annual crash costs. Select economic or comprehensive; comprehensive already
includes economic cost. Michigan 2024 statewide severity counts supply
provisional rear-end, opposing-left, angle and sideswipe mixes. Each layout
has independently editable K/A/B/C/O probabilities; unknown rows stay blank.
No severity mix is invented for the combined head-on/object/overturn group.

The UI starts with the provisional severity preset and applied replay base
rates as an explicitly incomplete illustrative sensitivity scenario. Those
rates have unverified system boundaries, so no combined cost total is shown.
The 1,000x demo and incident switch never change annual base-rate costs.
Custom rates/costs are preserved when switching methods. Complete custom
rate scenarios require exposure compatibility and matching dollar years
before a combined all-traffic total is available.

New: dist/crash-costs.js, dist/crash-cost-methods.html, crash-cost-tests.cjs,
run-crash-cost-study.cjs and analysis/crash-cost-study.json.
Verify: node crash-cost-tests.cjs
Reproduce: node run-crash-cost-study.cjs


VERSION 1.6 / INDEPENDENT MODULE 2.0 — 2026-11-03
The original two-layout model is retained. The independent eight-design module now has annual operating costs, optional separate FHWA crash valuation and a full experiment workbench. Open intersection-lab/experiments.html (dist/intersection-lab in the source tree). All 46 model inputs plus 3 valuation inputs have editable fixed values and sweep lists/ranges. Seed/count fields are separate protocol controls.
Exact grids never silently sample. Seeded sampled grids expose their coverage; irrelevant settings and periodic offset aliases are removed. Design settings compete only within matched assumption and valuation cases. Choices are frozen from screening and validated against unchanged baselines with disjoint seeds. Incomplete or storage-flagged cases remain visible. The operating objective excludes crash risk, construction and pedestrians.
The narrower 1,710-setting timing study is preliminary, not a final optimum. Its base-case best hit three searched boundaries, reversed under minor-road-heavy traffic and failed some storage stress cases. Read intersection-lab/research.html before quoting results.
Node: cd dist/intersection-lab; node experiment-tests.cjs; node run-experiment.cjs complete-protocol.json result.json. Protocols and full replication results are exportable from the browser. The full source includes run-mut-sweep.cjs and its preliminary protocol/data under analysis/.
