04-10-2016, 12:28 PM
1457649281-10.5923.j.se.20120204.01.pdf (Size: 1,014.27 KB / Downloads: 15)
Abstract The practical difficulties of setting up a wireless sensor network (WSN) and analysing its performance have
made simulation essential for the study of WSNs. The ns-2 network simulator is one of the most widely used tools by
researchers to investigate the characteristics of WSNs. ns-2 has the basic properties and capabilities to support simulations of
different localisation techniques. There are only a limited number of generic and reusable modules for ns-2 that can be
significantly customised to support specific research areas. Therefore, building a complete localisation system requires
in-depth knowledge of the inner workings of ns-2 and selecting between a large number of implementation options. This
paper presents an extension of ns-2 that will enable a user with a basic knowledge of ns-2 to simulate a localisation system
within a wireless network and explains how to implement new localisation algorithms using the extended ns-2. The technical
content of this paper would be beneficial to new ns-2 users regarding how a simulation project is built and structured.
1. Introduction
Location information plays a critical role in wireless
sensor networks (WSN). Most of the WSN applications and
techniques require that the positions of the sensor nodes be
determined. Localisation algorithms (e.g.[1-5]) follow
several approaches to estimate positions of sensor nodes.
One approach is to use special nodes, called beacons,
which know their own location, e.g. through a GPS receiver
or manual configuration. The other nodes that do not know
their location, sometimes referred to as unknowns, use
different techniques to compute their own position based on
the location information of the beacons and the measured
distance to these beacons. Once the unknown obtains its
position, it could act as a reference for other unknowns.
WSN Testbeds[6],[7] have been used to study various
aspects of WSNs. However, the practical difficulties of
setting up a WSN and analysing its performance have made
simulation essential for the study of WSNs. Simulation is
widely used in system modelling for applications ranging
from engineering research, business analysis, manufacturing
planning and biological science experimentation[8]. There
are several simulation packages that can be used to simulate a WSN, such as ns-2[9], OMNET++[10] and TOSSIM[11].
ns-2 is an open-source event-driven simulator designed
specifically for research in networks. ns-2 was developed in
C++ and uses Object-oriented Tool command Language
(OTcl) as a configuration and script interface (i.e., a
front-end). Each language has two types of classes. The first
type includes the standalone C++ and OTcl classes that are
not linked together. The second type includes classes which
are linked between the two languages. These C++ and OTcl
classes are respectively called, “compiled hierarchy” and
“interpreted hierarchy”. These two hierarchies are linked
together using an OTcl/C++ interface called TclCL[12].
ns-2 provides substantial support for simulation of TCP,
routing, and multicast protocols over wired and wireless
networks. Recently, Morávek[13] investigated the
capabilities of ns-2 with regards to its suitability to model
localisation in wireless networks. This investigation
concluded that: ns-2 has all the basic properties to support
simulations of different localisation techniques (such as time
of arrival (ToA) and received signal strength (RSS)) that are
contained in several ns-2 tools and modules; and, ns-2
allowed researchers a high level of independence from the
designed framework of the simulator thus allowing
developers to modify existing modules or create new
modules.
This freedom in ns-2 development, however, means a
developer is faced with a large number of implementation
options; these require widespread modification of modules
and an in-depth knowledge of the inner workings of ns-2.
In this paper, ns-2 is extended to simulate localisation
systems in WSNs (Section 3). This extension collects
together and leverages existing properties of ns-2 for
localisation modelling, offering a simplified and clearly
defined development route for implementing new schemes.
New modules are added and a base class, called “Position”,
is created. Position enables the sensor nodes to estimate their
position using the general multilateration method. New
classes derived from Position can be created to implement
other localisation algorithms as explained in Section 4. A
simulation is conducted in Section 5 to evaluate the
performance of Position. Results are presented for five
localisation algorithms (which are derived from Position) in
terms of localisation error, number of references used,
remaining energy and distance-measurement error
Localisation Extension Structure
ns-2 contains several flexible modules for
energy-constrained wireless ad-hoc networks, which
encourages researchers to use ns-2 to investigate the
characteristics of WSNs. However, to implement and
evaluate localisation algorithms, ns-2 should be extended
and new modules should be added. This section describes the
class and file structure of the localisation extension presented
in this paper. The main purpose of this extension is to
provide researchers with a simplified development path
when evaluating localisation schemes. Although the entire
structure is presented for the sake of completeness, not all the
classes and files need to be modified to implement a new
scheme. Only the classes and files shaded in yellow in Figure
3, Figure 4 and Figure 5 need to be customised.
Figure 3 shows the new classes that were added to ns-2.
These classes can be divided into two types. Firstly, there are
standalone classes, which are MMSE, Position and
YourPosition classes. These classes are used only from the
C++ domain. Secondly, there are compiled hierarchy classes,
which are LocDisApp, LocReqAgent and LocResAgent
classes. In fact, no OTcl modules were created. However, in
order to be able to access the newly compiled hierarchy
classes LocDisApp, LocReqAgent and LocResAgent from
the OTcl domain, these classes were mapped and linked to
corresponding OTcl classes, which are Application/LocDis,
Agent/LocReq and Agent/LocRes, respectively. In this way
the users are able to create an object of the compiled
hierarchy classes from the OTcl domain. For example, the
OTcl command “set lreq[new Agent/LocRec]” will create a
new object of class LocReqAgent.
Class Hierarchy
The Doxygen documentation system[19] was used to
illustrate the class hierarchy of the new classes as shown in
Figure 4. For the sake of simplicity, only the new classes, the
classes they are derived from (i.e. parent classes) and the
classes used by these new classes were included. Solid lines
show where a class is inheriting from another class, for
example A → B means class A is derived from class B Dotted lines show where a class is using a method and/or
member of another class.
3.1.1. MMSE Class
This class is responsible for all the mathematical matrices
operations required to solve (2). Instead of using general
matrix multiplication and matrix inverse, optimized
methods dedicated mainly to MMSE were implemented.
These optimized methods require less computation and
shorter execution time.
3.1.2. Position Class
Position class represents a general localisation method
using the basic multilateration method, which was
explained in Section 2.1, for position computation and RSS
for distance estimation. This method uses all of the
available references, does not distinguish between beacons
and references, does not weigh the references used and
performs the estimation only once. This class is the base
class for any localisation algorithms implemented,
represented in the text and figures as the YourPosition class.
For the sake of simplicity, Figure 3, Figure 4 and Figure 5
include only these two classes, even though other
localisation algorithms were also implemented that will be
mentioned later.
One of the important methods of this class is
“measure_distance_RSS(double Pr);”. This function uses
Friis free space equation (3) to estimate the measured
distance between the node and the reference (or beacon)
nodes,
( ) , 4 2
2
d
L P G G P T T R
R
π
λ = (3)
where: PR is the received power, PT is the transmitted power,
GT is the transmitter antenna gain, GR is the receiver
antenna gain, d is the distance between the transmitter and
the receiver, L is the system loss and λ is the wavelength.
To implement a new technique instead of RSS, e.g. ToA,
this function should be replaced with a new one. However,
this replacement will not affect the other two components,
position computation and localisation algorithm, of the
localisation system.
3.1.3. YourPosition Class
This class is derived from Position class and is the core
class for defining a new localisation scheme. Compared
with the Position class, the YourPosition class will include
functions specific to the scheme being implemented. For
example, for an implementation of ALWadHA[1], one of
the schemes tested in Section 5, this class would include
scheme-specific methods, such as the smart
reference-selection method specified number of references
and termination criterion.