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.
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 be compiled using
javac -cp sumo/bin/TraaS.jar ExampleName.java
after compiling they can be run using
java -cp .: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#
JavaDoc for TraaS can be found at https://sumo.dlr.de/javadoc/traas/
The file <SUMO_HOME>/bin/TraaS.jar is included in every SUMO release. To build TraaS locally, Apache Maven is required. To build, simply call mvn package within the traas folder or call make traas when you have a configured cmake build.