https://www.nsnam.org/mediawiki/api.php?action=feedcontributions&user=Jabraham3&feedformat=atomNsnam - User contributions [en]2024-03-19T01:57:54ZUser contributionsMediaWiki 1.24.1https://www.nsnam.org/mediawiki/index.php?title=Installation&diff=10832Installation2017-10-09T16:58:50Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
This is a detailed installation guide for ns-3. Basic installation instructions can be found in the [http://www.nsnam.org/docs/release/tutorial/html/index.html ns-3 tutorial] (see [http://www.nsnam.org/docs/release/tutorial/html/getting-started.html Getting Started chapter]).<br />
<br />
== Supported platforms ==<br />
<br />
ns-3 is primarily developed on GNU/Linux platforms, and the minimal requirements to run basic simulations are a [http://gcc.gnu.org/ gcc] or [http://clang.llvm.org/ clang] compiler and [http://www-python.org/ Python] interpreter (details on versions below).<br />
<br />
=== Operating system and compiler support ===<br />
<br />
ns-3 is supported and currently tested on the following primary platforms:<br />
<br />
# Linux (x86 and x86_64): gcc/g++ versions 4.9 and above<br />
## '''Note:''' If you are using RHEL or Centos, you will likely need to install a more up-to-date compiler than the default; search for how to enable 'software collections' or 'devtoolset' on these distributions. Other Linux distributions typically have a suitable default compiler (at least version 4.9).<br />
# MacOS Apple LLVM: version 8.0.0 and above (version 7.0.0 may work)<br />
# FreeBSD and Linux (x86_64): clang/LLVM version 3.9 and above (older versions down to 3.3 may work)<br />
<br />
The minimum Python version supported is 2.7 or greater (version 2), or version 3.4 or greater (version 3).<br />
<br />
By supported, we mean that the project tries to support most or all of the build options on these platforms unless there is a good reason to exclude the option; and at least the debug build will compile. If you intend to do serious work using ns-3, and are forced by circumstances to use a Windows platform, consider virtualization of a popular Linux platform or using [https://msdn.microsoft.com/en-us/commandline/wsl/install_guide Windows Subsystem for Linux]. <br />
<br />
The following platforms are lightly supported:<br />
* Windows Visual Studio 2012 (presently being [https://www.nsnam.org/bugzilla/show_bug.cgi?id=2726 upgraded])<br />
<br />
Some aspects of ns-3 depend on Unix (or specifically Linux) support, such as the emulation or TapBridge features, and those components are not enabled on the Windows or MacOS versions cited above.<br />
<br />
Additional maintainers are invited to make more platforms, compilers and environments supported.<br />
<br />
=== Integrated development environment support ===<br />
<br />
==== Eclipse ====<br />
The [http://www.eclipse.org/ Eclipse IDE] is not an officially supported platform, but some developers use it and have compiled a [[HOWTO configure Eclipse with ns-3|HOWTO]].<br />
<br />
==== NetBeans ====<br />
[https://netbeans.org/ NetBeans] is not officially supported either, but there is a [[HOWTO_configure_NetBeans_with_ns-3|HOWTO]] as well.<br />
<br />
==== QtCreator ====<br />
Same rule applies to [http://qt-project.org/wiki/category:tools::qtcreator Qt Creator]; it's not officially supported, but there are developers that use it and [[HOWTO configure QtCreator with ns-3|HOWTO]] is available.<br />
<br />
=== Support for optional features ===<br />
<br />
There are a few options that are not enabled by default and are not available on all platforms. At the end of the configuration process (explained below), the status of these options are shown as detected by a '''waf''' script:<br />
<br />
<pre><br />
---- Summary of optional NS-3 features:<br />
Python Bindings : not enabled (Python library or headers missing)<br />
BRITE Integration : not enabled (BRITE not enabled (see option --with-brite))<br />
NS-3 Click Integration : not enabled (nsclick not enabled (see option --with-nsclick))<br />
GtkConfigStore : not enabled (library 'gtk+-2.0 >= 2.12' not found)<br />
XmlIo : not enabled (library 'libxml-2.0 >= 2.7' not found)<br />
Threading Primitives : enabled<br />
Real Time Simulator : enabled<br />
Emulated Net Device : not enabled (<netpacket/packet.h> include not detected)<br />
Network Simulation Cradle : not enabled (architecture None not supported)<br />
MPI Support : not enabled (option --enable-mpi not selected)<br />
NS-3 OpenFlow Integration : not enabled (Required boost libraries not found)<br />
SQlite stats data output : not enabled (library 'sqlite3' not found)<br />
Tap Bridge : not enabled (<linux/if_tun.h> include not detected)<br />
PyViz visualizer : not enabled (Python Bindings are needed but not enabled)<br />
Use sudo to set suid bit : not enabled (option --enable-sudo not selected)<br />
Build tests : not enabled (defaults to disabled)<br />
Build examples : not enabled (defaults to disabled)<br />
GNU Scientific Library (GSL) : not enabled (GSL not found)<br />
</pre><br />
<br />
Generally if the platform is missing some requirement for an option it is marked as "not enabled." Note that "disabled by user request" will be shown when the user explicitly disables a feature (such as "--disable-python"); and if a feature defaults to disabled this will also be noted (e.g., option --enable-sudo not selected).<br />
<br />
The table below is meant to help sort out the different features and on which platforms they are supported. This table reflects the status as of ns-3.15 and may have changed since then:<br />
<br />
{| border=1 cellspacing=0 cellpadding=3<br />
<br />
|+ Option status<br />
! Option !! Linux !! FreeBSD !! Mac OS X<br />
|-<br />
! Optimized build <br />
| Y || Y || Y<br />
|-<br />
! Python bindings<br />
| Y || Y || Y<br />
|-<br />
! Threading<br />
| Y || Y || Y<br />
|-<br />
! Real-time simulator<br />
| Y || Y || N<br />
|-<br />
! Emulated Net Device<br />
| Y || N || N<br />
|-<br />
! Tap Bridge<br />
| Y || N || N<br />
|-<br />
! Network simulation cradle<br />
| Y<sup>1</sup> || ? || N<br />
|-<br />
! Static builds<br />
| Y || Y || Y<br />
<br />
|}<br />
<br />
''Key:'' '''Y''' = supported; '''N''' = not supported; '''?''' = unknown; '''dev''' = support in ns-3-dev (next release)<br />
<br />
''Notes:''<br />
<br />
# NSC works best with gcc-3.4 or gcc-4.2 or greater series. Try to avoid using gcc-4.0 and gcc-4.1 series; some build problems have been found with these versions of compilers.<br />
<br />
== Prerequisites ==<br />
<br />
The core of ns-3 requires a gcc/g++ installation of 4.9 or greater (Linux), or a recent version of clang compiler (OS X, Linux, or BSD), and Python 2.7 or greater. As mentioned above, different options require additional support. This is a list of packages (for Debian/Ubuntu systems) that are needed to support different ns-3 options. Note that other distributions (e.g., Fedora, FreeBSD) may have different package names or capitalization (e.g. ImageMagik). Installation should be similar for Red Hat/Fedora based systems, with "yum" replacing "apt-get", but some differences exist, so below is a guide for both Ubuntu (should generally apply to Debian) and Fedora/RedHat-based systems:<br />
<br />
=== Linux ===<br />
<br />
==== CentOS ====<br />
<br />
'''Note:''' CentOS version 6 series (currently 6.8) requires an upgrade of both gcc and Python to meet current ns-3 requirements. See these instructions if you need to upgrade: https://www.nsnam.org/bugzilla/show_bug.cgi?id=2667#c1<br />
<br />
The below instructions are based on a CentOS 6.6 install in November 2014; other RedHat/Fedora-based installs are likely similar.<br />
<br />
* '''minimal requirements for C++ (release):''' This is the minimal set of packages needed to run ns-3 C++ programs from a released tarball.<br />
<br />
yum install gcc-c++ python<br />
<br />
* '''minimal requirements for Python (release):''' Python development headers are necessary to enable the Python bindings (for writing ns-3 programs from Python):<br />
<br />
yum install python-devel<br />
<br />
The following additional packages add functionality to the build or documentation.<br />
<br />
* The netanim animator requires Qt5 development packages:<br />
<br />
yum install qt5-devel<br />
<br />
* Mercurial is needed to work with ns-3 development repositories.<br />
<br />
yum install mercurial<br />
<br />
* Bazaar is needed to fetch the development version of the pybindgen bindings generation tool. <br />
<br />
yum install bzr<br />
<br />
* Support for generating modified python bindings<br />
<br />
yum install cmake glibc-devel.i686 glibc-devel.x86_64<br />
<br />
and you will want to install gccxml and pygccxml as per the instructions for python bindings (or through the ''bake'' build tool as described in the tutorial).<br />
<br />
* Doxygen and related inline documentation:<br />
<br />
yum install doxygen graphviz ImageMagick<br />
* The ns-3 manual and tutorial are written in reStructuredText for Sphinx (doc/tutorial, doc/manual, doc/models), and figures typically in dia:<br />
<br />
yum install python-sphinx dia texlive texlive-latex<br />
<br />
* MPI-based parallel, distributed simulation support requires openmpi:<br />
<br />
yum install openmpi openmpi-devel<br />
<br />
* To read pcap packet traces generated by ns-3<br />
<br />
yum install tcpdump wireshark<br />
<br />
* Database support for statistics<br />
<br />
yum install sqlite sqlite-devel<br />
<br />
* Xml-based version of the config store (requires libxml2 >= version 2.7)<br />
<br />
yum install libxml2 libxml2-devel<br />
<br />
* Support for utils/check-style.py style check program<br />
<br />
yum install uncrustify<br />
<br />
* Support for openflowswitch requires some Boost libraries<br />
<br />
yum install boost-devel<br />
<br />
* Support for ns-3-pyviz visualizer<br />
<br />
This is a bit more involved due to lack of package support in the standard repositories.<br />
<br />
yum install graphviz graphviz-devel python-setuptools-devel ipython<br />
sudo easy_install pygraphviz<br />
<br />
Some additional packages are needed (goocanvas and pygoocanvas). It is suggested to enable the RPMForge repo as described here: http://wiki.centos.org/AdditionalResources/Repositories/RPMForge. Then, try this:<br />
<br />
yum install goocanvas pygtk2-devel<br />
<br />
Then obtain the RPM for pygoocanvas and pygoocanvas-devel from here: http://li.nux.ro/download/nux/dextop/el6/x86_64/<br />
<br />
rpm -ivh pygoocanvas-0.14.1-3.el6.nux.x86_64.rpm <br />
rpm -ivh pygoocanvas-devel-0.14.1-3.el6.nux.x86_64.rpm <br />
<br />
Or, if you prefer, build pygoocanvas from source code found here: https://wiki.gnome.org/Projects/PyGoocanvas<br />
<br />
Note, if you perform this install successfully on a CentOS server that does not have a desktop installed (i.e. a CentOS 'minimal install'), you will still not be able to see pyviz enabled; you will see the configuration report:<br />
<br />
PyViz visualizer : not enabled (Missing python modules: gtk)<br />
<br />
because the Python gtk module opens the display upon import.<br />
<br />
* Git is needed to fetch click modular routing and pygccxml<br />
<br />
yum install git<br />
<br />
* An optional but recommended package (for improving some wireless model fidelity) is GNU scientific library:<br />
<br />
yum install gsl gsl-devel<br />
<br />
* A GTK-based configuration system<br />
<br />
yum install gtk2 gtk2-devel<br />
<br />
* Debugging:<br />
<br />
yum install gdb valgrind<br />
[[#Installation| <span class="mw-ui-button mw-ui-progressive" style ="margin:.1em">Jump to installation</span>]]<br />
==== Ubuntu/Debian/Mint ====<br />
<br />
The following list of packages should be accurate for Ubuntu 16.04 release; other releases or other Debian-based systems may slightly vary.<br />
<br />
'''Note:''' Ubuntu 14.04 LTS release requires upgrade to gcc-4.9 from default gcc-4.8. The instructions at this link: http://askubuntu.com/questions/466651/how-do-i-use-the-latest-gcc-on-ubuntu?answertab=votes#tab-top have been found to work.<br />
<br />
* '''minimal requirements for C++ (release):''' This is the minimal set of packages needed to run ns-3 from a released tarball.<br />
<br />
apt-get install gcc g++ python<br />
<br />
* '''minimal requirements for Python (release):''' This is the minimal set of packages needed to work with Python bindings from a released tarball.<br />
<br />
apt-get install gcc g++ python python-dev<br />
<br />
* '''minimal requirements for Python (development):''' For use of ns-3-allinone repository (cloned from Mercurial), additional packages are needed to fetch and successfully install pybindgen:<br />
<br />
apt-get install mercurial python-setuptools git<br />
<br />
* '''Python API scanning support:''' cmake libc6-dev libc6-dev-i386 g++-multilib<br />
** To rescan Python bindings requires gccxml and pygccxml, which are installed by bake. However, for Ubuntu 16.04, gccxml will not work without installing and using g++-4.9.<br />
<br />
* qt5 development tools are needed for Netanim animator<br />
<br />
apt-get install qt5-default<br />
<br />
* Support for generating modified python bindings<br />
<br />
apt-get install cmake libc6-dev libc6-dev-i386 libclang-dev<br />
<br />
and you will want to install castxml and pygccxml as per the instructions for python bindings (or through the ''bake'' build tool as described in the tutorial).<br />
<br />
* Debugging:<br />
<br />
apt-get install gdb valgrind <br />
<br />
* GNU Scientific Library (GSL) support for more accurate WiFi error models<br />
<br />
apt-get install gsl-bin libgsl2 libgsl-dev<br />
<br />
* The Network Simulation Cradle (nsc) requires the flex lexical analyzer and bison parser generator:<br />
<br />
apt-get install flex bison libfl-dev<br />
<br />
* To read pcap packet traces<br />
<br />
apt-get install tcpdump<br />
<br />
* Database support for statistics framework<br />
<br />
apt-get install sqlite sqlite3 libsqlite3-dev<br />
<br />
* Xml-based version of the config store (requires libxml2 >= version 2.7)<br />
<br />
apt-get install libxml2 libxml2-dev<br />
<br />
* A GTK-based configuration system<br />
<br />
apt-get install libgtk2.0-0 libgtk2.0-dev<br />
<br />
* To experiment with virtual machines and ns-3<br />
<br />
apt-get install vtun lxc<br />
<br />
* Support for utils/check-style.py code style check program<br />
<br />
apt-get install uncrustify<br />
<br />
* Doxygen and related inline documentation:<br />
<br />
apt-get install doxygen graphviz imagemagick<br />
apt-get install texlive texlive-extra-utils texlive-latex-extra texlive-font-utils texlive-lang-portuguese dvipng<br />
<br />
* The ns-3 manual and tutorial are written in reStructuredText for Sphinx (doc/tutorial, doc/manual, doc/models), and figures typically in dia (also needs the texlive packages above):<br />
<br />
apt-get install python-sphinx dia <br />
<br />
'''Note:''' Sphinx version >= 1.12 required for ns-3.15. To check your version, type "sphinx-build". To fetch this package alone, outside of the Ubuntu package system, try "sudo easy_install -U Sphinx".<br />
<br />
* Support for Gustavo Carneiro's ns-3-pyviz visualizer<br />
<br />
apt-get install python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev ipython<br />
<br />
* Support for openflow module (requires some boost libraries)<br />
<br />
apt-get install libboost-signals-dev libboost-filesystem-dev<br />
<br />
* Support for MPI-based distributed emulation<br />
<br />
apt-get install openmpi-bin openmpi-common openmpi-doc libopenmpi-dev<br />
<br />
* Support for bake tool:<br />
<br />
apt-get install autoconf cvs bzr unrar<br />
[[#Installation| <span class="mw-ui-button mw-ui-progressive" style ="margin:.1em">Jump to installation</span>]]<br />
==== Fedora/RedHat ====<br />
<br />
The following list of packages should be aligned with recent Fedora releases; other releases may slightly vary. Note that these distributions sometimes change the package structure over time.<br />
<br />
* '''minimal requirements for C++ (release):''' This is the minimal set of packages needed to run ns-3 from a released tarball.<br />
<br />
dnf install gcc gcc-c++ python<br />
<br />
* '''Note:''' If you are using CentOS 5.4 or RHEL 5, you may want to also get and use the gcc44 packages; see the [[Troubleshooting]] page.<br />
<br />
* '''minimal requirements for Python (release):''' This is the minimal set of packages needed to work with Python bindings from a released tarball.<br />
<br />
dnf install gcc gcc-c++ python python-devel<br />
<br />
* Mercurial is needed to work with ns-3 development repositories.<br />
<br />
dnf install mercurial<br />
<br />
* Running python bindings from the ns-3 development tree (ns-3-dev) requires bazaar. You may need EPEL repository for this.<br />
<br />
dnf install bzr<br />
<br />
* An optional but recommended package (for improving some wireless model fidelity) is GNU scientific library:<br />
<br />
dnf install gsl gsl-devel<br />
<br />
* A GTK-based configuration system<br />
<br />
dnf install gtk2 gtk2-devel<br />
<br />
* Debugging:<br />
<br />
dnf install gdb valgrind <br />
<br />
* Doxygen and related inline documentation:<br />
<br />
dnf install doxygen graphviz ImageMagick<br />
<br />
* The ns-3 manual and tutorial are written in reStructuredText for Sphinx (doc/tutorial, doc/manual, doc/models), and figures typically in dia:<br />
<br />
dnf install python-sphinx dia texlive texlive-latex<br />
<br />
'''Note:''' Sphinx version >= 1.12 required for ns-3.15. To check your version, type "sphinx-build". To fetch this package alone, outside of the Fedora package system, try "sudo easy_install -U Sphinx"<br />
<br />
* The Network Simulation Cradle (nsc) requires the flex lexical analyzer and bison parser generator; note, this requires older compiler support (gcc-4 series):<br />
<br />
dnf install flex bison<br />
<br />
* To read pcap packet traces<br />
<br />
dnf install tcpdump<br />
<br />
* Database support for statistics framework<br />
<br />
dnf install sqlite sqlite-devel<br />
<br />
* Xml-based version of the config store (requires libxml2 >= version 2.7)<br />
<br />
dnf install libxml2 libxml2-devel<br />
<br />
* Support for utils/check-style.py style check program<br />
<br />
dnf install uncrustify<br />
<br />
* Support for MPI distributed simulations<br />
<br />
dnf install openmpi openmpi-devel<br />
<br />
* Support for openflowswitch<br />
<br />
dnf install boost-devel<br />
<br />
* Support for ns-3-pyviz visualizer<br />
<br />
dnf install redhat-rpm-config goocanvas-devel graphviz graphviz-devel python-setuptools python-kiwi pygoocanvas ipython<br />
easy_install pygraphviz<br />
<br />
* Support for netanim animator:<br />
<br />
dnf install qt5-devel<br />
<br />
* Support for generating modified python bindings<br />
<br />
dnf install cmake glibc-devel.i686 glibc-devel.x86_64<br />
<br />
and you will want to install gccxml and pygccxml as per the instructions for python bindings (or through the ''bake'' build tool as described in the tutorial).<br />
<br />
* Support for bake tool:<br />
<br />
dnf install patch autoconf cvs<br />
[[#Installation| <span class="mw-ui-button mw-ui-progressive" style ="margin:.1em">Jump to installation</span>]]<br />
==== Gentoo ====<br />
<br />
The following list of packages should be accurate for Gentoo as of 04/22/2010 (please note, this is quite some time ago-- an update would be welcome); due to possible changes in USE-flags or package names the list may slightly vary.<br />
First of all, become root as usual.<br />
<br />
* '''minimal requirements for C++ or Python (release):''' This is the minimal set of packages needed to run ns-3 or to work with Python bindings from a released tarball.<br />
<br />
USE="threads -nocxx nptl" emerge -uavN gcc python<br />
<br />
* Mercurial is needed to work with ns-3 development repositories.<br />
<br />
emerge -av --noreplace mercurial<br />
<br />
* Running python bindings from the ns-3 development tree (ns-3-dev) requires bazaar<br />
<br />
USE="curl" emerge -uavN bzr<br />
<br />
* A GTK-based configuration system<br />
<br />
emerge -av --noreplace gtk+:2<br />
<br />
* Debugging:<br />
<br />
emerge -av --noreplace gdb valgrind <br />
<br />
* Doxygen and related inline documentation; also ns-3 manual and tutorial (written in Texinfo):<br />
<br />
USE="extra graphics png" emerge -uavN texlive<br />
USE="cairo graphviz latex png svg" emerge -uavN doxygen imagemagick dia<br />
<br />
* The Network Simulation Cradle (nsc) requires the flex lexical analyzer and bison parser generator:<br />
<br />
emerge -av --noreplace flex bison<br />
<br />
* Some basic mobility visualization tests require goocanvas:<br />
<br />
emerge -av --noreplace goocanvas<br />
<br />
* To install gcc-3.4 for some Network Simulation Cradle (nsc) stacks:<br />
<br />
USE="-nocxx nptl" emerge -uavN gcc:3.4<br />
<br />
* To read pcap packet traces<br />
<br />
emerge -av --noreplace tcpdump<br />
<br />
or you may prefer<br />
<br />
emerge -av --noreplace wireshark<br />
<br />
* Database support for statistics framework<br />
<br />
USE="threadsafe" emerge -uavN sqlite:3<br />
<br />
* Xml-based version of the config store (requires libxml2 >= version 2.7)<br />
<br />
emerge -av --noreplace libxml2<br />
<br />
* Support for Gustavo's ns-3-pyviz visualizer (following packages have no stable version as of day of writing, so ~arch for ACCEPT_KEYWORDS)<br />
<br />
ACCEPT_KEYWORDS="~x86" emerge -av --noreplace pygraphviz kiwi pygoocanvas ipython<br />
<br />
* Support for utils/check-style.py style check program<br />
<br />
ACCEPT_KEYWORDS="~x86" emerge -av --noreplace uncrustify<br />
<br />
* To summarize all of above up (without not yet stable pygraphviz, kiwi, pygoocanvas, uncrustify):<br />
USE="cairo curl extra graphics graphviz latex -nocxx nptl png svg\<br />
threads threadsafe" emerge -uavN bison bzr dia doxygen flex gcc\<br />
gcc:3.4 goocanvas gtk+:2 imagemagick libxml2 mercurial python\<br />
ipython sqlite:3 tcpdump texlive valgrind wireshark<br />
[[#Installation| <span class="mw-ui-button mw-ui-progressive" style ="margin:.1em">Jump to installation</span>]]<br />
=== FreeBSD ===<br />
<br />
Many versions of FreeBSD provide gcc compiler. The latest version of gcc maintained for FreeBSD is 4.2.1. ns-3 (as of ns-3.18.1 release) builds on gcc-4.2.1 and clang-3.3 for FreeBSD.<br />
<br />
To use clang, one must set the 'CC=clang' and 'CXX=clang++' environment variables at compile time, such as:<br />
<br />
CC=clang CXX=clang++ ./waf configure<br />
<br />
or set these in your environment variables.<br />
<br />
=== Mac OS X ===<br />
<br />
ns-3.18.1 release and higher are supported by the clang/llvm compiler used in Xcode. To install (last tested for OS X El Capitan), one can follow these instructions:<br />
# Download and install Xcode (most recently tested version 7.3.1; versions from 5 or later should work) from the App Store. <br />
## Make sure to install the "Command line tools" option, so that you install the clang/LLVM compiler. This is done by typing `xcode-select --install` once Xcode is installed.<br />
## You will also have to agree to Apple's license agreement to proceed; type 'sudo clang -v' in a terminal window to take this step.<br />
# Download and unpack the ns-allinone release as described in the tutorial<br />
# If you wish to use the NetAnim animator, you must install [http://download.qt-project.org/archive/qt/4.8/ Qt] (version 4 series; version 5 is unsupported).<br />
# If you wish to use mercurial, you must install it. Follow the instruction in the [http://mercurial.selenic.com mercurial web site]. [https://www.macports.org/ MacPorts] and [http://brew.sh/ Homebrew] are possible package managers to accomplish this.<br />
<br />
'''Note to Anaconda users:''' If you have installed Anaconda, you may encounter a build problem such as:<br />
<br />
"../src/wifi/model/wifi-phy.cc:65:46: error: no matching constructor for initialization of 'WifiPhy::ChannelToFrequencyWidthMap' <br />
(aka 'map<pair<unsigned short, ns3::WifiPhyStandard>, pair<unsigned int, unsigned int> >')<br />
WifiPhy::ChannelToFrequencyWidthMap WifiPhy::m_channelToFrequencyWidth =<br />
^<br />
/usr/include/c++/4.2.1/bits/stl_map.h:188:9: note: candidate constructor template not viable: requires 2 arguments, but 79 were provided<br />
map(_InputIterator __first, _InputIterator __last)<br />
^<br />
This can be worked around by configuring Waf to use the system Python instead of the Python version provided by Anaconda. At the Waf configuration stage, try:<br />
<br />
./waf --python=/usr/bin/python configure ...<br />
<br />
When using build.py, the argument can be passed as follows:<br />
<br />
./build.py --enable-examples --enable-tests -- --python=/usr/bin/python<br />
<br />
See: [https://www.nsnam.org/bugzilla/show_bug.cgi?id=2778 issue 2778] in the ns-3 tracker for more information.<br />
<br />
For OS X 10.8 (Mountain Lion) and earlier, using Xcode 4 series, please see [[HOWTO_get_ns-3_running_on_Mac_OS_X_(10.6.2_Intel)]] and follow steps 1 and 2 (prerequisites) and continue reading below if you want to work with a released version, and follow all steps if you want to work with a development version of ns-3.<br />
<br />
=== Windows ===<br />
<br />
There are two basic options for Windows support:<br />
<br />
# We provide HOWTO documents describing the process for installing Linux and getting ns-3 running using two popular virtualization products: VirtualBox ([[HOWTO use VirtualBox to run simulations on Windows machines]]) and VMware ([[HOWTO use VMware to set up virtual networks (Windows)]]).<br />
# There is an experimental project, [[Ns-3 on Visual Studio 2012 |Ns3 on Windows]], using Visual Studio 2012.<br />
<br />
== Installation ==<br />
<br />
=== Installation with Bake ===<br />
<br />
Bake is a new tool for installing, building and finding out the missing requirements for ns-3 in your own environment. <br />
<br />
To use Bake you need to have at least Python (preferably 2.6 and above) and mercurial in your machine (see the section Prerequisites above to see how to install these). <br />
<br />
First you need to download Bake using Mercurial, go to where you want Bake to be installed and call<br />
<br />
hg clone http://code.nsnam.org/bake<br />
<br />
It is advisable to add bake to your path. <br />
<br />
export BAKE_HOME=`pwd`/bake <br />
export PATH=$PATH:$BAKE_HOME<br />
export PYTHONPATH=$PYTHONPATH:$BAKE_HOME<br />
<br />
After that you can use Bake to find the missing packages, download build and install ns-3 and its modules. <br />
<br />
To find out what is missing in your system and may be needed for installing ns-3 you can call bake check:<br />
<br />
bake.py check<br />
<br />
You should have seen something like: <br />
<br />
> Python - OK<br /> > GNU C++ compiler - OK<br /> > Mercurial - OK<br /> > CVS - OK<br /> > GIT - OK<br /> > Bazaar - OK<br /> > Tar tool - OK<br /> > Unzip tool - OK<br /> > Unrar tool - OK<br /> > 7z data compression utility - OK<br /> > XZ data compression utility - OK<br /> > Make - OK<br /> > cMake - OK<br /> > patch tool - OK<br /> > autoreconf tool - OK<br /> > Path searched for tools: /usr/lib64/qt-3.3/bin<br> /usr/lib64/ccache /usr/local/bin /usr/bin/bin/usr/local/sbin /usr/sbin<br> /sbin /user/dcamara/home/scripts/user/dcamara/home/INRIA/Programs/bin <br> /user/dcamara/home/INRIA/repos/llvm/build/Debug+Asserts/bin<br /><br />
<br />
Before downloading and building ns-3 you need to configure bake to inform it which are the modules you want added to ns-3, the standard distribution for example. <br />
<br />
bake.py configure -e ns-3.26<br />
<br />
Then to see the modules it has added, and the specific system requirements for this configuration, you can call bake show: <br />
<br />
<br />
bake.py show <br />
<br />
<br />
To download the modules, build and install you can call bake deploy<br />
<br />
<br />
bake.py deploy<br />
<br />
This will download the selected modules, all their dependencies and build ns-3 with all these independent modules. You can also perform this installation step by step, i.e. by calling download and build in different steps. <br />
<br />
<br />
bake.py download<br />
bake.py build<br />
<br />
=== Manual installation ===<br />
The ns-3 code is available in Mercurial repositories on the server http://code.nsnam.org (look for the latest release e.g., "ns-3.26"). You can download a tarball of the latest release at http://www.nsnam.org/releases or you can work with our repositories using Mercurial. We recommend using Mercurial unless there's a good reason not to (See the end of this section for instructions on how to get a tarball release).<br />
<br />
The simplest way to get started using Mercurial repositories is to use the '''ns-3-allinone''' environment. This is a set of scripts that manages the downloading and building of various subystems of ns-3 for you. We recommend that you begin your ns-3 adventures in this environment as it can really simplify your life at this point.<br />
<br />
==== Downloading ns-3 Using Mercurial ====<br />
<br />
One practice is to create a directory called '''repos''' in one's home directory under which one can keep local Mercurial repositories. If you adopt that approach, you can get a copy of ns-3-allinone by typing the following into your Linux shell (assuming you have installed Mercurial):<br />
<br />
cd<br />
mkdir repos<br />
cd repos<br />
hg clone http://code.nsnam.org/ns-3-allinone<br />
<br />
As the hg (Mercurial) command executes, you should see something like the following displayed,<br />
<br />
destination directory: ns-3-allinone<br />
requesting all changes<br />
adding changesets<br />
adding manifests<br />
adding file changes<br />
added 26 changesets with 40 changes to 7 files<br />
7 files updated, 0 files merged, 0 files removed, 0 files unresolved<br />
<br />
After the clone command completes, you should have a directory called ns-3-allinone under your ~/repos directory, the contents of which should look something like the following:<br />
<br />
build.py* constants.py dist.py* download.py* README util.py<br />
<br />
Notice that you really just downloaded some Python scripts. The next step will be to use those scripts to download and build the ns-3 distribution of your choice.<br />
<br />
If you go to the following link: http://code.nsnam.org/ you will see a number of repositories. Many are the private repositories of the ns-3 development team. The repositories of interest to you will be prefixed with '''ns-3'''. Official releases of ns-3 will be numbered as ns-3.release.hotfix. For example, a second hotfix to a still hypothetical release nine of ns-3 would be numbered as ns-3.9.2 on this page.<br />
<br />
The current development snapshot (unreleased) of ns-3 may be found at http://code.nsnam.org/ns-3-dev/. The developers attempt to keep these repository in consistent, working states but they are in a development area with unreleased code present, so you may want to consider staying with an official release if you do not need newly-introduced features.<br />
<br />
Since the release numbers are going to be changing, we will stick with the more constant ns-3-dev here, but you can replace the string ''ns-3-dev'' with your choice of release (e.g., ns-3.26) in the text below. You can find the latest version of the code either by inspection of the repository list or by going to the ''Getting Started'' web page and looking for the latest release identifier.<br />
<br />
To download the most common options type the following into your shell (remember you can substitute the name of your chosen release number instead of ns-3-dev)<br />
<br />
./download.py -n ns-3-dev<br />
<br />
After download process completes, you should have several new directories under ~/repos/ns-3-allinone:<br />
<br />
build.py* constants.pyc download.py* nsc/ README util.pyc<br />
constants.py dist.py* ns-3-dev/ pybindgen/ util.py<br />
<br />
Go ahead and change into ns-3-dev under your ~/repos/ns-3-allinone directory. You should see something like the following there:<br />
<br />
AUTHORS examples/ RELEASE_NOTES utils/ wscript<br />
bindings/ LICENSE samples/ VERSION wutils.py<br />
CHANGES.html ns3/ scratch/ waf*<br />
doc/ README src/ waf.bat*<br />
<br />
You are now ready to build the ns-3 distribution.<br />
<br />
==== Downloading ns-3 Using a Tarball ====<br />
<br />
The process for downloading ns-3 via tarball is simpler than the Mercurial process since all of the pieces are pre-packaged for you. You just have to pick a release, download it and decompress it.<br />
<br />
As mentioned above, one practice is to create a directory called '''repos''' in one's home directory under which one can keep local Mercurial repositories. One could also keep a tarballs directory. If you adopt the tarballs directory approach, you can get a copy of a release by typing the following into your Linux shell (substitute the appropriate version numbers, of course):<br />
<br />
cd<br />
mkdir tarballs<br />
cd tarballs<br />
wget http://www.nsnam.org/release/ns-allinone-3.13.tar.bz2<br />
tar xjf ns-allinone-3.13.tar.bz2<br />
<br />
If you change into the directory '''ns-allinone-3.13''' you should see a number of files:<br />
<br />
build.py* ns-3.13/ pybindgen-0.15.0.795/ util.py<br />
constants.py nsc-0.5.2/ README<br />
<br />
You are now ready to build the ns-3 distribution.<br />
<br />
== Building ns-3 with build.py ==<br />
<br />
The first time you build the ns-3 project you should build using the allinone environment. This will get the project configured for you<br />
in the most commonly useful way.<br />
<br />
Change into the directory you created in the download section above. If you downloaded using Mercurial you should have a directory called ns-3-allinone under your ~/repos directory. If you downloaded using a tarball you should have a directory called something like ns-allinone-3.13 under your ~/tarballs directory. Type the following:<br />
<br />
./build.py<br />
<br />
You will see lots of typical compiler output messages displayed as the build script builds the various pieces you downloaded. Eventually you should see the following magic words:<br />
<br />
Build finished successfully (00:02:37)<br />
Leaving directory `./ns-3-dev'<br />
<br />
Once the project has built you typically will not use ns-3-allinone scripts. You will now interact directly with Waf and we '''do it in the ns-3-dev directory and not in the ns-3-allinone directory'''.<br />
<br />
=== Configuration with Waf ===<br />
<br />
To see valid configure options, type ./waf --help. The most important option is -d <debug level>. Valid debug levels (which are listed in waf --help) are: "debug" or "optimized". It is also possible to change the flags used for compilation with (e.g.): <br />
<br />
CXXFLAGS="-O3" ./waf configure <br />
<br />
or, alternately, the gcc compiler<br />
<br />
CXX=g++-3.4 ./waf configure<br />
<br />
'''Note:''' Unlike some other build tools, to change the build target, the option must be supplied during the configure stage rather than the build stage (i.e., "./waf -d optimized" will not work; instead, do<br />
<br />
./waf -d optimized configure; ./waf <br />
<br />
The resulting binaries are placed in build/<debuglevel>/srcpath. For example, in a debug build you can find the executable for the first.cc example as build/examples/first. You can debug the executable directly by:<br />
<br />
./waf --shell<br />
cd build/debug/examples<br />
gdb ns-<version>-first-debug<br />
<br />
Of course, you can run gdb in emacs, or use your favorite debugger such as ddd or insight just as easily. In an optimized build you can find the executable for the first.cc example as build/examples/ns-<version>-first-optimized.<br />
<br />
In order to forcibly disable python bindings, you can provide the following option:<br />
<br />
./waf --disable-python configure<br />
<br />
In order to tell the build system to use the sudo program to set the suid bit if required, you can provide the following option:<br />
<br />
./waf --enable-sudo configure<br />
<br />
To start over a configuration from scratch, type:<br />
<br />
./waf distclean<br />
<br />
Or if you get stuck and all else fails:<br />
<br />
rm -rf build<br />
<br />
followed by changing back into ns-3-allinone and doing:<br />
<br />
./build.py<br />
<br />
will basically reset your build state.<br />
<br />
To see all waf options:<br />
<br />
./waf --help<br />
<br />
== Validating ==<br />
<br />
ns-3 has unit tests that can be run to verify the installation:<br />
<br />
./test.py<br />
<br />
which should produce output like:<br />
<pre><br />
PASS: TestSuite histogram<br />
PASS: TestSuite ns3-wifi-interference<br />
PASS: TestSuite ns3-tcp-cwnd<br />
PASS: TestSuite ns3-tcp-interoperability<br />
PASS: TestSuite sample<br />
...<br />
</pre><br />
<br />
== Using Python ==<br />
<br />
See [[NS-3 Python Bindings|this page]].<br />
<br />
== Troubleshooting ==<br />
<br />
See [[Troubleshooting|this page]].<br />
<br />
== Obsolete information ==<br />
Older versions of ns-3, prior to 3.15, supported using cygwin to run on Windows platform.<br />
<br />
=== Windows ===<br />
<br />
There are three basic options for Windows support:<br />
<br />
# We provide HOWTO documents describing the process for installing Linux support and getting ns-3 running using two popular virtualization products: VirtualBox ([[HOWTO use VirtualBox to run simulations on Windows machines]]) and VMware ([[HOWTO use VMware to set up virtual networks (Windows)]]).<br />
# There is an experimental project, [[Ns-3 on Visual Studio 2012 |Ns3 on Windows]], using Visual Studio 2012. For support on Visual Studio 2010 see [[HOWTO use ns-3 on Windows with Visual Studio 2010|ns-3 on Visual Studio 2010]]<br />
# [http://www.cygwin.com Cygwin] has been supported in the past: gcc 3.4.4 (debug only), gcc 4.3.2 (debug and optimized). Note, however, that there are limitations with regard to [[NS-3_Python_Bindings#Cygwin_limitation|Python bindings]], and that Real-time simulator, Emulated Net Device, Tap Bridge and Network simulation cradle are not supported.<br />
<br />
An alternative Windows platform is MinGW. There are maintainers who attempt to keep a subset of ns-3 running on MinGW, but it is not "officially" suppported. This means that bugs filed against MinGW will be addressed as time permits.<br />
<br />
Cygwin can sometimes be problematic due to the way it actually does its emulation, and sometimes interactions with other Windows software can cause problems. If you do use Cygwin or MinGW; and use Logitech products, we will save you quite a bit of heartburn right off the bat and encourage you to take a look at the [http://oldwiki.mingw.org/index.php/FAQ MinGW FAQ].<br />
<br />
Search for "Logitech" and read the FAQ entry, "why does make often crash creating a sh.exe.stackdump file when I try to compile my source code." Believe it or not, the ``Logitech Process Monitor`` insinuates itself into every DLL in the system when it is running. It can cause your Cygwin or MinGW DLLs to die in mysterious ways and often prevents debuggers from running. Beware of Logitech software when using Cygwin.</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=Installation&diff=10831Installation2017-10-09T16:51:26Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
This is a detailed installation guide for ns-3. Basic installation instructions can be found in the [http://www.nsnam.org/docs/release/tutorial/html/index.html ns-3 tutorial] (see [http://www.nsnam.org/docs/release/tutorial/html/getting-started.html Getting Started chapter]).<br />
<br />
== Supported platforms ==<br />
<br />
ns-3 is primarily developed on GNU/Linux platforms, and the minimal requirements to run basic simulations are a [http://gcc.gnu.org/ gcc] or [http://clang.llvm.org/ clang] compiler and [http://www-python.org/ Python] interpreter (details on versions below).<br />
<br />
=== Operating system and compiler support ===<br />
<br />
ns-3 is supported and currently tested on the following primary platforms:<br />
<br />
# Linux (x86 and x86_64): gcc/g++ versions 4.9 and above<br />
## '''Note:''' If you are using RHEL or Centos, you will likely need to install a more up-to-date compiler than the default; search for how to enable 'software collections' or 'devtoolset' on these distributions. Other Linux distributions typically have a suitable default compiler (at least version 4.9).<br />
# MacOS Apple LLVM: version 8.0.0 and above (version 7.0.0 may work)<br />
# FreeBSD and Linux (x86_64): clang/LLVM version 3.9 and above (older versions down to 3.3 may work)<br />
<br />
The minimum Python version supported is 2.7 or greater (version 2), or version 3.4 or greater (version 3).<br />
<br />
By supported, we mean that the project tries to support most or all of the build options on these platforms unless there is a good reason to exclude the option; and at least the debug build will compile. If you intend to do serious work using ns-3, and are forced by circumstances to use a Windows platform, consider virtualization of a popular Linux platform or using [https://msdn.microsoft.com/en-us/commandline/wsl/install_guide Windows Subsystem for Linux]. <br />
<br />
The following platforms are lightly supported:<br />
* Windows Visual Studio 2012 (presently being [https://www.nsnam.org/bugzilla/show_bug.cgi?id=2726 upgraded])<br />
<br />
Some aspects of ns-3 depend on Unix (or specifically Linux) support, such as the emulation or TapBridge features, and those components are not enabled on the Windows or MacOS versions cited above.<br />
<br />
Additional maintainers are invited to make more platforms, compilers and environments supported.<br />
<br />
=== Integrated development environment support ===<br />
<br />
==== Eclipse ====<br />
The [http://www.eclipse.org/ Eclipse IDE] is not an officially supported platform, but some developers use it and have compiled a [[HOWTO configure Eclipse with ns-3|HOWTO]].<br />
<br />
==== NetBeans ====<br />
[https://netbeans.org/ NetBeans] is not officially supported either, but there is a [[HOWTO_configure_NetBeans_with_ns-3|HOWTO]] as well.<br />
<br />
==== QtCreator ====<br />
Same rule applies to [http://qt-project.org/wiki/category:tools::qtcreator Qt Creator]; it's not officially supported, but there are developers that use it and [[HOWTO configure QtCreator with ns-3|HOWTO]] is available.<br />
<br />
=== Support for optional features ===<br />
<br />
There are a few options that are not enabled by default and are not available on all platforms. At the end of the configuration process (explained below), the status of these options are shown as detected by a '''waf''' script:<br />
<br />
<pre><br />
---- Summary of optional NS-3 features:<br />
Python Bindings : not enabled (Python library or headers missing)<br />
BRITE Integration : not enabled (BRITE not enabled (see option --with-brite))<br />
NS-3 Click Integration : not enabled (nsclick not enabled (see option --with-nsclick))<br />
GtkConfigStore : not enabled (library 'gtk+-2.0 >= 2.12' not found)<br />
XmlIo : not enabled (library 'libxml-2.0 >= 2.7' not found)<br />
Threading Primitives : enabled<br />
Real Time Simulator : enabled<br />
Emulated Net Device : not enabled (<netpacket/packet.h> include not detected)<br />
Network Simulation Cradle : not enabled (architecture None not supported)<br />
MPI Support : not enabled (option --enable-mpi not selected)<br />
NS-3 OpenFlow Integration : not enabled (Required boost libraries not found)<br />
SQlite stats data output : not enabled (library 'sqlite3' not found)<br />
Tap Bridge : not enabled (<linux/if_tun.h> include not detected)<br />
PyViz visualizer : not enabled (Python Bindings are needed but not enabled)<br />
Use sudo to set suid bit : not enabled (option --enable-sudo not selected)<br />
Build tests : not enabled (defaults to disabled)<br />
Build examples : not enabled (defaults to disabled)<br />
GNU Scientific Library (GSL) : not enabled (GSL not found)<br />
</pre><br />
<br />
Generally if the platform is missing some requirement for an option it is marked as "not enabled." Note that "disabled by user request" will be shown when the user explicitly disables a feature (such as "--disable-python"); and if a feature defaults to disabled this will also be noted (e.g., option --enable-sudo not selected).<br />
<br />
The table below is meant to help sort out the different features and on which platforms they are supported. This table reflects the status as of ns-3.15 and may have changed since then:<br />
<br />
{| border=1 cellspacing=0 cellpadding=3<br />
<br />
|+ Option status<br />
! Option !! Linux !! FreeBSD !! Mac OS X<br />
|-<br />
! Optimized build <br />
| Y || Y || Y<br />
|-<br />
! Python bindings<br />
| Y || Y || Y<br />
|-<br />
! Threading<br />
| Y || Y || Y<br />
|-<br />
! Real-time simulator<br />
| Y || Y || N<br />
|-<br />
! Emulated Net Device<br />
| Y || N || N<br />
|-<br />
! Tap Bridge<br />
| Y || N || N<br />
|-<br />
! Network simulation cradle<br />
| Y<sup>1</sup> || ? || N<br />
|-<br />
! Static builds<br />
| Y || Y || Y<br />
<br />
|}<br />
<br />
''Key:'' '''Y''' = supported; '''N''' = not supported; '''?''' = unknown; '''dev''' = support in ns-3-dev (next release)<br />
<br />
''Notes:''<br />
<br />
# NSC works best with gcc-3.4 or gcc-4.2 or greater series. Try to avoid using gcc-4.0 and gcc-4.1 series; some build problems have been found with these versions of compilers.<br />
<br />
== Prerequisites ==<br />
<br />
The core of ns-3 requires a gcc/g++ installation of 4.9 or greater (Linux), or a recent version of clang compiler (OS X, Linux, or BSD), and Python 2.7 or greater. As mentioned above, different options require additional support. This is a list of packages (for Debian/Ubuntu systems) that are needed to support different ns-3 options. Note that other distributions (e.g., Fedora, FreeBSD) may have different package names or capitalization (e.g. ImageMagik). Installation should be similar for Red Hat/Fedora based systems, with "yum" replacing "apt-get", but some differences exist, so below is a guide for both Ubuntu (should generally apply to Debian) and Fedora/RedHat-based systems:<br />
<br />
=== Linux ===<br />
<br />
==== CentOS ====<br />
<br />
'''Note:''' CentOS version 6 series (currently 6.8) requires an upgrade of both gcc and Python to meet current ns-3 requirements. See these instructions if you need to upgrade: https://www.nsnam.org/bugzilla/show_bug.cgi?id=2667#c1<br />
<br />
The below instructions are based on a CentOS 6.6 install in November 2014; other RedHat/Fedora-based installs are likely similar.<br />
<br />
* '''minimal requirements for C++ (release):''' This is the minimal set of packages needed to run ns-3 C++ programs from a released tarball.<br />
<br />
yum install gcc-c++ python<br />
<br />
* '''minimal requirements for Python (release):''' Python development headers are necessary to enable the Python bindings (for writing ns-3 programs from Python):<br />
<br />
yum install python-devel<br />
<br />
The following additional packages add functionality to the build or documentation.<br />
<br />
* The netanim animator requires Qt5 development packages:<br />
<br />
yum install qt5-devel<br />
<br />
* Mercurial is needed to work with ns-3 development repositories.<br />
<br />
yum install mercurial<br />
<br />
* Bazaar is needed to fetch the development version of the pybindgen bindings generation tool. <br />
<br />
yum install bzr<br />
<br />
* Support for generating modified python bindings<br />
<br />
yum install cmake glibc-devel.i686 glibc-devel.x86_64<br />
<br />
and you will want to install gccxml and pygccxml as per the instructions for python bindings (or through the ''bake'' build tool as described in the tutorial).<br />
<br />
* Doxygen and related inline documentation:<br />
<br />
yum install doxygen graphviz ImageMagick<br />
* The ns-3 manual and tutorial are written in reStructuredText for Sphinx (doc/tutorial, doc/manual, doc/models), and figures typically in dia:<br />
<br />
yum install python-sphinx dia texlive texlive-latex<br />
<br />
* MPI-based parallel, distributed simulation support requires openmpi:<br />
<br />
yum install openmpi openmpi-devel<br />
<br />
* To read pcap packet traces generated by ns-3<br />
<br />
yum install tcpdump wireshark<br />
<br />
* Database support for statistics<br />
<br />
yum install sqlite sqlite-devel<br />
<br />
* Xml-based version of the config store (requires libxml2 >= version 2.7)<br />
<br />
yum install libxml2 libxml2-devel<br />
<br />
* Support for utils/check-style.py style check program<br />
<br />
yum install uncrustify<br />
<br />
* Support for openflowswitch requires some Boost libraries<br />
<br />
yum install boost-devel<br />
<br />
* Support for ns-3-pyviz visualizer<br />
<br />
This is a bit more involved due to lack of package support in the standard repositories.<br />
<br />
yum install graphviz graphviz-devel python-setuptools-devel ipython<br />
sudo easy_install pygraphviz<br />
<br />
Some additional packages are needed (goocanvas and pygoocanvas). It is suggested to enable the RPMForge repo as described here: http://wiki.centos.org/AdditionalResources/Repositories/RPMForge. Then, try this:<br />
<br />
yum install goocanvas pygtk2-devel<br />
<br />
Then obtain the RPM for pygoocanvas and pygoocanvas-devel from here: http://li.nux.ro/download/nux/dextop/el6/x86_64/<br />
<br />
rpm -ivh pygoocanvas-0.14.1-3.el6.nux.x86_64.rpm <br />
rpm -ivh pygoocanvas-devel-0.14.1-3.el6.nux.x86_64.rpm <br />
<br />
Or, if you prefer, build pygoocanvas from source code found here: https://wiki.gnome.org/Projects/PyGoocanvas<br />
<br />
Note, if you perform this install successfully on a CentOS server that does not have a desktop installed (i.e. a CentOS 'minimal install'), you will still not be able to see pyviz enabled; you will see the configuration report:<br />
<br />
PyViz visualizer : not enabled (Missing python modules: gtk)<br />
<br />
because the Python gtk module opens the display upon import.<br />
<br />
* Git is needed to fetch click modular routing and pygccxml<br />
<br />
yum install git<br />
<br />
* An optional but recommended package (for improving some wireless model fidelity) is GNU scientific library:<br />
<br />
yum install gsl gsl-devel<br />
<br />
* A GTK-based configuration system<br />
<br />
yum install gtk2 gtk2-devel<br />
<br />
* Debugging:<br />
<br />
yum install gdb valgrind<br />
[[#Installation| <span class="mw-ui-button mw-ui-progressive" style ="margin:.1em">Jump to installation</span>]]<br />
==== Ubuntu/Debian/Mint ====<br />
<br />
The following list of packages should be accurate for Ubuntu 16.04 release; other releases or other Debian-based systems may slightly vary.<br />
<br />
'''Note:''' Ubuntu 14.04 LTS release requires upgrade to gcc-4.9 from default gcc-4.8. The instructions at this link: http://askubuntu.com/questions/466651/how-do-i-use-the-latest-gcc-on-ubuntu?answertab=votes#tab-top have been found to work.<br />
<br />
* '''minimal requirements for C++ (release):''' This is the minimal set of packages needed to run ns-3 from a released tarball.<br />
<br />
apt-get install gcc g++ python<br />
<br />
* '''minimal requirements for Python (release):''' This is the minimal set of packages needed to work with Python bindings from a released tarball.<br />
<br />
apt-get install gcc g++ python python-dev<br />
<br />
* '''minimal requirements for Python (development):''' For use of ns-3-allinone repository (cloned from Mercurial), additional packages are needed to fetch and successfully install pybindgen:<br />
<br />
apt-get install mercurial python-setuptools git<br />
<br />
* '''Python API scanning support:''' cmake libc6-dev libc6-dev-i386 g++-multilib<br />
** To rescan Python bindings requires gccxml and pygccxml, which are installed by bake. However, for Ubuntu 16.04, gccxml will not work without installing and using g++-4.9.<br />
<br />
* qt4 development tools are needed for Netanim animator ('''Note:''' qt version qt4, not qt5, is required)<br />
<br />
apt-get install qt4-dev-tools libqt4-dev<br />
<br />
* Support for generating modified python bindings<br />
<br />
apt-get install cmake libc6-dev libc6-dev-i386 libclang-dev<br />
<br />
and you will want to install castxml and pygccxml as per the instructions for python bindings (or through the ''bake'' build tool as described in the tutorial).<br />
<br />
* Debugging:<br />
<br />
apt-get install gdb valgrind <br />
<br />
* GNU Scientific Library (GSL) support for more accurate WiFi error models<br />
<br />
apt-get install gsl-bin libgsl2 libgsl-dev<br />
<br />
* The Network Simulation Cradle (nsc) requires the flex lexical analyzer and bison parser generator:<br />
<br />
apt-get install flex bison libfl-dev<br />
<br />
* To read pcap packet traces<br />
<br />
apt-get install tcpdump<br />
<br />
* Database support for statistics framework<br />
<br />
apt-get install sqlite sqlite3 libsqlite3-dev<br />
<br />
* Xml-based version of the config store (requires libxml2 >= version 2.7)<br />
<br />
apt-get install libxml2 libxml2-dev<br />
<br />
* A GTK-based configuration system<br />
<br />
apt-get install libgtk2.0-0 libgtk2.0-dev<br />
<br />
* To experiment with virtual machines and ns-3<br />
<br />
apt-get install vtun lxc<br />
<br />
* Support for utils/check-style.py code style check program<br />
<br />
apt-get install uncrustify<br />
<br />
* Doxygen and related inline documentation:<br />
<br />
apt-get install doxygen graphviz imagemagick<br />
apt-get install texlive texlive-extra-utils texlive-latex-extra texlive-font-utils texlive-lang-portuguese dvipng<br />
<br />
* The ns-3 manual and tutorial are written in reStructuredText for Sphinx (doc/tutorial, doc/manual, doc/models), and figures typically in dia (also needs the texlive packages above):<br />
<br />
apt-get install python-sphinx dia <br />
<br />
'''Note:''' Sphinx version >= 1.12 required for ns-3.15. To check your version, type "sphinx-build". To fetch this package alone, outside of the Ubuntu package system, try "sudo easy_install -U Sphinx".<br />
<br />
* Support for Gustavo Carneiro's ns-3-pyviz visualizer<br />
<br />
apt-get install python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev ipython<br />
<br />
* Support for openflow module (requires some boost libraries)<br />
<br />
apt-get install libboost-signals-dev libboost-filesystem-dev<br />
<br />
* Support for MPI-based distributed emulation<br />
<br />
apt-get install openmpi-bin openmpi-common openmpi-doc libopenmpi-dev<br />
<br />
* Support for bake tool:<br />
<br />
apt-get install autoconf cvs bzr unrar<br />
[[#Installation| <span class="mw-ui-button mw-ui-progressive" style ="margin:.1em">Jump to installation</span>]]<br />
==== Fedora/RedHat ====<br />
<br />
The following list of packages should be aligned with recent Fedora releases; other releases may slightly vary. Note that these distributions sometimes change the package structure over time.<br />
<br />
* '''minimal requirements for C++ (release):''' This is the minimal set of packages needed to run ns-3 from a released tarball.<br />
<br />
dnf install gcc gcc-c++ python<br />
<br />
* '''Note:''' If you are using CentOS 5.4 or RHEL 5, you may want to also get and use the gcc44 packages; see the [[Troubleshooting]] page.<br />
<br />
* '''minimal requirements for Python (release):''' This is the minimal set of packages needed to work with Python bindings from a released tarball.<br />
<br />
dnf install gcc gcc-c++ python python-devel<br />
<br />
* Mercurial is needed to work with ns-3 development repositories.<br />
<br />
dnf install mercurial<br />
<br />
* Running python bindings from the ns-3 development tree (ns-3-dev) requires bazaar. You may need EPEL repository for this.<br />
<br />
dnf install bzr<br />
<br />
* An optional but recommended package (for improving some wireless model fidelity) is GNU scientific library:<br />
<br />
dnf install gsl gsl-devel<br />
<br />
* A GTK-based configuration system<br />
<br />
dnf install gtk2 gtk2-devel<br />
<br />
* Debugging:<br />
<br />
dnf install gdb valgrind <br />
<br />
* Doxygen and related inline documentation:<br />
<br />
dnf install doxygen graphviz ImageMagick<br />
<br />
* The ns-3 manual and tutorial are written in reStructuredText for Sphinx (doc/tutorial, doc/manual, doc/models), and figures typically in dia:<br />
<br />
dnf install python-sphinx dia texlive texlive-latex<br />
<br />
'''Note:''' Sphinx version >= 1.12 required for ns-3.15. To check your version, type "sphinx-build". To fetch this package alone, outside of the Fedora package system, try "sudo easy_install -U Sphinx"<br />
<br />
* The Network Simulation Cradle (nsc) requires the flex lexical analyzer and bison parser generator; note, this requires older compiler support (gcc-4 series):<br />
<br />
dnf install flex bison<br />
<br />
* To read pcap packet traces<br />
<br />
dnf install tcpdump<br />
<br />
* Database support for statistics framework<br />
<br />
dnf install sqlite sqlite-devel<br />
<br />
* Xml-based version of the config store (requires libxml2 >= version 2.7)<br />
<br />
dnf install libxml2 libxml2-devel<br />
<br />
* Support for utils/check-style.py style check program<br />
<br />
dnf install uncrustify<br />
<br />
* Support for MPI distributed simulations<br />
<br />
dnf install openmpi openmpi-devel<br />
<br />
* Support for openflowswitch<br />
<br />
dnf install boost-devel<br />
<br />
* Support for ns-3-pyviz visualizer<br />
<br />
dnf install redhat-rpm-config goocanvas-devel graphviz graphviz-devel python-setuptools python-kiwi pygoocanvas ipython<br />
easy_install pygraphviz<br />
<br />
* Support for netanim animator:<br />
<br />
dnf install qt4-devel<br />
<br />
* Support for generating modified python bindings<br />
<br />
dnf install cmake glibc-devel.i686 glibc-devel.x86_64<br />
<br />
and you will want to install gccxml and pygccxml as per the instructions for python bindings (or through the ''bake'' build tool as described in the tutorial).<br />
<br />
* Support for bake tool:<br />
<br />
dnf install patch autoconf cvs<br />
[[#Installation| <span class="mw-ui-button mw-ui-progressive" style ="margin:.1em">Jump to installation</span>]]<br />
==== Gentoo ====<br />
<br />
The following list of packages should be accurate for Gentoo as of 04/22/2010 (please note, this is quite some time ago-- an update would be welcome); due to possible changes in USE-flags or package names the list may slightly vary.<br />
First of all, become root as usual.<br />
<br />
* '''minimal requirements for C++ or Python (release):''' This is the minimal set of packages needed to run ns-3 or to work with Python bindings from a released tarball.<br />
<br />
USE="threads -nocxx nptl" emerge -uavN gcc python<br />
<br />
* Mercurial is needed to work with ns-3 development repositories.<br />
<br />
emerge -av --noreplace mercurial<br />
<br />
* Running python bindings from the ns-3 development tree (ns-3-dev) requires bazaar<br />
<br />
USE="curl" emerge -uavN bzr<br />
<br />
* A GTK-based configuration system<br />
<br />
emerge -av --noreplace gtk+:2<br />
<br />
* Debugging:<br />
<br />
emerge -av --noreplace gdb valgrind <br />
<br />
* Doxygen and related inline documentation; also ns-3 manual and tutorial (written in Texinfo):<br />
<br />
USE="extra graphics png" emerge -uavN texlive<br />
USE="cairo graphviz latex png svg" emerge -uavN doxygen imagemagick dia<br />
<br />
* The Network Simulation Cradle (nsc) requires the flex lexical analyzer and bison parser generator:<br />
<br />
emerge -av --noreplace flex bison<br />
<br />
* Some basic mobility visualization tests require goocanvas:<br />
<br />
emerge -av --noreplace goocanvas<br />
<br />
* To install gcc-3.4 for some Network Simulation Cradle (nsc) stacks:<br />
<br />
USE="-nocxx nptl" emerge -uavN gcc:3.4<br />
<br />
* To read pcap packet traces<br />
<br />
emerge -av --noreplace tcpdump<br />
<br />
or you may prefer<br />
<br />
emerge -av --noreplace wireshark<br />
<br />
* Database support for statistics framework<br />
<br />
USE="threadsafe" emerge -uavN sqlite:3<br />
<br />
* Xml-based version of the config store (requires libxml2 >= version 2.7)<br />
<br />
emerge -av --noreplace libxml2<br />
<br />
* Support for Gustavo's ns-3-pyviz visualizer (following packages have no stable version as of day of writing, so ~arch for ACCEPT_KEYWORDS)<br />
<br />
ACCEPT_KEYWORDS="~x86" emerge -av --noreplace pygraphviz kiwi pygoocanvas ipython<br />
<br />
* Support for utils/check-style.py style check program<br />
<br />
ACCEPT_KEYWORDS="~x86" emerge -av --noreplace uncrustify<br />
<br />
* To summarize all of above up (without not yet stable pygraphviz, kiwi, pygoocanvas, uncrustify):<br />
USE="cairo curl extra graphics graphviz latex -nocxx nptl png svg\<br />
threads threadsafe" emerge -uavN bison bzr dia doxygen flex gcc\<br />
gcc:3.4 goocanvas gtk+:2 imagemagick libxml2 mercurial python\<br />
ipython sqlite:3 tcpdump texlive valgrind wireshark<br />
[[#Installation| <span class="mw-ui-button mw-ui-progressive" style ="margin:.1em">Jump to installation</span>]]<br />
=== FreeBSD ===<br />
<br />
Many versions of FreeBSD provide gcc compiler. The latest version of gcc maintained for FreeBSD is 4.2.1. ns-3 (as of ns-3.18.1 release) builds on gcc-4.2.1 and clang-3.3 for FreeBSD.<br />
<br />
To use clang, one must set the 'CC=clang' and 'CXX=clang++' environment variables at compile time, such as:<br />
<br />
CC=clang CXX=clang++ ./waf configure<br />
<br />
or set these in your environment variables.<br />
<br />
=== Mac OS X ===<br />
<br />
ns-3.18.1 release and higher are supported by the clang/llvm compiler used in Xcode. To install (last tested for OS X El Capitan), one can follow these instructions:<br />
# Download and install Xcode (most recently tested version 7.3.1; versions from 5 or later should work) from the App Store. <br />
## Make sure to install the "Command line tools" option, so that you install the clang/LLVM compiler. This is done by typing `xcode-select --install` once Xcode is installed.<br />
## You will also have to agree to Apple's license agreement to proceed; type 'sudo clang -v' in a terminal window to take this step.<br />
# Download and unpack the ns-allinone release as described in the tutorial<br />
# If you wish to use the NetAnim animator, you must install [http://download.qt-project.org/archive/qt/4.8/ Qt] (version 4 series; version 5 is unsupported).<br />
# If you wish to use mercurial, you must install it. Follow the instruction in the [http://mercurial.selenic.com mercurial web site]. [https://www.macports.org/ MacPorts] and [http://brew.sh/ Homebrew] are possible package managers to accomplish this.<br />
<br />
'''Note to Anaconda users:''' If you have installed Anaconda, you may encounter a build problem such as:<br />
<br />
"../src/wifi/model/wifi-phy.cc:65:46: error: no matching constructor for initialization of 'WifiPhy::ChannelToFrequencyWidthMap' <br />
(aka 'map<pair<unsigned short, ns3::WifiPhyStandard>, pair<unsigned int, unsigned int> >')<br />
WifiPhy::ChannelToFrequencyWidthMap WifiPhy::m_channelToFrequencyWidth =<br />
^<br />
/usr/include/c++/4.2.1/bits/stl_map.h:188:9: note: candidate constructor template not viable: requires 2 arguments, but 79 were provided<br />
map(_InputIterator __first, _InputIterator __last)<br />
^<br />
This can be worked around by configuring Waf to use the system Python instead of the Python version provided by Anaconda. At the Waf configuration stage, try:<br />
<br />
./waf --python=/usr/bin/python configure ...<br />
<br />
When using build.py, the argument can be passed as follows:<br />
<br />
./build.py --enable-examples --enable-tests -- --python=/usr/bin/python<br />
<br />
See: [https://www.nsnam.org/bugzilla/show_bug.cgi?id=2778 issue 2778] in the ns-3 tracker for more information.<br />
<br />
For OS X 10.8 (Mountain Lion) and earlier, using Xcode 4 series, please see [[HOWTO_get_ns-3_running_on_Mac_OS_X_(10.6.2_Intel)]] and follow steps 1 and 2 (prerequisites) and continue reading below if you want to work with a released version, and follow all steps if you want to work with a development version of ns-3.<br />
<br />
=== Windows ===<br />
<br />
There are two basic options for Windows support:<br />
<br />
# We provide HOWTO documents describing the process for installing Linux and getting ns-3 running using two popular virtualization products: VirtualBox ([[HOWTO use VirtualBox to run simulations on Windows machines]]) and VMware ([[HOWTO use VMware to set up virtual networks (Windows)]]).<br />
# There is an experimental project, [[Ns-3 on Visual Studio 2012 |Ns3 on Windows]], using Visual Studio 2012.<br />
<br />
== Installation ==<br />
<br />
=== Installation with Bake ===<br />
<br />
Bake is a new tool for installing, building and finding out the missing requirements for ns-3 in your own environment. <br />
<br />
To use Bake you need to have at least Python (preferably 2.6 and above) and mercurial in your machine (see the section Prerequisites above to see how to install these). <br />
<br />
First you need to download Bake using Mercurial, go to where you want Bake to be installed and call<br />
<br />
hg clone http://code.nsnam.org/bake<br />
<br />
It is advisable to add bake to your path. <br />
<br />
export BAKE_HOME=`pwd`/bake <br />
export PATH=$PATH:$BAKE_HOME<br />
export PYTHONPATH=$PYTHONPATH:$BAKE_HOME<br />
<br />
After that you can use Bake to find the missing packages, download build and install ns-3 and its modules. <br />
<br />
To find out what is missing in your system and may be needed for installing ns-3 you can call bake check:<br />
<br />
bake.py check<br />
<br />
You should have seen something like: <br />
<br />
> Python - OK<br /> > GNU C++ compiler - OK<br /> > Mercurial - OK<br /> > CVS - OK<br /> > GIT - OK<br /> > Bazaar - OK<br /> > Tar tool - OK<br /> > Unzip tool - OK<br /> > Unrar tool - OK<br /> > 7z data compression utility - OK<br /> > XZ data compression utility - OK<br /> > Make - OK<br /> > cMake - OK<br /> > patch tool - OK<br /> > autoreconf tool - OK<br /> > Path searched for tools: /usr/lib64/qt-3.3/bin<br> /usr/lib64/ccache /usr/local/bin /usr/bin/bin/usr/local/sbin /usr/sbin<br> /sbin /user/dcamara/home/scripts/user/dcamara/home/INRIA/Programs/bin <br> /user/dcamara/home/INRIA/repos/llvm/build/Debug+Asserts/bin<br /><br />
<br />
Before downloading and building ns-3 you need to configure bake to inform it which are the modules you want added to ns-3, the standard distribution for example. <br />
<br />
bake.py configure -e ns-3.26<br />
<br />
Then to see the modules it has added, and the specific system requirements for this configuration, you can call bake show: <br />
<br />
<br />
bake.py show <br />
<br />
<br />
To download the modules, build and install you can call bake deploy<br />
<br />
<br />
bake.py deploy<br />
<br />
This will download the selected modules, all their dependencies and build ns-3 with all these independent modules. You can also perform this installation step by step, i.e. by calling download and build in different steps. <br />
<br />
<br />
bake.py download<br />
bake.py build<br />
<br />
=== Manual installation ===<br />
The ns-3 code is available in Mercurial repositories on the server http://code.nsnam.org (look for the latest release e.g., "ns-3.26"). You can download a tarball of the latest release at http://www.nsnam.org/releases or you can work with our repositories using Mercurial. We recommend using Mercurial unless there's a good reason not to (See the end of this section for instructions on how to get a tarball release).<br />
<br />
The simplest way to get started using Mercurial repositories is to use the '''ns-3-allinone''' environment. This is a set of scripts that manages the downloading and building of various subystems of ns-3 for you. We recommend that you begin your ns-3 adventures in this environment as it can really simplify your life at this point.<br />
<br />
==== Downloading ns-3 Using Mercurial ====<br />
<br />
One practice is to create a directory called '''repos''' in one's home directory under which one can keep local Mercurial repositories. If you adopt that approach, you can get a copy of ns-3-allinone by typing the following into your Linux shell (assuming you have installed Mercurial):<br />
<br />
cd<br />
mkdir repos<br />
cd repos<br />
hg clone http://code.nsnam.org/ns-3-allinone<br />
<br />
As the hg (Mercurial) command executes, you should see something like the following displayed,<br />
<br />
destination directory: ns-3-allinone<br />
requesting all changes<br />
adding changesets<br />
adding manifests<br />
adding file changes<br />
added 26 changesets with 40 changes to 7 files<br />
7 files updated, 0 files merged, 0 files removed, 0 files unresolved<br />
<br />
After the clone command completes, you should have a directory called ns-3-allinone under your ~/repos directory, the contents of which should look something like the following:<br />
<br />
build.py* constants.py dist.py* download.py* README util.py<br />
<br />
Notice that you really just downloaded some Python scripts. The next step will be to use those scripts to download and build the ns-3 distribution of your choice.<br />
<br />
If you go to the following link: http://code.nsnam.org/ you will see a number of repositories. Many are the private repositories of the ns-3 development team. The repositories of interest to you will be prefixed with '''ns-3'''. Official releases of ns-3 will be numbered as ns-3.release.hotfix. For example, a second hotfix to a still hypothetical release nine of ns-3 would be numbered as ns-3.9.2 on this page.<br />
<br />
The current development snapshot (unreleased) of ns-3 may be found at http://code.nsnam.org/ns-3-dev/. The developers attempt to keep these repository in consistent, working states but they are in a development area with unreleased code present, so you may want to consider staying with an official release if you do not need newly-introduced features.<br />
<br />
Since the release numbers are going to be changing, we will stick with the more constant ns-3-dev here, but you can replace the string ''ns-3-dev'' with your choice of release (e.g., ns-3.26) in the text below. You can find the latest version of the code either by inspection of the repository list or by going to the ''Getting Started'' web page and looking for the latest release identifier.<br />
<br />
To download the most common options type the following into your shell (remember you can substitute the name of your chosen release number instead of ns-3-dev)<br />
<br />
./download.py -n ns-3-dev<br />
<br />
After download process completes, you should have several new directories under ~/repos/ns-3-allinone:<br />
<br />
build.py* constants.pyc download.py* nsc/ README util.pyc<br />
constants.py dist.py* ns-3-dev/ pybindgen/ util.py<br />
<br />
Go ahead and change into ns-3-dev under your ~/repos/ns-3-allinone directory. You should see something like the following there:<br />
<br />
AUTHORS examples/ RELEASE_NOTES utils/ wscript<br />
bindings/ LICENSE samples/ VERSION wutils.py<br />
CHANGES.html ns3/ scratch/ waf*<br />
doc/ README src/ waf.bat*<br />
<br />
You are now ready to build the ns-3 distribution.<br />
<br />
==== Downloading ns-3 Using a Tarball ====<br />
<br />
The process for downloading ns-3 via tarball is simpler than the Mercurial process since all of the pieces are pre-packaged for you. You just have to pick a release, download it and decompress it.<br />
<br />
As mentioned above, one practice is to create a directory called '''repos''' in one's home directory under which one can keep local Mercurial repositories. One could also keep a tarballs directory. If you adopt the tarballs directory approach, you can get a copy of a release by typing the following into your Linux shell (substitute the appropriate version numbers, of course):<br />
<br />
cd<br />
mkdir tarballs<br />
cd tarballs<br />
wget http://www.nsnam.org/release/ns-allinone-3.13.tar.bz2<br />
tar xjf ns-allinone-3.13.tar.bz2<br />
<br />
If you change into the directory '''ns-allinone-3.13''' you should see a number of files:<br />
<br />
build.py* ns-3.13/ pybindgen-0.15.0.795/ util.py<br />
constants.py nsc-0.5.2/ README<br />
<br />
You are now ready to build the ns-3 distribution.<br />
<br />
== Building ns-3 with build.py ==<br />
<br />
The first time you build the ns-3 project you should build using the allinone environment. This will get the project configured for you<br />
in the most commonly useful way.<br />
<br />
Change into the directory you created in the download section above. If you downloaded using Mercurial you should have a directory called ns-3-allinone under your ~/repos directory. If you downloaded using a tarball you should have a directory called something like ns-allinone-3.13 under your ~/tarballs directory. Type the following:<br />
<br />
./build.py<br />
<br />
You will see lots of typical compiler output messages displayed as the build script builds the various pieces you downloaded. Eventually you should see the following magic words:<br />
<br />
Build finished successfully (00:02:37)<br />
Leaving directory `./ns-3-dev'<br />
<br />
Once the project has built you typically will not use ns-3-allinone scripts. You will now interact directly with Waf and we '''do it in the ns-3-dev directory and not in the ns-3-allinone directory'''.<br />
<br />
=== Configuration with Waf ===<br />
<br />
To see valid configure options, type ./waf --help. The most important option is -d <debug level>. Valid debug levels (which are listed in waf --help) are: "debug" or "optimized". It is also possible to change the flags used for compilation with (e.g.): <br />
<br />
CXXFLAGS="-O3" ./waf configure <br />
<br />
or, alternately, the gcc compiler<br />
<br />
CXX=g++-3.4 ./waf configure<br />
<br />
'''Note:''' Unlike some other build tools, to change the build target, the option must be supplied during the configure stage rather than the build stage (i.e., "./waf -d optimized" will not work; instead, do<br />
<br />
./waf -d optimized configure; ./waf <br />
<br />
The resulting binaries are placed in build/<debuglevel>/srcpath. For example, in a debug build you can find the executable for the first.cc example as build/examples/first. You can debug the executable directly by:<br />
<br />
./waf --shell<br />
cd build/debug/examples<br />
gdb ns-<version>-first-debug<br />
<br />
Of course, you can run gdb in emacs, or use your favorite debugger such as ddd or insight just as easily. In an optimized build you can find the executable for the first.cc example as build/examples/ns-<version>-first-optimized.<br />
<br />
In order to forcibly disable python bindings, you can provide the following option:<br />
<br />
./waf --disable-python configure<br />
<br />
In order to tell the build system to use the sudo program to set the suid bit if required, you can provide the following option:<br />
<br />
./waf --enable-sudo configure<br />
<br />
To start over a configuration from scratch, type:<br />
<br />
./waf distclean<br />
<br />
Or if you get stuck and all else fails:<br />
<br />
rm -rf build<br />
<br />
followed by changing back into ns-3-allinone and doing:<br />
<br />
./build.py<br />
<br />
will basically reset your build state.<br />
<br />
To see all waf options:<br />
<br />
./waf --help<br />
<br />
== Validating ==<br />
<br />
ns-3 has unit tests that can be run to verify the installation:<br />
<br />
./test.py<br />
<br />
which should produce output like:<br />
<pre><br />
PASS: TestSuite histogram<br />
PASS: TestSuite ns3-wifi-interference<br />
PASS: TestSuite ns3-tcp-cwnd<br />
PASS: TestSuite ns3-tcp-interoperability<br />
PASS: TestSuite sample<br />
...<br />
</pre><br />
<br />
== Using Python ==<br />
<br />
See [[NS-3 Python Bindings|this page]].<br />
<br />
== Troubleshooting ==<br />
<br />
See [[Troubleshooting|this page]].<br />
<br />
== Obsolete information ==<br />
Older versions of ns-3, prior to 3.15, supported using cygwin to run on Windows platform.<br />
<br />
=== Windows ===<br />
<br />
There are three basic options for Windows support:<br />
<br />
# We provide HOWTO documents describing the process for installing Linux support and getting ns-3 running using two popular virtualization products: VirtualBox ([[HOWTO use VirtualBox to run simulations on Windows machines]]) and VMware ([[HOWTO use VMware to set up virtual networks (Windows)]]).<br />
# There is an experimental project, [[Ns-3 on Visual Studio 2012 |Ns3 on Windows]], using Visual Studio 2012. For support on Visual Studio 2010 see [[HOWTO use ns-3 on Windows with Visual Studio 2010|ns-3 on Visual Studio 2010]]<br />
# [http://www.cygwin.com Cygwin] has been supported in the past: gcc 3.4.4 (debug only), gcc 4.3.2 (debug and optimized). Note, however, that there are limitations with regard to [[NS-3_Python_Bindings#Cygwin_limitation|Python bindings]], and that Real-time simulator, Emulated Net Device, Tap Bridge and Network simulation cradle are not supported.<br />
<br />
An alternative Windows platform is MinGW. There are maintainers who attempt to keep a subset of ns-3 running on MinGW, but it is not "officially" suppported. This means that bugs filed against MinGW will be addressed as time permits.<br />
<br />
Cygwin can sometimes be problematic due to the way it actually does its emulation, and sometimes interactions with other Windows software can cause problems. If you do use Cygwin or MinGW; and use Logitech products, we will save you quite a bit of heartburn right off the bat and encourage you to take a look at the [http://oldwiki.mingw.org/index.php/FAQ MinGW FAQ].<br />
<br />
Search for "Logitech" and read the FAQ entry, "why does make often crash creating a sh.exe.stackdump file when I try to compile my source code." Believe it or not, the ``Logitech Process Monitor`` insinuates itself into every DLL in the system when it is running. It can cause your Cygwin or MinGW DLLs to die in mysterious ways and often prevents debuggers from running. Beware of Logitech software when using Cygwin.</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.108&diff=10830NetAnim 3.1082017-10-09T16:49:36Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.108 and will be bundled along with >= ns-3.27.<br />
NetAnim 3.108 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
** Makhtar Diouf<br />
<br />
== Changelog from 3.107 ==<br />
** Bug 2370 - Fails to build from source with GCC 6<br />
** Initial support for Ipv6<br />
** Fixes ambiguous operator << overload on g++ 7<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces. No support for Ipv6)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT5 development packages (recommended version > 5.4)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt5-default<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt5<br />
# yum install qt5-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt5 : Install Qt5 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.108<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT build tool called qmake. Qt versions from 5.4 are supported.<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt5" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.108&diff=10829NetAnim 3.1082017-10-09T16:48:32Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.108 and will be bundled along with >= ns-3.27.<br />
NetAnim 3.108 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
** Makhtar Diouf<br />
<br />
== Changelog from 3.107 ==<br />
** Bug 2370 - Fails to build from source with GCC 6<br />
** Initial support for Ipv6<br />
** Fixes ambiguous operator << overload on g++ 7<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces. No support for Ipv6)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT5 development packages (recommended version > 5.4)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt5-default<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt5<br />
# yum install qt5-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt5 : Install Qt5 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.108<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT build tool called qmake. Qt versions from 4.8 to 5.4 are supported.<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" or "qmake-qt5" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.108&diff=10822NetAnim 3.1082017-10-05T13:21:05Z<p>Jabraham3: /* Downloading NetAnim */</p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.108 and will be bundled along with >= ns-3.27.<br />
NetAnim 3.108 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
** Makhtar Diouf<br />
<br />
== Changelog from 3.107 ==<br />
** Bug 2370 - Fails to build from source with GCC 6<br />
** Initial support for Ipv6<br />
** Fixes ambiguous operator << overload on g++ 7<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces. No support for Ipv6)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.108<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT build tool called qmake. Qt versions from 4.8 to 5.4 are supported. Qt 5 support may not be available on OSX<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" or "qmake-qt5" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.108&diff=10821NetAnim 3.1082017-10-05T13:20:51Z<p>Jabraham3: /* Downloading NetAnim */</p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.108 and will be bundled along with >= ns-3.27.<br />
NetAnim 3.108 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
** Makhtar Diouf<br />
<br />
== Changelog from 3.107 ==<br />
** Bug 2370 - Fails to build from source with GCC 6<br />
** Initial support for Ipv6<br />
** Fixes ambiguous operator << overload on g++ 7<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces. No support for Ipv6)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.108:<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT build tool called qmake. Qt versions from 4.8 to 5.4 are supported. Qt 5 support may not be available on OSX<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" or "qmake-qt5" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.108&diff=10820NetAnim 3.1082017-10-05T13:20:09Z<p>Jabraham3: Created page with "{{TOC}} The NetAnim GUI The current release version is 3.108 and will be bundled along with >= ns-3.27. NetAnim 3.108 is compatible with n..."</p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.108 and will be bundled along with >= ns-3.27.<br />
NetAnim 3.108 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
** Makhtar Diouf<br />
<br />
== Changelog from 3.107 ==<br />
** Bug 2370 - Fails to build from source with GCC 6<br />
** Initial support for Ipv6<br />
** Fixes ambiguous operator << overload on g++ 7<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces. No support for Ipv6)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.108:<br />
<br />
hg clone -r 002086a646c6 http://code.nsnam.org/netanim<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT build tool called qmake. Qt versions from 4.8 to 5.4 are supported. Qt 5 support may not be available on OSX<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" or "qmake-qt5" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim&diff=10819NetAnim2017-10-05T13:17:48Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
NetAnim is an offline animator based on the Qt toolkit.<br />
It currently animates the simulation using an XML trace file collected during simulation. The first version was developed by George F Riley. <br />
<br />
[[Image:NetAnim3.png|thumb|The NetAnim GUI]] <br />
<br />
== NetAnim Versions == <br />
* 3.108 bundled with ns-3.27<br />
[[ NetAnim 3.108 ]]<br />
<br />
* 3.107<br />
[[ NetAnim 3.107 ]]<br />
<br />
* 3.106<br />
[[ NetAnim 3.106 ]]<br />
<br />
* 3.105 bundled with ns-3.20<br />
[[ NetAnim 3.105 ]]<br />
<br />
* 3.104 bundled with ns-3.19<br />
[[ NetAnim 3.104 ]]</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.107&diff=10332NetAnim 3.1072017-03-17T14:11:55Z<p>Jabraham3: /* Downloading NetAnim */</p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.107 and will be bundled along with >= ns-3.25.<br />
NetAnim 3.107 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
** Makhtar Diouf<br />
<br />
== Changelog from 3.106 ==<br />
** Fixes an issue where nodes with images get incorrectly centered with the description missing<br />
** Fixes an issue where CSMA packets were not being completely animated<br />
** Fixes incorrect RGB assignment on node's colors, when property browser is used for editing<br />
** Fixes an issue where node colors change if clicked<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces. No support for Ipv6)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.107:<br />
<br />
hg clone -r 002086a646c6 http://code.nsnam.org/netanim<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT build tool called qmake. Qt versions from 4.8 to 5.4 are supported. Qt 5 support may not be available on OSX<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.107&diff=9864NetAnim 3.1072016-01-28T07:03:12Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.107 and will be bundled along with >= ns-3.25.<br />
NetAnim 3.107 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
** Makhtar Diouf<br />
<br />
== Changelog from 3.106 ==<br />
** Fixes an issue where nodes with images get incorrectly centered with the description missing<br />
** Fixes an issue where CSMA packets were not being completely animated<br />
** Fixes incorrect RGB assignment on node's colors, when property browser is used for editing<br />
** Fixes an issue where node colors change if clicked<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces. No support for Ipv6)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.106:<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT build tool called qmake. Qt versions from 4.8 to 5.4 are supported. Qt 5 support may not be available on OSX<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.107&diff=9863NetAnim 3.1072016-01-28T07:01:16Z<p>Jabraham3: Created page with "{{TOC}} The NetAnim GUI The current release version is 3.106 and will be bundled along with > ns-3.22. NetAnim 3.106 is compatible with ns..."</p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.106 and will be bundled along with > ns-3.22.<br />
NetAnim 3.106 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
** Makhtar Diouf<br />
<br />
== Changelog from 3.105 ==<br />
** Adds support for Qt 5 with gcc. Tested upto Qt 5.4<br />
** Nodes which are images(pixmaps) are positioned with their centers aligned with the node's x, y co-ordinate. Prior to this change, the node's x, y co-ordinate was aligned with the pixmap's top-left corner.<br />
** Enhancements to the early detection of invalid trace files.<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces. No support for Ipv6)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.106:<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT build tool called qmake. Qt versions from 4.8 to 5.4 are supported. Qt 5 support may not be available on OSX<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim&diff=9862NetAnim2016-01-28T07:00:30Z<p>Jabraham3: /* NetAnim Versions */</p>
<hr />
<div>{{TOC}}<br />
<br />
NetAnim is an offline animator based on the Qt toolkit.<br />
It currently animates the simulation using an XML trace file collected during simulation. The first version was developed by George F Riley. <br />
<br />
[[Image:NetAnim3.png|thumb|The NetAnim GUI]] <br />
<br />
== NetAnim Versions == <br />
* 3.107<br />
[[ NetAnim 3.107 ]]<br />
<br />
* 3.106<br />
[[ NetAnim 3.106 ]]<br />
<br />
* 3.105 bundled with ns-3.20<br />
[[ NetAnim 3.105 ]]<br />
<br />
* 3.104 bundled with ns-3.19<br />
[[ NetAnim 3.104 ]]</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.106&diff=9827NetAnim 3.1062015-11-26T16:43:32Z<p>Jabraham3: /* Building and Starting NetAnim */</p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.106 and will be bundled along with > ns-3.22.<br />
NetAnim 3.106 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
** Makhtar Diouf<br />
<br />
== Changelog from 3.105 ==<br />
** Adds support for Qt 5 with gcc. Tested upto Qt 5.4<br />
** Nodes which are images(pixmaps) are positioned with their centers aligned with the node's x, y co-ordinate. Prior to this change, the node's x, y co-ordinate was aligned with the pixmap's top-left corner.<br />
** Enhancements to the early detection of invalid trace files.<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces. No support for Ipv6)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.106:<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT build tool called qmake. Qt versions from 4.8 to 5.4 are supported. Qt 5 support may not be available on OSX<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.106&diff=9341NetAnim 3.1062015-03-02T15:12:17Z<p>Jabraham3: /* Building and Starting NetAnim */</p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.106 and will be bundled along with > ns-3.22.<br />
NetAnim 3.106 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
** Makhtar Diouf<br />
<br />
== Changelog from 3.105 ==<br />
** Adds support for Qt 5 with gcc. Tested upto Qt 5.4<br />
** Nodes which are images(pixmaps) are positioned with their centers aligned with the node's x, y co-ordinate. Prior to this change, the node's x, y co-ordinate was aligned with the pixmap's top-left corner.<br />
** Enhancements to the early detection of invalid trace files.<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces. No support for Ipv6)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.106:<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT build tool called qmake. Qt versions from 4.7 to 5.4 are supported. Qt 5 support may not be available on OSX<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.106&diff=9340NetAnim 3.1062015-03-02T15:09:28Z<p>Jabraham3: /* Downloading NetAnim */</p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.106 and will be bundled along with > ns-3.22.<br />
NetAnim 3.106 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
** Makhtar Diouf<br />
<br />
== Changelog from 3.105 ==<br />
** Adds support for Qt 5 with gcc. Tested upto Qt 5.4<br />
** Nodes which are images(pixmaps) are positioned with their centers aligned with the node's x, y co-ordinate. Prior to this change, the node's x, y co-ordinate was aligned with the pixmap's top-left corner.<br />
** Enhancements to the early detection of invalid trace files.<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces. No support for Ipv6)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.106:<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.106&diff=9339NetAnim 3.1062015-03-02T15:06:42Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.106 and will be bundled along with > ns-3.22.<br />
NetAnim 3.106 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
** Makhtar Diouf<br />
<br />
== Changelog from 3.105 ==<br />
** Adds support for Qt 5 with gcc. Tested upto Qt 5.4<br />
** Nodes which are images(pixmaps) are positioned with their centers aligned with the node's x, y co-ordinate. Prior to this change, the node's x, y co-ordinate was aligned with the pixmap's top-left corner.<br />
** Enhancements to the early detection of invalid trace files.<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces. No support for Ipv6)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.105:<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.106&diff=9338NetAnim 3.1062015-03-02T15:06:04Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.106 and will be bundled along with > ns-3.22.<br />
NetAnim 3.105 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
** Makhtar Diouf<br />
<br />
== Changelog from 3.105 ==<br />
** Adds support for Qt 5 with gcc. Tested upto Qt 5.4<br />
** Nodes which are images(pixmaps) are positioned with their centers aligned with the node's x, y co-ordinate. Prior to this change, the node's x, y co-ordinate was aligned with the pixmap's top-left corner.<br />
** Enhancements to the early detection of invalid trace files.<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces. No support for Ipv6)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.105:<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim&diff=9337NetAnim2015-03-02T14:58:50Z<p>Jabraham3: /* NetAnim Versions */</p>
<hr />
<div>{{TOC}}<br />
<br />
NetAnim is an offline animator based on the Qt toolkit.<br />
It currently animates the simulation using an XML trace file collected during simulation. The first version was developed by George F Riley. <br />
<br />
[[Image:NetAnim3.png|thumb|The NetAnim GUI]] <br />
<br />
== NetAnim Versions == <br />
* 3.106<br />
[[ NetAnim 3.106 ]]<br />
<br />
* 3.105 bundled with ns-3.20<br />
[[ NetAnim 3.105 ]]<br />
<br />
* 3.104 bundled with ns-3.19<br />
[[ NetAnim 3.104 ]]</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.106&diff=9336NetAnim 3.1062015-03-02T14:57:54Z<p>Jabraham3: Created page with "{{TOC}} The NetAnim GUI The current release version is 3.105 and will be bundled along with ns-3.20. NetAnim 3.105 is compatible with ns-3..."</p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.105 and will be bundled along with ns-3.20.<br />
NetAnim 3.105 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces. No support for Ipv6)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.105:<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim&diff=9335NetAnim2015-03-02T14:56:05Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
NetAnim is an offline animator based on the Qt toolkit.<br />
It currently animates the simulation using an XML trace file collected during simulation. The first version was developed by George F Riley. <br />
<br />
[[Image:NetAnim3.png|thumb|The NetAnim GUI]] <br />
<br />
== NetAnim Versions == <br />
** 3.106<br />
[[ NetAnim 3.106 ]]<br />
<br />
** 3.105 bundled with ns-3.20<br />
[[ NetAnim 3.105 ]]<br />
<br />
** 3.104 bundled with ns-3.19<br />
[[ NetAnim 3.104 ]]</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim&diff=9334NetAnim2015-03-02T14:55:47Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
NetAnim is an offline animator based on the Qt 4 toolkit.<br />
It currently animates the simulation using an XML trace file collected during simulation. The first version was developed by George F Riley. <br />
<br />
[[Image:NetAnim3.png|thumb|The NetAnim GUI]] <br />
<br />
== NetAnim Versions == <br />
** 3.106<br />
[[ NetAnim 3.106 ]]<br />
<br />
** 3.105 bundled with ns-3.20<br />
[[ NetAnim 3.105 ]]<br />
<br />
** 3.104 bundled with ns-3.19<br />
[[ NetAnim 3.104 ]]</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim&diff=9126NetAnim2014-11-06T13:09:12Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
NetAnim is an offline animator based on the Qt 4 toolkit.<br />
It currently animates the simulation using an XML trace file collected during simulation. The first version was developed by George F Riley. <br />
<br />
[[Image:NetAnim3.png|thumb|The NetAnim GUI]] <br />
<br />
== NetAnim Versions == <br />
<br />
** 3.105 bundled with ns-3.20<br />
[[ NetAnim 3.105 ]]<br />
<br />
** 3.104 bundled with ns-3.19<br />
[[ NetAnim 3.104 ]]</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.105&diff=9125NetAnim 3.1052014-11-06T13:07:45Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.105 and will be bundled along with ns-3.20.<br />
NetAnim 3.105 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces. No support for Ipv6)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.105:<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.105&diff=9049NetAnim 3.1052014-09-23T13:25:47Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.105 and will be bundled along with ns-3.20.<br />
NetAnim 3.105 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces. No support for Ipv6)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.105:<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.105&diff=9048NetAnim 3.1052014-09-23T13:23:44Z<p>Jabraham3: /* Mac/OSX */</p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.105 and will be bundled along with ns-3.20.<br />
NetAnim 3.105 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces. No support for Ipv6)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
# apt-get install libqt4-dev<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt-project.org/downloads<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.105:<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.105&diff=8831NetAnim 3.1052014-06-30T00:38:20Z<p>Jabraham3: /* Debian/Ubuntu Linux distribution: */</p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.105 and will be bundled along with ns-3.20.<br />
NetAnim 3.105 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces. No support for Ipv6)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
# apt-get install libqt4-dev<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.105:<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.105&diff=8522NetAnim 3.1052014-05-02T03:35:02Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.105 and will be bundled along with ns-3.20.<br />
NetAnim 3.105 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces. No support for Ipv6)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.105:<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.105&diff=8521NetAnim 3.1052014-05-02T03:34:35Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.105 and will be bundled along with ns-3.20.<br />
NetAnim 3.105 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces. No support for Ipv6)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.0:<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.104&diff=8520NetAnim 3.1042014-05-02T03:33:41Z<p>Jabraham3: /* Downloading NetAnim */</p>
<hr />
<div>{{TOC}}<br />
<br />
NetAnim is an offline animator based on the Qt 4 toolkit.<br />
It currently animates the simulation using an XML trace file collected during simulation. The first version was developed by George F Riley. NetAnim 2 and 3 are written and maintained by John Abraham.<br />
<br />
<br />
[[Image:NetAnim3.png|thumb|The NetAnim GUI]] <br />
<br />
== Summary of features ==<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets (available only from ns-3.14 onwards)<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:Wifi2.png|thumb|left|Wifi Beacon]][[File:TCP.png|thumb|right|TCP flags]][[File:Wifi1.png|thumb|center|Wifi Assoc]]<br />
<br />
[[File:IP.png|thumb|left|IPv4 Address]][[File:MAC.png|thumb|left|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|left|Hidden node]]<br />
<br />
[http://code.nsnam.org/netanim/file/4990cf2177a1/RELEASE_NOTES 3.103 Release Notes (click here)]<br />
* Support for setting the following attributes before simulation and modifying them during simulation <br />
# P2p Link Description <br />
# Color of the nodes <br />
# Visibility of the nodes <br />
# Description of the nodes (Default is Node ID)<br />
<br />
* Built-in support for printing the IP and MAC at the interfaces. <br />
Currently if there is a text overlap, the IP/MAC text will be positioned outside the scene and connected by light blue line, to prevent clutter.<br />
* XML Tags for packet and wpacket now support "p" and "wp" respectively (instead of "packet" and "wpacket"), to save disk-space.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.104:<br />
<br />
hg clone http://code.nsnam.org/jabraham3/netanim-3.104<br />
<br />
For NetAnim on Qt 5 use<br />
<br />
hg clone http://code.nsnam.org/jabraham3/netanim-qt5<br />
<br />
* NetAnim 2.0: <br />
Go to this link [[NetAnim2]] <br />
<br />
* NetAnim 1.0:<br />
Go to this link [[NetAnim 1.0]]<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
* Here is a youtube video demonstrating Animation for Wired transmission [http://www.youtube.com/watch?v=ZQ2yMKZRAfM click here]<br />
* Here is a youtube video demonstrating Animation for Wireless transmission [http://www.youtube.com/watch?v=-dZcMhdULmw click here]<br />
* Here is a youtube video demonstrating Animation for Node trajectory [http://www.youtube.com/watch?v=jYRxDzeWxkA click here]<br />
<br />
==== The update rate slider ====<br />
<br />
* Update rate slider: [[File:Updaterate.png]]<br />
This slider controls the interval between updating animation. If it is low, more packets will be animated, but the simulation progress will be slow<br />
<font color=red>'''If it is high, some packets may get skipped, although the simulation may progress faster. <br />
'''</font color><br />
<br />
NetAnim uses the first/last bit transmit and receive time to show animations accurately. So if you can pick up your physical cable (assume it is transparent) and can see packets flowing then you can see it with NetAnim as well. But often, the low application data-rate or high bandwidth/low propagation delay links may make it impossible to see packets flowing because they travel really fast.<br />
In such situations (especially wireless and CSMA) use the "update rate interval" slider to slow down the animation. Also toggle the precision button, to downgrade the precision for CSMA links<br />
<br />
== Understanding the XML trace file format ==<br />
=== Parts of the XML ===<br />
The XML trace files has the following main sections<br />
# Topology<br />
## Nodes<br />
## Links<br />
# packets (packets over wired-links)<br />
# wpackets (packets over wireless-links.LTE not supported)<br />
<br />
=== XML tags ===<br />
Nodes are identified by their unique Node id.<br />
The XML begins with the "information" element describing the rest of the elements<br />
<br />
==== <anim> element ====<br />
This is the XML root element. All other elements fall within this element<br />
Attributes are:<br />
lp = Logical Processor Id (Used for distributed simulations only)<br />
<br />
==== <topology> element ====<br />
This elements contains the Node and Link elements.It describes, the <br />
co-ordinates of the canvas used for animation.<br />
<br />
Attributes are:<br />
minX = minimum X coordinate of the animation canvas<br />
minY = minimum Y coordinate of the animation canvas<br />
maxX = maximum X coordinate of the animation canvas<br />
maxY = maximum Y coordinate of the animation canvas<br />
<br />
Example:<br />
<topology minX = "-6.42025" minY = "-6.48444" maxX = "186.187" maxY = "188.049"><br />
<br />
==== <node> element ====<br />
This element describes each Node's Id and X,Y co-ordinate (position)<br />
<br />
Attributes are:<br />
lp = Logical Processor Id (Used for distributed simulations only)<br />
id = Node Id<br />
locX = X coordinate<br />
locY = Y coordinate<br />
<br />
Example: <br />
<node lp = "0" id = "8" locX = "107.599" locY = "96.9366" /><br />
<br />
==== <link> element ====<br />
This element describes wired links between two nodes.<br />
<br />
Attributes are:<br />
fromLp = From logical processor Id (Used for distributed simulations only)<br />
fromId = From Node Id (first node id)<br />
toLp = To logical processor Id<br />
toId = To Node Id (second node id)<br />
<br />
Example:<br />
<link fromLp="0" fromId="0" toLp="0" toId="1"/><br />
<br />
==== <packet> element ====<br />
This element describes a packet over wired links being transmitted at some node and received at another<br />
The reception details is described in it associated rx element<br />
<br />
Attributes are:<br />
fromLp = From logical processor Id (Used for distributed simulations only)<br />
fromId = Node Id transmitting the packet<br />
fbTx = First bit transmit time of the packet<br />
lbTx = Last bit transmit time of the packet<br />
<br />
Example: <br />
<packet fromLp="0" fromId="1" fbTx="1" lbTx="1.000067199"><rx toLp="0" toId="0" fbRx="1.002" lbRx="1.002067199"/><br />
Packet over wired-links from Node 1 was received at Node 0. The first bit of the packet was transmitted at the 1th second, the last bit was transmitted at the <br />
1.000067199th second of the simulation<br />
Node 0 received the first bit of the packet at the 1.002th second and the last bit of the packet at the 1.002067199th second of the simulation<br />
<br />
NOTE: A packet with fromId == toId is a dummy packet used internally by the AnimationInterface.Please ignore this packet<br />
<br />
===== <rx> element =====<br />
This element describes the reception of a packet at a node<br />
<br />
Attributes are:<br />
toLp = To logical processor Id<br />
toId = Node Id receiving the packet<br />
fbRx = First bit Reception Time of the packet<br />
lbRx = Last bit Reception Time of the packet<br />
<br />
==== <wpacket> element ====<br />
This element describes a packet over wireless links being transmitted at some node and received at another<br />
The reception details is described in it associated rx element<br />
<br />
Attributes are:<br />
fromLp = From logical processor Id (Used in distributed simulations only)<br />
fromId = Node Id transmitting the packet<br />
fbTx = First bit transmit time of the packet<br />
lbTx = Last bit transmit time of the packet<br />
range = Range of the transmission<br />
<br />
Example:<br />
<wpacket fromLp = "0" fromId = "20" fbTx = "0.003" lbTx = "0.003254" range = "59.68176982"><br />
<rx toLp="0" toId="32" fbRx="0.003000198" lbRx="0.003254198"/><br />
Packet over wireless-links from Node 20 was received at Node 32. The first bit of the packet was transmitted at the 0.003th second, <br />
the last bit was transmitted at the <br />
0.003254 second of the simulation<br />
Node 0 received the first bit of the packet at the 0.003000198 second and the last bit of the packet at the 0.003254198 second of the simulation<br />
<br />
== F.A.Q ==<br />
* I can see the nodes and topology but cannot see packets animated<br />
>> NetAnim uses the first/last bit transmit and receive time to show animations accurately. So if you can pick up your physical cable (assume it is transparent) and can see packets flowing then you can see it with NetAnim as well. But often, the low application data-rate or high bandwidth/low propagation delay links may make it impossible to see packets flowing because they travel really fast.<br />
In such situations (especially wireless and CSMA) use the "update rate interval" slider to slow down the animation. Also toggle the precision button, to downgrade the precision for CSMA links<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.104&diff=8519NetAnim 3.1042014-05-02T03:33:05Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
NetAnim is an offline animator based on the Qt 4 toolkit.<br />
It currently animates the simulation using an XML trace file collected during simulation. The first version was developed by George F Riley. NetAnim 2 and 3 are written and maintained by John Abraham.<br />
<br />
<br />
[[Image:NetAnim3.png|thumb|The NetAnim GUI]] <br />
<br />
== Summary of features ==<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets (available only from ns-3.14 onwards)<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:Wifi2.png|thumb|left|Wifi Beacon]][[File:TCP.png|thumb|right|TCP flags]][[File:Wifi1.png|thumb|center|Wifi Assoc]]<br />
<br />
[[File:IP.png|thumb|left|IPv4 Address]][[File:MAC.png|thumb|left|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|left|Hidden node]]<br />
<br />
[http://code.nsnam.org/netanim/file/4990cf2177a1/RELEASE_NOTES 3.103 Release Notes (click here)]<br />
* Support for setting the following attributes before simulation and modifying them during simulation <br />
# P2p Link Description <br />
# Color of the nodes <br />
# Visibility of the nodes <br />
# Description of the nodes (Default is Node ID)<br />
<br />
* Built-in support for printing the IP and MAC at the interfaces. <br />
Currently if there is a text overlap, the IP/MAC text will be positioned outside the scene and connected by light blue line, to prevent clutter.<br />
* XML Tags for packet and wpacket now support "p" and "wp" respectively (instead of "packet" and "wpacket"), to save disk-space.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.0:<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
For NetAnim on Qt 5 use<br />
<br />
hg clone http://code.nsnam.org/jabraham3/netanim-qt5<br />
<br />
* NetAnim 2.0: <br />
Go to this link [[NetAnim2]] <br />
<br />
* NetAnim 1.0:<br />
Go to this link [[NetAnim 1.0]]<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
* Here is a youtube video demonstrating Animation for Wired transmission [http://www.youtube.com/watch?v=ZQ2yMKZRAfM click here]<br />
* Here is a youtube video demonstrating Animation for Wireless transmission [http://www.youtube.com/watch?v=-dZcMhdULmw click here]<br />
* Here is a youtube video demonstrating Animation for Node trajectory [http://www.youtube.com/watch?v=jYRxDzeWxkA click here]<br />
<br />
==== The update rate slider ====<br />
<br />
* Update rate slider: [[File:Updaterate.png]]<br />
This slider controls the interval between updating animation. If it is low, more packets will be animated, but the simulation progress will be slow<br />
<font color=red>'''If it is high, some packets may get skipped, although the simulation may progress faster. <br />
'''</font color><br />
<br />
NetAnim uses the first/last bit transmit and receive time to show animations accurately. So if you can pick up your physical cable (assume it is transparent) and can see packets flowing then you can see it with NetAnim as well. But often, the low application data-rate or high bandwidth/low propagation delay links may make it impossible to see packets flowing because they travel really fast.<br />
In such situations (especially wireless and CSMA) use the "update rate interval" slider to slow down the animation. Also toggle the precision button, to downgrade the precision for CSMA links<br />
<br />
== Understanding the XML trace file format ==<br />
=== Parts of the XML ===<br />
The XML trace files has the following main sections<br />
# Topology<br />
## Nodes<br />
## Links<br />
# packets (packets over wired-links)<br />
# wpackets (packets over wireless-links.LTE not supported)<br />
<br />
=== XML tags ===<br />
Nodes are identified by their unique Node id.<br />
The XML begins with the "information" element describing the rest of the elements<br />
<br />
==== <anim> element ====<br />
This is the XML root element. All other elements fall within this element<br />
Attributes are:<br />
lp = Logical Processor Id (Used for distributed simulations only)<br />
<br />
==== <topology> element ====<br />
This elements contains the Node and Link elements.It describes, the <br />
co-ordinates of the canvas used for animation.<br />
<br />
Attributes are:<br />
minX = minimum X coordinate of the animation canvas<br />
minY = minimum Y coordinate of the animation canvas<br />
maxX = maximum X coordinate of the animation canvas<br />
maxY = maximum Y coordinate of the animation canvas<br />
<br />
Example:<br />
<topology minX = "-6.42025" minY = "-6.48444" maxX = "186.187" maxY = "188.049"><br />
<br />
==== <node> element ====<br />
This element describes each Node's Id and X,Y co-ordinate (position)<br />
<br />
Attributes are:<br />
lp = Logical Processor Id (Used for distributed simulations only)<br />
id = Node Id<br />
locX = X coordinate<br />
locY = Y coordinate<br />
<br />
Example: <br />
<node lp = "0" id = "8" locX = "107.599" locY = "96.9366" /><br />
<br />
==== <link> element ====<br />
This element describes wired links between two nodes.<br />
<br />
Attributes are:<br />
fromLp = From logical processor Id (Used for distributed simulations only)<br />
fromId = From Node Id (first node id)<br />
toLp = To logical processor Id<br />
toId = To Node Id (second node id)<br />
<br />
Example:<br />
<link fromLp="0" fromId="0" toLp="0" toId="1"/><br />
<br />
==== <packet> element ====<br />
This element describes a packet over wired links being transmitted at some node and received at another<br />
The reception details is described in it associated rx element<br />
<br />
Attributes are:<br />
fromLp = From logical processor Id (Used for distributed simulations only)<br />
fromId = Node Id transmitting the packet<br />
fbTx = First bit transmit time of the packet<br />
lbTx = Last bit transmit time of the packet<br />
<br />
Example: <br />
<packet fromLp="0" fromId="1" fbTx="1" lbTx="1.000067199"><rx toLp="0" toId="0" fbRx="1.002" lbRx="1.002067199"/><br />
Packet over wired-links from Node 1 was received at Node 0. The first bit of the packet was transmitted at the 1th second, the last bit was transmitted at the <br />
1.000067199th second of the simulation<br />
Node 0 received the first bit of the packet at the 1.002th second and the last bit of the packet at the 1.002067199th second of the simulation<br />
<br />
NOTE: A packet with fromId == toId is a dummy packet used internally by the AnimationInterface.Please ignore this packet<br />
<br />
===== <rx> element =====<br />
This element describes the reception of a packet at a node<br />
<br />
Attributes are:<br />
toLp = To logical processor Id<br />
toId = Node Id receiving the packet<br />
fbRx = First bit Reception Time of the packet<br />
lbRx = Last bit Reception Time of the packet<br />
<br />
==== <wpacket> element ====<br />
This element describes a packet over wireless links being transmitted at some node and received at another<br />
The reception details is described in it associated rx element<br />
<br />
Attributes are:<br />
fromLp = From logical processor Id (Used in distributed simulations only)<br />
fromId = Node Id transmitting the packet<br />
fbTx = First bit transmit time of the packet<br />
lbTx = Last bit transmit time of the packet<br />
range = Range of the transmission<br />
<br />
Example:<br />
<wpacket fromLp = "0" fromId = "20" fbTx = "0.003" lbTx = "0.003254" range = "59.68176982"><br />
<rx toLp="0" toId="32" fbRx="0.003000198" lbRx="0.003254198"/><br />
Packet over wireless-links from Node 20 was received at Node 32. The first bit of the packet was transmitted at the 0.003th second, <br />
the last bit was transmitted at the <br />
0.003254 second of the simulation<br />
Node 0 received the first bit of the packet at the 0.003000198 second and the last bit of the packet at the 0.003254198 second of the simulation<br />
<br />
== F.A.Q ==<br />
* I can see the nodes and topology but cannot see packets animated<br />
>> NetAnim uses the first/last bit transmit and receive time to show animations accurately. So if you can pick up your physical cable (assume it is transparent) and can see packets flowing then you can see it with NetAnim as well. But often, the low application data-rate or high bandwidth/low propagation delay links may make it impossible to see packets flowing because they travel really fast.<br />
In such situations (especially wireless and CSMA) use the "update rate interval" slider to slow down the animation. Also toggle the precision button, to downgrade the precision for CSMA links<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.104&diff=8518NetAnim 3.1042014-05-02T03:32:19Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
NetAnim is an offline animator based on the Qt 4 toolkit.<br />
It currently animates the simulation using an XML trace file collected during simulation. The first version was developed by George F Riley. NetAnim 2 and 3 are written and maintained by John Abraham.<br />
<br />
<br />
[[Image:NetAnim3.png|thumb|The NetAnim GUI]] <br />
<br />
== Summary of features ==<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets (available only from ns-3.14 onwards)<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:Wifi2.png|thumb|left|Wifi Beacon]][[File:TCP.png|thumb|right|TCP flags]][[File:Wifi1.png|thumb|center|Wifi Assoc]]<br />
<br />
== New Features in NetAnim 3.104 ==<br />
[[ NetAnim 3.104 ]]<br />
<br />
== New Features in NetAnim 3.103 ==<br />
[[File:IP.png|thumb|left|IPv4 Address]][[File:MAC.png|thumb|left|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|left|Hidden node]]<br />
<br />
[http://code.nsnam.org/netanim/file/4990cf2177a1/RELEASE_NOTES 3.103 Release Notes (click here)]<br />
* Support for setting the following attributes before simulation and modifying them during simulation <br />
# P2p Link Description <br />
# Color of the nodes <br />
# Visibility of the nodes <br />
# Description of the nodes (Default is Node ID)<br />
<br />
* Built-in support for printing the IP and MAC at the interfaces. <br />
Currently if there is a text overlap, the IP/MAC text will be positioned outside the scene and connected by light blue line, to prevent clutter.<br />
* XML Tags for packet and wpacket now support "p" and "wp" respectively (instead of "packet" and "wpacket"), to save disk-space.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.0:<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
For NetAnim on Qt 5 use<br />
<br />
hg clone http://code.nsnam.org/jabraham3/netanim-qt5<br />
<br />
* NetAnim 2.0: <br />
Go to this link [[NetAnim2]] <br />
<br />
* NetAnim 1.0:<br />
Go to this link [[NetAnim 1.0]]<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
* Here is a youtube video demonstrating Animation for Wired transmission [http://www.youtube.com/watch?v=ZQ2yMKZRAfM click here]<br />
* Here is a youtube video demonstrating Animation for Wireless transmission [http://www.youtube.com/watch?v=-dZcMhdULmw click here]<br />
* Here is a youtube video demonstrating Animation for Node trajectory [http://www.youtube.com/watch?v=jYRxDzeWxkA click here]<br />
<br />
==== The update rate slider ====<br />
<br />
* Update rate slider: [[File:Updaterate.png]]<br />
This slider controls the interval between updating animation. If it is low, more packets will be animated, but the simulation progress will be slow<br />
<font color=red>'''If it is high, some packets may get skipped, although the simulation may progress faster. <br />
'''</font color><br />
<br />
NetAnim uses the first/last bit transmit and receive time to show animations accurately. So if you can pick up your physical cable (assume it is transparent) and can see packets flowing then you can see it with NetAnim as well. But often, the low application data-rate or high bandwidth/low propagation delay links may make it impossible to see packets flowing because they travel really fast.<br />
In such situations (especially wireless and CSMA) use the "update rate interval" slider to slow down the animation. Also toggle the precision button, to downgrade the precision for CSMA links<br />
<br />
== Understanding the XML trace file format ==<br />
=== Parts of the XML ===<br />
The XML trace files has the following main sections<br />
# Topology<br />
## Nodes<br />
## Links<br />
# packets (packets over wired-links)<br />
# wpackets (packets over wireless-links.LTE not supported)<br />
<br />
=== XML tags ===<br />
Nodes are identified by their unique Node id.<br />
The XML begins with the "information" element describing the rest of the elements<br />
<br />
==== <anim> element ====<br />
This is the XML root element. All other elements fall within this element<br />
Attributes are:<br />
lp = Logical Processor Id (Used for distributed simulations only)<br />
<br />
==== <topology> element ====<br />
This elements contains the Node and Link elements.It describes, the <br />
co-ordinates of the canvas used for animation.<br />
<br />
Attributes are:<br />
minX = minimum X coordinate of the animation canvas<br />
minY = minimum Y coordinate of the animation canvas<br />
maxX = maximum X coordinate of the animation canvas<br />
maxY = maximum Y coordinate of the animation canvas<br />
<br />
Example:<br />
<topology minX = "-6.42025" minY = "-6.48444" maxX = "186.187" maxY = "188.049"><br />
<br />
==== <node> element ====<br />
This element describes each Node's Id and X,Y co-ordinate (position)<br />
<br />
Attributes are:<br />
lp = Logical Processor Id (Used for distributed simulations only)<br />
id = Node Id<br />
locX = X coordinate<br />
locY = Y coordinate<br />
<br />
Example: <br />
<node lp = "0" id = "8" locX = "107.599" locY = "96.9366" /><br />
<br />
==== <link> element ====<br />
This element describes wired links between two nodes.<br />
<br />
Attributes are:<br />
fromLp = From logical processor Id (Used for distributed simulations only)<br />
fromId = From Node Id (first node id)<br />
toLp = To logical processor Id<br />
toId = To Node Id (second node id)<br />
<br />
Example:<br />
<link fromLp="0" fromId="0" toLp="0" toId="1"/><br />
<br />
==== <packet> element ====<br />
This element describes a packet over wired links being transmitted at some node and received at another<br />
The reception details is described in it associated rx element<br />
<br />
Attributes are:<br />
fromLp = From logical processor Id (Used for distributed simulations only)<br />
fromId = Node Id transmitting the packet<br />
fbTx = First bit transmit time of the packet<br />
lbTx = Last bit transmit time of the packet<br />
<br />
Example: <br />
<packet fromLp="0" fromId="1" fbTx="1" lbTx="1.000067199"><rx toLp="0" toId="0" fbRx="1.002" lbRx="1.002067199"/><br />
Packet over wired-links from Node 1 was received at Node 0. The first bit of the packet was transmitted at the 1th second, the last bit was transmitted at the <br />
1.000067199th second of the simulation<br />
Node 0 received the first bit of the packet at the 1.002th second and the last bit of the packet at the 1.002067199th second of the simulation<br />
<br />
NOTE: A packet with fromId == toId is a dummy packet used internally by the AnimationInterface.Please ignore this packet<br />
<br />
===== <rx> element =====<br />
This element describes the reception of a packet at a node<br />
<br />
Attributes are:<br />
toLp = To logical processor Id<br />
toId = Node Id receiving the packet<br />
fbRx = First bit Reception Time of the packet<br />
lbRx = Last bit Reception Time of the packet<br />
<br />
==== <wpacket> element ====<br />
This element describes a packet over wireless links being transmitted at some node and received at another<br />
The reception details is described in it associated rx element<br />
<br />
Attributes are:<br />
fromLp = From logical processor Id (Used in distributed simulations only)<br />
fromId = Node Id transmitting the packet<br />
fbTx = First bit transmit time of the packet<br />
lbTx = Last bit transmit time of the packet<br />
range = Range of the transmission<br />
<br />
Example:<br />
<wpacket fromLp = "0" fromId = "20" fbTx = "0.003" lbTx = "0.003254" range = "59.68176982"><br />
<rx toLp="0" toId="32" fbRx="0.003000198" lbRx="0.003254198"/><br />
Packet over wireless-links from Node 20 was received at Node 32. The first bit of the packet was transmitted at the 0.003th second, <br />
the last bit was transmitted at the <br />
0.003254 second of the simulation<br />
Node 0 received the first bit of the packet at the 0.003000198 second and the last bit of the packet at the 0.003254198 second of the simulation<br />
<br />
== F.A.Q ==<br />
* I can see the nodes and topology but cannot see packets animated<br />
>> NetAnim uses the first/last bit transmit and receive time to show animations accurately. So if you can pick up your physical cable (assume it is transparent) and can see packets flowing then you can see it with NetAnim as well. But often, the low application data-rate or high bandwidth/low propagation delay links may make it impossible to see packets flowing because they travel really fast.<br />
In such situations (especially wireless and CSMA) use the "update rate interval" slider to slow down the animation. Also toggle the precision button, to downgrade the precision for CSMA links<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.105&diff=8345NetAnim 3.1052014-02-10T13:16:32Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.105 and will be bundled along with ns-3.20.<br />
NetAnim 3.105 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces. No support for Ipv6)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.0:<br />
<br />
hg clone http://code.nsnam.org/jabraham3/netanim-3.105<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=File:NetAnim.3.105.png&diff=8344File:NetAnim.3.105.png2014-02-09T01:04:41Z<p>Jabraham3: </p>
<hr />
<div></div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.105&diff=8343NetAnim 3.1052014-02-09T01:02:56Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: netAnim.3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.105 and will be bundled along with ns-3.20.<br />
NetAnim 3.105 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.0:<br />
<br />
hg clone http://code.nsnam.org/jabraham3/netanim-3.105<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.105&diff=8342NetAnim 3.1052014-02-09T01:02:16Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: NetAnim_3.105.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.105 and will be bundled along with ns-3.20.<br />
NetAnim 3.105 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.0:<br />
<br />
hg clone http://code.nsnam.org/jabraham3/netanim-3.105<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.105&diff=8337NetAnim 3.1052014-02-07T08:05:31Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: NetAnim_3.105_Gui.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.105 and will be bundled along with ns-3.20.<br />
NetAnim 3.105 is compatible with ns-3-dev.<br />
* Contributors:<br />
** John Abraham<br />
** Evegeny Kalishenko (Battery Visualization)<br />
** Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.0:<br />
<br />
hg clone http://code.nsnam.org/jabraham3/netanim-3.105<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim&diff=8336NetAnim2014-02-07T08:04:40Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
NetAnim is an offline animator based on the Qt 4 toolkit.<br />
It currently animates the simulation using an XML trace file collected during simulation. The first version was developed by George F Riley. <br />
<br />
[[Image:NetAnim3.png|thumb|The NetAnim GUI]] <br />
<br />
== NetAnim Versions == <br />
* Current Stable bundled with ns-3.19<br />
[[ NetAnim 3.104 ]]<br />
** Unstable-compatible with ns-3-dev<br />
[[ NetAnim 3.105 ]]</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim&diff=8335NetAnim2014-02-07T08:04:09Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
NetAnim is an offline animator based on the Qt 4 toolkit.<br />
It currently animates the simulation using an XML trace file collected during simulation. The first version was developed by George F Riley. <br />
<br />
[[Image:NetAnim3.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.103 bundled with ns-3.16<br />
<br />
== NetAnim Versions == <br />
* Current Stable<br />
[[ NetAnim 3.104 ]]<br />
** Unstable-compatible with ns-3-dev<br />
[[ NetAnim 3.105 ]]</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim&diff=8334NetAnim2014-02-07T08:02:32Z<p>Jabraham3: Replaced content with "{{TOC}} NetAnim is an offline animator based on the Qt 4 toolkit. It currently animates the simulation using an XML trace file collected during simulation. The first vers..."</p>
<hr />
<div>{{TOC}}<br />
<br />
NetAnim is an offline animator based on the Qt 4 toolkit.<br />
It currently animates the simulation using an XML trace file collected during simulation. The first version was developed by George F Riley. NetAnim 2 and 3 are written and maintained by John Abraham.<br />
<br />
<br />
<br />
<br />
<br />
<br />
[[Image:NetAnim3.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.103 bundled with ns-3.16<br />
<br />
== NetAnim Versions == <br />
* Current Stable<br />
[[ NetAnim 3.104 ]]<br />
** Unstable-compatible with ns-3-dev<br />
[[ NetAnim 3.105 ]]</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim&diff=8333NetAnim2014-02-07T08:01:53Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
NetAnim is an offline animator based on the Qt 4 toolkit.<br />
It currently animates the simulation using an XML trace file collected during simulation. The first version was developed by George F Riley. NetAnim 2 and 3 are written and maintained by John Abraham.<br />
<br />
<br />
<br />
<br />
<br />
<br />
[[Image:NetAnim3.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.103 bundled with ns-3.16<br />
<br />
== NetAnim Versions == <br />
* Current Stable<br />
[[ NetAnim 3.104 ]]<br />
** Unstable-compatible with ns-3-dev<br />
[[ NetAnim 3.105 ]]<br />
<br />
== Summary of features ==<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets (available only from ns-3.14 onwards)<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:Wifi2.png|thumb|left|Wifi Beacon]][[File:TCP.png|thumb|right|TCP flags]][[File:Wifi1.png|thumb|center|Wifi Assoc]]<br />
<br />
== New Features in NetAnim 3.105 ==<br />
[[ NetAnim 3.105 ]]<br />
== New Features in NetAnim 3.104 ==<br />
[[ NetAnim 3.104 ]]<br />
<br />
== New Features in NetAnim 3.103 ==<br />
[[File:IP.png|thumb|left|IPv4 Address]][[File:MAC.png|thumb|left|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|left|Hidden node]]<br />
<br />
[http://code.nsnam.org/netanim/file/4990cf2177a1/RELEASE_NOTES 3.103 Release Notes (click here)]<br />
* Support for setting the following attributes before simulation and modifying them during simulation <br />
# P2p Link Description <br />
# Color of the nodes <br />
# Visibility of the nodes <br />
# Description of the nodes (Default is Node ID)<br />
<br />
* Built-in support for printing the IP and MAC at the interfaces. <br />
Currently if there is a text overlap, the IP/MAC text will be positioned outside the scene and connected by light blue line, to prevent clutter.<br />
* XML Tags for packet and wpacket now support "p" and "wp" respectively (instead of "packet" and "wpacket"), to save disk-space.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.0:<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
For NetAnim on Qt 5 use<br />
<br />
hg clone http://code.nsnam.org/jabraham3/netanim-qt5<br />
<br />
* NetAnim 2.0: <br />
Go to this link [[NetAnim2]] <br />
<br />
* NetAnim 1.0:<br />
Go to this link [[NetAnim 1.0]]<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
* Here is a youtube video demonstrating Animation for Wired transmission [http://www.youtube.com/watch?v=ZQ2yMKZRAfM click here]<br />
* Here is a youtube video demonstrating Animation for Wireless transmission [http://www.youtube.com/watch?v=-dZcMhdULmw click here]<br />
* Here is a youtube video demonstrating Animation for Node trajectory [http://www.youtube.com/watch?v=jYRxDzeWxkA click here]<br />
<br />
==== The update rate slider ====<br />
<br />
* Update rate slider: [[File:Updaterate.png]]<br />
This slider controls the interval between updating animation. If it is low, more packets will be animated, but the simulation progress will be slow<br />
<font color=red>'''If it is high, some packets may get skipped, although the simulation may progress faster. <br />
'''</font color><br />
<br />
NetAnim uses the first/last bit transmit and receive time to show animations accurately. So if you can pick up your physical cable (assume it is transparent) and can see packets flowing then you can see it with NetAnim as well. But often, the low application data-rate or high bandwidth/low propagation delay links may make it impossible to see packets flowing because they travel really fast.<br />
In such situations (especially wireless and CSMA) use the "update rate interval" slider to slow down the animation. Also toggle the precision button, to downgrade the precision for CSMA links<br />
<br />
== Understanding the XML trace file format ==<br />
=== Parts of the XML ===<br />
The XML trace files has the following main sections<br />
# Topology<br />
## Nodes<br />
## Links<br />
# packets (packets over wired-links)<br />
# wpackets (packets over wireless-links.LTE not supported)<br />
<br />
=== XML tags ===<br />
Nodes are identified by their unique Node id.<br />
The XML begins with the "information" element describing the rest of the elements<br />
<br />
==== <anim> element ====<br />
This is the XML root element. All other elements fall within this element<br />
Attributes are:<br />
lp = Logical Processor Id (Used for distributed simulations only)<br />
<br />
==== <topology> element ====<br />
This elements contains the Node and Link elements.It describes, the <br />
co-ordinates of the canvas used for animation.<br />
<br />
Attributes are:<br />
minX = minimum X coordinate of the animation canvas<br />
minY = minimum Y coordinate of the animation canvas<br />
maxX = maximum X coordinate of the animation canvas<br />
maxY = maximum Y coordinate of the animation canvas<br />
<br />
Example:<br />
<topology minX = "-6.42025" minY = "-6.48444" maxX = "186.187" maxY = "188.049"><br />
<br />
==== <node> element ====<br />
This element describes each Node's Id and X,Y co-ordinate (position)<br />
<br />
Attributes are:<br />
lp = Logical Processor Id (Used for distributed simulations only)<br />
id = Node Id<br />
locX = X coordinate<br />
locY = Y coordinate<br />
<br />
Example: <br />
<node lp = "0" id = "8" locX = "107.599" locY = "96.9366" /><br />
<br />
==== <link> element ====<br />
This element describes wired links between two nodes.<br />
<br />
Attributes are:<br />
fromLp = From logical processor Id (Used for distributed simulations only)<br />
fromId = From Node Id (first node id)<br />
toLp = To logical processor Id<br />
toId = To Node Id (second node id)<br />
<br />
Example:<br />
<link fromLp="0" fromId="0" toLp="0" toId="1"/><br />
<br />
==== <packet> element ====<br />
This element describes a packet over wired links being transmitted at some node and received at another<br />
The reception details is described in it associated rx element<br />
<br />
Attributes are:<br />
fromLp = From logical processor Id (Used for distributed simulations only)<br />
fromId = Node Id transmitting the packet<br />
fbTx = First bit transmit time of the packet<br />
lbTx = Last bit transmit time of the packet<br />
<br />
Example: <br />
<packet fromLp="0" fromId="1" fbTx="1" lbTx="1.000067199"><rx toLp="0" toId="0" fbRx="1.002" lbRx="1.002067199"/><br />
Packet over wired-links from Node 1 was received at Node 0. The first bit of the packet was transmitted at the 1th second, the last bit was transmitted at the <br />
1.000067199th second of the simulation<br />
Node 0 received the first bit of the packet at the 1.002th second and the last bit of the packet at the 1.002067199th second of the simulation<br />
<br />
NOTE: A packet with fromId == toId is a dummy packet used internally by the AnimationInterface.Please ignore this packet<br />
<br />
===== <rx> element =====<br />
This element describes the reception of a packet at a node<br />
<br />
Attributes are:<br />
toLp = To logical processor Id<br />
toId = Node Id receiving the packet<br />
fbRx = First bit Reception Time of the packet<br />
lbRx = Last bit Reception Time of the packet<br />
<br />
==== <wpacket> element ====<br />
This element describes a packet over wireless links being transmitted at some node and received at another<br />
The reception details is described in it associated rx element<br />
<br />
Attributes are:<br />
fromLp = From logical processor Id (Used in distributed simulations only)<br />
fromId = Node Id transmitting the packet<br />
fbTx = First bit transmit time of the packet<br />
lbTx = Last bit transmit time of the packet<br />
range = Range of the transmission<br />
<br />
Example:<br />
<wpacket fromLp = "0" fromId = "20" fbTx = "0.003" lbTx = "0.003254" range = "59.68176982"><br />
<rx toLp="0" toId="32" fbRx="0.003000198" lbRx="0.003254198"/><br />
Packet over wireless-links from Node 20 was received at Node 32. The first bit of the packet was transmitted at the 0.003th second, <br />
the last bit was transmitted at the <br />
0.003254 second of the simulation<br />
Node 0 received the first bit of the packet at the 0.003000198 second and the last bit of the packet at the 0.003254198 second of the simulation<br />
<br />
== F.A.Q ==<br />
* I can see the nodes and topology but cannot see packets animated<br />
>> NetAnim uses the first/last bit transmit and receive time to show animations accurately. So if you can pick up your physical cable (assume it is transparent) and can see packets flowing then you can see it with NetAnim as well. But often, the low application data-rate or high bandwidth/low propagation delay links may make it impossible to see packets flowing because they travel really fast.<br />
In such situations (especially wireless and CSMA) use the "update rate interval" slider to slow down the animation. Also toggle the precision button, to downgrade the precision for CSMA links<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim&diff=8332NetAnim2014-02-07T08:00:39Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
NetAnim is an offline animator based on the Qt 4 toolkit.<br />
It currently animates the simulation using an XML trace file collected during simulation. The first version was developed by George F Riley. NetAnim 2 and 3 are written and maintained by John Abraham.<br />
<br />
[[ NetAnim 3.104 ]]<br />
[[ NetAnim 3.105 ]]<br />
<br />
<br />
<br />
<br />
[[Image:NetAnim3.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.103 bundled with ns-3.16<br />
<br />
== Summary of features ==<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets (available only from ns-3.14 onwards)<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:Wifi2.png|thumb|left|Wifi Beacon]][[File:TCP.png|thumb|right|TCP flags]][[File:Wifi1.png|thumb|center|Wifi Assoc]]<br />
<br />
== New Features in NetAnim 3.105 ==<br />
[[ NetAnim 3.105 ]]<br />
== New Features in NetAnim 3.104 ==<br />
[[ NetAnim 3.104 ]]<br />
<br />
== New Features in NetAnim 3.103 ==<br />
[[File:IP.png|thumb|left|IPv4 Address]][[File:MAC.png|thumb|left|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|left|Hidden node]]<br />
<br />
[http://code.nsnam.org/netanim/file/4990cf2177a1/RELEASE_NOTES 3.103 Release Notes (click here)]<br />
* Support for setting the following attributes before simulation and modifying them during simulation <br />
# P2p Link Description <br />
# Color of the nodes <br />
# Visibility of the nodes <br />
# Description of the nodes (Default is Node ID)<br />
<br />
* Built-in support for printing the IP and MAC at the interfaces. <br />
Currently if there is a text overlap, the IP/MAC text will be positioned outside the scene and connected by light blue line, to prevent clutter.<br />
* XML Tags for packet and wpacket now support "p" and "wp" respectively (instead of "packet" and "wpacket"), to save disk-space.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.0:<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
For NetAnim on Qt 5 use<br />
<br />
hg clone http://code.nsnam.org/jabraham3/netanim-qt5<br />
<br />
* NetAnim 2.0: <br />
Go to this link [[NetAnim2]] <br />
<br />
* NetAnim 1.0:<br />
Go to this link [[NetAnim 1.0]]<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
* Here is a youtube video demonstrating Animation for Wired transmission [http://www.youtube.com/watch?v=ZQ2yMKZRAfM click here]<br />
* Here is a youtube video demonstrating Animation for Wireless transmission [http://www.youtube.com/watch?v=-dZcMhdULmw click here]<br />
* Here is a youtube video demonstrating Animation for Node trajectory [http://www.youtube.com/watch?v=jYRxDzeWxkA click here]<br />
<br />
==== The update rate slider ====<br />
<br />
* Update rate slider: [[File:Updaterate.png]]<br />
This slider controls the interval between updating animation. If it is low, more packets will be animated, but the simulation progress will be slow<br />
<font color=red>'''If it is high, some packets may get skipped, although the simulation may progress faster. <br />
'''</font color><br />
<br />
NetAnim uses the first/last bit transmit and receive time to show animations accurately. So if you can pick up your physical cable (assume it is transparent) and can see packets flowing then you can see it with NetAnim as well. But often, the low application data-rate or high bandwidth/low propagation delay links may make it impossible to see packets flowing because they travel really fast.<br />
In such situations (especially wireless and CSMA) use the "update rate interval" slider to slow down the animation. Also toggle the precision button, to downgrade the precision for CSMA links<br />
<br />
== Understanding the XML trace file format ==<br />
=== Parts of the XML ===<br />
The XML trace files has the following main sections<br />
# Topology<br />
## Nodes<br />
## Links<br />
# packets (packets over wired-links)<br />
# wpackets (packets over wireless-links.LTE not supported)<br />
<br />
=== XML tags ===<br />
Nodes are identified by their unique Node id.<br />
The XML begins with the "information" element describing the rest of the elements<br />
<br />
==== <anim> element ====<br />
This is the XML root element. All other elements fall within this element<br />
Attributes are:<br />
lp = Logical Processor Id (Used for distributed simulations only)<br />
<br />
==== <topology> element ====<br />
This elements contains the Node and Link elements.It describes, the <br />
co-ordinates of the canvas used for animation.<br />
<br />
Attributes are:<br />
minX = minimum X coordinate of the animation canvas<br />
minY = minimum Y coordinate of the animation canvas<br />
maxX = maximum X coordinate of the animation canvas<br />
maxY = maximum Y coordinate of the animation canvas<br />
<br />
Example:<br />
<topology minX = "-6.42025" minY = "-6.48444" maxX = "186.187" maxY = "188.049"><br />
<br />
==== <node> element ====<br />
This element describes each Node's Id and X,Y co-ordinate (position)<br />
<br />
Attributes are:<br />
lp = Logical Processor Id (Used for distributed simulations only)<br />
id = Node Id<br />
locX = X coordinate<br />
locY = Y coordinate<br />
<br />
Example: <br />
<node lp = "0" id = "8" locX = "107.599" locY = "96.9366" /><br />
<br />
==== <link> element ====<br />
This element describes wired links between two nodes.<br />
<br />
Attributes are:<br />
fromLp = From logical processor Id (Used for distributed simulations only)<br />
fromId = From Node Id (first node id)<br />
toLp = To logical processor Id<br />
toId = To Node Id (second node id)<br />
<br />
Example:<br />
<link fromLp="0" fromId="0" toLp="0" toId="1"/><br />
<br />
==== <packet> element ====<br />
This element describes a packet over wired links being transmitted at some node and received at another<br />
The reception details is described in it associated rx element<br />
<br />
Attributes are:<br />
fromLp = From logical processor Id (Used for distributed simulations only)<br />
fromId = Node Id transmitting the packet<br />
fbTx = First bit transmit time of the packet<br />
lbTx = Last bit transmit time of the packet<br />
<br />
Example: <br />
<packet fromLp="0" fromId="1" fbTx="1" lbTx="1.000067199"><rx toLp="0" toId="0" fbRx="1.002" lbRx="1.002067199"/><br />
Packet over wired-links from Node 1 was received at Node 0. The first bit of the packet was transmitted at the 1th second, the last bit was transmitted at the <br />
1.000067199th second of the simulation<br />
Node 0 received the first bit of the packet at the 1.002th second and the last bit of the packet at the 1.002067199th second of the simulation<br />
<br />
NOTE: A packet with fromId == toId is a dummy packet used internally by the AnimationInterface.Please ignore this packet<br />
<br />
===== <rx> element =====<br />
This element describes the reception of a packet at a node<br />
<br />
Attributes are:<br />
toLp = To logical processor Id<br />
toId = Node Id receiving the packet<br />
fbRx = First bit Reception Time of the packet<br />
lbRx = Last bit Reception Time of the packet<br />
<br />
==== <wpacket> element ====<br />
This element describes a packet over wireless links being transmitted at some node and received at another<br />
The reception details is described in it associated rx element<br />
<br />
Attributes are:<br />
fromLp = From logical processor Id (Used in distributed simulations only)<br />
fromId = Node Id transmitting the packet<br />
fbTx = First bit transmit time of the packet<br />
lbTx = Last bit transmit time of the packet<br />
range = Range of the transmission<br />
<br />
Example:<br />
<wpacket fromLp = "0" fromId = "20" fbTx = "0.003" lbTx = "0.003254" range = "59.68176982"><br />
<rx toLp="0" toId="32" fbRx="0.003000198" lbRx="0.003254198"/><br />
Packet over wireless-links from Node 20 was received at Node 32. The first bit of the packet was transmitted at the 0.003th second, <br />
the last bit was transmitted at the <br />
0.003254 second of the simulation<br />
Node 0 received the first bit of the packet at the 0.003000198 second and the last bit of the packet at the 0.003254198 second of the simulation<br />
<br />
== F.A.Q ==<br />
* I can see the nodes and topology but cannot see packets animated<br />
>> NetAnim uses the first/last bit transmit and receive time to show animations accurately. So if you can pick up your physical cable (assume it is transparent) and can see packets flowing then you can see it with NetAnim as well. But often, the low application data-rate or high bandwidth/low propagation delay links may make it impossible to see packets flowing because they travel really fast.<br />
In such situations (especially wireless and CSMA) use the "update rate interval" slider to slow down the animation. Also toggle the precision button, to downgrade the precision for CSMA links<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.104&diff=8331NetAnim 3.1042014-02-07T07:58:15Z<p>Jabraham3: Created page with "{{TOC}} NetAnim is an offline animator based on the Qt 4 toolkit. It currently animates the simulation using an XML trace file collected during simulation. The first version ..."</p>
<hr />
<div>{{TOC}}<br />
<br />
NetAnim is an offline animator based on the Qt 4 toolkit.<br />
It currently animates the simulation using an XML trace file collected during simulation. The first version was developed by George F Riley. NetAnim 2 and 3 are written and maintained by John Abraham.<br />
<br />
<br />
[[Image:NetAnim3.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.103 bundled with ns-3.16<br />
<br />
== Summary of features ==<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets (available only from ns-3.14 onwards)<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:Wifi2.png|thumb|left|Wifi Beacon]][[File:TCP.png|thumb|right|TCP flags]][[File:Wifi1.png|thumb|center|Wifi Assoc]]<br />
<br />
== New Features in NetAnim 3.105 ==<br />
[[ NetAnim 3.105 ]]<br />
== New Features in NetAnim 3.104 ==<br />
[[ NetAnim 3.104 ]]<br />
<br />
== New Features in NetAnim 3.103 ==<br />
[[File:IP.png|thumb|left|IPv4 Address]][[File:MAC.png|thumb|left|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|left|Hidden node]]<br />
<br />
[http://code.nsnam.org/netanim/file/4990cf2177a1/RELEASE_NOTES 3.103 Release Notes (click here)]<br />
* Support for setting the following attributes before simulation and modifying them during simulation <br />
# P2p Link Description <br />
# Color of the nodes <br />
# Visibility of the nodes <br />
# Description of the nodes (Default is Node ID)<br />
<br />
* Built-in support for printing the IP and MAC at the interfaces. <br />
Currently if there is a text overlap, the IP/MAC text will be positioned outside the scene and connected by light blue line, to prevent clutter.<br />
* XML Tags for packet and wpacket now support "p" and "wp" respectively (instead of "packet" and "wpacket"), to save disk-space.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.0:<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
For NetAnim on Qt 5 use<br />
<br />
hg clone http://code.nsnam.org/jabraham3/netanim-qt5<br />
<br />
* NetAnim 2.0: <br />
Go to this link [[NetAnim2]] <br />
<br />
* NetAnim 1.0:<br />
Go to this link [[NetAnim 1.0]]<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
* Here is a youtube video demonstrating Animation for Wired transmission [http://www.youtube.com/watch?v=ZQ2yMKZRAfM click here]<br />
* Here is a youtube video demonstrating Animation for Wireless transmission [http://www.youtube.com/watch?v=-dZcMhdULmw click here]<br />
* Here is a youtube video demonstrating Animation for Node trajectory [http://www.youtube.com/watch?v=jYRxDzeWxkA click here]<br />
<br />
==== The update rate slider ====<br />
<br />
* Update rate slider: [[File:Updaterate.png]]<br />
This slider controls the interval between updating animation. If it is low, more packets will be animated, but the simulation progress will be slow<br />
<font color=red>'''If it is high, some packets may get skipped, although the simulation may progress faster. <br />
'''</font color><br />
<br />
NetAnim uses the first/last bit transmit and receive time to show animations accurately. So if you can pick up your physical cable (assume it is transparent) and can see packets flowing then you can see it with NetAnim as well. But often, the low application data-rate or high bandwidth/low propagation delay links may make it impossible to see packets flowing because they travel really fast.<br />
In such situations (especially wireless and CSMA) use the "update rate interval" slider to slow down the animation. Also toggle the precision button, to downgrade the precision for CSMA links<br />
<br />
== Understanding the XML trace file format ==<br />
=== Parts of the XML ===<br />
The XML trace files has the following main sections<br />
# Topology<br />
## Nodes<br />
## Links<br />
# packets (packets over wired-links)<br />
# wpackets (packets over wireless-links.LTE not supported)<br />
<br />
=== XML tags ===<br />
Nodes are identified by their unique Node id.<br />
The XML begins with the "information" element describing the rest of the elements<br />
<br />
==== <anim> element ====<br />
This is the XML root element. All other elements fall within this element<br />
Attributes are:<br />
lp = Logical Processor Id (Used for distributed simulations only)<br />
<br />
==== <topology> element ====<br />
This elements contains the Node and Link elements.It describes, the <br />
co-ordinates of the canvas used for animation.<br />
<br />
Attributes are:<br />
minX = minimum X coordinate of the animation canvas<br />
minY = minimum Y coordinate of the animation canvas<br />
maxX = maximum X coordinate of the animation canvas<br />
maxY = maximum Y coordinate of the animation canvas<br />
<br />
Example:<br />
<topology minX = "-6.42025" minY = "-6.48444" maxX = "186.187" maxY = "188.049"><br />
<br />
==== <node> element ====<br />
This element describes each Node's Id and X,Y co-ordinate (position)<br />
<br />
Attributes are:<br />
lp = Logical Processor Id (Used for distributed simulations only)<br />
id = Node Id<br />
locX = X coordinate<br />
locY = Y coordinate<br />
<br />
Example: <br />
<node lp = "0" id = "8" locX = "107.599" locY = "96.9366" /><br />
<br />
==== <link> element ====<br />
This element describes wired links between two nodes.<br />
<br />
Attributes are:<br />
fromLp = From logical processor Id (Used for distributed simulations only)<br />
fromId = From Node Id (first node id)<br />
toLp = To logical processor Id<br />
toId = To Node Id (second node id)<br />
<br />
Example:<br />
<link fromLp="0" fromId="0" toLp="0" toId="1"/><br />
<br />
==== <packet> element ====<br />
This element describes a packet over wired links being transmitted at some node and received at another<br />
The reception details is described in it associated rx element<br />
<br />
Attributes are:<br />
fromLp = From logical processor Id (Used for distributed simulations only)<br />
fromId = Node Id transmitting the packet<br />
fbTx = First bit transmit time of the packet<br />
lbTx = Last bit transmit time of the packet<br />
<br />
Example: <br />
<packet fromLp="0" fromId="1" fbTx="1" lbTx="1.000067199"><rx toLp="0" toId="0" fbRx="1.002" lbRx="1.002067199"/><br />
Packet over wired-links from Node 1 was received at Node 0. The first bit of the packet was transmitted at the 1th second, the last bit was transmitted at the <br />
1.000067199th second of the simulation<br />
Node 0 received the first bit of the packet at the 1.002th second and the last bit of the packet at the 1.002067199th second of the simulation<br />
<br />
NOTE: A packet with fromId == toId is a dummy packet used internally by the AnimationInterface.Please ignore this packet<br />
<br />
===== <rx> element =====<br />
This element describes the reception of a packet at a node<br />
<br />
Attributes are:<br />
toLp = To logical processor Id<br />
toId = Node Id receiving the packet<br />
fbRx = First bit Reception Time of the packet<br />
lbRx = Last bit Reception Time of the packet<br />
<br />
==== <wpacket> element ====<br />
This element describes a packet over wireless links being transmitted at some node and received at another<br />
The reception details is described in it associated rx element<br />
<br />
Attributes are:<br />
fromLp = From logical processor Id (Used in distributed simulations only)<br />
fromId = Node Id transmitting the packet<br />
fbTx = First bit transmit time of the packet<br />
lbTx = Last bit transmit time of the packet<br />
range = Range of the transmission<br />
<br />
Example:<br />
<wpacket fromLp = "0" fromId = "20" fbTx = "0.003" lbTx = "0.003254" range = "59.68176982"><br />
<rx toLp="0" toId="32" fbRx="0.003000198" lbRx="0.003254198"/><br />
Packet over wireless-links from Node 20 was received at Node 32. The first bit of the packet was transmitted at the 0.003th second, <br />
the last bit was transmitted at the <br />
0.003254 second of the simulation<br />
Node 0 received the first bit of the packet at the 0.003000198 second and the last bit of the packet at the 0.003254198 second of the simulation<br />
<br />
== F.A.Q ==<br />
* I can see the nodes and topology but cannot see packets animated<br />
>> NetAnim uses the first/last bit transmit and receive time to show animations accurately. So if you can pick up your physical cable (assume it is transparent) and can see packets flowing then you can see it with NetAnim as well. But often, the low application data-rate or high bandwidth/low propagation delay links may make it impossible to see packets flowing because they travel really fast.<br />
In such situations (especially wireless and CSMA) use the "update rate interval" slider to slow down the animation. Also toggle the precision button, to downgrade the precision for CSMA links<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim&diff=8330NetAnim2014-02-07T07:57:22Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
NetAnim is an offline animator based on the Qt 4 toolkit.<br />
It currently animates the simulation using an XML trace file collected during simulation. The first version was developed by George F Riley. NetAnim 2 and 3 are written and maintained by John Abraham.<br />
<br />
<br />
[[Image:NetAnim3.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.103 bundled with ns-3.16<br />
<br />
== Summary of features ==<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets (available only from ns-3.14 onwards)<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:Wifi2.png|thumb|left|Wifi Beacon]][[File:TCP.png|thumb|right|TCP flags]][[File:Wifi1.png|thumb|center|Wifi Assoc]]<br />
<br />
== New Features in NetAnim 3.105 ==<br />
[[ NetAnim 3.105 ]]<br />
== New Features in NetAnim 3.104 ==<br />
[[ NetAnim 3.104 ]]<br />
<br />
== New Features in NetAnim 3.103 ==<br />
[[File:IP.png|thumb|left|IPv4 Address]][[File:MAC.png|thumb|left|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|left|Hidden node]]<br />
<br />
[http://code.nsnam.org/netanim/file/4990cf2177a1/RELEASE_NOTES 3.103 Release Notes (click here)]<br />
* Support for setting the following attributes before simulation and modifying them during simulation <br />
# P2p Link Description <br />
# Color of the nodes <br />
# Visibility of the nodes <br />
# Description of the nodes (Default is Node ID)<br />
<br />
* Built-in support for printing the IP and MAC at the interfaces. <br />
Currently if there is a text overlap, the IP/MAC text will be positioned outside the scene and connected by light blue line, to prevent clutter.<br />
* XML Tags for packet and wpacket now support "p" and "wp" respectively (instead of "packet" and "wpacket"), to save disk-space.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.0:<br />
<br />
hg clone http://code.nsnam.org/netanim<br />
<br />
For NetAnim on Qt 5 use<br />
<br />
hg clone http://code.nsnam.org/jabraham3/netanim-qt5<br />
<br />
* NetAnim 2.0: <br />
Go to this link [[NetAnim2]] <br />
<br />
* NetAnim 1.0:<br />
Go to this link [[NetAnim 1.0]]<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
* Here is a youtube video demonstrating Animation for Wired transmission [http://www.youtube.com/watch?v=ZQ2yMKZRAfM click here]<br />
* Here is a youtube video demonstrating Animation for Wireless transmission [http://www.youtube.com/watch?v=-dZcMhdULmw click here]<br />
* Here is a youtube video demonstrating Animation for Node trajectory [http://www.youtube.com/watch?v=jYRxDzeWxkA click here]<br />
<br />
==== The update rate slider ====<br />
<br />
* Update rate slider: [[File:Updaterate.png]]<br />
This slider controls the interval between updating animation. If it is low, more packets will be animated, but the simulation progress will be slow<br />
<font color=red>'''If it is high, some packets may get skipped, although the simulation may progress faster. <br />
'''</font color><br />
<br />
NetAnim uses the first/last bit transmit and receive time to show animations accurately. So if you can pick up your physical cable (assume it is transparent) and can see packets flowing then you can see it with NetAnim as well. But often, the low application data-rate or high bandwidth/low propagation delay links may make it impossible to see packets flowing because they travel really fast.<br />
In such situations (especially wireless and CSMA) use the "update rate interval" slider to slow down the animation. Also toggle the precision button, to downgrade the precision for CSMA links<br />
<br />
== Understanding the XML trace file format ==<br />
=== Parts of the XML ===<br />
The XML trace files has the following main sections<br />
# Topology<br />
## Nodes<br />
## Links<br />
# packets (packets over wired-links)<br />
# wpackets (packets over wireless-links.LTE not supported)<br />
<br />
=== XML tags ===<br />
Nodes are identified by their unique Node id.<br />
The XML begins with the "information" element describing the rest of the elements<br />
<br />
==== <anim> element ====<br />
This is the XML root element. All other elements fall within this element<br />
Attributes are:<br />
lp = Logical Processor Id (Used for distributed simulations only)<br />
<br />
==== <topology> element ====<br />
This elements contains the Node and Link elements.It describes, the <br />
co-ordinates of the canvas used for animation.<br />
<br />
Attributes are:<br />
minX = minimum X coordinate of the animation canvas<br />
minY = minimum Y coordinate of the animation canvas<br />
maxX = maximum X coordinate of the animation canvas<br />
maxY = maximum Y coordinate of the animation canvas<br />
<br />
Example:<br />
<topology minX = "-6.42025" minY = "-6.48444" maxX = "186.187" maxY = "188.049"><br />
<br />
==== <node> element ====<br />
This element describes each Node's Id and X,Y co-ordinate (position)<br />
<br />
Attributes are:<br />
lp = Logical Processor Id (Used for distributed simulations only)<br />
id = Node Id<br />
locX = X coordinate<br />
locY = Y coordinate<br />
<br />
Example: <br />
<node lp = "0" id = "8" locX = "107.599" locY = "96.9366" /><br />
<br />
==== <link> element ====<br />
This element describes wired links between two nodes.<br />
<br />
Attributes are:<br />
fromLp = From logical processor Id (Used for distributed simulations only)<br />
fromId = From Node Id (first node id)<br />
toLp = To logical processor Id<br />
toId = To Node Id (second node id)<br />
<br />
Example:<br />
<link fromLp="0" fromId="0" toLp="0" toId="1"/><br />
<br />
==== <packet> element ====<br />
This element describes a packet over wired links being transmitted at some node and received at another<br />
The reception details is described in it associated rx element<br />
<br />
Attributes are:<br />
fromLp = From logical processor Id (Used for distributed simulations only)<br />
fromId = Node Id transmitting the packet<br />
fbTx = First bit transmit time of the packet<br />
lbTx = Last bit transmit time of the packet<br />
<br />
Example: <br />
<packet fromLp="0" fromId="1" fbTx="1" lbTx="1.000067199"><rx toLp="0" toId="0" fbRx="1.002" lbRx="1.002067199"/><br />
Packet over wired-links from Node 1 was received at Node 0. The first bit of the packet was transmitted at the 1th second, the last bit was transmitted at the <br />
1.000067199th second of the simulation<br />
Node 0 received the first bit of the packet at the 1.002th second and the last bit of the packet at the 1.002067199th second of the simulation<br />
<br />
NOTE: A packet with fromId == toId is a dummy packet used internally by the AnimationInterface.Please ignore this packet<br />
<br />
===== <rx> element =====<br />
This element describes the reception of a packet at a node<br />
<br />
Attributes are:<br />
toLp = To logical processor Id<br />
toId = Node Id receiving the packet<br />
fbRx = First bit Reception Time of the packet<br />
lbRx = Last bit Reception Time of the packet<br />
<br />
==== <wpacket> element ====<br />
This element describes a packet over wireless links being transmitted at some node and received at another<br />
The reception details is described in it associated rx element<br />
<br />
Attributes are:<br />
fromLp = From logical processor Id (Used in distributed simulations only)<br />
fromId = Node Id transmitting the packet<br />
fbTx = First bit transmit time of the packet<br />
lbTx = Last bit transmit time of the packet<br />
range = Range of the transmission<br />
<br />
Example:<br />
<wpacket fromLp = "0" fromId = "20" fbTx = "0.003" lbTx = "0.003254" range = "59.68176982"><br />
<rx toLp="0" toId="32" fbRx="0.003000198" lbRx="0.003254198"/><br />
Packet over wireless-links from Node 20 was received at Node 32. The first bit of the packet was transmitted at the 0.003th second, <br />
the last bit was transmitted at the <br />
0.003254 second of the simulation<br />
Node 0 received the first bit of the packet at the 0.003000198 second and the last bit of the packet at the 0.003254198 second of the simulation<br />
<br />
== F.A.Q ==<br />
* I can see the nodes and topology but cannot see packets animated<br />
>> NetAnim uses the first/last bit transmit and receive time to show animations accurately. So if you can pick up your physical cable (assume it is transparent) and can see packets flowing then you can see it with NetAnim as well. But often, the low application data-rate or high bandwidth/low propagation delay links may make it impossible to see packets flowing because they travel really fast.<br />
In such situations (especially wireless and CSMA) use the "update rate interval" slider to slow down the animation. Also toggle the precision button, to downgrade the precision for CSMA links<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.105&diff=8329NetAnim 3.1052014-02-07T07:55:41Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
[[Image: NetAnim_3.105_Gui.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.105 and will be bundled along with ns-3.20.<br />
NetAnim 3.105 is compatible with ns-3-dev.<br />
Contributors:<br />
* John Abraham<br />
* Evegeny Kalishenko (Battery Visualization)<br />
* Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.0:<br />
<br />
hg clone http://code.nsnam.org/jabraham3/netanim-3.105<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.105&diff=8328NetAnim 3.1052014-02-07T07:53:44Z<p>Jabraham3: </p>
<hr />
<div>{{TOC}}<br />
<br />
THIS PAGE IS UNDER CONSTRUCTION<br />
<br />
[[Image: NetAnim_3.105_Gui.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.105 and will be bundled along with ns-3.20.<br />
NetAnim 3.105 is compatible with ns-3-dev.<br />
Contributors:<br />
* John Abraham<br />
* Evegeny Kalishenko (Battery Visualization)<br />
* Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
<br />
== Summary of features ==<br />
[http://www.youtube.com/watch?v=-9a6dVbOds4&feature=youtu.be NetAnim-3.105 Summary Video]<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.0:<br />
<br />
hg clone http://code.nsnam.org/jabraham3/netanim-3.105<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=File:Battery.png&diff=8327File:Battery.png2014-02-07T05:41:26Z<p>Jabraham3: </p>
<hr />
<div></div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.105&diff=8326NetAnim 3.1052014-02-07T05:41:12Z<p>Jabraham3: /* Packet Timeline */</p>
<hr />
<div>{{TOC}}<br />
<br />
THIS PAGE IS UNDER CONSTRUCTION<br />
<br />
[[Image: NetAnim_3.105_Gui.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.105 and will be bundled along with ns-3.20.<br />
NetAnim 3.105 is compatible with ns-3-dev.<br />
Contributors:<br />
* John Abraham<br />
* Evegeny Kalishenko (Battery Visualization)<br />
* Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
<br />
== Summary of features ==<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.0:<br />
<br />
hg clone http://code.nsnam.org/jabraham3/netanim-3.105<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
=== Battery Visualization ===<br />
To view the battery level at a node, click the battery-icon on the left toolbar.<br />
[[File:battery.png|thumbnail|center|Battery Visualization]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.105&diff=8325NetAnim 3.1052014-02-07T05:33:59Z<p>Jabraham3: /* Packet Timeline */</p>
<hr />
<div>{{TOC}}<br />
<br />
THIS PAGE IS UNDER CONSTRUCTION<br />
<br />
[[Image: NetAnim_3.105_Gui.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.105 and will be bundled along with ns-3.20.<br />
NetAnim 3.105 is compatible with ns-3-dev.<br />
Contributors:<br />
* John Abraham<br />
* Evegeny Kalishenko (Battery Visualization)<br />
* Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
<br />
== Summary of features ==<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.0:<br />
<br />
hg clone http://code.nsnam.org/jabraham3/netanim-3.105<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|center|Packet TimeLine]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=File:Packet_timeline2.png&diff=8324File:Packet timeline2.png2014-02-07T05:33:30Z<p>Jabraham3: </p>
<hr />
<div></div>Jabraham3https://www.nsnam.org/mediawiki/index.php?title=NetAnim_3.105&diff=8323NetAnim 3.1052014-02-07T05:31:56Z<p>Jabraham3: /* Tracking Node counters */</p>
<hr />
<div>{{TOC}}<br />
<br />
THIS PAGE IS UNDER CONSTRUCTION<br />
<br />
[[Image: NetAnim_3.105_Gui.png|thumb|The NetAnim GUI]] <br />
The current release version is 3.105 and will be bundled along with ns-3.20.<br />
NetAnim 3.105 is compatible with ns-3-dev.<br />
Contributors:<br />
* John Abraham<br />
* Evegeny Kalishenko (Battery Visualization)<br />
* Emanuel Eichhammer (QCustomplot.com: Chart Visualization)<br />
<br />
== Summary of features ==<br />
* Animate packets over wired-links and wireless-links (Limited support for LTE traces)<br />
* Packet timeline with regex filter on packet meta-data.<br />
* Node position statistics with node trajectory plotting(path of a mobile node).<br />
* Print brief packet-meta data on packets<br />
* Use custom icons for nodes<br />
* Parse flow-monitor XML files and display statistics for each flow.<br />
* Show IP and MAC information, including peer IP and MAC for point-to-point links.<br />
* Display double or uint32 valued counters vs time for multiple nodes in a chart or a table.<br />
* Step through a simulation one event at a time and pause the simulation at a given time<br />
* Print the routing table at nodes at various points in time<br />
<br />
[[File:PacketStats.png|thumb|left|Packet Statistics]][[File:node_trajectory.png|thumb|right|Node Trajectory]]<br />
[[File:Dumbbell.png|thumb|center|Dumbbell]]<br />
[[File:wifi_beacon.png|thumb|left|Wifi Beacon]][[File:syn_ack.png|thumb|right|TCP flags]][[File:icmp.png|thumb|left|ICMP Unreachable]][[File:node_properties.png|thumb|center|Node Properties]]<br />
[[File:battery_visualization.png|thumb|right|Battery Visualization]]<br />
[[File:background.png|thumb|left|Custom Background]]<br />
[[File:routing_table.png|thumb|center|Routing Tables]]<br />
[[File:congestion_window.png|thumb|center|Congestion Window]]<br />
[[File:flow_monitor.png|thumb|right|Flow monitor output parsing]]<br />
[[File:packet_timeline.png|thumb|left|Packet Timeline]]<br />
<br />
[[File:IP.png|thumb|center|IPv4 Address]][[File:MAC.png|thumb|right|MAC Address]][[File:LinkDescription.png|thumb|left|Color,Link Description]][[File:NodeColorVisibility.png|thumb|center|Hidden node]]<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
.<br />
<br />
== Prerequisites ==<br />
# mercurial<br />
# QT4 development packages (recommended version 4.7)<br />
<br />
=== Debian/Ubuntu Linux distribution:===<br />
# apt-get install mercurial<br />
# apt-get install qt4-dev-tools<br />
<br />
=== Red Hat/Fedora based distribution:=== <br />
# yum install mercurial<br />
# yum install qt4<br />
# yum install qt4-devel<br />
<br />
=== Mac/OSX ===<br />
# mercurial<br />
# Qt4 : Install Qt4 (including Qt Creator if possible) from http://qt.nokia.com/downloads/<br />
<br />
=== Windows ===<br />
# mercurial<br />
# Qt Creator<br />
# Microsoft Visual C++ (Visual Studio 2010 and over http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) or MinGw compiler<br />
<br />
== Downloading NetAnim ==<br />
* NetAnim 3.0:<br />
<br />
hg clone http://code.nsnam.org/jabraham3/netanim-3.105<br />
<br />
== Building and Starting NetAnim==<br />
NetAnim uses a QT4 build tool called qmake. Only qmake version 4.7 is supported<br />
Please read the [[#Prerequisites]] before proceeding<br />
<br />
cd netanim<br />
make clean<br />
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)<br />
make<br />
<br />
'''Note: qmake could be "qmake-qt4" in some systems<br />
'''<br />
<br />
This should create an executable named "NetAnim" in the same directory. To start the application just type "./NetAnim"<br />
<br />
'''For windows users:'''<br />
* In the netanim repository you cloned in step: [[#Downloading NetAnim ]], there will be a file named "NetAnim.pro". Double-click it. This should open QtCreator.<br />
* In QtCreator to go "Projects" -->"Build settings"-->Tool chain. Here a tool chain should be displayed such as MSVisual C++ compiler or MinGw etc. If not click on "Manage" and point to the local of the tool chain. See http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html<br />
* In QtCreator -->Click "Build All"-->Run, it should open the NetAnim executable.<br />
<br />
== Using NetAnim ==<br />
Using NetAnim is a two-step process.<br />
<br />
Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the ns-3 code base<br />
<br />
Step 2: Load the XML trace file generated in Step 1 with the offline animator (NetAnim).<br />
<br />
=== Using ns3::AnimationInterface to generate Animation trace files===<br />
<br />
The NetAnim application requires a custom trace file for animation. <br />
This trace file is created by [http://www.nsnam.org/doxygen/classns3_1_1_animation_interface.html AnimationInterface] in ns-3. <br />
# Model is at: src/netanim/model<br />
# Examples are at src/netanim/examples<br />
<br />
==== Mandatory and optional set of steps ====<br />
Here is the recommended set of steps for generating XML Animation traces.They must be applied just before the "Simulation::Run" statement.<br />
<br />
'''NOTE: A node must have an associated mobility model in-order to be displayed on the animation. <br />
This applies for both stationary and mobile nodes (See notes below) '''<br />
<br />
===== Mandatory =====<br />
0. Ensure that your wscript includes the "netanim" module. Example as in: src/netanim/examples/wscript. <br />
1. Also include the header [#include "ns3/netanim-module.h"] in your test program<br />
2. Add the statement "AnimationInterface anim ("animation.xml");" before Simulator::Run()<br />
<br />
===== Optional =====<br />
3. anim.SetMobilityPollInterval (Seconds (1));[OPTIONAL]<br />
4. anim.SetConstantPosition (Ptr< Node > n, double x, double y); [OPTIONAL]<br />
5. anim.EnablePacketMetadata (true); [OPTIONAL] available only on ns-3-dev and from ns-3.14. Used to show packet meta data on the packet statistics and packet animation<br />
<br />
Try to keep the above as close as possible to the "Simulator::Run()" statement<br />
<br />
==== Running an Example File to generate XML trace file ====<br />
<br />
The netanim example files are located under "src/netanim/examples"<br />
<br />
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"<br />
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"<br />
<br />
<br />
==== Setting the location of nodes ====<br />
NetAnim requires a location to be assigned to each Node, in-order to be shown on the animation.<br />
<br />
===== For stationary nodes: =====<br />
* You should assign the ConstantPositionMobilityModel. Constant Position is a kind of mobility.<br />
Here is an example:<br />
<br />
1. Ptr<Node> n = nodecontainer.Get (1);<br />
2. AnimationInterface anim ("anim.xml");<br />
2. anim.SetConstantPosition (n, 100, 200);<br />
<br />
where<br />
<br />
1. Get a Ptr to Node from the node container<br />
2. Instantiate an object of type AnimationInterface<br />
3. Set a node pointed to by "n" to the x-coordinate of 100 and y-coordinate of 200<br />
<br />
===== For mobile nodes =====<br />
* You should assign any suitable Mobility model.<br />
The examples for these are found in places such as src/mobility/examples or examples/routing/manet-routing-compare.cc etc<br />
<br />
The ns3::AnimationInterface class is responsible for the creation of the xml trace files. Currently, in basic-mode, AnimationInterface records the position of the nodes at every periodic interval. This interval is 200 ms by default. This will become more efficient in future releases. This has the potential to cause <br />
a. Slowness in simulation<br />
b. Large XML trace files<br />
<br />
Some ways to get around this is to identify if your topology has <br />
# only stationary nodes and hence no mobility<br />
# or slow-moving nodes<br />
<br />
If the above is the case you should use AnimationInterface::SetMobilityPollInterval to set the poll interval to a high value.<br />
<br />
=== Using the XML trace with NetAnim ===<br />
Run NetAnim and click the file-open button on the top-left hand corner and select the XML trace file that was discussed in the previous sections<br />
<br />
* Here is a youtube video demonstrating how to load the XML file [http://www.youtube.com/watch?v=tz_hUuNwFDs click here]<br />
<br />
=== Setting and viewing node properties ===<br />
* The ideal way to set the node properties are through ns3::AnimationInterface<br />
** Update the size of the node using AnimationInterface::UpdateNodeSize (uint32_t nodeId, double width, double height)<br />
** Update the color of the node using AnimationInterface::UpdateNodeColor (uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)<br />
** Update the image of the node using AnimationInterface::UpdateNodeImage (uint32_t nodeId, uint32_t resourceId). Prior to using AnimationInterface::UpdateNodeImage, a resource ID must be obtained for your custom image using AnimationInterface::AddResource (std::string resourcePath)<br />
Sample usage for the above are found under src/netanim/examples<br />
<br />
* Double-click on a node (click the properties button on the left toolbar) and you will be presented with the node properties panel. <br />
[[File:properties_panel.png|thumb|center|Properties Panel]]<br />
From this panel you can set <br />
** The position of the node<br />
** The color of the node (including alpha value or opacity)<br />
** Enable the display of the node-trajectory (path moved by the node)<br />
** List of IP address and Mac address combinations<br />
** Any unit32 or double counters associated with the node<br />
** Set a custom icon for the node<br />
** Set the size of the node.<br />
<br />
<br />
=== Setting a custom background ===<br />
* A custom background image can be set using AnimationInterface::SetBackgroundImage (std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)** The background properties can be updated from the properties panel (click the properties button and select "Background")<br />
[[File:background_properties.png|thumb|center|Background Properties]]<br />
=== Reload the trace file ===<br />
Starting from 3.105 it is not required to re-open the file browser and locate the XML trace file if a new trace file has the same name as the previous trace file.Hit the reload button and the updated trace file will be loaded.<br />
[[File:reload.png|thumb|center|Reload Trace file]]<br />
<br />
=== Stepping through simulation ===<br />
Starting from 3.105 it is possible to step through each event in the animation trace file. Use the step button<br />
[[File:step.png|thumb|center|Step mode]]<br />
=== Tracking the routing table ===<br />
* The routing tables of various nodes can be tracked at various points in simulation time. Using AnimationInterface::EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, TimepollInterval=Seconds(5)) will a create a separate XML file that tracks routing tables at a node (or a container of nodes) at the polling interval.<br />
** Once the routing-table XML is generated, select the "Stats" tab and click the drop-down menu to select "Routing".<br />
** Click the file-browser button to load the XML file with routing-table information.<br />
[[File:Routing table2.png|thumbnail|center|Routing table stats]]<br />
<br />
=== Parsing the Flow-monitor XML output ===<br />
* The flow-monitor XML file can be parsed by selecting the "Stats" tab, click the drop-down menu to select "Flow-monitor", and choose the flow-monitor XML file by clicking the "FlowMon file" button.<br />
[[File:flowmon2.png|thumbnail|center|Flow monitor stats]]<br />
<br />
<br />
=== Tracking Node counters ===<br />
* AnimationInterface provides a way to track uint32 or double counters associated with a node. <br />
* The counters can be plotted as charts or shown as a table of values that can be exported. <br />
** Using node-counterss<br />
*** Obtain a counter-id by using AnimationInterface::AddNodeCounter (std::string counterName, CounterType counterType)<br />
*** Use the counter-id to update the counters values for a given node using AnimationInterface::UpdateNodeCounter (uint32_t nodeCounterId, uint32_t nodeId, double counter)Sample usages are found under src/netanim/examples<br />
[[File:double_counter.png|thumbnail|left|Double-counter chart]]<br />
[[File:double_counter_table.png|thumbnail|center|Double-counter Table]]<br />
<br />
=== Packet Timeline ===<br />
* Packet timeline can be viewed from the "Packets" tab** Note the "From Time" and "To Time" limits the range of packets that are visible** Note the filters and Time range are only applied after clicking the submit button.<br />
<br />
[[File:packet_timeline2.png|thumbnail|left|Packet TimeLine]]<br />
<br />
== F.A.Q ==<br />
* I get /<br />
home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::AnimationInterface(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:366: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build/../examples/routing/manet-routing-compare.cc:371: undefined reference to `ns3::AnimationInterface::~AnimationInterface()'<br />
collect2: ld returned 1 exit status<br />
Waf: Leaving directory `/home/wimax/ns-allinone-3.12.1/ns-3.12.1/build'<br />
Build failed: -> task failed (err #1): <br />
{task: cxx_link manet-routing-compare_9.o -> manet-routing-compare}<br />
<br />
>> Add 'netanim' to your wscript</div>Jabraham3