Trace File Generation

Introduction#

This tutorial describes how to generate vehicular trace files. Besides SUMO, the Tools/TraceExporter will be used. It requires Python to be executed and currently allows to generate trace files for ns2/ns3, Shawn, OMNET, and PHEM.

Simulation Scenario#

For generating vehicular traces, you need a simulation scenario, consisting at least of a road network and routes. You may visit Tutorials/Hello SUMO, Tutorials/quick start or Tutorials/Quick Start old style to learn how to get a scenario.

Generating a SUMO-trace#

We assume that you have the scenario and a configuration file named "myConfig.sumocfg". It may have a different name, of course. You should be able to start SUMO using your configuration like this:

sumo -c myConfig.sumocfg

Now, we use the simulation to get an fcd output, a trace file in a SUMO-format. This file will be later converted into a trace file for one of the applications supported by Tools/TraceExporter. We generate an fcd output as follows:

sumo -c myConfig.sumocfg --fcd-output sumoTrace.xml

Through this method, we obtain the file "sumoTrace.xml".

Converting the Trace#

We can now convert the vehicular traces in SUMO format into another format. For now, let's assume you would like to have a ns2 mobility file. We can generate one from the obtained fcd output using:

traceExporter.py --fcd-input sumoTrace.xml --ns2mobility-output ns2mobility.tcl

We obtain the file "ns2mobility.tcl", which we can give ns2 as input.

Further Possibilities#

Output Options#

Tools/TraceExporter generates files for ns2/ns3, OMNET, Shawn, and PHEM. Please visit the Tools/TraceExporter manual page for further information about how to generate these files. Look for "output options".

Different Penetration Rates#

Tools/TraceExporter allows to define different equipment / penetration rates using the --penetration <FLOAT>. <FLOAT> will be the amount of vehicles that are exported, where 1 is equal to 100 %. This means, if You want to have 10 % of vehicles to show up in Your ns2-trace, use:

traceExporter.py --penetration 0.1 \
 --fcd-input sumoTrace.xml --ns2-mobilityoutput ns2mobility.tcl

The --seed <FLOAT> allows you to give different random number initialisations for choosing the vehicles to export.

Limiting the Time#

You may limit the time steps to export using the options --begin <TIME> and --end <TIME>. All time steps before --begin and all after --end will be dismissed.

Additionally, You may force Tools/TraceExporter to convert only every nth time step using the option --delta <TIME>. Please note that the value should be a multiple of the time step length used within the simulation.

Further Information#