starling_sim.basemodel.topology.network_speeds
Module Contents
Classes
Abstract class for speed evaluation on topologies. |
|
Evaluate a constant speed independently of the edge. |
|
Evaluate the edge speed based on its "highway" tag. |
|
Evaluate speed individually for each network edge. |
- class starling_sim.basemodel.topology.network_speeds.NetworkEdgeSpeed
Bases:
abc.ABCAbstract class for speed evaluation on topologies.
- property speeds_data
Access the speeds data structure
- abstract __call__(u, v, d) float
Get the edge’s speed from the data stored in self._speeds_data
- Parameters:
u – origin node
v – destination node
d – edge data
- Returns:
speed in km/h
- class starling_sim.basemodel.topology.network_speeds.ConstantSpeed(speed: float)
Bases:
NetworkEdgeSpeedEvaluate a constant speed independently of the edge.
- __call__(u, v, d) float
Get the edge’s speed from the data stored in self._speeds_data
- Parameters:
u – origin node
v – destination node
d – edge data
- Returns:
speed in km/h
- class starling_sim.basemodel.topology.network_speeds.SpeedByHighwayType(speeds_json_file: str)
Bases:
NetworkEdgeSpeedEvaluate the edge speed based on its “highway” tag.
This class uses a speed mapper that maps “highway” tag values to speed values. The mapper has the following format: { <tag>: { “speed”: <speed_value> } }.
If a list of tags is provided, use the first one. If the tag ends with ‘_links’ and is not found in the speed mapper, look for the tag value without the ‘_link’ suffix. If the tag is still not found in the mapper, use the ‘other’ value of the mapper.
- __call__(u, v, d) float
Get the edge’s speed from the data stored in self._speeds_data
- Parameters:
u – origin node
v – destination node
d – edge data
- Returns:
speed in km/h
- class starling_sim.basemodel.topology.network_speeds.SpeedByEdge(speeds_table_file: str)
Bases:
NetworkEdgeSpeedEvaluate speed individually for each network edge.
This class uses a mapper that maps (origin, destination) tuples to speed values. The mapper is read from a CSV file that contains “origin”, “destination” and “speed” columns.
The mapper must contain exactly one value for each (directed) edge of the graph.
- __call__(u, v, d) float
Get the edge’s speed from the data stored in self._speeds_data
- Parameters:
u – origin node
v – destination node
d – edge data
- Returns:
speed in km/h