matsim-org / matsim-code-examples

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

[Beginner] How to see traffic volume on specific links #943

Closed Armanapattt closed 1 year ago

Armanapattt commented 1 year ago

Hi everyone! I'm a beginner user of MATSim and I'm trying to get the traffic counts of specific links from my model. I added the counts module to my config file and it ran successfully. However, I could not find the corresponding output that shows the volume count. Also, I found an example of the input counts file but I don't understand what loc_id and cs_id mean. Can you kindly tell me? Thank you in advance and my config.xml is as follows:

`<?xml version="1.0" ?> <!DOCTYPE config SYSTEM "http://www.matsim.org/files/dtd/config_v2.dtd">

`

jingjunL commented 1 year ago

The easiest way of comparing traffic counts would be through the Via visualisation tool (https://simunto.com/via/). I am also not sure how to use the count module via MATSim's in-built function :)

kainagel commented 1 year ago

Even if you use VIA, you need a way to input the data from reality.

(1) In your config file, you need to specify your counts file. Something like

<module name="counts">
   <param name="inputCountsFile" value="counts.xml"/>
</module>

(2) I am relatively optimistic that cs_id means "counting station ID", i.e. some "name" that the counting station has in reality. Presumably, all of these need to be different, but apart from that do not matter. And loc_id means the link ID (I think; you need to try out).

mrieser commented 1 year ago

The counts module in MATSim is to compare against real-world data.

If you're only interested in link counts from the MATSim simulation, look at the file linkstats.txt.gz which is written by default every 10th iteration (it is thus located e.g. in output/ITERS/it.10/10.linkstats.txt.gz).

This file lists for every link the average link-volume (averaged over the last 5 iterations) for every hour in the simulation (e.g. the column HRS6-7avg contains the average link volumes for the hour from 06:00 to 07:00).

As Via was mentioned: if you load the network and events file into Via, you could query the volumes of specific links by clicking on them: https://docs.simunto.com/via/analyses/network-queries.html#link-volumes

Armanapattt commented 1 year ago

Thank you for every help, it works for me now by providing the input counts file and the output file is in the ITERS folder every 5 iteration named countscompare.txt