Learn

Scenario mechanics and calculations

Traffic Lab is a simplified planning simulator. These formulas are meant to make assumptions transparent, not to replace calibrated transport modelling, engineering design or official approvals.

1. Scenario edits

Each scenario edit stores an intervention type, selected road, geometry, length, lane count, one-way setting, road class and cost properties.

Supported edits include new roads, flyovers, underpasses, lane additions/removals, bus lanes, no-parking controls, signal timing changes, one-way conversions, roundabouts, closures and road deletion.

New roads, flyovers, underpasses, add-lane and remove-lane tools use start-click then endpoint-click geometry. Roundabouts use one click plus a selectable radius. Flyovers drawn from an existing road have an enabled-by-default option to add one approach lane on each side.

2. Edited road graph

The simulation creates a temporary edited graph from the loaded OpenStreetMap-derived Delhi NCR road graph. Existing-road edits adjust lane count, directional rules, effective capacity or closure status. New-road/flyover/underpass edits create scenario-only links drawn by the user; they are not treated as existing real roads.

3. What is recalculated after an edit

Every comparison rebuilds the edited graph, finds the affected roads, regenerates segment context, assigns OD demand, diagnoses the local traffic problem, scores edit fit, redistributes traffic, and then recalculates capacity, V/C ratio, pressure, speed, waiting, risk and score.

editedGraph = applyEdits(baseGraph, edits)
scope = affectedSegments(baseGraph, editedGraph, edits)
assignedDemand = routeAssign(generateOD(...), editedGraph)
editImpact = calculateEditImpact(edit, context, diagnosis)
metrics = calculatePlanningMetrics(editedGraph, scope, edits)
delta = editedMetrics - baselineMetrics

The scope includes directly edited roads, new scenario links, roads connected through affected intersections, and roads close to the complete drawn geometry.

4. Road context, diagnosis and fit

The simulator no longer treats every edit as a fixed multiplier. Affected roads are classified as contexts such as arterial, market street, school zone, terminal access, bridge crossing, flyover approach, ramp merge or known bottleneck corridor.

The model then diagnoses likely problems: capacity bottleneck, signal delay, turn conflict, merge/weaving, downstream spillback, parking/curb friction, market activity, school pickup, freight conflict, event pressure, poor connectivity, unsafe speed or residential cut-through.

fitScore =
  editProblemFit(
    editType,
    roadContext,
    problemDiagnosis,
    timeProfile
  )

effect =
  boundedEffectRange(edit × context × problem × time)
  × fitScale
  × contextConfidence

Examples: flyovers fit signal-delay arterials well, but fit market parking friction poorly. No-parking fits market/curb friction well. Roundabouts fit lower-speed conflicts, but are weak on high-speed trunk corridors.

5. New road, flyover and underpass calculation

capacityEstimate =
  lanes × capacityPerLane × directionCapacity
  + proposedSpeedKmph × 1.4

capacityPerLane:
  express 105, arterial 82, local 58

directionCapacity:
  one-way 1.18, otherwise 1.00

effective-capacity multiplier:
  flyover 1.34
  underpass/new road 1.18

if flyover.addApproachLanes:
  effectiveCapacity ×= 1.18
  targetRoad.lanes += 2

A scenario-only link gets a demand-generation factor of 0.34. It initially absorbs diverted traffic instead of immediately creating the same local demand as an established road.

Approach lanes make the flyover more expensive but also strengthen relief on the selected surface road and its approaches. This models the fact that many grade-separated projects need approach capacity, not only the elevated or depressed link.

If a new road, flyover or underpass cuts through an open/green-space gap, the engine calculates an open-space shortcut index. That shortcut can reduce pressure on roads people previously had to take around the gap, while also adding environmental and land-use penalties.

shortcutIndex =
  max(
    clamp((avgDistanceToExistingRoad - 0.08km) / 0.32km, 0, 1),
    clamp((maxDistanceToExistingRoad - 0.14km) / 0.38km, 0, 1) × 0.85
  )

shortcutRelief:
  flyover/underpass 0.22 × shortcutIndex
  surface road       0.14 × shortcutIndex

nearbyShortcutRelief = shortcutRelief × 0.72

6. Intersection and T-point grade separation

The complete drawn flyover/underpass line is compared with real graph intersections. A link affects a road when an endpoint is within 1.15 km, the drawn corridor is within 0.42 km, or it crosses a connected junction.

junctionBenefit =
  shapeBenefit
  + complexityBenefit
  + placementBenefit

shapeBenefit:
  4+ approaches 0.18
  T-point       0.14
  other         0.08

complexityBenefit =
  clamp((intersectionComplexity - 1) × 0.30, 0, 0.12)

placementBenefit:
  within 0.16 km  0.08
  within 0.38 km  0.045
  endpoint-near   0.03

junctionBenefit is capped at 0.32

The benefit is subtracted from the segment pressure multiplier. A well-aligned grade-separated link can reduce the direct multiplier to 0.16 and nearby approaches to 0.34.

Grade-separated links can also relieve a nearby major road or flyover corridor when they create a connector through a gap, even if the drawn line is not directly on top of that road.

corridorConnectorBenefit =
  endpointBenefit
  + corridorBenefit
  + shortcutBenefit
  + bottleneckBenefit
  + typeBenefit

eligible roads:
  motorway/trunk/primary/secondary or bridge/flyover roads
  within 1.65 km of endpoint or 0.95 km of drawn corridor

endpointBenefit:
  <=0.75 km 0.14, <=1.15 km 0.10, <=1.65 km 0.06

corridorBenefit:
  <=0.42 km 0.08, <=0.70 km 0.055, <=0.95 km 0.035

shortcutBenefit = openSpaceShortcutIndex × 0.08
bottleneckBenefit = 0.04 for priors/high intersection complexity
typeBenefit = underpass 0.03, flyover 0.02
cap = 0.24

7. Traffic diversion onto new links

relief = existingAssignedDemand × impact
existingDemand -= relief
newLinkDemand += relief × captureRatio

captureRatio:
  flyover                 0.92
  flyover + approach lanes 1.02
  underpass               0.88
  new road                0.78

impact =
  gradeBase × laneFactor × classFactor
  × shortcutFactor
  × approachLaneFactor
  × roadImportance × distanceFactor
  × corridorFactor
  + junctionImpact
  + corridorConnectorImpact

shortcutFactor =
  1 + clamp(openSpaceShortcutIndex, 0, 1) × 0.28

corridorConnectorImpact =
  min(0.26, endpointBoost + corridorBoost + shortcutBoost + bottleneckBoost + typeBoost)

Junction diversion is strongest at four-or-more approach intersections, followed by T-points. Total per-road diversion impact is capped at 0.92.

8. Segment context

Before each run, the engine precomputes context for every road segment:

  • midpoint and bounding box
  • assigned Delhi pincode polygon, adult population and density
  • matched Delhi traffic priors such as Ashram, ITO, Dhaula Kuan, Anand Vihar and Kalindi Kunj
  • connected intersection ids and T-point/crossing complexity
  • capacity class and render importance

9. OD demand

Pincode population does not directly color roads red. It produces trip demand. The model generates deterministic origin-destination pairs from pincode adult population and zone roles.

OD volume = originProduction
  × destinationAttraction
  × timeProfileMultiplier

Morning demand moves from residential pincodes toward office, education, commercial and transit zones. Evening demand reverses toward residential zones. Weekend/evening demand increases market and leisure attraction.

10. Capacity and V/C ratio

Congestion is based on volume divided by effective capacity.

volume =
  (assignedODDemand + localAccessDemand × roadClassDemand)
  × time/weather/event/peak demand

V/C ratio = volumePerHour / effectiveCapacityPerHour

Effective capacity responds to lanes, highway type, one-way status, bridge/tunnel friction, intersections/T-points, traffic priors, weather, event mode and scenario edits.

<0.45       free
0.45-0.70   light
0.70-0.90   moderate
0.90-1.10   heavy
1.10-1.35   severe
>1.35       gridlock

11. Waiting time

Waiting time is calculated from weighted segment pressure, not simply from road length. High V/C segments, intersection friction and signal-like penalties increase waiting. New links reduce waiting only when they divert demand away from constrained approaches without overloading downstream segments.

waitingLoad = Σ(demandUnits × congestionPressure^1.42 × signalPenalty)
totalWaitingTimeMin = waitingLoad × 38

signalPenalty:
  synthetic link 0.42
  one-way link   0.92
  otherwise      1.00

scenarioLinkWeight:
  flyover + approach lanes 0.10
  flyover/underpass        0.16
  new surface road         0.24

12. Speed, jams and commute

Speed uses a BPR/logistic speed-flow curve so speed collapses smoothly near and above capacity instead of dropping linearly.

bprRatio = 1 / (1 + 0.58 × V/C^4.2)
queueCollapse = 1 / (1 + exp((V/C - 1.08) × 7.2))
speedRatio = clamp(bprRatio × (0.64 + 0.36 × queueCollapse), 0.08, 1)
segmentSpeed = max(4, freeFlowSpeed × speedRatio)

Jams are counted from high congestion/V-C bands on existing roads. Scenario-only new links still affect pressure, waiting, speed and emissions, but they are not counted as extra existing jammed roads in the before/after comparison.

13. Accident risk

Risk begins from each segment's base accident score and is adjusted by scenario effects. General capacity expansion can add merge/conflict risk; parking control, bus priority and roundabouts can reduce conflict exposure.

14. Cost

totalCost = constructionCost + landCost
landCost = privateDisplacementSqm × circleRatePerSqm × 1.35

Construction cost depends on intervention type, length/quantity, lane count, area multiplier, roundabout radius, flyover approach-lane factor and disruption multiplier. Land cost is added for new corridors and grade-separated work where private displacement is estimated.

roundaboutFootprint = π × radiusM²
flyoverApproachLaneCostFactor = 1.18 when enabled
flyoverFootprintWidth += 7m when approach lanes are enabled

environmentalCostIndex =
  shortcutIndex × typeFactor × clamp(lengthKm, 0.45, 2.2)

typeFactor:
  flyover 28, underpass 20, new road 22
  +6 when flyover approach lanes are enabled

Open-space shortcut projects can improve travel time and still receive environment, land-use and political-acceptability penalties.

15. Improvement score

The before/after improvement score combines visible metrics:

  • Speed gain: 35%
  • Waiting reduction: 35%
  • Damped jam reduction: 20%
  • Risk reduction: 10%
improvement =
  speedGain × 0.35
  + waitingReduction × 0.35
  + jamReduction × 0.20
  + riskReduction × 0.10

jamReduction =
  (baseJams - editedJams)
  / max(baseJams, editedJams, 6)
  × 100

Jam scoring is damped so a one-road count change in a small local scope does not dominate speed and waiting results.

16. City score

The broader city score includes mobility, safety, environment, equity, budget efficiency, construction disruption, induced-demand risk, land-use compatibility and political acceptability. It intentionally does not reward car speed alone.

Environmental cost from open-space shortcut projects reduces the emissions proxy, noise score, land-use compatibility and political acceptability. The result can show traffic improvement while still warning that the project needs environmental review.

17. Current sources

Current road geometry is derived from OpenStreetMap/Overpass and rendered over OpenStreetMap raster tiles. Pincode polygons and adult-population values inform demand production. Delhi traffic priors are curated planning priors, not live traffic. Cost and land displacement values are rough scenario estimates.

The traffic road colors on the map come from V/C ratio and speed-flow degradation. The optional population heat layer is separate and does not directly set road traffic colors.