trip_generate
Generate origin-destination trip definitions for SUMO traffic simulation. Supports random trips with adjustable traffic levels or real OD data from CSV files using coordinate or zone mapping.
Instructions
[Step 3/5] Generate trip demand (trips.xml) for SUMO simulation.
Creates origin-destination trip definitions. This tool ONLY generates trips —
route assignment is done separately by route_generate().
Previous step: net_convert() to get .net.xml file.
Next step: route_generate() to assign routes to trips.
=== THREE MODES ===
1. RandomOD — Random trip generation:
- trip_type: "RandomOD"
- traffic_condition (REQUIRED): "light" | "medium" | "heavy"
* light: ~20% of edge count (rural, off-peak)
* medium: ~80% of edge count (typical urban)
* heavy: ~150% of edge count (rush hour, dense urban)
2. RealOD-coordinate — Real OD from coordinate CSV:
- trip_type: "RealOD", od_type: "coordinate"
- od_data_file: Path to CSV file
- Default columns: O_lon, O_lat, D_lon, D_lat, O_time_relative
- Use column_mapping if your CSV has different column names
3. RealOD-zone — Real OD from zone CSV + shapefile:
- trip_type: "RealOD", od_type: "zone"
- od_data_file: Path to OD CSV file
- zone_shp_file: Path to zone shapefile (.shp)
- Default columns: h3_lv9_O, h3_lv9_D, O_time_relative
- Default shapefile ID column: h3_indx
- Use column_mapping to override any of these
=== COLUMN MAPPING ===
For non-standard CSV files, provide column_mapping to map standard names to actual column names.
Coordinate mode mapping keys:
"O_lon", "O_lat", "D_lon", "D_lat", "O_time_relative"
Zone mode mapping keys:
"zone_O", "zone_D", "O_time_relative", "zone_id_column"
Example: {"O_lon": "pickup_lng", "O_lat": "pickup_lat", "D_lon": "dropoff_lng", "D_lat": "dropoff_lat", "O_time_relative": "start_sec"}
=== RETURNS ===
- trip_file: Path to generated .trips.xml file (pass to route_generate)
- trip_count: Number of trips generated
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"trip_type": "<trip_type>",
"net_file": "<net_file>"
},
"name": "trip_generate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| od_type | No | ||
| net_file | Yes | ||
| trip_type | Yes | ||
| output_dir | No | output/trips | |
| od_data_file | No | ||
| zone_shp_file | No | ||
| column_mapping | No | ||
| traffic_condition | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |