-
Notifications
You must be signed in to change notification settings - Fork 179
faq 173768705
by Stephan Lehmler on 2018-02-12 10:42:05
Hello,
I already asked a question regarding some errors I encountered while trying to run a simulation of public transport. I got very helpful tips but in the end couldn't solve my problem.
That's why I thought, it might be useful to have a dedicated more general question on this topic.
In the documentation and miscellaneous publications, I can find many examples where people successfully run the pt-module of Matsim. What currently seems to be missing are some reproducible examples on how to create the necessary files (vehicles.xml and schedule.xml).
Are there currently any examples that I just overlooked? How do users in general create these inputs? Does someone here has experience in this field?
Thank you in advance & kind regards
by Marcel Rieser on 2018-02-12 15:00:13
Hi Stephan
In the end, it depends on what data you have available. Without knowing that, I can only give you generic advice:
A short tutorial, explaining the data formats and simple examples: https://matsim.atlassian.net/wiki/spaces/MATPUB/pages/83099693/Transit+Tutorial
If you have your schedule data prepared, try the validator first to see if there might be some problems with the (converted?) data: https://matsim.atlassian.net/wiki/spaces/MATPUB/pages/83099698/Transit+Schedule+Validation
Now, how to generate the data? It depends on the data you have:
If you have GTFS data, have a look at GTFS2MATSim, which allows you to convert GTFS-data to the MATSim formats.
An alternative is pt2MATSim, which claims to support GTFS and HAFAS data and converts it to the MATSim data formats. In addition, it allows to match bus-routes to a road-network based on OpenStreetMap data.
A few years ago, I wrote a simple converter to convert the schedule data from VISUM to the MATSim format. The corresponding code is still around some, but I don't know if it still works with the latest VISUM versions. If you're interested in this, let me know and I can have a closer look.
I've heard of people using/writing web-crawlers to collect schedule data from public websites like, and then convert it to the MATSim formats.
Some converters do not produce the vehicles.xml file, or do not add links to stops or specify a route for the lines. This is mostly due to the original data source not containing the necessary information. PT2MATSim (see above) tries to fix this by matching stops and lines to data extracted from OpenStreetMap.
An alternative, to get started, is the class org.matsim.pt.utils.CreatePseudoNetwork
. This creates a network connecting the stops along the lines, and assigning the lines/routes the corresponding links. Transit vehicles (e.g. buses) will not interact with regular car-traffic, as they use their own links. Also, in visualization, it does not look very nice, as stops are just connected with straight links, across city blocks, lakes or whatever there is in-between. But for the simulation itself, it should work.
The resulting network can then be merged with the car-network to receive one single network suitable for simulation.
There is also org.matsim.pt.utils.CreateVehiclesForSchedule
which creates a vehicles.xml
file for a given transit schedule. Naturally, such a file does not contain the correct vehicle capacities, but just contains generic large values (so, every bus likely has the capacity of a train). But it is a start and allows to run the simulation. More detailed data can be provided later if such data is available.
You are viewing an archive of the previous MATSim Q&A site. The real site is now at https://matsim.org/faq