Skip to content

Latest commit

 

History

History
175 lines (121 loc) · 9.19 KB

simulation.md

File metadata and controls

175 lines (121 loc) · 9.19 KB

Running the Île-de-France MATSim simulation

In order to run a simulation of Île-de-France in MATSIM, you first need to obtain or generate a synthetic population. Afterwards, the pipeline provides additional stages to create and run a full MATSim scenario including a digital road and public transport network.

This guide covers the following steps:

Gathering additional data

In this section we refere to the same data directory structure as described when gathering the data for the synthetic population.

I) Road network (OpenStreetMap)

The road network in the pipeline is based on OpenStreetMap data. A cut-out for Île-de-France is available from Geofabrik:

II) Public transit schedule (GTFS)

A digital public transport schedule for Île-de-France is available from Île-de-France mobilités. Since 2023 you are required to create an account and accept the data license before making use of the data.

  • Go to Île-de-France GTFS
  • Create an account "Connexion" on top of the page
  • Once you have created a valid account, go back to the page and click "Exporter la donnée"
  • In the popup window, accept the use conditions and select "CSV" type, then click "Télécharger" to download
  • The resulting file is not the data itself, but only contains a link to them. Open the downloaded CSV and find the URL starting with https://data.iledefrance-mobilites.fr/api/v2/catalog/datasets/...
  • Enter the URL in your browser and download the file IDFM-gtfs.zip
  • Put IDFM-gtfs.zip into the folder data/gtfs_idf

Note that this schedule is updated regularly and is only valid for the next three weeks.

Overview

In your directory structure, there should now be the following additional files:

  • data/osm_idf/ile-de-france-latest.osm.pbf
  • data/gtfs_idf/IDFM-gtfs.zip

The pipeline can be used to generate a full runnable MATSim scenario and run it for a couple of iterations to test it. For that, you need to make sure that the following tools are installed on your system (you can just try to run the pipeline, it will complain if this is not the case):

  • Java needs to be installed, with a minimum version of Java 11. In case you are not sure, you can download the open AdoptJDK. Attention: There are incompatibilities with more recent version (for instance 17), so for the time being we recommend using version 11.
  • Maven >= 3.8.7 needs to be installed to build the necessary Java packages for setting up the scenario (such as pt2matsim) and running the simulation. Maven can be downloaded here if it does not already exist on your system.
  • Osmosis needs to be accessible from the command line to convert and filter to convert, filter and merge OSM data sets. Alternatively, you can set the path to the binary using the osmosis_binary option in the confiuration file. Osmosis can be downloaded here.
  • git => 2.39.2 is used to clone the repositories containing the simulation code. In case you clone the pipeline repository previously, you should be all set. However, Windows has problems with working with the long path names that result from the pipelien structure of the project. To avoid the problem, you very likely should set git into long path mode by calling git config --system core.longpaths true.
  • In recent versions of Ubuntu you may need to install the font-config package to avoid crashes of MATSim when writing images (sudo apt install fontconfig).

Then, open your config.yml and uncomment the matsim.output stage in the run section. If you call python3 -m synpp again, the pipeline will know already which stages have been running before, so it will only run additional stages that are needed to set up and test the simulation.

After running, you should find the MATSim scenario files in the output folder:

  • ile_de_france_population.xml.gz containing the agents and their daily plans.
  • ile_de_france_facilities.xml.gz containing all businesses, services, etc.
  • ile_de_france_network.xml.gz containing the road and transit network
  • ile_de_france_households.xml.gz containing additional household information
  • ile_de_france_transit_schedule.xml.gz and ile_de_france_transit_vehicles.xml.gz containing public transport data
  • ile_de_france_config.xml containing the MATSim configuration values
  • ile_de_france-1.0.6.jar containing a fully packaged version of the simulation code including MATSim and all other dependencies

If you want to run the simulation again (in the pipeline it is only run for two iterations to test that everything works), you can now call the following:

java -Xmx14G -cp ile_de_france-1.0.6.jar org.eqasim.ile_de_france.RunSimulation --config-path ile_de_france_config.xml

This will create a simulation_output folder (as defined in the ile_de_france_config.xml) where all simulation is written.

As of version 1.0.6 of the Île-de-France pipeline, simulations of a 5% population sample use calibrated values for the mode choice model. This means after running for 60 or more iterations, the correct mode shares and network speeds are achieved, compared to the EGT reference data.

For more flexibility and advanced simulations, have a look at the MATSim simulation code provided at https://github.com/eqasim-org/eqasim-java. The generated ile-de-france-*.jar from this pipeline is an automatically compiled version of this code.

Mode choice

The population files for MATSim will automatically contain randomly assigned transport modes for the trips performed by the agents. In the mode choice process of MATSim, the modes will be adjusted and chosen according to the specific travel conditions of the agents.

It is possible to perform an upfront mode choice based on freeflow travel times that assigns more realistic modes by performing a 100% mode choice on ideal traffic conditions. To do so, update the mode_choice configuration entry in the config.yml configuration file. Once the pipeline is run again, the modes will be present in the population:

config:
  mode_choice: true

Optionnaly export detailed link geometries

When creating the matsim network from the OSM data, the pt2matsim project simplifies link geometries. You can export a detailed_network.csv file containing the detailed geometries of every network link by the following in theconfig.yml file :

# ...

config:
  export_detailed_network: True

# ...

Using MATSim's emissions contrib

You can calculate air pollution emissions using matsim by using some additional data.

You must download the crit'air data from this site : https://www.statistiques.developpement-durable.gouv.fr/donnees-sur-le-parc-automobile-francais-au-1er-janvier-2021

You should download both files :

  • Données régionales des voitures particulières - 2011 à 2021 (zip, 1.79 Mo)
  • Données communales des voitures particulières - 2011 à 2021 (zip, 130.33 Mo)

Inside the zip you'll find one data file per year, you can extract the files concerning the year you're intereseted in (let's use 2015 for this exemple). Then unzip and place them in a data/vehicles_2015/.

Then, in the config.yml, you must enable the vehicle fleet generation :

# ...

config:
  generate_vehicles_file: True
  generate_vehicles_method: fleet_sample
  vehicles_data_year: 2015

# ...

You should end up, at the end of the matsim.output stage, with a vechicles.xml file.

After you run the full simulation, you'll be able to use some classes defined in eqasim-java to analyse and compute emissions based on the MATSim outputs.

for exemple :

java -cp ile_de_france-1.0.6.jar org.eqasim.ile_de_france.emissions.RunComputeEmissionsEvents --config-path config.xml --hbefa-cold-avg ./EFA_ColdStart_Vehcat_2015_Cold_Average.csv --hbefa-hot-avg ./EFA_HOT_Vehcat_2015_Hot_Average.csv --hbefa-cold-detailed ./EFA_ColdStart_Subsegm_2015_Cold_Detailed.csv --hbefa-hot-detailed ./EFA_HOT_Subsegm_2015_Hot_Detailed.csv
java -cp ile_de_france-1.0.6.jar org.eqasim.ile_de_france.emissions.RunExportEmissionsNetwork --config-path config.xml --time-bin-size 3600
java -cp ile_de_france-1.0.6.jar org.eqasim.ile_de_france.emissions.RunComputeEmissionsGrid --config-path config.xml --domain-shp-path idf_2154.shp

Please note that you need a copy of the HBEFA database in order to run those.

For further information you can look at eqasim-java and matsim-libs/contribs/emissions