iduedu.TransportSpec¶
- class iduedu.TransportSpec(name, vmax_tech_kmh, accel_dist_m, brake_dist_m, base_speed_kmh, avg_wait_time_min=1.0, dwell_min=0.0)[source]¶
Configuration of a single public-transport mode used to estimate travel time on graph edges.
Each transport specification defines technical and operational characteristics of a mode (e.g. bus, tram, subway) that are used to compute per-edge travel time based on segment length, road speed limits, acceleration/braking behavior, and traffic conditions.
- Parameters:
- name¶
Transport type identifier, usually matching the OSM
route=*value (e.g."bus","tram","subway").- Type:
- accel_dist_m¶
Typical distance (meters) required to accelerate from standstill to cruising speed.
- Type:
- brake_dist_m¶
Typical distance (meters) required to decelerate from cruising speed to standstill.
- Type:
- base_speed_kmh¶
Free-flow speed of the mode in kilometers per hour: the speed it holds between stops once it is up to speed.
A road speed limit does not scale this value. Earlier versions made free speed affine in the limit,
base + traffic_coef * limit, and fitting that form against published timetables showed the two terms are not separately identifiable: for buses, a fast base with a weak coefficient and a slow base with a strong one differ by less than a percent in error. Dropping the term outright improved accuracy for every mode measured (bus, tram, trolleybus, subway, commuter rail), because OSM’smaxspeeddescribes what a car may do, not what a bus with passengers, stops and traffic actually does.The limit is still honoured where it binds: a vehicle is not modelled faster than the road allows.
- Type:
- dwell_min¶
Time lost standing at a stop, in minutes. Added once per segment. Defaults to
0.- Type:
- avg_wait_time_min¶
Average passenger waiting time in minutes. It is assigned to directed
boardingedges built from OSM data.- Type:
Methods
Compute travel time (minutes) for a single graph segment.
Validate transport specification fields.
- validate()[source]¶
Validate transport specification fields.
- Raises:
ValueError – If a required field is missing or outside the supported
range. –
- Return type:
- travel_time_min(segment_len_m, *, speed_limit_mpm=None, min_speed_mpm=60.0)[source]¶
Compute travel time (minutes) for a single graph segment.
The method estimates traversal time using a simplified kinematic model that accounts for: - the transport mode technical maximum speed; - an optional road speed limit, entering the free-flow speed affinely; - time lost standing at a stop (
dwell_min); - time lost on acceleration and braking.For short segments where the vehicle cannot reach cruising speed, a reduced peak speed is assumed and the segment is traversed using an acceleration-deceleration profile without a cruising phase. The peak speed scales as
sqrt(L / span)because under constant acceleration the distance covered grows with the square of the speed reached; the two branches meet continuously atL == span.- Parameters:
segment_len_m (
float) – Segment length in meters. Must be positive.speed_limit_mpm (
float | None) – Optional road speed limit in meters per minute. If provided, the effective speed will not exceed this value.min_speed_mpm (
float) – Lower bound for effective speed (meters per minute), used to avoid unrealistically large travel times on very short segments.
- Returns:
Estimated travel time for the segment in minutes.
- Return type: