Skip to content
egueli edited this page Apr 16, 2013 · 3 revisions

Improving Simulation Speed with Multi-Queries

When dealing with a large-scale simulation, with hundreds or even thousands of vehicles and/or roads, it's important to take care of performance.

SUMO by itself is quite scalable, but when it is controlled via TraCI, the overhead associated to message exchange can cause a performance bottleneck, especially if each [http://sumo.sourceforge.net/doc/current/docs/userdoc/TraCI/Protocol.html#Messages](TraCI message) contains only one command. TraCI4J provides a way to group together a batch of commands, send them as a single message and get a single reply message with all the responses.

Here's how to do:

  1. call SumoTraciConnection.makeMultiQuery() to get a MultiQuery instance;
  2. add all the queries (e.g. Vehicle.queryReadPMXEmission()) to the MultiQuery, keeping a reference in your code;
  3. call MultiQuery.run(), which will make the network request to SUMO;
  4. in the referenced queries, call their get() method to retrieve the requested data.

TraCITest shows an example of MultiQuery usage.

Clone this wiki locally