From 30.000 feet
traceExporter.py converts and filters SUMO fcd output to different "trace file" formats: OMNET, Shawn, ns2/ns3, PHEM.
- Purpose: trace file conversion/generation
- System: portable (Linux/Windows is tested); runs on command line
- Input (mandatory): SUMO fcd-output
- Output: One or more "trace file(s)" and other complementary files
- Programming Language: Python
Different applications read "vehicular traces", files containing mainly positions of vehicles over time. traceExporter.py generates such files by converting SUMO's fcd output into several supported formats. Following files can be generated, sorted by application:
- OMNET: mobility-traces (.xml)
- Shawn: snapshot-files (.xml)
- ns2/ns3: trace-files, activity-files, and mobility-files (all *.tcl)
- PHEM: .dri-files, .str-files, .fzp-files, .flt-files
- GPSDAT csv traces (id,date,x,y,status,speedKMH)
- POIs (can visualize GPS distortions and sampling in SUMO-GUI)
- fcd output to restrict the file to certain regions or time intervals
traceExporter.py comes with SUMO and is located in <SUMO_HOME>/tools/. Python must be installed.
You convert a given fcd output into a format using a command like this:
traceExporter.py --fcd-input myFCDoutput.xml --omnet-output myOMNETfile.xml
In the case given above, a file for OMNET will be built.
In the following, the command line options are described.
traceExporter.py often needs only the fcd output as input. In some cases, the network used while obtaining the fcd output must be given. traceExporter.py gives an error message if the wanted output needs additional files, such as the network, but no such file is specified. The options for defining the input files are:
|The fcd-output - file to convert (numeric value is interpreted as port to listen on)|
|The network file used; Mainly used for exporting the network|
All outputs which need to read the input only once support reading from a socket. To do so just give a number as file name and the script will open a port to listen on. Afterwards you can start sumo with the corresponding port as output, e.g. traceExporter.py --fcd-input 43214 ... needs to be followed by sumo --fcd-output localhost:43214. This should work at least with OMNET, Shawn, GPSDAT, GPX, POIs and fcd filtering.
In the following, the output options of traceExporter.py are given, divided by the application,
|--dri-output <FILE>||Generates a PHEM .dri-file named <FILE>|
|--str-output <FILE>||Generates a PHEM .str-file named <FILE>; note that the SUMO network used during the simulation must be given using the --net-input option|
|--fzp-output <FILE>||Generates a PHEM .fzp-file named <FILE>|
|--flt-output <FILE>||Generates a PHEM .flt-file named <FILE>|
|--omnet-output <FILE>||Generates a OMNET mobility trace named <FILE>|
|--shawn-output <FILE>||Generates a Shawn snaphot file named <FILE>|
|--ns2config-output <FILE>||Generates a ns2 configuration file named <FILE>|
|--ns2activity-output <FILE>||Generates a ns2 activity file named <FILE>|
|--ns2mobility-output <FILE>||Generates a ns2 mobility file named <FILE>|
|--gpsdat-output <FILE>||Generates a GPSDAT file named <FILE>|
|--gpx-output <FILE>||Generates a GPX file named <FILE>|
|--poi-output <FILE>||Generates a SUMO PoI file named <FILE>|
|--fcd-filter <FILE>||Reads filter settings from <FILE>|
|--fcd-filter-comment <STRING>||Extra comments to include in fcd file|
|--fcd-filter-type <STRING>||Modify the vehicle type of all written vehicles to <STRING>|
The filter file is a simple csv format giving begin;end;bounding_box;outfile where the bounding box is x1,y1,x2,y2 defining the lower left and the upper right corner of the area to extract. The coordinate format needs to fit the input format (so if the input has geo coordinates the bounding box needs to have geo coordinates as well). It is currently not possible to give the same output file for different filter lines.
Example filter file:
Several options allow to fine-tune the processing.
|--persons <BOOL>||Whether persons should be included in the trace; default: False|
|--penetration <FLOAT>||A float between 0 and 1, defining the probability of a vehicle to be included in the output; default: 1|
|--gps-blur <FLOAT>||A float defining a random offset applied on the vehicle positions before exporting them; default: 0|
|--boundary <FLOAT>,<FLOAT>,<FLOAT>,<FLOAT>||Defines the bounding box as 'xmin,ymin,xmax,ymax'|
|Defines the time sampling, if given; only every <TIME> time step will be exported.|
|Time steps before <TIME> are not exported.|
|Time steps after <TIME> are not exported. Please note that some issues are known, here.|
|The randomizer seed to use.|
|The base date in seconds since the epoch (1970-01-01 00:00:00), the default is the current local time.|
|Shows a help screen.|