Link Search Menu Expand Document

Integrating Tramola

In many cases, a custom MATSim version is required which also includes contribs and additional functionality. In these cases, additional code must be integrated to communicate with Tramola and to provide up-to-date data during a run to Tramola.

Required Dependency

The MATSim-Integrations project provides all the necessary code and examples to integrate Tramola in MATSim.

To use it, add the following Maven repository and dependency to your pom.xml:

<repositories>
  <repository>
    <id>tramola-integrations-gitlab</id>
    <url>https://gitlab.com/api/v4/groups/2317058/-/packages/maven</url>
  </repository>
</repositories>

<dependencies>
  <dependency>
    <groupId>com.simunto.tramola</groupId>
    <artifactId>tramola-matsim15</artifactId>
    <version>23.2.0</version>
  </dependency>
</dependencies>

Try to use the latest version listed in the code repository.

Integrating into your MATSim code

For the integration of Tramola functionality into MATSim, create and initialize a TramolaMatsimIntegration object and add it as a module to the controler, as shown in the code example below. The essential lines are marked with a * at the beginning of the lines.

public class Run { 
  public static void main(String[] args) {
    String configFilename = args[0];
    Config config = ConfigUtils.loadConfig(configFilename);
    
*   TramolaMatsimIntegration tramola = new TramolaMatsimIntegration(config);
*   tramola.init();
    
    Scenario scenario = ScenarioUtils.loadScenario(config);
    Controler controler = new Controler(scenario);
    
*   controler.addOverridingModule(tramola);

    controler.run(); 
  }
}

Adapt your config.xml

If you start a run through Tramola, an additional config-group will be added automatically to your config.xml. If you plan to start your MATSim simulation yourself without the help of Tramola, add the following config-group to your config.xml to provide the necessary data for the integration to work:

<module name="tramola" >
  <param name="url" value="https://tramola.io" /> <!-- replace with your own URL -->
  <param name="apiKey" value="ABCD-EFGH-IJKL-MNOP" /> <!-- replace with your own API Key -->
</module>