matsim-org / matsim-libs

Multi-Agent Transport Simulation
www.matsim.org
480 stars 446 forks source link

A question about analysising for the output files. #1420

Open HawkTom opened 3 years ago

HawkTom commented 3 years ago

Hello,

Now, I have a project, in which I need to analyze the output files and obtain some useful data.

I hope to obtain the map data and the state of each edge in the map at every time. More detailly, I want to obtain the data that for each time point, how long a vehicle will take to traverse a route (edge).

May I ask if it is possible to extract these data from the output files? If so, how can I obtain them.

Thanks!!!

Best, Hao

mrieser commented 3 years ago

Yes, this is possible by analyzing the simulation events (output_events.xml.gz). The basic idea is to remember for each vehicle the link-enter time, and then when the vehicle leaves the link again, calculate it's travel time. This information can then be aggregated in whatever way you want.

An example to collect LinkEnter- and LinkLeave-Events can be found in this example events-handler. Note that you should filter out vehicles performing an activity on a link (VehicleLeavesTrafficEventHandler).

An alternative could also be to use the TravelTimeCalculator from MATSim, which calculates for each link and each 15-min time-bin the average travel time per link.