Tutorial on Using SUMO, OMNeT++, and Veins for Traffic Simulation

2 minute read

Published:

One of the challenging aspects of this project is the installation of OMNeT++ and SUMO.

SUMO

Since Veins requires a relatively old version of SUMO, we cannot directly use sudo apt-get install sumo to install it. I have checked this YouTube video for the installation of various SUMO versions.

Specifically, the installation for SUMO (Ubuntu System) has the following steps:

  1. Download SUMO from this link. For example, I used sumo-src-0.32.0.tar.gz.
  2. Extract the SUMO installation file.
  3. Change directory to the extracted folder.
  4. In the command line, type:

     sudo apt install build-essential autoconf automake libxmu-dev libfox-1.6-dev libproj-dev libxerces-c-dev libxerces-c3.2 libgdal-dev default-jdk 
        
     ./configure
        
     make
        
     sudo make install
    

Now you can test whether you have installed SUMO successfully by typing sumo-gui in the command line.

Moreover, remember to add SUMO to your PATH by executing the following commands in the terminal:

gedit ~/.bashrc

Then, add the following line to the end of the file:

export SUMO_HOME="/Yourpath/sumo-0.32.0"

DO NOT change any other lines in this file!

Finally, reboot your system or type:

source ~/.bashrc

How to Create a Simulation Map and Generate Vehicles

  1. Download an OSM file of the selected area from openstreetmap.org.
  2. Open your terminal.
  3. Convert the OSM file to a SUMO network file using the following command:

     netconvert --osm-files XXX.osm -o XXX.net.xml --junctions.join --tls.guess-signals --tls.discard-simple --tls.join
    
  4. Import polygons from OSM data and produce a SUMO polygon file using this command:

     polyconvert --net-file XXX.net.xml --osm-files XXX.osm --type-file typemap.xml -o XXX.poly.xml
    
  5. Generate vehicle traffic demand using the following command. The randomTrips.py script can be found in the sumo/tools directory:

     python XXX/sumo/tools/randomTrips.py --n XXX.net.xml -r cars.rou.xml -t "type=\"car\" departSpeed=\"max\" departLane=\"best\"" --additional-files car.add.xml -p 1.4 -e 1000 -l
    

OMNeT++

Although there are many videos and blogs about the installation of OMNeT++, I strongly suggest you take a look at the official manual of OMNeT++. It will make your life much easier.

VEINS

The installation of Veins is quite simple; just download it from its official site.

Build Connection

After you have installed SUMO, OMNeT++, and Veins, you can try running the example provided by Veins. Take a look at this YouTube video; it is really helpful.

Try Your Project

Another exciting opportunity is to build a network for your own project. The process is quite simple. Please check this YouTube video.

By the way, all the information I provided here is based on the efforts of others. I have summarized them based on my understanding.