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

Installing NS3 with LENA (LTE Simulation) Module in Ubuntu 14

NOTE: 5G/ mmWave NS3 SIMULATOR IS AVAILABLE NOW. https://github.com/mmezzavilla/ns3-mmwave



Dear Friends,
      I am sharing my experience of installing LTE module LENA and NS3 in Ubuntu. I Hope this will help you. I have installed Ubuntu in VMPlayer with 1.7GB RAM assigned.
  • Install Ubuntu in VMPlayer
    • Download VMPlayer
      • https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/6_0
    • Download Ubuntu ISO
      • http://www.ubuntu.com/download/desktop
  • After installation U need to install prerequisite of NS3
    • This link contain all the commands for Ubuntu. But I am adding those commands here for your ease.
      http://www.nsnam.org/wiki/Installation#Ubuntu.2FDebian
NOTE: NS3 simulator requires some other programs (dependencies) to be installed already in your system. You can install those dependencies using these commands:

  sudo apt-get install gcc g++ python

  sudo apt-get install gcc g++ python python-dev
  sudo apt-get install mercurial
  sudo apt-get install bzr
  sudo apt-get install gdb valgrind 
  sudo apt-get install gsl-bin libgsl0-dev libgsl0ldbl
  sudo apt-get install flex bison libfl-dev
  sudo apt-get install g++-3.4 gcc-3.4
  sudo apt-get install tcpdump
  sudo apt-get install sqlite sqlite3 libsqlite3-dev
  sudo apt-get install libxml2 libxml2-dev
  sudo apt-get install libgtk2.0-0 libgtk2.0-dev
  sudo apt-get install vtun lxc
  sudo apt-get install uncrustify
  sudo apt-get install doxygen graphviz imagemagick
  sudo apt-get install texlive texlive-extra-utils texlive-latex-extra
  sudo apt-get install python-sphinx dia 
  sudo apt-get install python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev
  sudo apt-get install libboost-signals-dev libboost-filesystem-dev
  sudo apt-get install openmpi-bin openmpi-common openmpi-doc libopenmpi-dev
  sudo apt-get install gcc-multilib

Section 1:All in one install
 
This tutorial will guide you to install NS3 in your UBUNTU 14. I have installed Ubuntu 14 in VMplayer virtual environment.
To install NS3 use this:

1 cd
2 mkdir workspace
3 cd workspace
4 wget http://www.nsnam.org/releases/ns-allinone-3.21.tar.bz2

If above does not work try downloading latest tar from : http://www.nsnam.org/ns-3-21/ 
Download the latest ns3 stable release: https://www.nsnam.org/release/ns-allinone-3.24.1.tar.bz2 or from here: https://www.nsnam.org/ns-3-24/
after downloading cp the file to workspace folder

$ sudo cp /home/user/Downloads/ns3-allinone-3.21 ~/workspace/

above command will copy the file then use 
$ cd ~/workspace/

5 tar xjf ns-allinone-3.21.tar.bz2
this will create a workspace folder and in that folder will create ns-allinone folder.
Problem: Now if you are unable to download above ns3 tar file then download it manually using:
or
and copy the file in workspace using
cp /home/hassan/Downlaods/ns-allinone-3.21.tar.bz2  ~/workspace

after copy use step 5 (given above) to untar the files. After untar use this command to build.
Change the directory and go to ns3 folder.

./build.py 
./build.py --enable-examples --enable-tests

after build you will have some folder that you can see using ls command.

cd ns-3.21

so that you get in to ns3 directory then use waf to configure ns3


$ ./waf clean
$ ./waf configure --build-profile=debug --out=build/debug
$ ./waf configure --build-profile=optimized --out=build/optimized
$ ./waf configure --enable-examples –-enable-tests
$ ./waf build
(Note: If tests and examplse are still disabled use:)
cd ..
./build.py --enable-examples --enable-tests
Now if everything
goes well you can test your NS3 by:
./test.py -c core
and You should see 
92 of 92 tests
passed (92 passed, 0 failed, 0 crashed, 0 valgrind errors)
Now lets run one
script so that we can be sure of NS3.
./waf
./waf –run hello-simulator
Ta da .. Done . 
In case you have difficulties running hello-simulator code. Try configuring WAF again:

Configuration with Waf 

 ./waf -d optimized configure; ./waf 
 ./waf distclean ./waf configure    // (or use this > ./waf configure –enable-  examples –enable-tests)
 ./build.py --enable-examples --enable-tests  // we are enabling example and test by build
 ./waf configure --enable-examples --enable-tests // we are enabling example and test by waf
./waf build
  •  Now as You are good to go with ./waf to run scripts.
  • to run any script use
./waf --run first // to run file first.cc while your root folder should be ns3.17

Using Above method I have found that LTE is supported and installed already in NS3 . So no need to install separate module.
So Now lets run a simple LTE file with 1 enb and some devices.
You can refer this file documentation here and source code here.

Put lte_basic_example.cc in scratch folder.

./waf
./waf --run lte_basic_example

This will not generate any output on console but I have added some code to generate an xml file to read in NetAnim program. You will see a file in ns3 folder named as lte_animation_test.xml you can use netanim to read and simulate LTE basic scenario. To understand how to run netanim go here.

I HOPE THAT NOTHING IS MISSING, HAPPY CODING GUYS. "GOOD LUCK"                <WRITE COMMENT FOR ANY QUERY>

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