Expand description
Spatial density grid and Level-of-Service (LoS) analysis for transportation.
LoS is not a single metric – the Highway Capacity Manual (HCM) defines separate criteria for different facility types and modes:
| Criteria type | Input metric | Typical use |
|---|---|---|
PedestrianWalkway | Density (pax/m2) | Sidewalks, corridors (Fruin) |
PedestrianStairway | Density (pax/m2) | Stairs, escalator approaches |
PedestrianQueuing | Density (pax/m2) | Waiting areas, platforms |
VehicularFreeway | Density (pc/km/ln) | Freeway segments |
VehicularUrbanStreet | Delay (s/veh) | Signalized intersections, arterials |
BicycleFacility | Events per min | Bike lanes, shared paths |
TransitCapacity | Load factor | Bus, rail passenger loading |
CustomLosCriteria | User-defined thresholds | Any metric |
§Architecture
The LosCriteria trait defines how a raw measurement is classified
into a LosGrade (A through F). Built-in implementations cover
the standard HCM facility types. Users can implement the trait for
custom metrics.
DensityGrid is a spatial grid that counts agents per cell and
can classify each cell using any LosCriteria implementation.
§Usage
ⓘ
use rustsim_spaces::density::*;
let mut grid = DensityGrid::new(100.0, 50.0, 2.0);
for agent in model.agents() {
grid.add_position(agent.x, agent.y);
}
// Pedestrian walkway LoS (Fruin / HCM)
let los = PedestrianWalkway.classify(grid.density_at(10.0, 20.0));
// Pedestrian stairway LoS
let los = PedestrianStairway.classify(grid.density_at(5.0, 3.0));
// Full statistics with a specific criteria
let stats = grid.statistics(&PedestrianWalkway);
// Vehicular delay-based LoS (not grid-based -- classify directly)
let los = VehicularUrbanStreet.classify(35.0); // 35 s/veh delay
grid.clear();Structs§
- Bicycle
Facility - Bicycle facility LoS based on hindrance events per minute (HCM Chapter 24).
- Custom
LosCriteria - User-defined LoS criteria with custom thresholds.
- Density
Grid - Spatial density grid for computing agents-per-square-meter.
- Density
Statistics - Summary statistics from a density grid.
- Pedestrian
Queuing - Pedestrian queuing area LoS based on density (HCM Chapter 24).
- Pedestrian
Stairway - Pedestrian stairway LoS based on density (HCM Chapter 24).
- Pedestrian
Walkway - Pedestrian walkway LoS based on density (Fruin / HCM Chapter 24).
- Transit
Capacity - Transit vehicle LoS based on passenger load factor (Transit Capacity and Quality of Service Manual).
- Vehicular
Freeway - Vehicular freeway LoS based on density (HCM Chapter 12).
- Vehicular
Unsignalized - Unsignalized intersection LoS based on control delay (HCM Chapters 20 and 21).
- Vehicular
Urban Street - Vehicular urban street and signalized intersection LoS based on control delay (HCM Chapters 16 and 19).
Enums§
- Density
Grid Error - Errors returned by density-grid validation.
- LosCriteria
Config Error - Errors returned by custom LoS criteria validation.
- LosGrade
- Level-of-Service grade A through F (HCM convention).
Traits§
- LosCriteria
- Trait for classifying a raw measurement into a
LosGrade.