OpenStreetMap, SUMO and NS3

OpenStreetMap and SUMO

This section gives a functional example of the integration between OpenStreetMap, SUMO and NS3.

Form the web: https://www.youtube.com/watch?v=Mh4WnY4KY4Y.

  1. Download the OSM files of the area of interest from openstreetmap.org
  2. Convert the OSM normal files to the new modified OSM files (with elevation) (using osmosis tool) with additional srtm plugin osmosis --read-xml map.osm --write-srtm tagName=ele --write-xml Munich.osm
  3. Generate the network file using the netconvert netconvert --osm-file Munich.net.xml --osm-files Munich.osm --type-file typemap.xml -o Munich.poly.xml
  4. Imports polygons from OSM-data and produces a Sumo-polygon file polyconvert --net-file Munich.net.xml --osm-files Munich.osm --type-file typemap.xml -o Munich.poly.xml
  5. Generate de vehicular traffic demand python sumo/tools/randomTrips.py --n Munich.net.xml -r cars.rou.xml -t "type=\"car\" departSpeed=\"max\" departLine=\"best\"" -c passenger --additional-files car.add.xml -p 1.4 -e 1000 -l
  6. Generate de pedestrian traffic demand python sumo/tools/randomTrips.py --n Munich.net.xml -r peds.rou.xml -t"type=\"ped\" -c pedestrian --pedestrians --additional-files ped.add.xml --max-dist 800 -p 1.4 -e 1000 -l
  7. Run the sumo-gui and load the configuration file sumo-gui -c Munich.sumo.cfg

Notes

  • In randomTrips.py, -e option specifies the end time of the simulation. -p option specifies departure period. As a result, their mix generate ceil(-e/-p) trips.
  • Note that if the network is fully connected then all of these trips are valid so this is the number of vehicles you will see (not all at the same time, however). But if the network is not fully connected, some generated random trips will be invalid, so ceil(-e/-p) wil not be true.

SUMO and NS3

To run a sumo simulation and convert the output to ns2 trace files, follow this tutorial. You will basically need to use the tool traceExporter.py to export sumo output to an ns2 trace file.

Locate the file $NS_DIR/src/mobility/examples/ns2-mobility-trace.cc and run it specifying as parameters:

  • --traceFile the file generated by SUMO and converted to ns2 trace file
  • --nodeNum the total number of nodes
  • --duration the number of seconds that the simulation lasts
  • --logFile the name of a log file

results matching ""

    No results matching ""