From Sumo
Revision as of 12:23, 1 May 2019 by Behrisch (talk | contribs)
Jump to navigation Jump to search


TraaS is a java library for working with TraCI. The name TraaS stands for TraCI as a Service. It was developed by Mario Krumnow and uses code from the now discontinued TraCI4J project by Enrico Gueli. Since version 1.0, TraaS is maintained within the SUMO repository at <SUMO_HOME>/tools/contributed/traas.

TraaS provides three things which are explained below.

  • A java traci client that can be used to write TraCI scripts directly
  • A web service that can be used to connect multiple webservice clients to a running TraCI instance in a language-agnostic way.
  • A web service client

In constrast to the native TraCI multi-client support, TraaS does not require the number of clients to be known beforehand. It also cannot impose any ordering on client command execution which leaves client synchronization to be managed on the user side.

Java Client

The client provides functions using with the same name and signature as the python client. A major difference is, that the method return values must be casted in the calling code:

 double timeSeconds = (double)conn.do_job_get(Simulation.getTime());


The examples must becomplied using

 javac -cp sumo/tools/contributed/traas/examples/java_library:sumo/bin/TraaS.jar

after compiling they can be run using

 java -cp sumo/tools/contributed/traas/examples/java_library:sumo/bin/TraaS.jar ExampleName

Insert Vehicles and Access Induction Loop Data


Connect Multiple clients


Subscribe to Variables


Generate screenshots during simulation runtime

Change the TLS-program

Get CO2 Emissions


Webservice Client


JavaDoc for TraaS can be found at

Building TraaS

The file <SUMO_HOME> /bin/TraaS.jar is inclued in every SUMO release. To build TraaS locally, ant is required. To build, simply call ant within the traas folder:

 sumo/tools/contributed/traas$ ant