__pycache__ | ||
input_files | ||
output_files | ||
.gitignore | ||
main.py | ||
matsim_engine.py | ||
matsim_visualizer.py | ||
matsim-network-from-osm.jar | ||
matsim.jar | ||
matsim.py | ||
README.md | ||
requirements.txt | ||
traffic_animation.gif |
MATSim Runner Script
Requirements
- JDK 17
- Python 3
Goal
Estimate city pollution coming from people driving in vehicles.
Setup
Make sure to have JDK 17 installed and clone this repository.
Usage
The file main.py
is essentially a replica from MEB workflow. It constructs a city and then allows the user to apply characteristics to that given city.
The difference is in the implementation of MatSimEngine. This engine should create the following files:
- facilities.xml
- network.xml
- population.xml
- config.xml
Facilities and network are quite simple as the facilities file can be built from our city object and the network file can be built using a matsim utility along with OpenStreetMaps data. The population file must be generated via other ways and the config file can be generated once the first 3 files are created.
Additionally, it may be interesting to include public transport in the simulation. This is a potentially simple task. Montreal offers the GTFS files for its public transport for free and the project PT2MATSim allows you to create the MatSim xml files from the initial GTFS files.
Visualization
Given we want to be able to visualize the results similar to the way the Munich scenario did it: https://www.matsim.org/gallery/munich.
The repository also has the code to visualize these results. It's a very basic implementation, but it basically uses matplotlib and nx to plot the network and how much traffic exists on a given link at a given time.