NetAnim for NS3, Graphical simulation animation and statistics for NS3 simulation

Dear Fellow,
         This tutorial is to help you configure and run NetAnim with NS3. I hope you have already installed NS3 in ubuntu. If not refer my previous post for NS3 installation.
To configure go in netanim directory. This directory you can find in NS3 folder.

Prerequisites

  1. mercurial
  2. QT4 development packages (recommended version 4.7)

Debian/Ubuntu Linux distribution:

  1. apt-get install mercurial
  2. apt-get install qt4-dev-tools


root@hassan-virtual-machine:~/workspace/ns-allinone-3.21/netanim-3.105#

after that use these commands:

make clean
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)
make

after these commands netanim will be configure. NetAnim can be used to read *.xml files generated by your code. Lets assume we are using /example/tutorial/third.cc file. add following lines of code in this file. (its better to copy this file first in scratch folder)

For adding ns3 to your program, do the following
1. Add the header file

#include "ns3/netanim-module.h"

2. Add the following statement before Simulation::Run()

AnimationInterface anim ("animation.xml"); 
anim.SetMobilityPollInterval(Seconds(0.25));
anim.EnablePacketMetadata(true);



References: http://www.nsnam.org/wiki/NetAnim

by using these lines a new file will be created named as animation.xml
now go in

root@hassan-virtual-machine:~/workspace/ns-allinone-3.21/# 

and type

root@hassan-virtual-machine:~/workspace/ns-allinone-3.21/# ./netanim-3.105/NetAnim

This will open graphical interface of NetAnim, use open file and open animation.xml
By play button you can easily play the simulation.

Note: There is different interface that you can encounter. Using above method you will get full interface.
In above picture you can see 3 tabs.
But if you open netanim from dashboard you will get minimal view.
. (This is due to root permissions :) )


Thats all for now.
GOOD LUCK.. 

7 comments:

  1. I am getting that minimal view even though I run netanim as root user.

    ReplyDelete
    Replies
    1. Do This:
      1- sudo su
      2- gnome-open ~ (if this command says to install any package, then install it.)
      It should open a windows explorer (With root access)
      in There look for NetAnim and run it from there.
      Try It Out.

      Delete
    2. Nothing opens It says : (nautilus:15699) unique DBus Warning ** unable to connect to the running instance

      Delete
    3. When I launch NetAnim I got the following error on terminal:

      QGtkStyle was unable to detect the current GTK+ theme.
      Qt: Session management error: None of the authentication protocols specified are supported

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. hello ,
    i have installed netanim as given above .netanim exe also generated but when i run a program i get error
    /home/ubantu/ns-allinone-3.25/ns-3.25/build/../examples/tutorial/first.cc:68: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'

    Please help

    ReplyDelete
    Replies
    1. I think You are required to include its header file at the top.

      #include "ns3/netanim-module.h"

      Try that...

      Delete

Connecting Arduino Uno with ThingSpeak using ESP 8266 Wi-Fi Module

Connecting Arduino Uno with ThingSpeak using ESP 8266 Wi-Fi Module We will connect ARDUINO with ThingSpeak using TCP Connection and HT...