flow_generation_tool
Generates SUMO traffic flows between locations using place names or coordinates, with rate-based or total vehicle count options.
Instructions
Generate a SUMO flow from source to destination.
Two ways to specify locations:
1. Place names (source/dest) — uses geocoding to find coordinates
2. Direct coordinates (source_lat/lon, dest_lat/lon) — skips geocoding.
Use this when coordinates are already known (e.g., from map O/D selection).
Two ways to specify vehicle count (exactly one required):
1. vehs_per_hour — rate-based generation (SUMO <flow vehsPerHour="N">)
2. number — total vehicle count over [begin,end] (SUMO <flow number="N">)
Safety parameters applied: departLane="free", departPos="random_free", departSpeed="random"
IMPORTANT: When calling multiple times for multi-OD scenarios, pass the previous call's
route_file output as the next call's route_file input to accumulate all flows in one file.
Args:
route_file: Route file path (pass previous output for chained calls)
net_file: Network file path
source: Source location place name (e.g., "Madison Square Garden")
dest: Destination location place name (e.g., "Lincoln Tunnel")
begin: Start time in seconds (default: 0.0)
end: End time in seconds (default: 3600.0)
vehs_per_hour: Vehicles per hour — mutually exclusive with number
number: Total vehicle count — mutually exclusive with vehs_per_hour
flow_id: Flow ID (auto-generated if None)
output_dir: Output directory for results
use_geocoding: Use geocoding for place name resolution (default: True)
search_radius: Search radius in km for nearest edge (default: 0.3)
source_lat: Source latitude (WGS84) — use with source_lon for coordinate mode
source_lon: Source longitude (WGS84) — use with source_lat for coordinate mode
dest_lat: Destination latitude (WGS84) — use with dest_lon for coordinate mode
dest_lon: Destination longitude (WGS84) — use with dest_lat for coordinate mode
Examples:
Place name mode (geocoding):
flow_generation_tool(route_file="r.rou.xml", net_file="n.net.xml",
source="Madison Square Garden", dest="Lincoln Tunnel",
begin=0, end=1800, vehs_per_hour=260)
Coordinate mode (from map selection):
flow_generation_tool(route_file="r.rou.xml", net_file="n.net.xml",
source_lat=40.7505, source_lon=-73.9934,
dest_lat=40.7580, dest_lon=-73.9855,
begin=0, end=3600, number=200)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | No | ||
| dest | No | ||
| begin | No | ||
| number | No | ||
| source | No | ||
| flow_id | No | ||
| dest_lat | No | ||
| dest_lon | No | ||
| net_file | Yes | ||
| output_dir | No | output/trips | |
| route_file | Yes | ||
| source_lat | No | ||
| source_lon | No | ||
| search_radius | No | ||
| use_geocoding | No | ||
| vehs_per_hour | No |