Professional Documents
Culture Documents
Thomas Watteyne
CITI Laboratory, INSA Lyon
France Telecom R&D, Grenoble
thomas.watteyne@insa-lyon.fr
July 7, 2006
1
This document is not written by the ocial GTNetS and GTSNetS team
at Georgia Tec, and does not reect their ideas. In particular, nor the
author, nor the GTNetS and GTSNetS teams are responsible for any
errors, or content lacking in this document. This document is distributed in
the hope that it will be useful, but WITHOUT ANY WARRANTY. All of
part of it can be copied and reused, provided you specify the source of this
document. This document is regurlarly maintained and can be found
somewhere at http://citi.insa-lyon.fr/~twatteyne. Please feel free to
send any comment or request concerning this document to
thomas.watteyne@insa-lyon.fr.
1 Introduction
2 Installing GTSNetS
Once installed, you should have the following directory structure and impor-
tant les:
3
• / make.depend.dbg and make.depend.opt contain the dependencies
created during installation (using the Makefile). lib* are the li-
brairies created during installation. gtnets.el is the Emacs Lisp code
for coding in the Georgia Tech Network Simulator.
• /SRC/ This directory contains all the source les and the header les
of GTSNetS. It contains the source les for the nodes, communication
protocols, mobility pattern, trac generation, physical link models,
battery models, and the simulator. These basic blocs will be assembled
by the user to form a given simulation scenario.
In this section, we will look more closely at the most important objects,
the elementary building blocks in the /SRC/ directory used to build
an simulation in the /EXAMPLE directory. We will rst present the
4
TBC
5
4.4 The node: node.cc, node-sn.cc and node-sink.cc
The Node object is quite general: it can be a host in a wired computer
network, or in our case a wireless sensor node. We will start describing the
generic node, and then the WSN and sink node models. In the source code,
a dierence is made between Ghost nodes and Real nodes. This has to do
with the distributed simulation capability: a node is considered ghost if it
is simulated by another computer. Throughout this document, we will only
consider having one simulating computer (i.e. only "Real" nodes).
We group the main attributes of a Node object:
6
4.6 The mobility model: mobility-random-waypoint.cc
Nodes can be mobile in GTSNetS, this is especially interesting for evaluating
routing protocols in mobile networks. The Mobility object is a generic
object capable of updating the nodes position. It also informs the node if it
is mobile. The RandomWayPoint class inherits from the Mobility class, and
implements the random waypoint mobility model.
Now that we have seen an overview of the basic building blocs provided in
the /SRC directory, we will go into the /EXAMPLE directory and look at
an example le.
We will study the le testwirelessgrid.cc. This simulation puts 500
nodes on a 500mx500m rectangular region. Deployment is done using po-
lar coordinates (as shown in SRC/wireless-grid-polar.cc). The passed
parameters mean that node's distance to the center should have an expo-
nential distribution, i.e. probability of being at a given distance form the
center decreases exponentially when this distance grows.
Once the nodes are positionned, each node is aected a mobility model, in
this case random waypoint. In this mobility model (shown in SRC/mobility-random-waypoint.cc),
the node choses some location with the same exponential distribution and
picks a random duration to get there. It's speed is constant. Once there, the
7
Figure 2: 99 randomly places black nodes and a centered red sink node in a
10mx10m region.
node randomly picks a waiting time, and after that it starts chosing a new
location.
This example is very easy in that it only uses ready-made objects, and
does not involve communication. In the next section, we will build a new
example le and go more into the details of transmitting information over a
wireless channel.
8
and variables inside the main function.
• classes MyEvent and MyTrigger are used to schedule new events dur-
ing simulation. Once again, these classes are dened for rm under-
standing, most examples hide those functions inside ready-made ob-
ject. MyTrigger basically sends a layer 3 packet on the calling nodes
interface, and changes to node's color from blue to green and vice versa.
Note the Schedule(Time("1sec")); line which reschedules itself one
second later. This way, calling node will continuously send packets,
one per second.
• in the trace le, dened at the begining of the main function, we will
gather the trace of all sent packets (on our case only layer 3 packets).
• the sink node is colored red, and is mobile. The AddWaypoint method
denes the locations it will pass through, and the passing instants.
There will be no pause times.
• we have dened a variable called print which if set to true makes
the simulator print out the IP addresses of each nodes. This is only
for debugging purposes.
• At the end of the le, we ask the Simulator object to display the
topology or screen.
9
During execution, the topology on screen shows the sink node moving
and the other 99 nodes changing there colors when sending a packet. In-
side the console, HuH? IPV4 indication with no l4demux object proto
number 0 means that, at the sink, the packets were received, but with no
layer 4 header. This warning can be ignored, but it is useful because it
informs us that the sink has received our packets.
In this section, we will further go into detail of how the code works. We will
start by creating a new application, and then look at the interaction between
this application and the lower layers.
The "application" is the entity in GTSNetS which controls the gener-
ation of messages. We want this application to periodically generate a
message in all node which are within a geographical region. Resulting
code can be found at http://citi.insa-lyon.fr/~twatteyne/documents/
application-geo.cc which you will need to install in the /SRC directory.
The corresponding example le can be found at http://citi.insa-lyon.
fr/~twatteyne/documents/geographic.cc. This one goes in the /EXAM-
PLE directory. Once installed, run a make in EXAMPLE/, and a make at
the root.
Some explanation about geographic.cc, thou this is very similar to
onereportpersecond.cc:
• test
Now that we have understood how to use the basic blocks provided by GT-
SNetS in the SRC/ directory, we will construct our own block. The simulation
we want to run is an extension of the simulation built in the previous section.
The sink node will stay at location 5,5, but the nodes will not be able to
reach is directly. A multihop routing scheme is needed. We will use greedy
geographical forwarding, in which each node sends its data to its neighbor
closest to destination. This simulation is somewhat articial as we consider
each node knows its neighbors and their positions.
TBC
10