Advanced Seminar Embedded Systems 2008/2009
Simulation of wireless ad-hoc sensor networks with QualNet
Documentation
by Tobias Doerffel
Chemnitz, April 9, 2009
Contents
Contents 1 Intr Introdu oduct ctio ion n
1.1 1.1
3
The The scena scenari rioo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2 Qual QualNe Nett over overvie view w
4
2.1 Componen Components ts of QualNet QualNet . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Instal Installin lingg QualNet QualNet on a recen recentt Linux Linux system system . . . . . . . . . . . . . 2.3 Instal Installin lingg QualN QualNet et on Windo Windows ws . . . . . . . . . . . . . . . . . . . . 3 Design Designing ing the scena scenario rio
3.1 3.1 3.2 3.2 3.3 3.3 3.4
Data sink Data sink . . . . . . Mobi Mobile le sens sensor or nodes nodes . Wirel Wireles esss subne subnett . . . Traffic generato generators rs . .
3 4 4 5 6
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
4 Runnin Running g the the scena scenario rio
4.1 Graphi Graphical cal animati animation on . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 QualNe QualNett 3D Visuali Visualizer zer . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 Comman Command d line line interf interface ace . . . . . . . . . . . . . . . . . . . . . . . .
8 8 8 9 11
11 11 13
5 Anal Analyzi yzing ng the the resu result ltss
14
6 Conc Conclu lusi sion on
16
2
1. Introduction
1 Introduc Introductio tion n Nowadays network applications – especially in the area of wireless networks – are becoming more and more complex which makes the design and the testing almost impossible without appropriate software. There’re a lot of different programs available to aid the user in simulating simulating previously previously designed designed scenarios. This work covers covers the implementation of a given scenario using the software QualNet software QualNet by Scalable by Scalable Networks in works in version 4.5.1. QualNet is a commercial software that runs on all common platforms (Linux, Windows, Solaris, OS X) and is specialized in simulating all kind of wireless applications. It has a quite clear user interface compared to other solutions while also offering an easy to use command line interface.
1.1 The scena scenario rio We had been given the following wireless scenario to be implemented: •
sen senso sorr net network ork with with 10 mobi mobile le nodes nodes and and a stat static ical ally ly plac placed ed data data sink sink (root node)
•
IEEE 802.15.4 wireless standard for PHY and MAC layer
•
AODV (Ad hoc On-Demand Distance Vector) routing 1
•
Random Waypoint Mobility Model for the mobile nodes 2
•
•
•
2 KB/s KB/s unidire unidirectio ctional nal contin continuous uous network network load from each each sensor sensor node to data sink time synchronization with the root node every 10 seconds using the FTSP (Flooding Time Synchronization Protocol) 3 optional: – TCP/IP
stack integratio integration n with UDP load (e.g. videostream) videostream) from root node to all nodes (10 KB/s) – acknowledged sensor data It however was not possible to meet all these requirements due to missing features in the program. Details will follow.
1
http://tools.ietf.org/html/rfc3561 http://mathstat.helsinki.fi/mathph http://mathst at.helsinki.fi/mathphys/EVERGR ys/EVERGROW/virtamo.pdf OW/virtamo.pdf 3 http://www.eecs.harv http://www .eecs.harvard.edu/ ard.edu/ mdw/course/cs263/papers/ftsp-se mdw/course/cs263/papers/ftsp-sensys04.pdf nsys04.pdf 2
3
2. QualNet overview
2 QualNe QualNett overvie overview w 2.1 Componen Components ts of QualNe QualNett QualNet consists of various components: •
QualNet Scenario Designer
•
QualNet Animator
•
QualNet 3D Visualizer
•
QualNet Analyzer
•
QualNet Packet Tracer
All components but the last will be described in detail in the according chapter.
2.2 Instal Installin ling g QualNe QualNett on a recent recent Linux system system Getting to run QualNet on recent Linux systems is a bit tricky as it has been built for rather outdated Linux distributions (Fedora Core 4 which has been released in June 2005). All steps steps described described in the follow following ing refer to recent recent Debian Debian based distributions but probably are applicable for other distributions as well. First of all you need to register an account in order to download the software software archive archive 4 at . Afterwards the archive can be extracted: s ud ud o s u c d / o pt pt t a r x z f < d o w n l o a d d i r ec ec t o ry ry > / q u a ln ln e t - 4 .5 .5 . 1 - e v a l u a t i on on . t a r . g z
Next Next the QualNet QualNet core applicati application on has to be compil compiled. ed. Since Since the provided provided source code does not follow the official C++ standard (ISO/IEC 14882:1998) it can’t be compiled without some small modifications. An according patch named fix-qualnetnamed fix-qualnetcore-sources.diff can be found in the archive archive containing containing all files related to this work. To apply it and compile everything run the following commands: s ud ud o s u c d / o p t / q u al a l n et et / 4 . 5 / p a t ch ch - p 2 < . . . . ./ ./ f i x - q u al al n e t - c o re re - s o u r c e s . d i f f c d m ai ai n cp Makefile -linux -glibc -2.3-gcc -4.0 Makefile ma m a k e 4
4
http://www.scalable-netw http://www .scalable-networks.com/products/qualnet/do orks.com/products/qualnet/download.php wnload.php
2.3 Instal Installin ling g QualNe QualNett on Windo Windows ws
In case you system is 64 bit you need to replace ”Makefile-linux-glibc-2.3-gcc-4.0” with ”Makefile-lin ”Makefile-linux-x86 ux-x86 64-glibc-2.3-gcc 64-glibc-2.3-gcc-4.0” -4.0” in the abov ab ovee commands. commands. Now some symlinks need to be created due to the already mentioned linking against old libraries. s ud ud o s u c d / u s r / li li b l n - s l i be b e x pa p a t . s o l i b ex ex p at at . s o . 0 l n - s l ib i b ss s s l . so so l ib i b ss s s l . so so . 5 l n - s l i bc b c r y pt pt o . s o l i bc b c r y pt pt o . s o . 5
The last thing to do at this stage is to download the license file (qualnet (qualnet-4. -4.5.1 5.1-ev -evalal-YYY YYYY.M Y.MM.D M.DD.l D.lic) ic) from the same same URL as the softw software are and place it in /opt/qualnet/4.5/license in /opt/qualnet/4.5/license dir . If everything finished without errors, QualNet is ready to run.
2.3 Installing Installing QualNet QualNet on Windows Windows The installation of QualNet on Windows should be quite straight-forward via the install installer er and thus thus is not described described in detail detail here. The installa installatio tion n brings brings a precompiled qualnet.exe so there’s no need to compile components of QualNet on your own.
5
3. Designing the scenario
3 Design Designing ing the scena scenario Given QualNet has been started successfully, a new empty scenario has to be created using a wizard which can be started via File via File New . After it has finished finished a workspace workspace with an empty scenario can be seen as as shown in figure 1. →
Figure 1: QualNet Designer: an empty scenario to start with All properties of the scenario can be viewed and changed using the Inspector on the left side. There’s an amazing amount amount of properties, subproperties subproperties and parameters that can be altered although we only need to touch a very few of them. For not having to change common properties for each node there’s a possibility to set global properties below ConfigSettings below ConfigSettings . In particular only some of the items are of interest in the following. The changes as listed below were made to configure the nodes according to the requirements: •
Wireless Settings Radio/Physical Layer Radio Type : 802.15.4 Radio
•
Wireless Settings MAC Protocol MAC Protocol : Protocol : 802.15.4
•
6
→
→
→
→
Network Protocols Routing Protocol Routing Policy Routing Protocol for IPv4 : AODV →
→
→
3. Designing the scenario •
Network Protocols Network Protocol IP Fragmentation Unit : Unit : 70
•
Node Positioning Mobility Mobility Model : Model : Random Waypoint
•
General Terrain Coordinate-System Dimensions : 100 100
→
→
→
→
→
→
→
Now we can start adding nodes by selecting selecting Devices DEFAULT DEFAULT in the toolbar and clickin clickingg in the wo works rkspace pace.. This This is merely merely useful useful in scenario scenarioss with with only only a few nodes. →
A vast number of nodes can be created easily utilizing utilizing Experiment Place Nodes . In the dialog the numer of nodes to be created can be set - in our case 11 nodes. Keeping the placement strategy Uniform strategy Uniform works works quite well. well. After clicking clicking Finish Finish , 11 new nodes should appear on the workspace workspace.. The first node (which (which will be our data sink) should be dragged to the center of the workspace (make sure to select the move-tool before) so the average distance to all the other mobile nodes will be minimal. →
Figure 2: Inspector with all modified global properties 7
3.1 3.1
Data Data sink sink
3.1 3.1 Data Data sink sink The data sink differs from the other (sensor) nodes only regarding mobility and its role in the 802.15.4 network. Therefore the following properties below Hierarchy(0) below Hierarchy(0) Nodes host1 Node Configuration explicitely Configuration explicitely have to be overridden:
→
→
→
•
Mobility
•
MAC Protocol
→
MAC Protocol : Protocol : 802.15.4
•
MAC Protocol
→
MAC Protocol
→
Mobility Model : Model : None
→
Device Type : Type : Full Function Device
The latter two settings are required to make the root node act as PAN Coordinator which which is require required d in every 802.15. 802.15.44 wireles wirelesss netwo network. rk. The other nodes act as so called Reduced Function Devices (RFD).
3.2 Mobile Mobile senso sensorr nodes No further changes have have to be made for mobile sensor nodes although it’s possible to tune various interesting parameters in later experiments, for example transmission power or energy model specifications.
3.3 Wirele Wireless ss subnet subnet Until now all the nodes will only communicate on PHY and MAC layer. Therefore a wirel wireless ess subnet subnet has to be added added to the scenari scenario. o. The The most most conv conven enie ient nt way way to achieve this is selecting all hosts either using the rectangular- or the lasso selection tool. tool. Then Then enab enable le Network Components Components Wireless Wireless Network Network in the toolbar and click click somewhere somewhere into the selecte selected d region. region. This This will will add a new wireless wireless subnet and automatically attach all hosts to it. →
Now the PHY and MAC layer need to be configured by modifying some items below Hierarchy(0) Nodes Wireless Subnet N8-192.0.0.0 : N8-192.0.0.0 : →
8
→
•
Wireless Subnet Properties Radio Type Radio Type : 802.15.4 Radio
•
Wireless Subnet Properties MAC Protocol MAC Protocol : Protocol : 802.15.4
→
→
→
→
3.4 Traffic raffic genera generator tors s
3.4 Traffic generator generatorss The last important thing that is still missing in our scenario are traffic generators so that we can actually do some sensible simulation simulations. s. For this select select Applications CBR from CBR from the toolbar in the designer view. Via drag’n’drop it’s possible to link link all sensor nodes with the root node. Make Make sure to drag from sensor node to root node so that there’s an unidirectional traffic to root node. After finishing the scenario looks like in figure 3 figure 3.. →
Figure 3: Final scenario with traffic generators
9
3.4 Traffic raffic genera generator tors s
Finally the traffic generators have to be configured according to the scenario specifications. For each traffic generator in the inspector change the following properties below below Connections CBR XX-1 : →
•
Items to Send : Send : 30
•
Item Size (bytes): (bytes) : 2048
•
End Time : 0
•
Traffic type Data Size Fixed Size : 2048 →
→
As a last tweak the simulation time (ConfigSettings (ConfigSettings General Simulation Time ) should be altered to 300 seconds as per default the simulation runs faster than realtime and thus would be finished just after a few seconds. →
→
Now the scenario should be ready to run.
Figure 4: Inspector with properties of traffic generators
10
4. Running the scenario
4 Running Running the the scenario scenario There are various ways of running the scenario – depending on the results you want to have. Every procedure has its own advantages and disadvantages.
4.1 Graphical Graphical animation animation To give an idea of how (in terms of quantitative) the scenario performs it can be run using the QualNet Animator. Figure 5 Figure 5 shows shows the Animator with the previously designed designed scenario scenario in action. action. On the right right side you can enable enable or disabl disablee various arious types of animations. In the Layers the Layers tab tab animations for each of the 7 OSI layers can be enabled or disabled individually.
Figure 5: QualNet Animator in action The worst drawback of the QualNet animator is its extrem high CPU utilization and its implementation in Java which makes it run very slowly on most machines.
4.2 QualNe QualNett 3D Visualiz Visualizer er To bypass the performance limitations of the Animator you can use the QualNet 3D Visual Visualize izerr which which makes makes use of OpenGL OpenGL accelle accellerate rated d graphic graphic cards. It also also allow allowss various arious threedim threedimensi ensional onal views views at the running running scenario. scenario. In figure figure 6 and figure 7 typical 3D Visualizer sessions are shown. 11
4.2 QualNe QualNett 3D 3D Visu Visuali alizer zer
Figure 6: 3D Visualizer
Figure 7: 3D Visualizer with broadcasts enabled 12
4.3 Comman Command d line line inter interfac face e
4.3 Comman Command d line line interf interface ace While offering a lot of easy-to-use graphical frontends, QualNet also brings a command line interface which is mainly useful if you’re only interested in the actual statistical data of a simulation. When creating a scenario using the Designer, besides the project file a subdirectory with the same name is being created and contains various other files related to simulation. For using the command line interface the file
.config is of importance. importance. This This config config file is a standard standard text file and setting settingss can be changed changed easily easily by just editing editing this file. To run the scenario scenario described described in a config file, the QualNet CLI can be run as follows: c d < p a th th t o s c en e n a r io io f ol o l de d e r > / < p r oj oj e ct c t n am am e > < p a t h t o q u al al n e t > / b i n / q u a l n e t < p r o j e c t n am am e > . c o n f i g
If not specified differently, this will generate a file called Qualnet.stat called Qualnet.stat which which contains all statisti statistical cal data related to the simulat simulation ion.. It can be viewe viewed d using using the QualNe QualNett Analyzer as described in the next chapter.
13
5. Analyzing the results
5 Anal Analyz yzin ing g the the resul results ts The most interesting part probably is analyzing the statistical data generated during simulation. simulation. Depending on the configuration configuration scenario statistics statistics for all OSI layers layers can be viewed separately. Clicking the Analyzer the Analyzer tab at the top will bring up the QualNet QualNet Analyzer Analyzer.. Inside Inside the subdirect subdirectory ory belonging belonging to the current current scenario scenario there should be some files called ”Qualnet....stat” - if not, the scenario hasn’t been run before. Double clicking the according statistic file will open the Analyzer which allows you to browse browse through through the statistic statisticss of the differen differentt OSI layers. layers. Selectin Selectingg items items will will show informative graphs such as shown in figure 8 and figure 9.
Figure 8: Analyzer with chart of signals received and forwarded to MAC
14
5. Analyzing the results
Figure 9: Analyzer with chart on AODV routing statistics
15
6. Conclusion
6 Conclu Conclusio sion n Without having compared QualNet to other similiar solutions various advantages became apparent while using it. The most important ones are: •
easy-to-use and clear UI
•
wide range of possible applications (even WiMAX MAC layer is supported)
•
support for multiprocessor systems and distributed computing
•
sophisticated animation capabilities
•
extensive possibilities for analyzing scenario
•
shipped with a lot helpful documentation and tons of example scenarios
There’re some disadvantages as well: •
difficult installation on Linux
•
slow Java-based UI
•
5
very expensive (couldn’t find any specific figure) – however there’s a special QualNet University Program which - according to 5 - allows to get a license for about 3000 Euro per year.
ftp://ftp.tik.ee.ethz.ch/pub/publications/TIK-Report-255.pdf , page 11
16