matsim-org / matsim-code-examples

A repository containing code examples around MATSim
GNU General Public License v3.0
83 stars 179 forks source link

calculate free flow travel time and actual travel time for each agent #620

Open elyh1992 opened 3 years ago

elyh1992 commented 3 years ago

Hi,

I want to calculate free-flow travel time (in the condition of no traffic congestion in the system) and compare it with actual travel time for each agent in my model so I can compare total delay in the system. Is there anywhere in MATSim outputs that I can get free flow travel time and actual travel time for agents? Output plan file includes the travel time for each leg but when I compare it with travel times from the event file they are not the same. Is the travel time reported in the output plan file the free-flow travel time? Also, the output plan file includes the route that agent uses (including list of links), is this the route that agent actually takes? in general is the output plan file reliable? Also is there a way to get event file as csv?

Thank you for your help in advance.

jalal1 commented 3 years ago

Hello,

Let me try to answer some questions depend on my experience with MATSim, not as an expert.

Option 1: You may use the network.xml file as it contains the free speed and the length for each link, so you can calculate the free-flow travel time. Next, from the event file, you can calculate the actual travel time for each link, and compare it. The recommendation from MATSim's team is always to use the event file, not the plan file.

Option 2: There is a file called "linkstats.txt.gz" in the MATSim output ITER folder (per iteration). It contains for each link the free speed and the hourly travel time. This option saves your time, as the travel time has already been calculated. In fact, I am using option 1, because I didn't know about option 2 back then. I didn't have the time to try option 2.

For the plans, I usually rely on "output_experienced_plans.xml.gz" in the output folder instead of "output_plans.xml.gz" as it contains more accurate information about each plan. In order to generate this file, there is a parameter in the config file, that you have to turn on.