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.
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..
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
- mercurial
- QT4 development packages (recommended version 4.7)
Debian/Ubuntu Linux distribution:
- apt-get install mercurial
- apt-get install qt4-dev-tools
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..
I am getting that minimal view even though I run netanim as root user.
ReplyDeleteDo This:
Delete1- 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.
Nothing opens It says : (nautilus:15699) unique DBus Warning ** unable to connect to the running instance
DeleteWhen I launch NetAnim I got the following error on terminal:
DeleteQGtkStyle was unable to detect the current GTK+ theme.
Qt: Session management error: None of the authentication protocols specified are supported
This comment has been removed by the author.
ReplyDeletehello ,
ReplyDeletei 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
I think You are required to include its header file at the top.
Delete#include "ns3/netanim-module.h"
Try that...