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..