SUMO and MOVE Example Traffic Simulation

This post will show you the example of SUMO and MOVE using the Ubuntu 12.04 (64bit) operating system.

  • MOVE.jar (This software will work only with sumo version 0.12.3).
  • SUMO (0.12.3)  
  • jdk (To run MOVE)
The command to run MOVE.jar is
$] java -jar MOVE.jar

Here is the screenshot of all the images.
My Own Road with Traffic Signals

 The above diagram shows there are 6 junctions (0 to 5) and the Traffic signals are at 1,2,4 and 5. There are roads connecting the junctions. Each Road has two lanes named R for Right, L for Left, U for Up and D for down.
R12 indicates a lane from 1 to 2 and L12 indicates 2 to 1

To create simulation using MOVE, The following options in MOVE.jar have to be implemented. 
  •  Mobility Model
    • Node (file.nod.xml)
    • Edge (file.edge.xml)
    • Configuration (file.netc.cfg)
    • Create Map (
    • Flow (file.flow.xml)
    • Turn (file.turn.xml)
    • Create Vehicle (file.rou.xml)
    • Configuration (file.sumo.cfg) - This file is the one running in sumo-gui
    • Visualization ( - This file will be helpful in creating the tcl file for ns2.
    • Run Simulation (no of vehicles emitted and running with simulation time will be shown)
  •  Traffic Model
    • Static Mobility (this creates file.nam,, file.tcl) that can be running using ns2.
First screen of MOVE

After Selecting Mobility Model from the above Image



SUMO Configuration

Generate Map



Sumo configuration file generation

SUMO Demo for the Road designed in Fig 1

Sumo Demo in Zoom Out

 To create tcl file for ns2
To Create Tcl file for ns2

nam file demo

nam file demo
All the above images shows that the move and sumo is helpful in creating a traffic simulation that transmit packets between the vehicles. Here each node in nam represents the vehicle and they transmit packets between them.
The packet delivery ratio, throughput, bit error rate, loss rate, end to end delay can be calculated based on the tracefile generation.

The same project can be extended as following
  • A car act as a malicious node and can be analysed for the packet loss before and after malicious activity
  • Instead our own design of junctions and roads, real roads may be taken using openstreetmap and some of the above procedures may be carried out. 
If any user needs the source code for any of these applications, they can contact me through my email or comment in the following section. 

 T S Pradeep Kumar

Simulation of Urban Mobility (SUMO) in Ubuntu 12.04

This post will tell you how to install SUMO 0.12.3 version in Ubuntu 12.04 LTS. Also this post will tell you how to use MOVE for generating VANETs Simulation scenario.

OS Used: Ubuntu 12.04 LTS (64 bit)
Sumo Version : 0.12.3
MOVE.jar (For this to work, Java runtime environment to be installed)
(Also MOVE.jar will support only SUMO 0.12.3). The latest version of SUMO (at the time of writing this post) is sumo 0.21.

Points to be noted:

  • Its always better to use the latest software, but to begin with SUMO needs XMl files are roads, edges, vehicle routes, etc. So MOVE.jar file is just helping in creating the xml files needed by SUMO. But the recent versions of SUMO (0.21) and etc, the XML files are to be generated manually by means of any external xml editors or simply using gedit or vim.
  • Also, the Ubuntu package manager comes default with sumo and sumo-gui command (that can be installed using the command sudo apt-get install sumo , but the python scripts like, etc may not work for creating the routes, vehicles, etc. So compiling from the source is the best option for  installing SUMO in Ubuntu.
Steps to install sumo-0.12.3 in Ubuntu 12.04
2. Download MOVE.jar from this location:
2. Execute the following commands one by one 
$] sudo apt-get update
$] sudo apt-get install build-essential autoconf automake libxmu-dev default-jre g++-4.4 libproj-dev libgdal-dev libxerces-c2-dev libfox-1.6-dev
$] export CC=gcc-4.4 CXX=g++-4.4 
$] ./configure
$] make
$] sudo make install
See the screenshot below for successful installation of sumo and sumo-gui. Now you can create the simulations using MOVE and SUMO. 

Installation of MOVE
MOVE is a software that runs using java run time and helpful in creating the xml files for SUMO. This can be running using the command 
$] java -jar MOVE.jar
Here is the screenshot of all the three windows for MOVE.
Thats all about the MOVE installation. My next post will be about the creation of xml files using MOVE and to generate traffic files for NS2.

Please pour in your comments for SUMO or MOVE installation. I have created a Virtual image OS for running the SUMO, MOVE and NS2 (if anybody wants the Virtual Image separately, contact me through the comment section or through google plus. I may send you the DVD by Courier after paying the nominal charges)

T S Pradeep Kumar

Prerequisites for learning NS2

At many places, I happen to see researchers and students wanted to use Windows for NS2 rather than Linux. The reason may be,
  • Linux is tough
  • It occupies more space and more memory in my Computer
  • Linux uses lot of commands and i am not aware of it
  • Tough to handle dual boot OS (windows and Linux)
  • always wanted to be in the cakewalk. (never try a new thing)
  • etc
ns2 installation in Linux

But here are some basic tips for using NS2 under a Linux Machine.
  • It is enough to know some basic Linux commands to work with NS2 (hardly not more than 20 commands)
  • One should have a basic knowledge of how tree structure in Linux/Unix look like
  • Finally, where to set the PATH information in Linux
With all the above three, one can confidentially work on Linux. As for as windows is concerned, upto NS2.27 version is tested under windows and recent versions there is no hope (however it will work fine, but “Use at your Own Risk”)
Now we will see some basic Linux commands that are needed for NS2.
  1. ls => listing the file contents
  2. ls -l => listing the file in long format, it tells you about the ownership and permissions
  3. chmod => Changing the mode of the file (syntax is chmod 755 <filename>
  4. echo => it echo the value to the screen
    1. Example: echo name
    2. echo $SHELL (it will print the name of the shell)
    3. echo $USER (it will print the name of the user)
    4. echo $PATH (it display the values contained in the PATH variable)
    5. echo $HOME (it displays the home folder of the user) (Now you can understood that the variable names are denoted using a $ symbol)
  5. pwd => it is just present working directory
  6. make => (it executes the instructions given in the Makefile which is available under that directory)
  7. gcc filename.cxx => A command to run the gcc compiler (This is not necessarily needed for NS2, but as a developer, you should know)
  8. ./install  => (See a dot in the beginning, it is just executing the install file which is available under a folder, any executable can be executed with the help of this ./)
  9. passwd => changing the password of the current user
  10. cd => change the directory
  11. mkdir => make a directory
  12. gedit => it is similar like a notepad editor in windows(syntax is gedit filename)
  13. vi => it is vi editor
Path setting
The path can be set in a file which is available for each user of the Linux OS.  For example, a user called  “pradeep” will have the home folder as /home/pradeep and another user “kumar” has home folder as /home/kumar
Each user “pradeep” and “kumar” will have a file called .bash_profile (in case of redhat and fedora) and .bashrc (Ubuntu, etc) in their home folder. This file is a hidden file which can be opened using a vi or gedit editor
The command being
vi /home/pradeep/.bash_profile
vi /home/pradeep/.bashrc

gedit /home/pradeep/.bash_profile
gedit /home/pradeep/.bashrc
Similarly the same for user “kumar” (if you set the path for “pradeep” and running under “kumar”, it will not work, for that to work, there is a separate customisation is available), for beginners, these steps are enough.
T S Pradeep Kumar

Contiki OS - An Operating System and Framework for IOT (Internet Of Things)

This article is published in the "Open Source For you" magazine in India in this month September 2014. This article is under the creative commons license. For any queries related to this software, please input your queries through the comment section of this page.

Introduction to Contiki OS
Contiki is an open source operating system for connecting the tiny low cost microcontrollers, sensors to the internet. Contiki is preferred because it supports the various internet standards, rapid development, selection of hardware, active community to help and commercial support altogether with a open source license. 

Contiki is designed for tiny devices and thus the memory footprint is very less when compared with other systems, it supports the Full TCP with IPv6, it handles power awareness where in the device power management is handled by the OS, all the modules of Contiki is loaded and unloaded during the run time,  it implements protothreads, uses a light weight file system, various hardware platforms with sleepy routers (to make the routers sleep between message relays). 

One of the important feature of contiki is the use of Cooja Simulator to emulate if any of the hardware devices is not available.

Installation of Contiki
Contiki can be downloaded as “Instant Contiki”. Instant Contiki is available in a single download that contains an entire Contiki development environment. It is an Ubuntu Linux virtual machine that runs in VMWare player and has Contiki and all the development tools, compilers, and simulators used in Contiki development installed. Most of the users prefer instant Contiki over the Source code binaries. 

The current version of Contiki (at the time of writing this post) is 2.7.  
Step 1: Install VMWare Player (which is free for academic and personal use)
Step 2: Download the Instant Contiki virtual image of size 2.5GB approximately ( and unzip it.
Step 3: Open the Virtual Machine  and open the Contiki OS and wait till the login screen appears
Step 4: Input the password as “user” and the shows the desktop of Ubuntu(Contiki)

Running the simulation
To run with a simulation, contiki comes with many prebuilt modules that can be readily run on the Cooja simulator or on the real ha7rdware platform.  There are two methods of opening the cooja simuator window.
Contiki OS Desktop
Method 1: 
In the desktop as shown in Figure 1 – Desktop of Contiki, double click the Cooja icon and it will compile the binaries for the first time and opens the Simulation windows
Method 2: 
Open the Terminal
Go the Cooja directory 
pradeep@localhost$] cd contiki/tools/cooja 

Figure 2: Cooja Compilation

You can see the simulation window as shown in Figure 2.

Creating a new Simulation
To create a simulation in Contiki, from the File menu New Simulation and name it as shown in Figure 3.
Figure 3 – New Simulation

Select any one radio medium (in this case) -> Unit Disk Graph Medium (UDGM): Distance Loss and Click Create
The following screen shows the Simulation window (Figure 4). The simulation window has the following windows
  • Network Window – Shows all the motes in the simulated network
  • Timeline Window – shows all the events over the time
  • Mote Output Window – all serial port outputs will be shown here
  • Notes Window – User notes information can be put here
  • Simulation Control Window – Start, stop and pause the simulation 
Figure 4 – Simulation Window

Adding the Sensor Motes
Once the simulation window is opened, motes can be added to the simulation using the Menu Motes-> Add Motes. Since we add the motes for the first time, the type of the motes have to be specified. There are more than 10 types of motes are supported in contiki
Here are some of them.
  • MicaZ 
  • Sky
  • Trxeb1120
  • Trxeb2520
  • cc430
  • ESB
  • eth11
  • Exp2420
  • Exp1101
  • Exp1120
  • WisMote
  • Z1
Contiki will generate object codes for these motes to run on the real hardware and also to run on the simulator if the hardware platform is not available.
Step 1: 
To add a Mote-> Add Motes Select any of the motes given above MicaZ mote.
You will get a screen like this Figure 6. 
Step 2: 
Cooja opens the Create Mote Type dialog, in which the name of the mote type as well as the Contiki application that the mote type will run. 
For this example click the button on the right hand side to choose the Contiki application and select /home/user/contiki/examples/hello-world/hello-world.c and click Compile.  
Step 3: 
Once compiled without errors, click “Create”.  This is shown in the Figure 6.

Figure 6 – Mote Creation and Compile Contiki

Step 4: Now the screen asks to enter the number of motes to be created and its position (random or ellipse, linear or manual position)
In this example, 10 motes are created and click the “start” button in the Simulation Control window and enable the mote's “Log Output: printf()'s” statements in the view menu of the Network window. The network window shows the output Hello World in the sensors. Figure 7 is represented by this

Figure 7 – Log Output in Motes 
This is a simple output of the Network window where it shows the “Hello World” application. If the real MicaZ motes are connected and are written the object to the motes, the Hello World will be displayed in the LCD Panel of the Sensor Motes.  The overall output is shown in Figure 8

Figure 8 – Simulation window of Contiki

Also the output of the above hello world application can be run using the terminal also 
To compile and test the program, go into the hello-world directory:

pradeep@localhost $]  cd /home/user/contiki/examples/hello-world

This will compile the hello-world program in the 'native' target.  This causes the entire Contiki operating system and the hello-world application to be compiled into a single program that can be run by typing the following command (This is depicted in Figure 9)
Figure 9 - Compilation using Terminal
pradeep@localhost $] ./hello-world.native

This will print out the following text:
Contiki initiated, now starting process scheduling
Hello, world

The program will then appear to hang, and must be stopped by pressing the C key
while holding down the Control key.

Developing new modules
Contiki comes with numerous prebuilt modules like IPv6, IPV6 udp, hello world, sensor nets, EEPROM, IRC, Ping, Ping-IPv6, etc. These modules can run with all the sensors irrespective of their make. Also there are modules that runs only on specific sensors. For example, energy of a sky mote can be used only on Sky Motes, they give errors if running with other motes like Z1 or MicaZ. 

Developers can build new modules for various sensor motes that can be used with various sensor BSPs using the conventional C programming and can be deployed in the corresponding sensors. 

Here is the C source code for above hello-world application.
#include "contiki.h"
#include <stdio.h> /* For printf() */
PROCESS(hello_world_process, "Hello world process");
PROCESS_THREAD(hello_world_process, ev, data)
  printf("Hello, world\n");

Conclusion: Internet of Things is an emerging technology that leads to Smart City, Smart home, etc applications. Over these years, implementing IOT was really a challenge and now there is one such OS contiki is available to start with.  Contiki can be very useful for deploying applications like automatic lighting system in buildings, Smart refrigerators, Wearble computing systems, domestic power management for homes, offices, etc. 


T S Pradeep Kumar