Demand¶
A helper for turning a time-varying demand rate profile into a list of Vehicles
with staggered departure times (and optional route shares). See
Building networks for how demand is attached to
an origin.
vehicles_from_demand_profile
¶
vehicles_from_demand_profile(demand_pattern: Sequence[float], total_time: float, route: Sequence[int] | None = None, route_integer_share: dict[tuple[int, ...], int] | None = None, random_route: bool = False, origin: NodeId = 0, destination: NodeId = 0) -> list[Vehicle]
Expand a piecewise-constant demand profile into individual vehicles.
Ported from abmmeso (demand/trip.py Trip.from_continuous_demand).
Each entry of demand_pattern is a flow rate (veh/s) that applies over an
equal-length slice of total_time; vehicles are spaced uniformly within
each slice. Routes may be a single fixed route or drawn from a share map.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
demand_pattern
|
Sequence[float]
|
Sequence of flow rates (veh/s), one per equal time slice. |
required |
total_time
|
float
|
Total horizon in seconds spanned by |
required |
route
|
Sequence[int] | None
|
A fixed route ( |
None
|
route_integer_share
|
dict[tuple[int, ...], int] | None
|
Optional map |
None
|
random_route
|
bool
|
If |
False
|
origin
|
NodeId
|
Origin identifier stored on every vehicle (bookkeeping). |
0
|
destination
|
NodeId
|
Destination identifier stored on every vehicle (bookkeeping). |
0
|
Returns:
| Type | Description |
|---|---|
list[Vehicle]
|
A list of :class: |