NetAnim2

From Nsnam
Revision as of 14:07, 22 October 2009 by Jpelkey (Talk | contribs) (Adding the Animation Interface for ns-3)

Jump to: navigation, search

A simple animator is presented here, called NetAnim. Written by George Riley, and based on the multi-platform QT4 GUI toolkit, it is capable of animating simulations with PointToPoint links in ns-3. It depicts frames on the links as they travel from node to node. It uses a custom trace output format for animation, so there is some additional code which has to be included in ns-3 to enable these traces.

The NetAnim GUI


Prerequisites

The animator requires the QT4 development packages. If you are using a Debian or Ubuntu Linux distribution, you can get the following package: qt4-dev-tools

This should install everything you need to compile and build NetAnim. If you are using an Red Hat based distribution, look for similar qt4 packages (or libqt4*) and install these using yum. Mac users should install the binaries: http://www.qtsoftware.com/downloads/mac-os-cpp

Make sure to download the binary package; look for a link to something without the word "src" or "debug" in the download filename. These will be the library binaries you need.

Also, you will require mercurial. See your distribution's packages or the mercurial website for more info.

Downloading NetAnim

The tarball of the source code is available here. Download it, then untar it:

tar -xzvf NetAnim.tar.gz

Building NetAnim

NetAnim uses a QT4 build tool called qmake; this is similar to the configure script from autotools in that it generates the Makefile, which make then uses to build the project. qmake is different on different versions of Qt, so we'll provide some additional information that is system dependent. You can check your default version of qmake:

qmake --version
Qmake version: 1.07a (Qt 3.3.8b)
Qmake is free software from Trolltech ASA.

If you see something like the above, where it says Qt 3.x.x, find the qt4 version of qmake on your system and explicitly call it instead.

In General

cd NetAnim
qmake
make

On Mac OS X

cd NetAnim
/usr/local/Trolltech/Qt-4.x.y/bin/qmake
make

Note that above, the x.y is the specific version of Qt4 you are running. As of April 1st 2009, the latest version is 4.5.0, although you might have an older version already installed.

On Ubuntu/Debian with Qt3 AND Qt4

cd NetAnim
qmake-qt4
make

Adding the Animation Interface for ns-3

The animation interface has been merged with the main tree as of ns-3.6. The source code for the animation interface is located in src/contrib/net-anim.

Running an Example File

An example of how to use the animation functionality can be found here. You can drop this file into your scratch directory of ns-3-netanim to compile it and try it out:

./waf --run "scratch/testdb --nLeftLeaf=10 --nRightLeaf=3 --animFile=out.tr"

Then take the output file we generated, and feed it into NetAnim. Copy the out.tr file from ns-3-netanim directory to the NetAnim directory. From the NetAnim directory:

./NetAnim out.tr

This should produce an animation of the packets in the simulation. The sliders control the behavior of the speed of animation.

There are also two more examples included with the net-anim interface. They are test-dumbell.cc and test-grid.cc. (located in examples or src/contrib/netanim depending on the route you took to get the netanim interface).