Scenario data format
If you want to import your owntravel demand model, you can use this JSONfile.
Specification
Until we switch to using protobufs or similar, there's no formal spec. The JSONdeserialization happens fromRust code.It's easiest to follow the example below.
Example
This defines a scenario containing a single person, who takes two trips. Theybegin at 1 second past midnight (10000) at the building nearest to theorigin, 'find' a bike and cycle to thedestination. Then at 12:20(12000000 is1200 seconds after midnight), they walk to the building nearestto thedestination. Note that thedestination of trip 1 must match theorigin of trip 2.
Themode field can be beWalk,Bike, orTransit. Thepurpose field ismostly unused; you could pickother valuesthat show up in the UI. And of course, you can add as many people as you like.
{ "scenario_name": "minimal", "people": [ { "trips": [ { "departure": 10000, "origin": { "Position": { "longitude": -122.303723, "latitude": 47.6372834 } }, "destination": { "Position": { "longitude": -122.3190500, "latitude": 47.6378600 } }, "mode": "Bike", "purpose": "Meal" }, { "departure": 12000000, "origin": { "Position": { "longitude": -122.3190500, "latitude": 47.6378600 } }, "destination": { "Position": { "longitude": -122.3075948, "latitude": 47.6394773 } }, "mode": "Walk", "purpose": "Recreation" } ] } ]}Tools
To import this JSON file into A/B Street:
cargo run --release --bin cli -- import-scenario --map=data/system/us/seattle/maps/montlake.bin --input=/path/to/input.jsonThen run the game as follows:
cargo run --bin game -- --dev data/system/us/seattle/maps/montlake.binYou will need to select the senario with the user interface.
This tool matches input positions to the nearest building, within 100 meters. Ifthe point lies outside the map boundary, it's snapped to the nearest map border.The tool will fail if any point doesn't match to a building. If you pass--skip_problems, those people will be logged and skipped instead.
There are also a few tools that produce this JSON file:
- https://github.com/a-b-street/abstreet/blob/master/headless/examples/generate_traffic.py
- https://github.com/a-b-street/abstr
Future requests
- A way to specify some kind of numeric ID for each person, so you can latercorrelate results from the simulation with your input