Steps
AdminExpressStep
Abstract Step to retrieve data from the ADMIN EXPRESS database.
Data is retrieved from local files when the
admin_express_directory parameter is defined,
otherwise data is requested from the WFS API.
AggregateResultsStep
Generates a JSON file with various aggregate results on the simulation.
NOTE: The developpement of this step is still in progress. More output will be added in the future. Do not hesitate to suggest additional output.
Currently available output:
- vehicle-kilometers (total, weighted by PCE, by mode)
- mode shares (by trip count, by trip Euclidean distance)
-
Parameters:
simulation_ratio -
Input files:
MetroVehicleTypesFile,TripResultsFile,TripsDistancesFile(optional) -
Output files:
AggregateOutputFile
AllFreeFlowTravelTimesStep
Computes travel time of the fastest path under (car) free-flow conditions, for all node pairs of the road network.
-
Input files:
RoadEdgesCleanFile,RoadEdgesFreeFlowTravelTimeFile -
Output files:
AllRoadFreeFlowTravelTimesFile
AllRoadDistancesStep
Computes distance of the shortest path, for all node pairs of the road network.
-
Input files:
RoadEdgesCleanFile -
Output files:
AllRoadDistancesFile
BicycleODNodesFromCoordinatesStep
Identifies nodes on the bicycle network to be used as origins and destinations of the trips.
First, this Step finds the nearest edge to the origin / destination coordinates.
Edges whose type is specified in the
forbidden_types parameter are excluded from
that search.
Then, the origin / destination node is either the source or target of that nearest edge,
whichever is closer.
-
Parameters:
bicycle_network.forbidden_types,crs -
Input files:
BicycleEdgesCleanFile,TripsDestinationsFile,TripsOriginsFile -
Output files:
TripsBicycleNodesFile
BicyclePreferencesFromPopulationStep
Generates the preference parameters of traveling by bicycle, for each trip, from constant values over population segments.
The following parameters are generated:
- constant: penalty of traveling by bicycle, per trip
- value of time / alpha: penalty per hour spent traveling by bicycle
The modes.bicycle.preferences_file parameter
must point to a Parquet or CSV file with the constant and/or alpha value for the population
segments.
The file can have the following columns:
constant: constant penalty for each bicycle trip (default is 0 when omitted)alphaorvalue_of_time: penalty per hour spent traveling by bicycle (default is 0 when omitted)mode: if present, only rows withmode = "bicycle"are used- any column representing persons’ characteristics from
PersonsFile
For example, to set different preferences for men and women, you can use the following CSV file:
mode,woman,constant,value_of_time
bicycle,true,-2,15
bicycle,false,-1,12
-
Parameters:
modes.bicycle.preferences_file -
Input files:
PersonsFile -
Output files:
BicyclePreferencesFile
BicyclePreferencesStep
Generates the preference parameters of traveling by bicycle, for each trip, from exogenous values.
The following parameters are generated:
- constant: penalty of traveling by bicycle, per trip
- value of time / alpha: penalty per hour spent traveling by bicycle
The values can be constant over trips or sampled from a specific distribution.
-
Parameters:
modes.bicycle.alpha,modes.bicycle.constant,random_seed -
Input files:
PersonsFile -
Output files:
BicyclePreferencesFile
BicycleTravelTimesFromDistanceStep
Computes travel time by bicycle for each trip, from a given distance and a constant speed.
The parameter modes.bicycle.distance.type specifies
how the bicycle distance is computed. For now, the only option is "pedestrian" which uses the
distance of the shortest path on the pedestrian network (Step
TripsPedestrianDistancesStep).
The parameter modes.bicycle.speed controls the speed at
which bicycles run.
If the parameter
modes.bicycle.distance.with_snap is set to
true, the snap distance at origin and destination is added to the bicycle travel time, with a
speed given by modes.bicycle.snap_speed (equal to
modes.bicycle.speed by default).
The snap distance corresponds to the distance between the trips’ origin and destination and the
network (See Step
PedestrianODNodesFromCoordinatesStep).
-
Parameters:
modes.bicycle.distance.type,modes.bicycle.distance.with_snap,modes.bicycle.snap_speed,modes.bicycle.speed -
Input files:
TripsPedestrianDistancesFile[ifmodes.bicycle.distance.typeis"pedestrian"],TripsPedestrianNodesFile[ifmodes.bicycle.distance.with_snapistrue] -
Output files:
BicycleTravelTimesFile
CarAccessEgressStep
Identifies the access and egress parts of car trips based on the primary road network.
For each car trip, this step determines:
- Access part: The sequence of edges taken before the first primary edge in the trip.
- Egress part: The sequence of edges taken after the last primary edge in the trip.
The access and egress parts are derived from the free-flow route of the trip and the set of primary edges. Trips that consist solely of primary edges or solely of secondary edges will not have access or egress parts.
The output includes the following information for each trip:
access_node: The node where the primary part of the trip begins.access_path: The list of edges in the access part.access_time: The total free-flow travel time for the access part.access_length: Length of the access part (meters).egress_node: The node where the primary part of the trip ends.egress_path: The list of edges in the egress part.egress_time: The total free-flow travel time for the egress part.egress_length: Length of the egress part (meters).
-
Input files:
RoadEdgesCleanFile,RoadEdgesFreeFlowTravelTimeFile,RoadEdgesPrimaryFlagFile,TripsCarFreeFlowTravelTimesFile -
Output files:
NonPrimaryCarTrips,PrimaryCarTripsAccessEgressFile
CarDriverPreferencesFromPopulationStep
Generates the preference parameters of traveling by car_driver, for each trip, from constant values over population segments.
The following parameters are generated:
- constant: penalty of traveling by car_driver, per trip
- value of time / alpha: penalty per hour spent traveling by car_driver
The modes.car_driver.preferences_file parameter
must point to a Parquet or CSV file with the constant and/or alpha value for the population
segments.
The file can have the following columns:
constant: constant penalty for each car_driver trip (default is 0 when omitted)alphaorvalue_of_time: penalty per hour spent traveling by car_driver (default is 0 when omitted)mode: if present, only rows withmode = "car_driver"are used- any column representing persons’ characteristics from
PersonsFile
For example, to set different preferences for men and women, you can use the following CSV file:
mode,woman,constant,value_of_time
car_driver,true,-2,15
car_driver,false,-1,12
-
Parameters:
modes.car_driver.preferences_file -
Input files:
PersonsFile -
Output files:
CarDriverPreferencesFile
CarDriverPreferencesStep
Generates the preference parameters of traveling by car_driver, for each trip, from exogenous values.
The following parameters are generated:
- constant: penalty of traveling by car_driver, per trip
- value of time / alpha: penalty per hour spent traveling by car_driver
The values can be constant over trips or sampled from a specific distribution.
-
Parameters:
modes.car_driver.alpha,modes.car_driver.constant,random_seed -
Input files:
PersonsFile -
Output files:
CarDriverPreferencesFile
CarDriverWithPassengersPreferencesFromPopulationStep
Generates the preference parameters of traveling by car_driver_with_passengers, for each trip, from constant values over population segments.
The following parameters are generated:
- constant: penalty of traveling by car_driver_with_passengers, per trip
- value of time / alpha: penalty per hour spent traveling by car_driver_with_passengers
The modes.car_driver_with_passengers.preferences_file parameter
must point to a Parquet or CSV file with the constant and/or alpha value for the population
segments.
The file can have the following columns:
constant: constant penalty for each car_driver_with_passengers trip (default is 0 when omitted)alphaorvalue_of_time: penalty per hour spent traveling by car_driver_with_passengers (default is 0 when omitted)mode: if present, only rows withmode = "car_driver_with_passengers"are used- any column representing persons’ characteristics from
PersonsFile
For example, to set different preferences for men and women, you can use the following CSV file:
mode,woman,constant,value_of_time
car_driver_with_passengers,true,-2,15
car_driver_with_passengers,false,-1,12
-
Parameters:
modes.car_driver_with_passengers.preferences_file -
Input files:
PersonsFile -
Output files:
CarDriverWithPassengersPreferencesFile
CarDriverWithPassengersPreferencesStep
Generates the preference parameters of traveling by car_driver_with_passengers, for each trip, from exogenous values.
The following parameters are generated:
- constant: penalty of traveling by car_driver_with_passengers, per trip
- value of time / alpha: penalty per hour spent traveling by car_driver_with_passengers
The values can be constant over trips or sampled from a specific distribution.
-
Parameters:
modes.car_driver_with_passengers.alpha,modes.car_driver_with_passengers.constant,random_seed -
Input files:
PersonsFile -
Output files:
CarDriverWithPassengersPreferencesFile
CarFuelStep
Generates the fuel consumption and price of each car trips by applying a constant emission factor to the free-flow fastest-path length, combined with a fuel price.
-
Parameters:
fuel.consumption_factor,fuel.price -
Input files:
TripsCarFreeFlowTravelTimesFile -
Output files:
CarFuelFile
CarPassengerPreferencesFromPopulationStep
Generates the preference parameters of traveling by car_passenger, for each trip, from constant values over population segments.
The following parameters are generated:
- constant: penalty of traveling by car_passenger, per trip
- value of time / alpha: penalty per hour spent traveling by car_passenger
The modes.car_passenger.preferences_file parameter
must point to a Parquet or CSV file with the constant and/or alpha value for the population
segments.
The file can have the following columns:
constant: constant penalty for each car_passenger trip (default is 0 when omitted)alphaorvalue_of_time: penalty per hour spent traveling by car_passenger (default is 0 when omitted)mode: if present, only rows withmode = "car_passenger"are used- any column representing persons’ characteristics from
PersonsFile
For example, to set different preferences for men and women, you can use the following CSV file:
mode,woman,constant,value_of_time
car_passenger,true,-2,15
car_passenger,false,-1,12
-
Parameters:
modes.car_passenger.preferences_file -
Input files:
PersonsFile -
Output files:
CarPassengerPreferencesFile
CarPassengerPreferencesStep
Generates the preference parameters of traveling by car_passenger, for each trip, from exogenous values.
The following parameters are generated:
- constant: penalty of traveling by car_passenger, per trip
- value of time / alpha: penalty per hour spent traveling by car_passenger
The values can be constant over trips or sampled from a specific distribution.
-
Parameters:
modes.car_passenger.alpha,modes.car_passenger.constant,random_seed -
Input files:
PersonsFile -
Output files:
CarPassengerPreferencesFile
CarRidesharingPreferencesFromPopulationStep
Generates the preference parameters of traveling by car_ridesharing, for each trip, from constant values over population segments.
The following parameters are generated:
- constant: penalty of traveling by car_ridesharing, per trip
- value of time / alpha: penalty per hour spent traveling by car_ridesharing
The modes.car_ridesharing.preferences_file parameter
must point to a Parquet or CSV file with the constant and/or alpha value for the population
segments.
The file can have the following columns:
constant: constant penalty for each car_ridesharing trip (default is 0 when omitted)alphaorvalue_of_time: penalty per hour spent traveling by car_ridesharing (default is 0 when omitted)mode: if present, only rows withmode = "car_ridesharing"are used- any column representing persons’ characteristics from
PersonsFile
For example, to set different preferences for men and women, you can use the following CSV file:
mode,woman,constant,value_of_time
car_ridesharing,true,-2,15
car_ridesharing,false,-1,12
-
Parameters:
modes.car_ridesharing.preferences_file -
Input files:
PersonsFile -
Output files:
CarRidesharingPreferencesFile
CarRidesharingPreferencesStep
Generates the preference parameters of traveling by car_ridesharing, for each trip, from exogenous values.
The following parameters are generated:
- constant: penalty of traveling by car_ridesharing, per trip
- value of time / alpha: penalty per hour spent traveling by car_ridesharing
The values can be constant over trips or sampled from a specific distribution.
-
Parameters:
modes.car_ridesharing.alpha,modes.car_ridesharing.constant,random_seed -
Input files:
PersonsFile -
Output files:
CarRidesharingPreferencesFile
CircularNetworkStep
Generates a toy road network of circular form with radial and ring roads.
The network is inspired by de Palma, A., Kilani, M., & Lindsey, R. (2005). Congestion pricing on a road network: A study using the dynamic equilibrium simulator METROPOLIS. Transportation Research Part A: Policy and Practice, 39(7-9), 588-611.
The network has a center node, called “CBD”.
From the center, bidirectional radial roads are going in all directions.
The number of radial roads is controled by the nb_radials parameters and they are evenly
spaced (in the polar dimension).
At fixed distances from the center (controled by the parameter radius), bidirectional rings
are connecting the radial roads together.
The number of rings is controled by the nb_rings parameter.
There is one node at each crossing of a ring road with a radial road.
The number of nodes is thus nb_radials * nb_rings + 1.
The number of edges is 4 * nb_radials * nb_rings.
Node ids are set to "{D}-{i}", where D is the direction (N, S, E, W, NW, NE, SW, SE, or D1,
D2, etc. when the number of radials is different from 2, 4, or 8) and i is the ring index
(starting at 1).
For example, node "NW-1" is at the intersection of the Northwest radial with the first ring
(closest ring to the center).
Node "D1-2" is at the intersection of the first radial road (radial roads are generated
starting from the east direction and going in a counterclockwise direction, like the unit
circle) with the second ring.
By convention, the center node is denoted "CBD".
Edge ids for radial roads are set to "In{i}-{D}" for edges going toward the center and
"Out{i}-{D}" for edges going away from the center, with the same definition of D and i
than for the nodes.
For example, edge "In2-S" is the radial edge on the South axis, between the first and second
ring (its source node is "S-2" and its target node is "S-1").
Edge ids for ring roads are set to {D1}-{D2}-{i}, where D1 is the direction the edge is
starting from, D2 is the direction the edge is going to, and i is the ring index.
For example, edge "S-SE-1" is the ring edge from node "S-1" to node "SE-1".
Road types are set to "Radial {i}" for radial roads and "Ring {i}" for ring roads.
The parameter with_ramps allows to split each node of the road network (except the CBD node)
in four different nodes (inner, outer, left, and right) connected by edges representing entry /
exit ramps in and out of highways.
-
Parameters:
circular_network.entry_ramps_length,circular_network.exit_ramps_length,circular_network.nb_radials,circular_network.nb_rings,circular_network.radial_inter_ramp_length,circular_network.radius,circular_network.resolution,circular_network.ring_inter_ramp_length,circular_network.with_ramps -
Output files:
RoadEdgesRawFile
ConvergencePlotStep
Generates various graphs to analyze the convergence of the simulation.
-
Input files:
IterationResultsFile -
Output files:
ExpectedRoadTravelTimesConvergencePlotFile,MeanSurplusConvergencePlotFile,RouteLengthDiffConvergencePlotFile,SimulatedRoadTravelTimesConvergencePlotFile,TourDepartureTimeConvergencePlotFile
CustomODMatrixStep
Generates car driver origin-destination pairs from the provided origin-destination matrix.
The origin-destination matrix is provided in a CSV or Parquet file with the following columns:
origin: id of the origin node,destination: id of the destination node,size: number of trips to be generated from origin to destination.
The size variable can be integers or floats.
For float values, stochastic rounding is used to convert the value to an integer: e.g., 3.3 is
converted to 3 with probability 70% and to 4 with probability 30%.
-
Parameters:
od_matrix.file,random_seed -
Input files:
RoadEdgesCleanFile -
Output files:
TripsRoadNodesFile
CustomRoadImportStep
Imports a road network from a geospatial file.
The file must have the same schema has the RawEdgesFile.
-
Parameters:
custom_road_import.edges_file -
Output files:
RoadEdgesRawFile
CustomZonesStep
Reads zones from a geospatial file.
The input file can have these three columns:
geometry: Polygon or MultiPolygon of the zoneszone_id: Identifier of the zone (integer or sting)name: Name of the zone (string)
The two first columns are mandatory.
-
Parameters:
zones.custom_zones -
Output files:
ZonesFile
EdgesFreeFlowTravelTimesStep
Generates free-flow travel times for each edge of the road network.
The free-flow travel time of an edge is:
constant_penalty + length / speed
-
Input files:
RoadEdgesCleanFile,RoadEdgesPenaltiesFile(optional) -
Output files:
RoadEdgesFreeFlowTravelTimeFile
EqasimImportStep
Imports a synthetic population from the output of the Eqasim pipeline.
To use this step, you first need to generate a synthetic population following the instructions here: https://github.com/eqasim-org/eqasim-france.
A few extra steps need to be done for Pymetropolis:
- Set the
departementsorregionsconfiguration parameter so that it englobs the simulation area. Pymetropolis will automatically restricts the population to the simulation area (if defined). - Use parquet and geoparquet as output formats (optional):
output_formats: - "parquet" - "geoparquet" - Use MobiSurvStd for the Household Travel Survey (optional):
hts: mobisurvstd mobisurvstd: path: path/to/compatible/hts/ - Use
urban_typeandprofessional_activityas extra matching attributes (optional):use_urban_type: true matching_attributes: ["professional_activity", "urban_type", "*default*"]- Add extra attributes to the generated persons (optional):
extra_enriched_attributes: - "education_level" - "detailed_education_level"
- Add extra attributes to the generated persons (optional):
- Do not activate mode choice (unused):
mode_choice: false
-
Parameters:
crs,random_seed,synthetic_population.eqasim_output,synthetic_population.fraction -
Input files:
SimulationAreaFile(optional) -
Output files:
HouseholdsFile,HouseholdsHomesFile,PersonsFile,TripsDestinationsFile,TripsFile,TripsOriginsFile
ExogenousBicycleEdgeCostsStep
Generates costs for the bicycle network edges, from exogenous values.
-
Input files:
BicycleEdgesCleanFile -
Output files:
BicycleEdgesCostsFile
ExogenousCapacitiesStep
Generates bottleneck capacities for the road network edges, from exogenous values.
The bottleneck capacities can be:
- constant over edges
- constant by edge type
- constant by combinations of edge type and urban flag
-
Parameters:
road_network.capacities -
Input files:
RoadEdgesCleanFile,RoadEdgesUrbanFlagFile[if default capacities rely on the urban flag] -
Output files:
RoadEdgesCapacitiesFile
ExogenousEdgePenaltiesStep
Generates travel time penalties for the road network edges, from exogenous values.
The penalties can be:
- constant over edges
- constant by edge type
- constant by combinations of edge type and urban flag
-
Parameters:
road_network.penalties -
Input files:
RoadEdgesCleanFile,RoadEdgesUrbanFlagFile[if default penalties rely on the urban flag] -
Output files:
RoadEdgesPenaltiesFile
FrenchHouseholdsHomesZonesStep
Identifies the geographic zones where households’ homes are located in the French zoning system.
The French zoning system uses multiple levels of geographic zones:
- Zone 1: Region
- Zone 2: Department
- Zone 3: EPCI (Établissement Public de Coopération Intercommunale)
- Zone 4: INSEE commune
- Zone 5: IRIS
Check the AdminExpressStep and IRISStep
abstract steps to know how to configure this step.
-
Parameters:
ign.admin_express_directory,ign.api_communes_service_name,ign.api_iris_service_name,ign.api_wfs_url,ign.contours_iris_directory -
Input files:
HouseholdsHomesFile -
Output files:
HouseholdsZonesFile
FrenchTripsZonesStep
Identifies the geographic zones where trips’ origins and destinations are located in the French zoning system.
The French zoning system uses multiple levels of geographic zones:
- Zone 1: Region
- Zone 2: Department
- Zone 3: EPCI (Établissement Public de Coopération Intercommunale)
- Zone 4: INSEE commune
- Zone 5: IRIS
Check the AdminExpressStep and IRISStep
abstract steps to know how to configure this step.
-
Parameters:
ign.admin_express_directory,ign.api_communes_service_name,ign.api_iris_service_name,ign.api_wfs_url,ign.contours_iris_directory -
Input files:
TripsDestinationsFile,TripsOriginsFile -
Output files:
TripsZonesFile
GenericPopulationStep
Generates a population (persons and trips) from a list of car-driver origin-destination pairs.
Each person has a single trip.
-
Input files:
TripsRoadNodesFile -
Output files:
PersonsFile,TripsFile
GravityODMatrixStep
Generates car driver origin-destination pairs by generating trips from a gravity model.
The model is based on de Palma, A., Kilani, M., & Lindsey, R. (2005). Congestion pricing on a road network: A study using the dynamic equilibrium simulator METROPOLIS. Transportation Research Part A: Policy and Practice, 39(7-9), 588-611.
The total number of trips generated from each node is fixed (parameter trips_per_node).
Then, the number of trips generated from node \(i\) to node \(j\) is proportional to:
\[ e^{-\lambda \cdot {tt}^0} \]
where \(\lambda\) is the decay rate (parameter exponential_decay) and \({tt}^0\) is the
free-flow travel time by car from node \(i\) to node \(j\).
-
Parameters:
gravity_od_matrix.exponential_decay,gravity_od_matrix.nodes_regex,gravity_od_matrix.trips_per_node,random_seed -
Input files:
AllRoadFreeFlowTravelTimesFile -
Output files:
TripsRoadNodesFile
GridNetworkStep
Generates a toy road network from a grid.
The network is defined by a number of rows and columns.
The first node is located at the bottom left, at coordinates (0, 0).
Then, the node on the i-th column and j-th row has coordinates (i - 1, j - 1).
The total number of nodes is nb_columns * nb_rows.
By default, edges are bidirectional, connecting all adjacent nodes.
The total number of edges is thus
2 * nb_columns * (nb_rows - 1) + 2 * nb_rows * (nb_columns - 1).
The length parameter control the length of all edges.
With the parameters left_to_right, right_to_left, bottom_to_top, and top_to_bottom (by
default all equal to true), it is possible to disable the creation of edges in some direction.
For example, if right_to_left is set to false, all horizontal edges will be unidirectional
(towards increasing x coordinate).
Be careful, if the edges are not all bidirectional, the grid network is not strongly connected which can cause issue later on in the simulation.
A network of successive roads can be created by setting nb_rows to 1, nb_columns to the
desired number of roads + 1, and right_to_left to false.
Node ids are set to "Node_{x}_{y}", where x is the index of the column and y is the index
of the row (starting at 0).
For row edges, ids are set to "Row_{y}:{x1}to{x2}" for row y, when connecting column x1 to
column x2.
For column edges, ids are set to "Col_{x}:{y1}to{y2}" for column x, when connecting row x1
to row x2.
Road types are set to the edge direction: "LeftToRight", "RightToLeft", "TopToBottom", or
"BottomToTop".
-
Parameters:
grid_network.bottom_to_top,grid_network.left_to_right,grid_network.length,grid_network.nb_columns,grid_network.nb_rows,grid_network.right_to_left,grid_network.top_to_bottom -
Output files:
RoadEdgesRawFile
HomogeneousTstarStep
Generates the desired start time of the activity following each trip, from exogenous values.
The desired start times can be constant over trips or sampled from a specific distribution. It is recommended to only use this Step when each person has one trip only.
This Step should be combined with a Step that generate schedule-utility parameters.
-
Parameters:
departure_time.linear_schedule.tstar,random_seed -
Input files:
TripsFile -
Output files:
TstarsFile
IRISStep
Abstract Step to retrieve data from the Contours IRIS database.
Data is retrieved from local file when the
contours_iris_directory parameter is defined,
otherwise data is requested from the WFS API.
IterationResultsStep
Reads the iteration-level results from the Metropolis-Core simulation and produces a clean file for the results.
-
Input files:
MetroIterationResultsFile -
Output files:
IterationResultsFile
LinearScheduleFromPurposeStep
Generates the preference parameters for schedule-delay utility of each trip, from constant values over purposes.
The following parameters are generated:
- beta: the penalty for starting the following activity earlier than the desired time
- gamma: the penalty for starting the following activity earlier than the desired time
- delta: the length of the desired time window
The
departure_time.linear_schedule.preferences_file
parameter must point to a Parquet or CSV file with the beta, gamma and/or delta values for each
purpose.
The file can have the following columns:
purpose: purpose for which the given values applybeta: early penalty, in euros per hour (default is 0 when omitted)gamma: late penalty, in euros per hour (default is 0 when omitted)delta: desired-time window length, given in number of seconds or directly as Duration dtype (default is 0 when omitted)
For example, to set the beta and gamma values for work and education purposes:
purpose,beta,gamma
work,5,15
education,4,10
-
Parameters:
departure_time.linear_schedule.preferences_file -
Input files:
TripsFile -
Output files:
LinearScheduleFile
LinearScheduleStep
Generates the preference parameters for schedule-delay utility of each trip, using a linear-penalty model (à la Arnott, de Palma, Lindsey), from exogenous values.
For each trip, the following parameters are created:
- beta: the penalty for starting the following activity earlier than the desired time
- gamma: the penalty for starting the following activity earlier than the desired time
- delta: the length of the desired time window
The values can be constant over trips or sampled from a specific distribution.
This Step should be combined with a Step that generate desired activity start times.
-
Parameters:
departure_time.linear_schedule.beta,departure_time.linear_schedule.delta,departure_time.linear_schedule.gamma,random_seed -
Input files:
TripsFile -
Output files:
LinearScheduleFile
ODMatrixEachStep
Generates car driver origin-destination pairs by generating a fixed number of trips for each node pair of the road network.
Nodes selected as eligible origins are all nodes with at least one outgoing edge. Nodes selected as eligible destinations are all nodes with at least one incoming edge.
If the road network is not strongly connected, there is no guarantee that all the origin-destination pairs generated are feasible (i.e., there is a path from origin to destination).
-
Parameters:
node_od_matrix.each,random_seed -
Input files:
RoadEdgesCleanFile -
Output files:
TripsRoadNodesFile
OpenStreetMapBicycleImportStep
Imports a bicycle network from OpenStreetMap data.
Edges of the bicycle network are read from the OpenStreetMap ways with tag highway:*.
The osm_bicycle_import.highways parameter is used
to define the highway values which are part of the bicycle network. For example, values
"cycleway" and "path" should usually be included, while value "motorway" should be
excluded as it does not represent ways accessible by bicycles.
In addition to the highways parameter, this step requires both the
osm_file and crs parameters to be set.
For example, to import the cycleways in Paris, you can use:
osm_file = "path/to/paris.osm.pbf"
crs = "epsg:2154"
[osm_bicycle_import]
highways = [
"tertiary",
"tertiary_link",
"residential",
"cycleway",
"path",
]
An OpenStreetMap way is selected as valid cycleway edge if it satisfies all the conditions below:
- Tag
highwaymatches one of the value given inhighwaysparameter. - The way has no tag
bicycleor tagbicycleis not"no". - The way’s geometry is a valid LineString.
- The way intersects with the simulation area (if
simulation_area_filteristrue).
When filtering with the simulation area, the
simulation_area_buffer parameter can
be used to extend or shrink the area by a given distance.
This can be useful to include edges outside the area that might be used when traveling between
two points inside the area.
Various processing operations are done to clean the edges:
- Duplicate
oneway=falseways in two opposing edges. - Split ways at nodes where another way is intersecting.
Edges attributes are defined as follows: TODO
edge_id: OSM id of the way, with “r” appended if the edge is going backward, with “-[idx]” appended if the edge is split in multiple segments (withidxthe segment index).source: OSM id of the source node.target: OSM id of the target node.original_id: OSM id of the way (note that values are generally not unique).length: computed as geometric operation on the ways’ LineString, after conversion to the simulation CRS.edge_type:highwaytag value.name:nametag value if any, otherwiseaddr:streettag value if any, otherwisereftag value if any.speed_limit: read frommaxspeed,maxspeed:forward, ormaxspeed:backwardtag, as appropriate.lanes: read fromlanes,lanes:forward, orlanes:backwardtag, as appropriate.oneway:onewaytag value.roundabout:Trueifjunction=roundabout.toll:Trueiftoll=yes.give_way: way has a node withhighway=give_way, in the correct direction.stop: way has a node withhighway=stop, in the correct direction.traffic_signals: way has a node withhighway=traffic_signals, in the correct direction.
-
Parameters:
crs,osm_bicycle_import.highways,osm_bicycle_import.simulation_area_buffer,osm_bicycle_import.simulation_area_filter,osm_file -
Input files:
SimulationAreaFile[ifsimulation_area_filteris set totrue] -
Output files:
BicycleEdgesRawFile
OpenStreetMapPedestrianImportStep
Imports a pedestrian network from OpenStreetMap data.
Edges of the pedestrian network are read from the OpenStreetMap ways with tag highway:*.
The osm_pedestrian_import.highways parameter is
used to define the highway values which are part of the pedestrian network. For example,
values "footway" and "path" should usually be included, while value "motorway" should be
excluded as motorways are generally not allowed for pedestrians.
In addition to the highways parameter, this step requires both the
osm_file and crs parameters to be set.
For example, to import the pedestrian network of Paris, you can use:
osm_file = "path/to/paris.osm.pbf"
crs = "epsg:2154"
[osm_pedesrian_import]
highways = [
"primary",
"primary_link",
"secondary",
"secondary_link",
"tertiary",
"tertiary_link",
"living_street",
"unclassified",
"residential",
"road",
"service",
"track",
"footway",
"path",
"pedestrian",
]
An OpenStreetMap way is selected as valid pedestrian-network edge if it satisfies all the conditions below:
- Tag
highwaymatches one of the value given inhighwaysparameter. - The way has no tag
accessor tagaccessis not"private". - The way’s geometry is a valid LineString.
- The way intersects with the simulation area (if
simulation_area_filteristrue).
When filtering with the simulation area, the
simulation_area_buffer parameter
can be used to extend or shrink the area by a given distance.
This can be useful to include edges outside the area that might be used when traveling between
two points inside the area.
Edges attributes are defined as follows:
edge_id: OSM id of the way, with “r” appended if the edge is going backward, with “-[idx]” appended if the edge is split in multiple segments (withidxthe segment index).source: OSM id of the source node.target: OSM id of the target node.original_id: OSM id of the way (note that values are generally not unique).length: computed as geometric operation on the ways’ LineString, after conversion to the simulation CRS.edge_type:highwaytag value.name:nametag value if any, otherwiseaddr:streettag value if any, otherwisereftag value if any.
-
Parameters:
crs,osm_file,osm_pedestrian_import.highways,osm_pedestrian_import.simulation_area_buffer,osm_pedestrian_import.simulation_area_filter -
Input files:
SimulationAreaFile[ifsimulation_area_filteris set totrue] -
Output files:
PedestrianEdgesRawFile
OpenStreetMapRoadImportStep
Imports a road network from OpenStreetMap data.
Edges of the road network are read from the OpenStreetMap ways with tag highway:*.
The osm_road_import.highways parameter is used to
define the highway values which are part of the road network. For example, values "motorway"
and "motorway_link" should usually be included, while value "footway" should be excluded as
it does not represent ways accessible by road vehicles.
In addition to the highways parameter, this step requires both the
osm_file and crs parameters to be set.
For example, to import the major roads of Paris, you can use:
osm_file = "path/to/paris.osm.pbf"
crs = "epsg:2154"
[osm_road_import]
highways = [
"motorway",
"motorway_link",
"trunk",
"trunk_link",
"primary",
"primary_link",
"secondary",
"secondary_link",
]
An OpenStreetMap way is selected as valid road-network edge if it satisfies all the conditions below:
- Tag
highwaymatches one of the value given inhighwaysparameter. - The way has no tag
accessor tagaccessmatches one of the value given inallowed_access. - The way’s geometry is a valid LineString.
- The way intersects with the simulation area (if
simulation_area_filteristrue).
By default, the allowed tags for access are yes, permissive (non-public roads with allowed
access), and destination (allowed for local traffic only).
When filtering with the simulation area, the
simulation_area_buffer parameter can be
used to extend or shrink the area by a given distance.
This can be useful to include edges outside the area that might be used when traveling between
two points inside the area.
Various processing operations are done to clean the edges:
- Duplicate
oneway=falseways in two opposing edges. - Split ways at nodes where another way is intersecting.
Edges attributes are defined as follows:
edge_id: OSM id of the way, with “r” appended if the edge is going backward, with “-[idx]” appended if the edge is split in multiple segments (withidxthe segment index).source: OSM id of the source node.target: OSM id of the target node.original_id: OSM id of the way (note that values are generally not unique).length: computed as geometric operation on the ways’ LineString, after conversion to the simulation CRS.edge_type:highwaytag value.name:nametag value if any, otherwiseaddr:streettag value if any, otherwisereftag value if any.speed_limit: read frommaxspeed,maxspeed:forward, ormaxspeed:backwardtag, as appropriate.lanes: read fromlanes,lanes:forward, orlanes:backwardtag, as appropriate.oneway:onewaytag value.roundabout:Trueifjunction=roundabout.toll:Trueiftoll=yes.give_way: way has a node withhighway=give_way, in the correct direction.stop: way has a node withhighway=stop, in the correct direction.traffic_signals: way has a node withhighway=traffic_signals, in the correct direction.
-
Parameters:
crs,osm_file,osm_road_import.allowed_access,osm_road_import.highways,osm_road_import.simulation_area_buffer,osm_road_import.simulation_area_filter -
Input files:
SimulationAreaFile[ifsimulation_area_filteris set totrue] -
Output files:
RoadEdgesRawFile
OpenStreetMapUrbanAreasStep
Identifies urban areas from OpenStreetMap data.
Urban areas are read from the OpenStreetMap areas with tag landuse:*.
The osm_urban_areas.urban_landuse_tags
parameter is used to define the landuse values which are considered as urban.
For example, values "residential", "industrial", "commercial", or "retail" should
generally be included.
In addition to the urban_landuse_tags parameter, this step requires both the
osm_file and crs parameters to be set.
For example, to identifies the urban areas of Brittany, you can use:
osm_file = "path/to/brittany.osm.pbf"
crs = "epsg:2154"
[osm_urban_areas]
urban_landuse_tags = [
"residential",
"industrial",
"commercial",
"retail",
]
The osm_urban_areas.buffer parameter can be used to
extend (positive values) or shrink (negative values) the areas.
-
Parameters:
crs,osm_file,osm_urban_areas.buffer,osm_urban_areas.urban_landuse_tags -
Input files:
SimulationAreaFile(optional) -
Output files:
UrbanAreasFile
OutsideOptionPreferencesStep
Generates the preference parameters of the outside option alternative from exogenous values.
The following parameters are generated:
- constant: utility of choosing the outside option alternative
- value of time / alpha: penalty per hour spent traveling for the outside option (this usually irrelevant as the outside option does not imply traveling)
The values can be constant over tours or sampled from a specific distribution.
-
Parameters:
modes.outside_option.alpha,modes.outside_option.constant,random_seed -
Input files:
OutsideOptionTravelTimesFile(optional),TripsFile -
Output files:
OutsideOptionPreferencesFile
OutsideOptionTravelTimesFromRoadDistancesStep
Generates travel times for the outside option alternatives by applying a constant speed to the shortest-path distances of the car-driver trips.
If a tour has multiple trips, the outside option travel time of the tour depends on the sum of the shortest-path distances of all trips.
-
Parameters:
modes.outside_option.road_network_speed -
Input files:
TripsCarFreeFlowTravelTimesFile,TripsFile -
Output files:
OutsideOptionTravelTimesFile
PedestrianODNodesFromCoordinatesStep
Identifies nodes on the pedestrian network to be used as origins and destinations of the trips.
First, this Step finds the nearest edge to the origin / destination coordinates.
Edges whose type is specified in the
forbidden_types parameter are excluded from
that search.
Then, the origin / destination node is either the source or target of that nearest edge,
whichever is closer.
-
Parameters:
crs,pedestrian_network.forbidden_types -
Input files:
PedestrianEdgesCleanFile,TripsDestinationsFile,TripsOriginsFile -
Output files:
TripsPedestrianNodesFile
PopulationFromTripCoordinatesStep
Generates a population (persons and trips) from a list of trips with origin / destination coordinates.
Each person has a single trip.
The input file must have columns: trip_id, origin_lng, origin_lat, destination_lng,
destination_lat.
-
Parameters:
crs,population.trip_coordinates_file -
Output files:
PersonsFile,TripsDestinationsFile,TripsFile,TripsOriginsFile
PostprocessBicycleNetworkStep
Performs some operations on the “raw” bicycle network to make it suitable for simulation.
The operations performed are:
- Remove all parallel edges (edges with same source and target nodes), keeping only the edge
of minimum distance. This is only done if
remove_duplicatesistrue. - Keep only the largest strongly connected component of the bicycle-network graph. This
ensures that all origin-destination pairs are feasible. This is only done if
ensure_connectedistrue. - Set edge ids to
1,...,n, wherenis the number of edges. This is only done ifreindexistrue.
-
Parameters:
bicycle_network.ensure_connected,bicycle_network.reindex,bicycle_network.remove_duplicates -
Input files:
BicycleEdgesRawFile -
Output files:
BicycleEdgesCleanFile
PostprocessPedestrianNetworkStep
Performs some operations on the “raw” pedestrian network to make it suitable for simulation.
The operations performed are:
- Remove all parallel edges (edges with same source and target nodes), keeping only the edge
of minimum distance. This is only done if
remove_duplicatesistrue. - Keep only the largest strongly connected component of the pedestrian-network graph. This
ensures that all origin-destination pairs are feasible. This is only done if
ensure_connectedistrue. - Set edge ids to
1,...,n, wherenis the number of edges. This is only done ifreindexistrue.
-
Parameters:
pedestrian_network.ensure_connected,pedestrian_network.reindex,pedestrian_network.remove_duplicates -
Input files:
PedestrianEdgesRawFile -
Output files:
PedestrianEdgesCleanFile
PostprocessRoadNetworkStep
Performs some operations on the “raw” road network to make it suitable for simulation.
The operations performed are:
- Replace NULL values with defaults for columns
speed_limit,lanes,hov_lanes, and all the boolean columns. - Remove all parallel edges (edges with same source and target nodes), keeping only the edge
of minimum free-flow travel time. This is only done if
remove_duplicatesistrue. - Keep only the largest strongly connected component of the road-network graph. This ensures
that all origin-destination pairs are feasible. This is only done if
ensure_connectedistrue. - Set edge ids to
1,...,n, wherenis the number of edges. This is only done ifreindexistrue. - Set a minimum value for the number of lanes, speed limit, and length of edges.
- Compute in- and out-degrees of nodes.
The default values for speed_limit and lanes can be specified as
- constant value over edges
- constant value by edge type
- constant value by combinations of edge type and urban flag
-
Parameters:
road_network.default_lanes,road_network.default_speed_limit,road_network.ensure_connected,road_network.hov_lanes,road_network.min_lanes,road_network.min_length,road_network.min_speed_limit,road_network.reindex,road_network.remove_duplicates -
Input files:
RoadEdgesRawFile,RoadEdgesUrbanFlagFile[if default values rely on the urban flag] -
Output files:
RoadEdgesCleanFile
PublicTransitPreferencesFromPopulationStep
Generates the preference parameters of traveling by public_transit, for each trip, from constant values over population segments.
The following parameters are generated:
- constant: penalty of traveling by public_transit, per trip
- value of time / alpha: penalty per hour spent traveling by public_transit
The modes.public_transit.preferences_file parameter
must point to a Parquet or CSV file with the constant and/or alpha value for the population
segments.
The file can have the following columns:
constant: constant penalty for each public_transit trip (default is 0 when omitted)alphaorvalue_of_time: penalty per hour spent traveling by public_transit (default is 0 when omitted)mode: if present, only rows withmode = "public_transit"are used- any column representing persons’ characteristics from
PersonsFile
For example, to set different preferences for men and women, you can use the following CSV file:
mode,woman,constant,value_of_time
public_transit,true,-2,15
public_transit,false,-1,12
-
Parameters:
modes.public_transit.preferences_file -
Input files:
PersonsFile -
Output files:
PublicTransitPreferencesFile
PublicTransitPreferencesStep
Generates the preference parameters of traveling by public_transit, for each trip, from exogenous values.
The following parameters are generated:
- constant: penalty of traveling by public_transit, per trip
- value of time / alpha: penalty per hour spent traveling by public_transit
The values can be constant over trips or sampled from a specific distribution.
-
Parameters:
modes.public_transit.alpha,modes.public_transit.constant,random_seed -
Input files:
PersonsFile -
Output files:
PublicTransitPreferencesFile
PublicTransitTravelTimesFromRoadDistancesStep
Generates travel times for the public-transit trips by applying a constant speed to the shortest-path distances of the car-driver trips.
-
Parameters:
modes.public_transit.road_network_speed -
Input files:
TripsCarFreeFlowTravelTimesFile -
Output files:
TripsPublicTransitItinerariesFile
RoadEdgesVariablesStep
This Step generates edge-level variables to be used in the calibration process.
-
Parameters:
road_network.calibration_variables -
Input files:
RoadEdgesCleanFile,RoadEdgesUrbanFlagFile(optional) -
Output files:
RoadEdgesVariablesFile
RoadNetworkCongestionFunctionPlotsStep
Generates plots of expected and simulated congestion function global over the entire road network.
-
Input files:
MetroExpectedTravelTimeFunctionsFile,MetroSimulatedTravelTimeFunctionsFile,RoadEdgesFreeFlowTravelTimeFile -
Output files:
ExpectedRoadNetworkCongestionFunctionPlotFile,SimulationRoadNetworkCongestionFunctionPlotFile
RoadNetworkPrimaryEdgesStep
Identifies the edges which are part of the “primary” road network.
Only primary edges are simulated in Metropolis-Core, whereas the secondary edges are supposed to always be under free-flow conditions. By default, all edges are considered “primary”.
You can use the secondary_types parameter to
define the list of edges’ types that should be considered “secondary”.
For example, setting secondary_types to ["residential"] excludes residential edges from the
primary network, which can be useful as these edges are rarely congested but often represent a
large portion of the road network.
When secondary edges are defined, road trips are split in at most three parts:
- A sequence of secondary edges (access).
- A sequence of primary edges (simulated in Metropolis-Core).
- A sequence of secondary edges (egress).
Since only the primary part of the trip is simulated, secondary edges cannot appear in the
middle of the primary part.
If the ensure_primary_connected
parameter is set to true, Pymetropolis will add secondary edges to the primary network to
ensure that the fastest free-flow route for each trip can be completed without requiring more
than three parts.
-
Parameters:
road_network.ensure_primary_connected,road_network.secondary_types -
Input files:
RoadEdgesCleanFile,TripsCarFreeFlowTravelTimesFile[ifsecondary_typesis not empty andensure_primary_connectedistrue] -
Output files:
RoadEdgesPrimaryFlagFile
RoadODMatrixStep
Construct an origin-destination matrix (at the road-network node level) from the trips’ origins and destinations.
-
Input files:
RoadEdgesCleanFile,TripsRoadNodesFile -
Output files:
RoadODMatrixFile
RoadODNodesFromCoordinatesStep
Identifies nodes on the road network to be used as origins and destinations of the trips.
First, this Step finds the nearest edge to the origin / destination coordinates.
Edges whose type is specified in the
forbidden_types parameter are excluded from that
search.
Then, the origin / destination node is either the source or target of that nearest edge,
whichever is closer.
-
Parameters:
crs,road_network.forbidden_types -
Input files:
RoadEdgesCleanFile,TripsDestinationsFile,TripsOriginsFile -
Output files:
TripsRoadNodesFile
RouteResultsStep
Reads the results from the Metropolis-Core simulation and produces a clean file for route results of road trips.
-
Input files:
MetroRouteResultsFile,PrimaryCarTripsAccessEgressFile(optional),RoadEdgesFreeFlowTravelTimeFile -
Output files:
RouteResultsFile
RunSimulationStep
Runs the Metropolis-Core simulation.
This Step can take a few hours or even days to execute for large-scale simulations.
-
Parameters:
metropolis_core.exec_path -
Input files:
MetroParametersFile -
Output files:
MetroAgentResultsFile,MetroExpectedTravelTimeFunctionsFile,MetroIterationResultsFile,MetroNextExpectedTravelTimeFunctionsFile,MetroRouteResultsFile,MetroSimulatedTravelTimeFunctionsFile,MetroTripResultsFile
SimulationAreaFromAAVStep
Creates the simulation area from the boundaries of a Frech metropolitan area.
A French metropolitan area (aire d’attraction d’une ville) is a type of statistical area defined by the French national statistics office INSEE. It is defined by considering the commuting patterns between cities, making it well adapted to define areas for transport simulations.
The database for these aires d’attraction des villes is publicly available on the
INSEE website.
Pymetropolis can automatically download the database and read the polygon of an area if you set
the aav_name parameter to one of the existing area.
The areas’ name is usually the name of the biggest city in the area.
[simulation_area]
aav_name = "Paris"
If the automatic download does not work, you can download the file locally and tell Pymetropolis to use that version:
- Go to the INSEE page of the aires d’attraction des villes database: https://www.insee.fr/fr/information/4803954
- Download the zip file “Fonds de cartes des aires d’attraction des villes 2020 au 1er janvier 2024”
- Unzip the file. You will get two zip files representing shapefiles:
aav2020_2024.zip(polygons of the areas) andcom_aav2020_2024.zip(polygons of the municipalities). Only the former is needed. - In the section
[simulation_area]of the configuration, add the linesaav_filename = "path/to/aav2020_2024.zip"andaav_name = "YOUR_AAV_NAME".
[simulation_area]
aav_name = "Paris"
aav_filename = "path/to/aav2020_2024.zip"
-
Parameters:
crs,simulation_area.aav_filename,simulation_area.aav_name,simulation_area.buffer -
Output files:
SimulationAreaFile
SimulationAreaFromBboxStep
Creates the simulation area from a bounding box.
This is the easiest way to specify the simulation area. However, the area is thus limited to rectangles.
The bounding box needs to be specified as the bbox value, which expects a list of coordinates
[minx, miny, maxx, maxy].
By default, the coordinates need to be specified in the simulation CRS.
If you want to specify them in WGS84 (longitude, latitude), you can use bbox_wgs = true.
You can go to www.openstreetmap.org to identify the bounding box of a region (as WGS84 coordinates), using the “Export” button.
[simulation_area]
bbox = [1.4777, 48.3955, 3.6200, 49.2032]
bbox_wgs = true
-
Parameters:
crs,simulation_area.bbox_wgs,simulation_area.bbox -
Output files:
SimulationAreaFile
SimulationAreaFromOSMStep
Creates the simulation area by reading administrative boundaries from OpenStreetMap data.
Administrative boundaries of various subdivisions are specified directly on OpenStreetMap (e.g.,
states, counties, municipalities), with the tags
admin_level=* and
boundary=administrative.
The OpenStreetMap wiki has a
table
indicating the meaning of each admin_level value by country.
For example, admin_level=6 represents counties in the U.S. and départements in France.
You can use this Step to create the simulation area by reading one or more administrative
boundaries from OpenStreetMap data.
First, you need to set the osm_file value to the path to the OpenStreetMap file.
In the [simulation_area] section, the osm_admin_level value represents the admin_level
value to be used as filter and the osm_name value is a list of the subdivisions names to be
selected.
For example, to get the polygon of Madrid, you can use:
osm_file = "path/to/spain.osm.pbf"
[simulation_area]
osm_admin_level = 8
osm_name = ["Madrid"]
Or, to get the polygon of Paris and the surrounding departments, you can use:
osm_file = "path/to/france.osm.pbf"
[simulation_area]
osm_admin_level = 6
osm_name = ["Paris", "Hauts-de-Seine", "Seine-Saint-Denis", "Val-de-Marne"]
-
Parameters:
crs,osm_file,simulation_area.buffer,simulation_area.osm_admin_level,simulation_area.osm_name -
Output files:
SimulationAreaFile
SimulationAreaFromPolygonsStep
Creates the simulation by reading a geospatial file with polygon(s).
If you already have a set of polygons which jointly form the entire area (e.g., the administrative boundaries of all municipalities to be considered), you can simply provide as input a geospatial file with those polygons. Then, Pymetropolis will read the file and define the polygon of the simulation area as the union of all polygons. If there is a single polygon (e.g., the administrative boundary of the region to be considered), Pymetropolis will simply use it as the simulation area polygon.
The file can use any GIS format that can be read by geopandas (e.g., Parquet, Shapefile,
GeoJson).
It needs to be specified as the polygon_file value.
[simulation_area]
polygon_file = "path/to/polygon/filename"
-
Parameters:
crs,simulation_area.buffer,simulation_area.polygon_file -
Output files:
SimulationAreaFile
TripDepartureTimeDistributionStep
Generates a histogram of departure-time distribution at the trip level.
-
Input files:
TripResultsFile -
Output files:
TripDepartureTimeDistributionPlotFile
TripDistancesStep
Computes the Euclidean distances between origin and destination for each trip.
-
Input files:
TripsDestinationsFile,TripsOriginsFile -
Output files:
TripsDistancesFile
TripModeSharesStep
Generates a plot of mode shares at the trip level.
-
Input files:
TripResultsFile -
Output files:
TripModeSharesPlotFile
TripResultsStep
Reads the results from the Metropolis-Core simulation and produces a clean file for results at the trip level.
-
Input files:
MetroAgentResultsFile,MetroTripResultsFile,MetroTripsFile,PrimaryCarTripsAccessEgressFile(optional) -
Output files:
TripResultsFile
TripsBicycleCostStep
Computes the trips’ minimum cost on the bicycle network.
If the output_path is set to true, the list
of bicycle edges along the minimum-cost path is stored in the bicycle_path column of the
TripsBicycleCostsFile file.
-
Parameters:
bicycle_routing.output_path,metropolis_core.routing_exec_path -
Input files:
BicycleEdgesCleanFile,BicycleEdgesCostsFile,TripsBicycleNodesFile -
Output files:
TripsBicycleCostsFile
TripsCarFreeFlowTravelTimesStep
Computes the trips’ travel time on the road network by car, under free-flow conditions.
The free-flow travel time is defined as the travel time of the fastest path from origin to destination node on the road network, using edge-level car free-flow travel times.
-
Parameters:
metropolis_core.routing_exec_path -
Input files:
RoadEdgesCleanFile,RoadEdgesFreeFlowTravelTimeFile,TripsRoadNodesFile -
Output files:
TripsCarFreeFlowTravelTimesFile
TripsOpenTripPlannerStep
Computes the trips’ travel time and generalized time by public transit with OpenTripPlanner.
This step requires having access to an OpenTripPlanner API server. You can run one on your machine by following the OpenTripPlanner documentation. This step has been tested with OpenTripPlanner v2.9.0.
If you want a simpler (but less flexible) way to compute public-transit travel times, check out TripsPublicTransitTravelTimeFromR5Step.
The OpenTripPlanner server must be running when you execute Pymetropolis and accessible from the
URL opentripplanner.url ("http://0.0.0.0:8080" by
default).
The date parameter controls the date used in the
public-transit timetables, for all queries.
You need to ensure that the GTFS file(s) have running services at this date.
The departure / arrival time of the trips is control by the
time_type and
time parameters.
Five different cases are possible:
time_type = "departure": trips are departing at their ex-ante departure time, read from TripsFile (withtimeas a fallback value)time_type = "arrival": trips are arriving at their ex-ante arrival time, read from TripsFile (withtimeas a fallback value)time_type = "tstar": trips are arriving at their desired arrival time, read from TstarsFile (withtimeas a fallback value)time_type = "custom_departure": trips are all departing at timetimetime_type = "custom_arrival": trips are all arriving at timetime
Note that the departure / arrival time represents a time window, controllable by
OpenTripPlanner: for example, a trips with departure time 08:00:00 might actually depart at
08:04:00 to match the schedule of a bus.
The itinerary selected by OpenTripPlanner is the one that minimizes the “generalized time”, which is equal to the travel time with different weights applied to different modes.
You can control how the generalized time function is defined through several parameters:
walking_speed: walking speed on the pedestrian network, in km/h (default is 4 km/h).transfer_cost: penalty for transfers, in seconds equivalent (default is 5 minutes).multipliers.walk: multiplier for the value of time walking (default is 2).multipliers.wait: multiplier for the value of time waiting (default is 1.1).multipliers.bus: multiplier for the value of time in a bus (default is 1.2).multipliers.tram: multiplier for the value of time in a tramway (default is 1).multipliers.subway: multiplier for the value of time in a subway (default is 1).multipliers.rail: multiplier for the value of time for rail transport (default is 1).
When running this step, the public-transit itineraries of all trips are hold in memory.
If you are running out of memory, you can try to use the
batch_size parameter to reduce RAM consumption.
Reducing the batch size should reduce memory consumption, at the cost of an increase in running
time.
By default, all trips are run in a single batch.
Example of configuration for this step:
[opentripplanner]
url = "http://0.0.0.0:8080"
batch_size = 50000
date = 2026-05-28
time_type = "tstar"
walking_speed = 4.0
transfer_cost = 300
[opentripplanner.multipliers]
walk = 2
wait = 1.1
bus = 1.2
tram = 1
subway = 1
rail = 1
-
Parameters:
nb_threads,opentripplanner.batch_size,opentripplanner.date,opentripplanner.multipliers.bus,opentripplanner.multipliers.rail,opentripplanner.multipliers.subway,opentripplanner.multipliers.tram,opentripplanner.multipliers.wait,opentripplanner.multipliers.walk,opentripplanner.time_type,opentripplanner.time,opentripplanner.transfer_cost,opentripplanner.url,opentripplanner.walking_speed -
Input files:
TripsDestinationsFile,TripsFile,TripsOriginsFile,TstarsFile[iftime_typeis"tstar"] -
Output files:
TripsPublicTransitItinerariesFile
TripsPedestrianDistancesStep
Computes the trips’ distance on the pedestrian network.
The distance is defined as the length of the shortest path from origin to destination node on the pedestrian network.
If the output_path is set to true, the list
of pedestrian edges along the shortest path is stored in the pedestrian_path column of the
TripsPedestrianDistancesFile file.
-
Parameters:
metropolis_core.routing_exec_path,pedestrian_routing.output_path -
Input files:
PedestrianEdgesCleanFile,TripsPedestrianNodesFile -
Output files:
TripsPedestrianDistancesFile
TripsPublicTransitTravelTimeFromR5Step
Computes the trips’ travel time by public transit with r5py.
This is the easiest and (usually) fastest solution to compute public-transit travel times. However, it comes with some drawbacks:
- Time spent in each public-transit modes cannot be weighted (walking vs waiting vs bus vs metro…).
- The itineraries are not computed (needed for some post-simulation analysis).
- Approximations are made to the origin / destination locations and to the departure time.
- It is not possible to compute travel time for a given arrival time, only the departure time can be controlled.
If you want a more flexible solution, check out TripsOpenTripPlannerStep.
For this step, r5py build the public-transit network from an OpenStreetMap file
(osm_file) and from GTFS file(s)
(gtfs_files).
The date parameter controls the date used in the public-transit
timetables, for all queries.
You need to ensure that the GTFS file(s) have running services at this date.
The departure time of the trips is control by the time_type and
time parameters.
If time_type is "departure", then the departure time is given by the trips’ ex-ante
departure times (usually generated by the synthetic population).
If time_type is "custom", then the departure time is given by time.
The running time of r5py does not depend on the number of trips, but rather on the number of
unique origins, destinations, and departure times.
When trips’ origins and destinations are exact coordinates, as is the case with the Eqasim
synthetic population, the running time of this step can be very long.
Therefore, some approximations are done to “group” together similar origins, destinations, and
departure times.
You can control these approximations with the
coordinates_rounding and
time_rounding parameters.
By default, origins and destinations are rounded to the nearest 500 meters and departure time is
rounded to periods of 1 hour.
Example of configuration for this step:
osm_file = "data/ile-de-france-260101.osm.pbf"
gtfs_files = ["data/IDFM-gtfs.zip"]
[r5]
date = 2026-05-28
time_type = "departure"
coord_rounding = 1000
time_rounding = 1800
-
Parameters:
gtfs_files,osm_file,r5.coordinates_rounding,r5.date,r5.time_rounding,r5.time_type,r5.time -
Input files:
TripsDestinationsFile,TripsFile,TripsOriginsFile -
Output files:
TripsPublicTransitItinerariesFile
TstarFromArrivalTimeStep
Generates the desired start time of the activity following each trip, from the trip’s ex-ante arrival time.
This Step is useful to generate activity desired start times for the synthetic population
imported from EqasimImportStep.
To enable this Step, you must set the
departure_time.linear_schedule.tstar_type
parameter to "arrival_time".
-
Parameters:
departure_time.linear_schedule.tstar_type -
Input files:
TripsFile -
Output files:
TstarsFile
UniformDrawsStep
Draws random numbers for the inverse transform sampling of mode choice and departure time choice of each tour.
The random numbers are drawn from a uniform distribution between 0 and 1.
-
Parameters:
random_seed -
Input files:
TripsFile -
Output files:
UniformDrawsFile
UrbanEdgesStep
Identifies edges which are part of urban areas.
An edge is classified as “urban” if it is fully contained within the urban areas of the simulation.
-
Input files:
RoadEdgesRawFile,UrbanAreasFile -
Output files:
RoadEdgesUrbanFlagFile
WalkingPreferencesFromPopulationStep
Generates the preference parameters of traveling by walking, for each trip, from constant values over population segments.
The following parameters are generated:
- constant: penalty of traveling by walking, per trip
- value of time / alpha: penalty per hour spent traveling by walking
The modes.walking.preferences_file parameter
must point to a Parquet or CSV file with the constant and/or alpha value for the population
segments.
The file can have the following columns:
constant: constant penalty for each walking trip (default is 0 when omitted)alphaorvalue_of_time: penalty per hour spent traveling by walking (default is 0 when omitted)mode: if present, only rows withmode = "walking"are used- any column representing persons’ characteristics from
PersonsFile
For example, to set different preferences for men and women, you can use the following CSV file:
mode,woman,constant,value_of_time
walking,true,-2,15
walking,false,-1,12
-
Parameters:
modes.walking.preferences_file -
Input files:
PersonsFile -
Output files:
WalkingPreferencesFile
WalkingPreferencesStep
Generates the preference parameters of traveling by walking, for each trip, from exogenous values.
The following parameters are generated:
- constant: penalty of traveling by walking, per trip
- value of time / alpha: penalty per hour spent traveling by walking
The values can be constant over trips or sampled from a specific distribution.
-
Parameters:
modes.walking.alpha,modes.walking.constant,random_seed -
Input files:
PersonsFile -
Output files:
WalkingPreferencesFile
WalkingTravelTimesFromDistanceStep
Computes travel time by walking for each trip, from a given distance and a constant speed.
The parameter modes.walking.distance.type specifies
how the walking distance is computed. For now, the only option is "pedestrian" which uses the
distance of the shortest path on the pedestrian network (Step
TripsPedestrianDistancesStep).
The parameter modes.walking.speed controls the speed at
which people walk.
If the parameter
modes.walking.distance.with_snap is set to
true, the snap distance at origin and destination is added to the walking travel time, with a
speed given by modes.walking.snap_speed (equal to
modes.walking.speed by default).
The snap distance corresponds to the distance between the trips’ origin and destination and the
network (See Step
PedestrianODNodesFromCoordinatesStep).
-
Parameters:
modes.walking.distance.type,modes.walking.distance.with_snap,modes.walking.snap_speed,modes.walking.speed -
Input files:
TripsPedestrianDistancesFile[ifmodes.walking.distance.typeis"pedestrian"],TripsPedestrianNodesFile[ifmodes.walking.distance.with_snapistrue] -
Output files:
WalkingTravelTimesFile
WriteMetroAgentsStep
Generates the input agents file for the Metropolis-Core simulation.
If mode choice is enabled (more than 1 mode is simulated), the mode-choice parameters of the agents are initiated.
-
Parameters:
mode_choice.model,mode_choice.modes,mode_choice.mu -
Input files:
TripsFile,UniformDrawsFile[if there are at least two modes] -
Output files:
MetroAgentsFile
WriteMetroAlternativesStep
Generates the input alternatives file for the Metropolis-Core simulation.
-
Parameters:
departure_time_choice.model,departure_time_choice.mu,mode_choice.modes -
Input files:
OutsideOptionPreferencesFile[if the outside-option mode is defined],TripsFile[if at least one “trip-based” mode is defined],UniformDrawsFile[if at least one “trip-based” mode is defined and departure-time choice is “ContinuousLogit”] -
Output files:
MetroAlternativesFile
WriteMetroEdgesStep
Generates the input edges file for the Metropolis-Core simulation.
-
Input files:
MetroVehicleTypesFile,RoadEdgesCapacitiesFile(optional),RoadEdgesCleanFile,RoadEdgesPenaltiesFile(optional),RoadEdgesPrimaryFlagFile(optional) -
Output files:
MetroEdgesFile
WriteMetroParametersStep
Generates the input parameters file for the Metropolis-Core simulation.
-
Parameters:
nb_threads,simulation.backward_wave_speed,simulation.departure_time_interval,simulation.learning_factor,simulation.max_pending_duration,simulation.nb_iterations,simulation.period,simulation.recording_interval,simulation.routing_algorithm,simulation.spillback -
Input files:
MetroAgentsFile,MetroAlternativesFile,MetroEdgesFile(optional),MetroTripsFile(optional),MetroVehicleTypesFile(optional) -
Output files:
MetroParametersFile
WriteMetroTripsStep
Generates the input trips file for the Metropolis-Core simulation.
-
Parameters:
mode_choice.modes,vehicle_types.car.ridesharing_passenger_count -
Input files:
BicyclePreferencesFile(optional) [if the “bicycle” mode is defined],BicycleTravelTimesFile[if the “bicycle” mode is defined],CarDriverPreferencesFile(optional) [if the “car_driver” mode is defined],CarDriverWithPassengersPreferencesFile(optional) [if the “car_driver_with_passengers” mode is defined],CarFuelFile(optional) [if any “car_*” mode is defined],CarPassengerPreferencesFile(optional) [if the “car_passenger” mode is defined],CarRidesharingPreferencesFile(optional) [if the “car_ridesharing” mode is defined],LinearScheduleFile(optional),NonPrimaryCarTrips[if any “car_*” mode is defined],PrimaryCarTripsAccessEgressFile[if any “car_*” mode is defined],PublicTransitPreferencesFile(optional) [if the “public_transit” mode is defined],TripsFile,TripsPublicTransitItinerariesFile[if the “public_transit” mode is defined],TstarsFile(optional),WalkingPreferencesFile(optional) [if the “walking” mode is defined],WalkingTravelTimesFile[if the “walking” mode is defined] -
Output files:
MetroTripsFile
WriteMetroVehicleTypesStep
Generates the input vehicle-types file for the Metropolis-Core simulation.
-
Parameters:
mode_choice.modes,simulation_ratio,vehicle_types.car.headway,vehicle_types.car.pce,vehicle_types.car.ridesharing_passenger_count -
Input files:
RoadEdgesCleanFile[if the “car_driver” mode is defined] -
Output files:
MetroVehicleTypesFile