Characterisation and Applications of MANET Routing Algorithms in Wireless Sensor Networks

elfinoverwroughtNetworking and Communications

Jul 18, 2012 (5 years and 10 months ago)


Characterisation and Applications of MANET
Routing Algorithms in Wireless Sensor
Siddhu Warrier
Master of Science
School of Informatics
University of Edinburgh
Wireless Sensor Networks (WSN) are networks of low-cost,low-power,multi-
functional devices that can be used to monitor physical phenomena.Communication
between nodes in a vast network requires routing mechanisms.A Specknet is a pro-
grammable computational network of large numbers of minute semiconductor compo-
nents with integrated sensing,processing and wireless networking capabilities called
This thesis sets to analyse the feasibility of using Mobile Ad-hoc Network (MANET)
routing mechanisms in Wireless Sensor Networks,and to investigate application do-
mains where MANET algorithms can be used.Therefore,the Destination Sequenced
Distance Vector (DSDV) and Zone Routing Protocol (ZRP) algorithms,and a Visitor
Tracking System (VTS) application using the DSDV algorithm were implemented on
prototypes of Specks called the ProSpeckz.
The suitability of the algorithms and the performance of the application are anal-
ysed using several experiments.The results of the experiments indicate that MANET
algorithms such as the DSDV algorithm are candidates for use in certain WSN appli-
cations.It is also learnt that the DSDValgorithm,while more responsive when used in
small networks,is less scalable than the ZRP algorithm.
Future work includes improving the performance of the implementations analysed
by performing optimisations to MAC algorithm characteristics and additions to net-
work layer functionality,and extending the ZRP algorithmto newapplication domains.
First and foremost,I would like to thank my supervisor,Dr.D.K.Arvind,Reader,
School of Informatics,University of Edinburgh,for his constant guidance,and for
having provided me both material and moral support over an extremely staggered thesis
I would like to thank Prof.Klaus Wehrle,Head,Distributed Systems Group,Chair
of Computer Science IV,RWTH Aachen,for consenting to be my second supervisor,
and for agreeing to mark my thesis at an extremely short notice.
Just as importantly,my thanks go out to Dr.Steven K.J.Wong,Nanyang Tech-
nological University,Singapore,who helped me get started,wrote the SpeckMAC
algorithm,and helped immeasurably in the implementation of the DSDV algorithm.
I would also like to thank the European Commission for funding me over the past
two years,as well as Agilent Technologies,who funded me during a part of this work.
This section would be incomplete if I failed to acknowledge Mat Barnes,Research
Associate,School of Informatics,University of Edinburgh,for guiding me millions of
times when I was stuck,sitting through long debugging sessions of my (often un-
sightly) code,helping me with hardware problems,and reading my thesis.
I would also like to express my gratitude to my good friend Mohammad Dmour,
who has very patiently proof-read this work.
I would like to express my heartfelt gratitude to Alex Young and Martin Ling,
School of Informatics,University of Edinburgh,for having patiently explained certain
concepts to me,taught me to use some of the equipment in the lab,and for having
steered me through choppy waters.
Tom Feist,who designed the foundation upon which part of this work is based
on,also deserves my sincere thanks,as do Ryan Mc Nally and Janek Mann,School
of Informatics,University of Edinburgh,for having suggested tracking mechanisms to
Dipl.Inf.Jo Agila Bitsch Link,Chair of Computer Science IV,RWTH Aachen,
deserves my gratitude for having proof-read my thesis and provided me with detailed
feedback,as does Galiia Khasanova for having taken a look at my thesis and for
having tolerated me and my endless rants for as long as she has.
Last but definitely not the least,I would like to thank my parents for,well,being
loving parents and for having resisted the wholly understandable temptation to drown
me when I was still an (insufferable) child.Society probably suffers fromthat decision
of theirs borne out of parental love,but I sure got lucky!
I declare that this thesis was composed by myself,that the work contained herein is
my own except where explicitly stated otherwise in the text,and that this work has not
been submitted for any other degree or professional qualification except as specified.
( Siddhu Warrier )
This thesis is dedicated to Eric Cartman,Southpark,Colorado,USA,for his
unflinching guidance,and for having shaped my philosophy in life.
Table of Contents
1 Introduction 1
1.1 Rationale................................1
1.2 AlgorithmCharacterisation.......................2
1.3 Applications...............................3
1.3.1 Visitor Tracking System....................3
1.4 Outline.................................4
2 Background 5
2.1 Wireless Sensor Networks.......................5
2.1.1 Architecture and constraints..................6
2.1.2 Deployment Structure and Topology..............7
2.1.3 Protocol Stack on a typical Sensor Node............7
2.2 Specknets and the ProSpeckz IIK....................8
2.2.1 Overview............................9
2.2.2 The Prospeckz IIK.......................9
2.3 The MAC Layer in Wireless Sensor Networks.............11
2.4 SpeckMAC...............................12
2.4.1 SpeckMAC-B..........................13
2.4.2 SpeckMAC-D..........................14
2.4.3 Why SpeckMAC?.......................14
2.5 Routing in Wireless Sensor Networks.................15
2.5.1 Classification of routing protocols...............16
2.5.2 Classification of WSN routing protocols............16
2.6 Destination-Sequenced Distance-Vector Routing (DSDV).......17
2.6.1 Distance Vector routing.....................17
2.6.2 Sequence Numbers.......................18
2.6.3 Broken Links..........................18
2.6.4 Full Routing Table Dump vs Incremental Routing Update..18
2.6.5 Preventing Routing Table Fluctuation.............19
2.6.6 Issues with the DSDV Algorithm...............19
2.7 Zone Routing Protocol.........................19
2.7.1 Basic Operation.........................20
2.7.2 Intra-zone communication in ZRP...............21
2.7.3 Inter-zone communication...................21
2.7.4 Properties of the ZRP routing algorithm............22
2.8 Tracking in WSNs...........................22
2.9 Summary................................23
3 Implementation of the DSDV Algorithm 25
3.1 Protocol Stack..............................25
3.2 Primitives and Data Structures.....................26
3.2.1 MAC Layer Primitives.....................26
3.2.2 Packet Types..........................29
3.2.3 The Routing Table.......................31
3.3 Operational Example..........................35
3.3.1 Node Discovery and Route Propagation............38
3.3.2 Data Transmission.......................41
3.3.3 Link Failure...........................44
3.4 Summary................................44
4 Applications using the DSDV Algorithm- Visitor Tracking System 45
4.1 Aim...................................45
4.2 Requirements..............................46
4.3 Architecture...............................46
4.3.1 Hardware and Software Platforms...............47
4.3.2 Protocol Stack.........................47
4.3.3 The VTS in the Application Layer...............47
4.3.4 Packet Types in the Application Layer.............50
4.4 The VTS in operation..........................51
4.4.1 Stage 1.............................51
4.4.2 Stage 2.............................51
4.4.3 Stage 3.............................54
4.4.4 Stage 4.............................54
4.5 Summary................................55
5 Implementation of the ZRP Algorithm 56
5.1 Protocol Stack..............................56
5.2 Inter- and Intra-Zone communication..................57
5.3 Modifications made to the DSDV implementation...........57
5.3.1 Changes to the DSDV implementation.............58
5.3.2 Code Optimisations and Additions...............58
5.4 Reactive Inter-Zone communication..................58
5.4.1 Packet Types and the Inter-Zone Route Discovery Protocol..59
5.4.2 Route Caching Mechanisms..................62
5.5 Operational Example..........................62
5.5.1 Stage 1.............................64
5.5.2 Stage 2.............................64
5.5.3 Stage 3.............................65
5.6 Summary................................65
6 Experimental Methodology 66
6.1 Metrics Used for Characterisation...................66
6.1.1 Transmission Time.......................67
6.1.2 Delivery Ratio.........................67
6.1.3 Transmitter/Receiver On-time.................67
6.1.4 Metrics used for application characterisation.........68
6.2 Measurement Techniques........................68
6.2.1 Measuring Transmission Latency...............69
6.2.2 Measuring Delivery Ratio...................73
6.2.3 Measuring Tx/Rx On-time...................74
6.2.4 Measuring Metrics for Application Characterisation.....75
6.3 Summary................................76
7 Characterisation and Analysis of the DSDV Algorithm 78
7.1 Transmission Time...........................78
7.1.1 Results and Conclusions....................79
7.2 Delivery Ratio..............................79
7.2.1 Results.............................80
7.2.2 Conclusions...........................80
7.3 Tx/Rx On-time.............................80
7.3.1 Results.............................80
7.3.2 Conclusions...........................83
7.4 Summary................................83
8 Characterisation and Analysis of the VTS Application 84
8.1 Varying Requirements for different VTS node types:The Rationale.84
8.2 Experimental Setup...........................85
8.3 Tx/Rx On-time.............................86
8.3.1 Conclusions...........................86
8.4 CPU On-time..............................88
8.4.1 Conclusions...........................88
8.5 Power Consumption...........................88
8.5.1 Results and Conclusions....................88
9 Characterisation and Analysis of the ZRP Algorithm 93
9.1 Transmission Time...........................93
9.1.1 Results and Conclusions....................94
9.2 Delivery Ratio..............................95
9.2.1 Results and Conclusions....................95
9.3 Tx/Rx On-time.............................95
9.3.1 Results and Conclusions....................98
9.4 Summary................................101
10 Comparison of ZRP and DSDV on WSNs 102
10.1 Suitability of the DSDV and ZRP algorithms.............102
10.2 DSDV vs ZRP..............................103
11 Conclusions and Future Work 104
11.1 Future Work...............................105
Bibliography 106
List of Figures
2.1 Architecture of a Sensor Node (reproduced from(2)).........6
2.2 Overview of Specknet Architecture (reproduced from(4)).......9
2.3 The operation of the B-MAC,SpeckMAC-B and SpeckMAC-D algo-
2.4 A network divided into zones with a zone radius of 2.........20
3.1 DSDV protocol stack..........................26
3.2 Basic Packet Structure (with DSDV-specific extensions)........27
3.3 Packet Types used in the DSDV algorithm...............29
3.4 DSDV routing table entry........................32
3.5 Structure of DSDV Routing Table...................33
3.6 DSDV Node Discovery and Route Propagation:Stage 1........36
3.7 DSDV Node Discovery and Route Propagation:Stage 2........36
3.8 DSDV Node Discovery and Route Propagation:Stage 3........37
3.9 DSDV Data Transmission:Stage 1...................39
3.10 DSDV Data Transmission:Stage 2...................40
3.11 DSDV Link Failure:Stage 1......................42
3.12 DSDV Link Failure:Stage 2......................43
4.1 VTS protocol stack...........................48
4.2 VTS packet types............................50
4.3 VTS operation:Stage 1.........................52
4.4 VTS operation:Stage 2.........................52
4.5 VTS operation:Stage 3.........................53
4.6 VTS operation:Stage 4.........................53
5.1 ZRP protocol stack...........................57
5.2 Packet Types used in the ZRP algorithm................59
5.3 Basic packet structure with ZRP-specific extensions..........60
5.4 ZRP Operational Example:Stage 1...................63
5.5 ZRP Operational Example:Stage 2...................63
5.6 ZRP Operational Example:Stage 3...................64
6.1 Architecture of the MN.........................69
6.2 Procedure for Transmission Time Measurement in the DSDV algorithm 71
6.3 Procedure for Transmission Time Measurement in the ZRP algorithm 72
7.1 Results:Transmission Time for 2-hop transmission..........79
7.2 Results:Delivery Ratio across 1 hop..................81
7.3 Results:Delivery Ratio across 2 hops.................82
7.4 Results:Tx/Rx On-time for the DSDV algorithm...........83
8.1 VTS:Experimental Setup and Topology................85
8.2 VTS Results:Tx/Rx On-time at the MN................87
8.3 VTS Results:Tx/Rx On-time at the IN.................87
8.4 VTS Results:Tx/Rx On-time at the VN................87
8.5 VTS Results:CPU On-time at the MN.................89
8.6 VTS Results:CPU On-time at the IN..................89
8.7 VTS Results:CPU On-time at the VN.................90
8.8 VTS Results:Power Consumed by the MN..............90
8.9 VTS Results:Power Consumed by the IN...............91
8.10 VTS Results:Power Consumed by the VN...............91
9.1 Results:Transmission Time for 2-zone transmission..........94
9.2 Results:Delivery Ratio across 1 zone hop...............96
9.3 Results:Delivery Ratio across 2 zone hops...............97
9.4 Results:Tx On-time for the ZRP algorithm..............99
9.5 Results:Rx On-time for the ZRP algorithm..............100
List of Tables
3.1 DSDV Packet type identifiers......................30
4.1 VTS Packet type identifiers.......................50
5.1 ZRP Packet type identifiers.......................60
List of Abbreviations
Analog to Digital Converter
Vertical Cavity Surface Emitting Laser
Wireless Sensor Network
Mobile Ad-hoc Network
MediumAccess Control
Radio Frequency
Programmable Specks over Zigbee radio
Commercial Off-The-Shelf components
Programmable Systemon Chip
Pulse Width Modulation
Universal Asynchronous Receiver/Transmitter
Pseudo RandomSequence generator
Multiply Accumulate
Operational Amplifier
Integrated Development Environment
Time Division Multiple Access
Destination Sequenced Distance Vector
Distance Vector
Access Point
Distributed Bellman-Ford
Incremental Routing Update
Zone Routing Protocol
Route Query
Route Reply
Global Positioning System
Wireless Local Area Network
Radio Frequency Identification
Interrupt Service Routine
Least Significant Byte
Received Signal Strength Indicator
Cyclic Redundancy Check
Most Significant Byte
Sending Node
Receiver Node
Visitor Tracking System
Visitor Node
Infrastructure Node
Monitor Node
Visitor Information (packet)
Central Processing Unit
Global Counter
Transmit Counter
Receive Counter
CPU Counter
Border Gateway Protocol
Chapter 1
1.1 Rationale
In recent years,there have been significant advances in the technology used to build
Micro-Electro-Mechanical Systems (MEMS),digital electronics,and wireless com-
munications.This has enabled the development of low-cost,low-power,multi-functional
small sensor nodes that can communicate across short distances (2).
There has been a lot of research into routing in wireless sensor networks,as sum-
marised in (1) and (3).Routing in wireless sensor networks is important,as commu-
nication between nodes is central to most applications that use them.According to
Al-Karaki and Kamal (3),routing in wireless sensor networks is different fromrouting
in IP and Mobile Ad-hoc Networks (MANET) because:
• The large numbers of nodes,that make it expensive to construct a global address-
ing scheme.Furthermore,since several wireless sensor network applications are
data-driven,addressing is not as important.
• Most applications require data to flowfromseveral sensor nodes to a given sink.
• There are tight constraints on energy,processing power,and memory.
• In most application scenarios,most wireless sensor network nodes are stationary,
except for a few mobile nodes,thereby making topological changes infrequent.
Similarly,according to (2),ad-hoc routing techniques are unsuitable for use in
wireless sensor networks because of the larger numbers of nodes,dense deployment,
higher failure rates,frequent topology changes,use of the broadcast (as opposed to the
Chapter 1.Introduction 2
point-to-point) communication paradigm,limited power,computational capacities and
memories,and infeasibility of using global identifiers.
Several of the objections raised in (2) and (3) are similar,though a few - regarding
frequency of topological changes and the use of broadcast paradigms - contradict each
MANET nodes are highly mobile,and this mobility produces effects similar to
node failure,i.e.,topological changes.There are also wireless sensor applications
where dense deployment and significantly larger numbers of nodes are unnecessary,
and global IDs are necessary.However,the available energy and memory capacity is
highly limited on wireless sensor networks.
Therefore,in this work,we consider whether and howMANET routing algorithms
can be used in wireless sensor networks,and application scenarios of the sort described
in the preceding paragraph are discussed.
1.2 AlgorithmCharacterisation
The primary question that this work set out to answer is whether MANET routing
algorithms are suitable for use in wireless sensor networks.This could potentially
open up an entirely new class of algorithms for use in wireless sensor networks.
To this end,an exploratory study was carried out,wherein two routing algorithms
used in MANETs were implemented on hardware prototypes of Specknets called the
Prospeckz IIK (4).
The Prospeckz IIKis the second generation of a prototype that was developed in or-
der to “enable the rapid development of Specks” as well as applications for Specks (4).
The Prospeckz IIKuses off-the-shelf components,and includes a radio with adjustable
signal strengths,an 8-bit microcontroller with 32 Kbytes of FLASH and 2 Kbytes of
RAM,and the ability to design analogue circuitries that are software reconfigurable.
The SpeckMAC algorithm developed by K.J.Wong and D.K.Arvind (38),was
used in the MAC layer.This was done because the SpeckMAC algorithm has better
power conservation characteristics than other comparable MAC layer algorithms such
as the B-MAC (27).
The two algorithms implemented were the Destination Sequenced Distance Vector
(DSDV) (26) and the Zone Routing Protocol (ZRP) (15).The first is a proactive -
wherein routes to all nodes are stored within each node - while the latter is a hybrid
routing algorithm- which uses a proactive routing algorithmwithin defined zones and
Chapter 1.Introduction 3
a reactive algorithmoutside these zones (15).
These algorithms were characterised by considering their memory requirements,
power consumption,message delivery latency,and Transmitter/Receiver On-time.
1.3 Applications
In addition to the characterisation of MANET algorithms,we also consider applica-
tions where these routing algorithms could be used in the network layer.
Therefore,in this work,we developed an application running on the Prospeckz IIK,
which used the routing algorithms characterised as enablers.
During the implementation of these applications,we were also able to study the
use of wireless sensor networks in the fields of moving object tracking and ubiquitous
1.3.1 Visitor Tracking System
The application we envisaged - called the Visitor Tracking System- involved tracking
the approximate location of several mobile nodes in a small building,and feed infor-
mation on location and direction of each node to a single central sink.It was required
that the user at the central sink receive alerts if any mobile node approached restricted
areas within the building.
However,the omni-directional nature of radio waves and multi-path propagation
make accurate location estimation using radios a very difficult and challenging prob-
lem.This is still an open research problem.
Therefore,it was decided that the application would attempt to perform approxi-
mate location estimation on the basis of the signal strength of received radio signals.
The DSDV routing algorithm (26) was used to communicate node location infor-
mation to the sink node.The application’s performance was subsequently charac-
terised by analysing the power consumption,as well as by monitoring the percentage
of time the CPU,Receiver and Transmitter were turned on.
However,the DSDV algorithm is a proactive algorithm,and this,for reasons ex-
plained later on in this document,limits the scale of this application.
Chapter 1.Introduction 4
1.4 Outline
The rest of this thesis is organised as follows:
Chapter 2 delves in considerable depth into the background and context of this
work.It includes a description of Wireless Sensor Networks (WSN)and the hardware
and software platforms used in the development of this work,followed by a brief out-
line of the routing algorithms and applications implemented during the course of this
The three chapters that followdescribe the implementation of the DSDValgorithm,
the Visitor Tracking System (VTS),and the ZRP algorithm.The discussion considers
the primitives and data structures used therein,and clarifies the operation of these
algorithms using examples.
Chapter 6 contains a discussion of the metrics used to analyse the implementations
described in the previous chapters.The metrics,and the procedures and experimental
setups required to measure them,are presented in great detail in this chapter.
The next three chapters expound on the results obtained upon running the experi-
ments defined in Chapter 6 on the implementations presented in Chapters 3,4,and 5.
An attempt is made to analyse the significance of the results thus obtained.
The last chapter compares the two algorithms implemented as part of this work,
and attempts to draw conclusions from the comparison.It also explores avenues for
future work.
Chapter 2
In this chapter,a brief discussion is presented of some of the concepts,algorithms,
and hardware platforms that were used during the course of this work.A discussion
of Wireless Sensor Networks (WSN) is followed by a discussion on Specknets,and
the Prospeckz IIK hardware platform that was used to implement the algorithms and
the applications.The next section describes Mobile Ad-hoc Networks (MANETs),
and provides arguments both for and against the use of MANET algorithms in wire-
less sensor networks.Section 2.3 describes the algorithm used in the Medium Access
Control (MAC) layer throughout the thesis - SpeckMac.The fourth section discusses
the MANET routing algorithms which were evaluated on the WSN platform.This is
followed by a discussion of tracking mechanisms used in wireless networks.
2.1 Wireless Sensor Networks
Sensor nodes are low-cost,low-power,multi-functional devices which have a small
form factor and can communicate untethered,using (usually) Radio Frequency (RF)
communication across short distances (2).
Networks of such nodes are called WSNs,and can be deployed in the area of
interest to monitor the physical environment.
They are usually deployed densely in random positions,either inside of,or very
close to the phenomenon that has to be monitored.
Sensor networks can be used in several applications and locations,ranging from a
battlefield to the user’s living room.
In the remainder of this section,we shall present short overviews of the architecture
of sensor nodes and networks,traditional sensor network topology,and the sensor
Chapter 2.Background 6
Figure 2.1:Architecture of a Sensor Node (reproduced from (2))
network protocol stack.This section is based on (2) unless stated otherwise.
2.1.1 Architecture and constraints
According to (2) (please see Figure 2.1),a sensor node consists of the following com-
ponents.The components drawn using dotted lines are application-dependent.
• A Sensing Unit:A sensing unit typically consists of sensors and Analog-to-
Digital Converters (ADCs).However,it is not necessarily true,unlike what (2)
states,that sensing units are built into sensor nodes.We shall see this in the
following section,where we discuss the Prospeckz IIK (4).
• Processing Unit:The processing unit is usually associated with a small storage
unit,and handles reading sensor data and collaboration with other sensor nodes.
• Transceiver Unit:The transceiver unit connects the sensor node with other nodes
in the network - using RF,Infra-Red (IR),optical media such as Vertical Cavity
Surface-Emitting Lasers (VCSEL),or even optical communication using VC-
SELs and radio (28).
• Power Unit:It follows fromthe paramount importance of power consumption in
sensor networks that the power unit is a very important component of a sensor
node.It may be supported by power scavenging units such as solar cells,or may
use chemical batteries.
Chapter 2.Background 7
Sensor networks are placed under the following constraints,given the specialised roles
that they play.
• All the components described above should fit into a small unit.For example,
work is currently underway to develop Specknets (4) with a formfactor of 5mm
called the 5CubeOTS (8).
• Other important constraints include low power consumption,high “volumetric
density”,and high fault tolerance of the network (i.e.,dispensability of individ-
ual nodes) (19;2).
2.1.2 Deployment Structure and Topology
In this subsection,we describe the structure and topology of a typical WSN deploy-
ment.The sensor nodes collect data,and autonomously route data back to a sink that
performs collation.The routing is multi-hop.This is necessitated by the individual
nodes’ limited ratio range,as well as the requirement for the minimisation of power
The topology of such a network,according to (2) can be examined in three distinct
• Pre-deployment and deployment phase:Sensor nodes are scattered,either indi-
vidually or in clusters,using a variety of delivery mechanisms.
• Post-deployment phase:Sensor nodes,as have been mentioned earlier,are failure-
prone.Taken in conjunction with a possibly hostile deployment environment,
this means that the topology is subject to change.
• Redeployment phase:The autonomous nature of the multi-hop routing algo-
rithms used allows for the redeployment of additional nodes at any time during
operation.This may be done because of the failure of previously deployed nodes,
or due to changed deployment requirements.
2.1.3 Protocol Stack on a typical Sensor Node
The protocol stack is adapted from the stack presented in (32).This has also been pre-
sented in (2).The stack has three planes,namely,the power management plane,the
Chapter 2.Background 8
mobility management plane,and the task management plane.The stack also consists
of five distinct layers as described below:
• Physical Layer:This layer deals with modulation and Transmission and Recep-
tion techniques.
• Data Link Layer:The focus,in this layer,is on the development of a power-
aware MAC protocol,which minimises collisions,as well as the time for which
the transceiver is turned on.
• Network Layer:This layer primarily deals with routing.However,the presence
or absence of this layer is dependent upon application requirements.
• Transport Layer:This layer maintains data flow,performs congestion control,
and several other tasks which are traditionally performed on transport layers in
wired networks as well.However,in the applications presented in this work,we
do not use the transport layer,and therefore,we shall not discuss this further.
• Application Layer:This layer contains the application software.
This work primarily concerns itself with the implementation of a small subset of
these routing techniques,and therefore,our focus will subsequently be restricted to the
MAC and network layers respectively.
2.2 Specknets and the ProSpeckz IIK
A Speck,as defined in (4),“is designed to integrate sensing,processing and wire-
less networking capabilities in a minute semiconductor grain”.Thousands of Specks,
once deployed,are expected to collaborate as “programmable computational networks
called Specknets”.
As can be seen from these definitions,Specks and Specknets are analogous to the
sensor nodes and WSNs discussed in the previous section.The aim of the Speckled
Computing Project
is to enable ubiquitous computing,wherein computation will be
performed everywhere,invisible to its users (37).
Communication between nodes on a Specknet are expected to be a combination of
optical and radio communication as discussed in the previous section (28;4).
Chapter 2.Background 9
Figure 2.2:Overview of Specknet Architecture (reproduced from (4))
2.2.1 Overview
The architecture of the systemis split across three levels - Speck Architecture,Speck-
net Architecture,and Speckled Computing.The architecture is self-explanatory,given
the basis established in Section 2.1.
This work focuses on the Specknet Architecture as it attempts to characterise spe-
cific routing protocols.
2.2.2 The Prospeckz IIK
The ProSpeckz (Programmable Specks over Zigbee Radio) (4) is a prototype of Specks
developed in order to enable rapid development of Speckled Computing applications.
The ProSpeckz,and its successor,the ProSpeckz IIK,have been developed entirely
using Commercial off-the-shelf (COTS) components.
In the remainder of this section,we provide a short overview of the ProSpeckz IIK
Chapter 2.Background 10 Programmable System-on-Chip (PSoC)
The Programmable System-on-Chip (PSoC) (12) family,developed by Cypress Mi-
crosystems,consists of several “Mixed Signal Array with On-Chip Controller” de-
vices.The CY8C29666 chip used on the ProSpeckz IIK belongs to this family.
The PSoC device consists of configurable blocks of analogue and digital logic,and
programmable interconnects.
It also includes an M8C processor (with speeds up to 24MHz),32 KBytes of Flash
programming storage,and 2 KBytes of SRAMdata storage.
The chip consists of four components:
• PSoC Core:This includes the M8C processor,Flash memory (which can emu-
late EEPROM),and the SRAM.
• Digital System:This includes 16 digital PSoC blocks.These blocks support the
incorporation of 8-to-32 bit Timers (13),8-to-32 bit Pulse Width Modulation
(PWMs) blocks,8-to-32 bit (down-)Counters (11),an 8-bit Universal Asyn-
chronous Receiver/Transmitter (UART) (14),and Pseudo Random Sequence
(PRS) Generators.There are many more configurations supported,but they are
not relevant to developing an understanding of this work.
• Analog System:This includes 12 configurable blocks,each of which consists
of an Operational Amplifier (Op-Amp) circuit.This allows for the creation of
complex analog signal flows.
• System Resources:SystemResources provide “additional capabilities useful for
complete systems” (12),such as digital clock dividers,a Multiply-Accumulate
(M-AC) system,and an integrated switch mode pump (SMP) allowing for the
use of 1.2 V batteries,among others.
PSoC chips can be programmed using an Integrated Development Environment
(IDE) called the PSoC Designer - which was used,for the most part,during the course
of this work.An in-circuit emulator can be used for debugging.Additionally,the
analogue reconfigurability of the PSoC chip allows for quick and easy interfacing of
external sensors to the ProSpeckz IIK.
Chapter 2.Background 11 The CC2420 Radio
The ProSpeckz IIK uses the CC2420 transceiver in order to implement radio commu-
nications.The CC2420 is a single-chip,IEEE 802.15.4 compliant RF transceiver,and
communicates using the 2.4 GHz (2,400−2,583 MHz) Industrial,Scientific,Medical
(ISM) band.
It is low-power,runs at a low voltage (18.8mA at 3.3V on the Prospeckz IIK),and
provides an effective data rate of 250 Kbps.
The CC2420 can transmit at several different signal strengths,ranging from0 dBm
(Rx:18.8 mA,Tx:17.4 mA) to -25 dBm (Tx:8.5 mA).This can be set using integer
arguments ranging from 0 to 31,with the latter corresponding to transmission (Tx)
power of 17.4 mA.
Since it provides extensive hardware support for packet handling,data buf fer-
ing,encryption and authentication,burst transmissions,clear channel assessment,link
quality,and packet timing information,it reduces the load on the host controller.
Additionally,the ProSpeckz IIK uses 2.4 GHz matched antenna and filter cir-
cuitries to improve power transfer fromcircuitry to the transmission medium(air).
2.3 The MAC Layer in Wireless Sensor Networks
A MAC protocol on sensor networks has the following requirements:
• Creation of a network infrastructure.
• Fair and efficient sharing of communication resources.
• Most importantly,the minimisation of the power consumed.
The closest peers to sensor networks,according to (2) are Bluetooth and MANETs.
However,Bluetooth communication is essentially of a Master-Slave nature,allowing
for the use of time-division multiple access (TDMA) scheduling.And in the case of
MANETs,power consumption minimisation is not as important as it is on WSNs.
This is because the batteries on the devices used therein are usually larger,and can be
replaced by the user.
MAC protocols can be classified on the basis of the the degree of centralisation
(38).MAC protocols can thus be classified either as centralised or decentralised.
dBmis a power ratio in decibels (dB) of the measured power,referenced to one milliwatt,and used
to measure absolute power in radio,microwave,and fibre optic transceivers.
Chapter 2.Background 12
In the former category,a base station or cluster head ensures collision-free opera-
tion within the network or cluster.Algorithms using TDMA fall within this category.
As mentioned earlier in this section,this approach is used in Bluetooth (for instance),
and cannot be applied to wireless sensor networks where all the nodes are equally
Decentralised MAC protocols deal with the aforementioned deficiencies,and can
be classified as being either “scheduled” or “random-access”.Examples of the former
include S-MAC (39) and T-MAC (35).These protocols use time slots which are much
larger than those used in TDMAbased centralised schemes,in order to obviate the need
for tight time synchronisation.Random-access MAC protocols allow nodes to access
the shared medium “on-demand”,and do not require scheduling or synchronisation
(unlike the other classes of algorithms described above).Examples of this approach
include the B-MAC (27) and SpeckMAC (38) algorithms.
This work uses the SpeckMACalgorithmin the MAClayer of the routing protocols
adapted as part of this work.Therefore,the next section provides the reader with a short
description of SpeckMAC,and the rationale behind the choice of SpeckMAC.
2.4 SpeckMAC
SpeckMAC (38) is a “low power,distributed,unsynchronised,random-access” MAC
protocol that provides support for low data rate communication on wireless sensor
Randomaccess MACprotocols allownodes to access the channel without requiring
synchronisation or scheculing.SpeckMAC uses in-channel signalling to wake desti-
nation nodes up
SpeckMAC transfers the communication costs to the transmission of data,i.e.,the
receiver is turned on for as short a period as possible at the expense of a longer transmit-
ted packet.This choice is informed by the low data-rates (low numbers of transmitted
packets) and high nodal density (number of receptions >number of transmissions) on
As a result of this,radio receivers are kept turned off,and are turned on only at
specific intervals of time,T
This is because radio receivers are automatically switched off in order to minimise power consump-
Chapter 2.Background 13
Figure 2.3:The operation of the B-MAC,SpeckMAC-B and SpeckMAC-D algorithms
(illustrated by showing transmission of packet from Source S to Destination D) (repro-
duced from (38))
SpeckMAC uses redundant retransmissions for a period
before transmitting the actual data.There are two variants to SpeckMAC:
• SpeckMAC-Backoff (SpeckMAC-B)
• SpeckMAC-Data (SpeckMAC-D)
The operation of SpeckMAC-B,SpeckMAC-D and B-MAC (27) are represented
in figure 2.3,which is reproduced from(38).
2.4.1 SpeckMAC-B
The transmitting node sends a long streamof wakeup packets for the previously defined
period T
before sending the data packet itself.
Chapter 2.Background 14
When a node switches its receiver on and notices that the mediumis busy,it listens
in.If it receives a data packet,it goes back to idle mode after completing reception.
On the other hand,if it receives a wakeup packet,it then switches the receiver off,and
turns it back on when the streamof wakeup packets gives way to the data packet.The
node then returns to sampling the channel periodically as described above.
2.4.2 SpeckMAC-D
In this case,the transmitting node performs redundant retransmissions of the data
packet itself,thereby sending a streamof data packets for a period defined by T
where T
is the time required to transmit a single data packet,and T
is an integral
multiple of T
.A data packet is padded with a 3 byte long preamble.
When a node samples the channel,and finds the mediumbusy,it listens in to com-
plete reception of a data packet,and then turns the receiver off for a period of T
Subsequently,it continues to listen periodically for packets.
2.4.3 Why SpeckMAC?
There are two reasons why SpeckMAC was used in the MAC layer for the evaluation
of the routing algorithms implemented as part of this work.These are summarised
• SpeckMAC is a decentralised,random-access MAC protocol.The advantages
of this class of algorithms is described in Section 2.3.
• B-MAC was the only other algorithm in the same class that was under consid-
eration,and SpeckMAC performs considerably better than B-MAC with respect
to power consumption - and by extension,battery life.Experiments performed
in (38) indicate that SpeckMAC-B and SpeckMAC-Dimprove battery life by up
to 83.5%and 117.9%respectively,when compared to B-MAC.
Additionally,since the performance improvements upon using SpeckMAC-Dwere
shown in (38) to be considerably higher,it was chosen as the MAC protocol over
Chapter 2.Background 15
2.5 Routing in Wireless Sensor Networks
As discussed in Section 2.1,WSNs require multi-hop routing algorithms due to limited
radio ranges of the individual nodes.According to (3;2;1),routing algorithms in
WSNs must be designed keeping the following requirements and constraints in mind:
• Power efficiency is the most important consideration due to the limited capacity
of a sensor node.
• The WSN has to be self-organising.
• WSNs are mostly data-centric.
• Position awareness is extremely important in many WSN applications.
• Data collected by sensor nodes may contain large amounts of redundancy.There-
fore,in-network aggregation would have to be performed.
Additionally,it is stated in (3) that:
• The large numbers of sensor nodes in typical WSN deployments make it impos-
sible to build a global addressing scheme.
• Post-deployment,WSNnodes are stationary in most cases.In some applications,
however,sensor networks may be allowed to move and change their location
(although with low mobility)
Furthermore,it is stated in (2) that:
• Sensor nodes mainly use a broadcast communication paradigm,whereas most ad
hoc network routing algorithms use the point-to-point communication paradigm.
On the basis of some of the arguments put forth in the two preceding lists,the
authors of (2) state that protocols and algorithms proposed for traditional wireless ad
hoc networks are “not well-suited to the unique features and application requirements
of sensor networks”.
In this work,part of our focus is to validate the veracity of this assertion by
implementing and evaluating two algorithms designed for and traditionally used in
Chapter 2.Background 16
2.5.1 Classification of routing protocols
Routing protocols are classified in (15) to be of three types:
• Proactive routing algorithms:In proactive routing algorithms,each node stores
information on routes to every other node in the network.The settling time for
a network using an algorithm of this sort is extremely high,and the number of
messages exchanged in order to maintain route information can grow large very
quickly,limiting the scalability of such algorithms.
• Reactive routing algorithms:Reactive routing algorithms require each node to
store routes only to its immediate neighbours,and determine multi-hop routes
as required.This reduces the routing table maintenance overhead,but increases
the time required to send a message as the path has to be determined each time a
packet has to be transmitted across multiple hops.
• Hybrid routing algorithms:Hybrid routing algorithms combine the strengths
of both reactive and proactive algorithms,and use a proactive scheme within
a given radius,and a reactive scheme to determine routes to nodes outside the
radius.The radius may be determined by several metrics,including number of
2.5.2 Classification of WSN routing protocols
The classification of WSN routing algorithms,according to (3),can be performed on
the following bases:
• According to network structure:
– Flat:In a flat network,all the nodes play the same role.
– Hierarchical:The network is clustered,so that cluster heads do the work.
Different nodes can be cluster-heads at different times.
– Location-Based:Positioning information is used in networks of this nature
to relay data to a specific portion/region of the network.
– Multipath-based
– Query-based
– Quality of Service (QoS)- based
Chapter 2.Background 17
– Coherent-based
However,as described above,we are not concerned with routing protocols tra-
ditionally used in WSNs.Therefore,in the following sections,we discuss the two
MANET routing algorithms that were implemented during the course of this thesis.
2.6 Destination-Sequenced Distance-Vector Routing (DSDV)
The first MANET algorithm that we implemented as part of this work is called the
Destination-Sequenced Distance Vector (DSDV) routing algorithm(26).According to
the classification scheme presented in (15),it is a proactive routing algorithm.
The DSDV algorithm is a Distance Vector (DV) based routing algorithm designed
for use in MANETs,which are defined by Perkins et al.(26) as the “cooperative
engagement of a collection of Mobile Hosts without the required intervention of any
centralised Access Point (AP)”.
It operates each node as a “specialised router” (26) which periodically advertises its
knowledge of the network with the other nodes in the network.It makes modifications
to the basic Bellman-Ford routing algorithms (9),thereby doing away with the count-
to-infinity problem.
The algorithmis designed for portable computing devices such as laptops who have
energy and processing capabilities far beyond that of a typical WSN node.However,
it is our contention that this algorithm can be used on WSNs,and this work attempts
to modify the algorithmto have it run on WSNs (albeit of constrained size).
In the rest of this section,we present a short overview of DV based algorithms,
followed by a discussion of the operation of,and issues with,the DSDV algorithm.It
is based on (26) unless explicitly mentioned otherwise.
2.6.1 Distance Vector routing
Every node i in the network maintains distances to every other node in the network.
This distance is chosen from the shortest distance d
i j
),where x is the
destination node,and j is a neighbour of i.Each node keeps track of the distances
between itself and every other node in the network,and periodically broadcasts its
current estimate of the shortest distance to every other node in the network to all of its
neighbours.This algorithmis known as the Distributed Bellman-Ford (DBF) algorithm
Chapter 2.Background 18
However,DV algorithms such as the DBF algorithm suffer from the count-to-
infinity problem(21).This can be solved using the split-horizon and poisoned-reverse
mechanisms.However,these solutions are not entirely compatible with the essentially
broadcast nature of radio communications.
The DSDV algorithm works similar to other DV algorithms in that it broadcasts
routing table entries to each of its neighbours,where the routing table entries contain
entries for every node in the network.
2.6.2 Sequence Numbers
Each routing table entry contains the destination address,the number of hops to reach
the destination,the next hop along the path to the destination,and the sequence num-
ber of the latest information received regarding the destination.Routing table entries
with newer (read:higher) sequence numbers supercede entries with older sequence
numbers.When faced with a choice between two routing table entries with the same
sequence number,the entry with the lower value of the metric (in our implementation,
the number of hops) is chosen.
Every destination stamps sequence numbers with consecutive even numbers.Every
receiver in turn broadcasts this information to its neighborus,incrementing the value
of the metric.
2.6.3 Broken Links
A broken link is described by a metric of ∞.Whenever a link between a destination
and a neighbour breaks,the neighbour changes the link distance stored to to ∞ and
increments the sequence number by 1,i.e.,the next highest odd number.If any node
receiving information of a link break (with a distance metric of ∞) has a routing table
entry with a later (even) sequence number,it broadcasts this information to all of its
2.6.4 Full Routing Table Dump vs Incremental Routing Update
The DSDV algorithmdefines two kinds of routing table updates.The first is called an
Incremental Routing Update (IRU),where only those routing table entries that have
changed since the last IRU was sent are transmitted.The second,called the Full Rout-
ing Table Dump (FRTD),transmits every routing table entry in the node’s routing table.
Chapter 2.Background 19
The latter is done less frequently,and then only when there is not much node move-
ment (i.e.,no IRUs have been sent in awhile).An IRUshould ideally fit inside a single
network layer packet,whereas a FRTD will most likely require multiple such packets,
even in small networks.
Perkins and Bhagwat (26) also underline the need for a mechanism by which it is
determined if a change in a routing table entry is significant enough for it to be included
in an IRU message.
2.6.5 Preventing Routing Table Fluctuation
In order to prevent a continuous stream of routing updates froma given node,it is
suggested in (26) that two different routing tables be used - one each for advertisement
and forwarding respectively;with the former being updated less frequently than the
2.6.6 Issues with the DSDV Algorithm
We identified the following problems with implementing the DSDValgorithmin WSNs
such as Specknets - primarily due to the tighter memory and power constraints faced
in WSNs.
• Transmission of FRTDs when there is no change in the network would waste
transmitter power,and can be done away with.
• Maintaining two distinct routing tables would be a waste of memory.A simpler
approach would be to delay transmission of routing updates,in order to allow
for the best routes to be available before IRUs are transmitted.Also,in order to
prevent fluctuations caused by nodes that spasmodically appear to be neighbours,
an anti-flap mechanismmay be used
2.7 Zone Routing Protocol
The Zone Routing Protocol (ZRP) algorithm was first proposed for use in ad-hoc net-
works in (15).It is a hybrid routing algorithm,which uses a proactive routing algo-
The DSDVimplementation used within the ZRP implementation solved this problemby using IRUs
to discover neighbours.This also reduced the total number of transmissions,as well as the probability
of a stray transmission being received.
Chapter 2.Background 20
Figure 2.4:A network divided into zones with a zone radius of 2
rithm within a given zone (with a user-defined radius),and a reactive scheme outside
the zone.The rest of this section describes the ZRP algorithmin greater detail.
2.7.1 Basic Operation
The network is divided into a series of overlapping zones.The radius of the zones may
be defined by,for instance,the number of hops.Figure 2.4 shows a network divided
into zones with a zone radius of 2.The ellipses bounded by black,red,and green lines
indicate the zone boundaries for the nodes marked 1,2 and 3 respectively.
As is clear in this figure,there is a significant degree of overlap between the zones.
For example,node 2 is in the zone for nodes 1 and 3.
Each node maintains information on paths to every other node within its zone in
its routing table.Routing table information within the zone is maintained using any
proactive routing algorithm.
When a node wishes to communicate with another within the same zone (i.e.,intra-
zone communication),the approach taken for communication is the same as that used
in any proactive routing algorithm.
Inter-zone communication is performed when the node is unable to find the desti-
nation within its routing table,and uses a reactive scheme.
Chapter 2.Background 21
Both inter- and intra-zone communication are described in greater detail in the
forthcoming sections.
2.7.2 Intra-zone communication in ZRP
Aproactive routing scheme is used for intra-zone communication using the ZRP algo-
rithm,as mentioned in the previous section.The proactive routing algorithmused can
Communication involves the following steps:
1.The source node tries to determine whether an entry for the destination node
exists in its routing table.
2.It then forwards the packet to the destination node by sending the packet to the
next hop along the path to the destination node (if the route has multiple hops).
If no entry is found for the destination node in the routing table of the source node,
then either the destination doesn’t exist (or has failed),or the destination node is not
within the zone of the source node.In the latter case,the inter-zone communication
techniques described in the following section are used.
2.7.3 Inter-zone communication
A reactive scheme is used for inter-zone communication using the ZRP algorithm.
Inter-zone communication is used by a source node under the circumstances outlined
in the previous section.The steps involved may be described as followed:
1.If the source node finds that the destination node is not within its zone,it sends a
Route Query (RQ) packet to each of the nodes at the boundary of its zone,called
the zone ending nodes,using the intra-zone routing algorithm.It then waits for
responses for a pre-determined period of time.
2.Each of the zone ending nodes examines the final destination specified in the
route query message.
If a route to the destination is stored in the routing table of the zone ending
node,the node sends a Route Reply (RR) packet back to the source node along
the path the query message arrived along.
The DSDV algorithm was used for intra-zone communication in the implementation developed as
part of this work.
Chapter 2.Background 22
If not,the node forwards the query messages along to each of the nodes at
the end of its zone (excluding nodes that have already received the message).
3.The approach used is,thus,a formof controlled,directional flooding.
4.Upon receipt of the route reply message,the source node stores the path and
sends a data message along it
.If no route reply messages are received before
timer expiry at the source node,it reports failure.
2.7.4 Properties of the ZRP routing algorithm
Some of the properties of the ZRP routing algorithminclude:
• ZRP has good scalability;by suitably adjusting the zone radius,it is possible
to allow for communication in much larger networks than is possible using a
proactive routing mechanismsuch as DSDV.
• ZRP performs better than reactive schemes,especially if a large proportion of
communication takes place across short distances.This is because the time re-
quired for route determination for intra-zone communication in ZRP is much
lower than in reactive algorithms,which in turn is due to the use of a proactive
scheme for intra-zone communication.
2.8 Tracking in WSNs
As part of this work,we considered the utility of MANET algorithms for use in WSN
applications.The application under consideration was a tracking application,where
sensor nodes were used to determine the (relative) location of mobile users in a built-
in environment.In this section,therefore,we review some of the approaches taken to
performtracking in WSNs.The section concludes with a brief overview of the simple
mechanismused in the application implemented herein.
The major approaches towards tracking include the use of in-building Infrared (IR)
networks (36;5),using wide-area cellular networks (33;22;18),and the Global Posi-
tioning System(GPS) (24).
However,all of these approaches are inherently inapplicable to the application do-
main under consideration due to different reasons.
IR networks are inapplicable because:
An implementation improvement could be the caching of discovered inter-zone routes.
Chapter 2.Background 23
• Their performance is adversely affected by sunlight.
• IR transceivers cannot be used for data transmission.
• IR networks work out to be too expensive.
Conversely,approaches used for location tracking in cellular networks are inappli-
cable indoors.GPS systems are too expensive,and are inefficient inside buildings (as
buildings block GPS transmissions).
A fourth approach,most applicable to the application domain under consideration,
is to use RF signals for location estimation and tracking in built environments.To the
best of our knowledge,all the published work in this area has taken Wireless Local
Area Networks (WLAN) which use the IEEE 802.11 standard (10).
(6) discusses an approach called RADAR where WLANs are used to achieve ac-
curate user location and tracking.This uses signal strength information obtained from
multiple receivers to allow for the triangulation of the user’s coordinates.
Bahl et al (7) make significant improvements to the existing RADAR system(6) in
order to minimise problems caused by environmental changes (such as changes in the
number of people,obstructions,and temperature).It also extends the RADAR system
to take multi-floor environments into consideration.
Another location systemworth mentioning is LANDMARC,developed by Ni et al
in (25),wherein Radio Frequency Identification (RFID) technology is used for locating
objects indoors.
Smailagic and Kogan (30) also describe a triangulation-based approach using an
IEEE 802.11b (10) wireless network.The approach described therein is client-centric;
that is,the client obtains signal strengths from multiple APs,which in turn is used
for position calculation.This is a triangulation-based remapped interpolated approach,
and is termed CMU-TMI.
The location sensing mechanismused in the application implemented as part of this
work is simpler and more coarse-grained than those used in RADAR or CMU-TMI,as
it performs location estimation on the basis of the minimum received signal strength.
This mechanismis described in greater detail in Chapter 4.
2.9 Summary
This chapter presented the reader with a basic introduction to the areas covered in this
thesis.Starting with a sketch of the architecure,constraints,and deployment structures
Chapter 2.Background 24
of WSNs,the reader was introduced to Specknets and the hardware platform used for
this work,the ProSpeckz IIK.This was followed by a discussion of the MAC layer in
WSNs and the SpeckMACMAc algorithmused in the MAClayer of all the algorithms
and applications developed as part of this thesis.The discussion subsequently shifted
to routing in WSNs,with special emphasis on the MANET algorithms implemented
herein;namely,the DSDV and ZRP routing algorithms.The last section presented the
reader with a survey of tracking mechanisms,and their applicability to WSNs.
The three chapters that follow delve into the algorithms and applications imple-
mented in considerable depth.
Chapter 3
Implementation of the DSDV Algorithm
In this chapter,we describe the implementation of the DSDValgorithmon the Prospeckz
IIK (4).In the first section,the protocol stack used for the DSDV algorithm is de-
scribed.This is followed in the next section with a description of the data structures
used in the DSDV algorithm - namely the packet formats and the routing table struc-
ture.After considering an operational example of the DSDV algorithm,this chapter
concludes with a short summary of the topics presented.
3.1 Protocol Stack
Figure 3.1 summarises the protocol stack within which the implementation of the
DSDV algorithmresides.
The DSDV algorithm is written on the Prospeckz IIK described in Section 2.2.2.
The SpeckMACalgorithm(38),or to be more specific,the SpeckMAC-Dvariant of the
same,is used in the MAClayer.The SpeckMAC-Dalgorithmwas chosen because (38)
indicates that it performs better than SpeckMAC-B.The reader is therefore requested
to note that in the rest of this section,the word SpeckMAC is used to refer to the
SpeckMAC-D variant unless explicitly mentioned otherwise.
The DSDV algorithm uses the sending and receiving primitives and the packet
format defined in the SpeckMAC algorithm.In the following section,we describe the
primitives and structures used from the lower layers,as well as the structures defined
in the network layer,in greater detail.
Chapter 3.Implementation of the DSDV Algorithm 26
Figure 3.1:DSDV protocol stack
3.2 Primitives and Data Structures
In this section,the sending and receiving primitives (defined in the MAC layer) used
in the network layer are described.This is followed by a description of the MAC
layer packet structure used,the mechanisms used for packing the network layer data
structures into the MAC layer packet format,and the packet structures defined in the
network layer.
3.2.1 MAC Layer Primitives
The SpeckMACalgorithmdescribed in Section 2.4 provides several primitives to allow
for the transmission and reception of data from other nodes over the CC2420 radio.
The primitives used in the implementation of the DSDV algorithm are described in
this section. SpeckMAC Blocking Send Primitive
The blocking send primitive does not return until the packet passed to it as an argu-
ment has been successfully sent.Since this reduces the complexity of the code in the
network layer,this primitive was extensively used in the implementation of the DSDV
The implementation characterised herein does not use a scheduler to schedule the
transmission of multiple packets from the network layer.It is,however,worthwhile,
Chapter 3.Implementation of the DSDV Algorithm 27
Figure 3.2:Basic Packet Structure (with DSDV-specific extensions)
noting that the implementation of the ZRP algorithm (described in Chapter 5) uses a
scheduler. Receiving Packets using SpeckMAC
The SpeckMAC algorithm periodically switches the node radio on.When the radio
senses activity in the medium
,it listens in until it has received a whole data packet.
Upon completion of reception,an interrupt which handles the received packet and
checks for errors is triggered.
The packet handler for the DSDV algorithm is called from within the SpeckMAC
Interrupt Service Routine (ISR). Packet Format
The packet format used in the MAC layer of the implementation is summarised in
Figure 3.2.
To maintain separation between the layers,it would have been necessary to encap-
sulate the entire network layer packet inside the data field of the MAC layer packet.
However,the design decision was taken to sacrifice modularity in favour of perfor-
mance.Hence,the packet header was modified to include DSDV-specific headers.
This is because the size of the data field is limited.Therefore,using the data field to
store DSDV-specific information would be a waste of valuable space,and would also
This is indicative of packet transmission by another node in the network.
Chapter 3.Implementation of the DSDV Algorithm 28
result in an increase in the transmission time for the packet
The fields in Figure 3.2 that are marked in red are DSDV-specific fields,whereas
those marked in black are the MAC layer-specific fields.The purpose of the fields in
the structure are as described below:
• MAC Layer-specific fields:
Cyclic Redundancy Check (CRC):CRC is an error detection method which
typically involves the calculation of a two-byte checksum of a data block,and
is used to detect the accidental alteration of data during transmission or storage.
The Least Significant Byte (LSB) of the CRC is loaded into this 1 byte field.
Received Signal Strength Indicator (RSSI):RSSI is a measure of the strength
(and not necessarily the quality) of the received signal strength in a wireless
network (31).The Most Significant Byte (MSB) of the two-byte CRC is loaded
into this 1 byte field by the MAC layer whenever a packet is transmitted.
Destination Address:This field holds the ID of the node that is the packet’s
final destination.This field is 16 bits long,and thus,the implementation of the
DSDV theoretically allows for 65,536 distinct nodes in the network.However,
in practice,only 13 of these bits are used,thereby restricting the number of nodes
to 8191.
Source Address:This field,which is also 16 bits long,holds the address of
the source of the packet,i.e.,the node that constructed the original packet.
• Network Layer-specific fields:
DSDV Address:This 2 byte field holds the address of the next node along
the path fromthe source to the destination that the packet is to be forwarded to.
Sequence Number:This field is also 2 bytes long,and is used to hold the
sequence number of the DSDV algorithm packet transmitted from that source.
The reasons behind the utilisation of sequence numbers are discussed in Section
• Data length:This field is 8 bits long,and indicates the size of the payload in
bytes,to a maximumof 32.
It must be noted here that the MAC layer implementation transmits the entire header with each
Chapter 3.Implementation of the DSDV Algorithm 29
Figure 3.3:Packet Types used in the DSDV algorithm
• Payload:The payload field is a character array of length 32.Consequently,the
maximum payload size is limited to 256 bits.The number of bytes used in the
payload are indicated,as described above,in the data length field.
3.2.2 Packet Types
Figure 3.3 shows the packet types used in the implementation of the DSDV algorithm,
organised as a tree.There are primarily two kinds of packets:
1.Protocol Packets:Protocol packets are central to the operation of the DSDV
algorithm,and include packet types used for neighbour discovery and routing
table maintenance.There are two kinds of protocol packets:Hello packets and
IRU packets.
2.Data Packets:Data packets allow for the DSDV algorithm to be used to send
information across the network,and to ensure receipt of sent information.Data
packets are used by entities in higher layers of the DSDV protocol stack.Data
packets can either be Data packets or Acknowledgement packets.
Packet type information is stored,along with next hop information,in the 16 bit
DSDVAddress field.Since there are two kinds of packets of each type,there are a total
of 13 bits available for node addressing;this restricts the number of nodes to 8191
Bit 15,the most significant bit,indicates whether the packet is a protocol packet
(when set) or a data packet (otherwise).Table 3.1 presents the list of packet types in
the DSDV implementation,and their corresponding type identifiers.
The node ID 0 is used to indicate broadcasts.
Chapter 3.Implementation of the DSDV Algorithm 30
Bit 15 = 1
Bit 15 = 0
Hello Packet
Incremental Routing Update
Table 3.1:DSDV Packet type identifiers
The forthcoming sections include detailed discussions of each packet type de-
scribed above. Hello Packets
Hello packets are protocol packets broadcast by each node once every second,and
are used to notify the node’s neighbours of,first,its existence,and later,its continued
presence.Hello Packets are the simplest type of protocol packets,and have an identifier
of 6 (refer to Table 3.1),which is loaded into the most significant 3 bits of the DSDV
Address field.
Broadcasts are indicated by setting the destination address of the packet to 0.When
a node receives a hello packet from any other node X,then if X is not in its routing
table,it adds Xto the routing table.The node then stamps the the newly created routing
table entry with the current local time.If X is already in the routing table of the node,
then the node refreshes the timestamp value for the routing table entry for X. Incremental Routing Update (IRU)
An IRU is a subtype of protocol packet,and each node broadcasts one periodically
An IRU has a packet identifier of 5,referring to Table 3.1,which is loaded into the
most significant 3 bits of the DSDV Address field.
Each IRUbroadcast by a given node contains routing table entries that have changed
since the last time the node broadcast an IRU.These changes include the addition of a
new routing table entry,an increase or decrease in the number of hops to the node in
the routing table entry,or node failure.
The changed routing table entries are stored in the data field of the packet structure
discussed in Section
The period is user-defined,and is set to 20 seconds in the DSDV implemented presented here.
Chapter 3.Implementation of the DSDV Algorithm 31 Data Packet
Adata packet is used to send data to any other node in the routing table of the Sending
Node (SN).A data packet is constructed as follows:
• The Source address is set to the node’s ID.
• The Destination address is set to the address of the packet’s destination.
• The DSDV address is set to the XOR of the packet type identifier (refer to Table
3.1) and the address of the next hop to the destination specified in the Destination
address field.If the destination node is 1 hop away,then the DSDV address is
set to the same value as the destination address.
• The Sequence number field is loaded with the sequence number of the data
packet being sent.
• The data to be sent is loaded into the packet’s Payload.
• The Data length field is loaded with the number of bytes of the payload used. Acknowledgement Packet
Acknowledgement packets are used to certify receipt of a Data packet,and is sent
by the Receiving Node (RN) to the Sending Node (SN).Acknowledgement packets
typically contain no data,and are constructed just as data packets are - except for the
Sequence number field,which stores the sequence number of the data packet being
Acknowledgement packets can be used to implement delivery guarantees.
3.2.3 The Routing Table
The routing table contains information about every other node in the network.This
information includes the address of the RN,the number of hops to it,and the next hop
through which any packets to the RN must be routed.
The routing table in the DSDV implementation is structured as a circular list.Fig-
ure 3.4 shows the structure of a single entry in the routing table,and Figure 3.5 shows
the organisation of the links between the nodes in the routing table.
The fields in a routing table entry include:
Chapter 3.Implementation of the DSDV Algorithm 32
Figure 3.4:DSDV routing table entry
• Status:The 8 bit Status field is used to indicate whether the entry is full (i.e.,a
routing table entry is stored within) or not.If the entry is full,the status field is
used to indicate if the entry is valid or not,and also if there has been a significant
change that must be communicated in the next IRU sent.
• Destination address:The 16 bit Destination address field holds the address of
the node that the routing table entry defines a path to.
• Sequence number:The 16 bit Sequence number field stores the sequence num-
ber of the last information received about the node.This may be the sequence
number of the last Hello packet received (if the node is a direct neighbour) or
the sequence number of the last entry about the node received in an IRU from a
• Hops:This field is 8 bits long,and specifies the number of hops from this node
to the node specified in the Destination address field of the routing table entry.
Chapter 3.Implementation of the DSDV Algorithm 33
Figure 3.5:Structure of DSDV Routing Table
• Next address:This 16 bit field holds the address of the next node to which pack-
ets addressed to the destination node must be sent to.If the destination node is 1
hop away,then the value in the Next address field is the same as the value in the
Destination address field.
• Timestamp:This field is also 16 bits long,and holds the local time at which
information about the node defined in the routing table entry was last received.
• Next pointer:As mentioned earlier,the routing table entries are linked together
in a circular list.The Next pointer points to the next routing table entry in the
list.If the entry is the last in the list,it points to the first routing table entry in
the list.
The rest of this section describes the mechanisms used for adding,modifying and
removing routing table entries.
Chapter 3.Implementation of the DSDV Algorithm 34 Adding a routing table entry
A new entry for a node X is added to the routing table under two circumstances:
1.A Hello packet is received fromX,which was previously undetected.
2.An IRU received froma neighbour contains an entry for the node X.
In the first case,X is the node’s neighbour,and is hence one hop away.The list is
scanned until an empty entry - indicated by the Status field - is found.The status is
set to indicate the entry is now full and valid.Then,the Destination address is set to
the source address of the Hello packet.The Sequence number field is filled with the
value of the Sequence number field of the received Hello packet.The number of hops
is set to 1,and the Hop field is set to hold the same value as the Destination address
field.The local time,which is kept track of using a simple integer variable incremented
every second,is written into the Timestamp field.
In the second case,the routing table entry for the node Xis stored in the payload of
the received IRU.An empty routing table entry is located,the status field is set,and the
Timestamp field is written into as described in the first case.The Destination address
field is then set to the appropriate value stored in the payload of the received IRU,as is
the Sequence number field.The Hops field is set to one more than the value stored in
the received IRU. Modifying a routing table entry
An existing routing table entry is modified under two circumstances:
• When fresher information about the node,indicated by a higher sequence num-
ber,is received froma neighbour.
• When the path to a node changes.
Fresher information is received from a neighbour when the next Hello packet is
received.In the case of nodes that are not neighbours,this information is received
in the next IRU sent by one of the node’s neighbours.When fresher information -
indicated by a higher sequence number of the Hello packet in the first case,or the value
of the Sequence number field of the corresponding entry in the IRU in the second - is
received,the appropriate entry is found and the sequence number fields are updated.
Additionally,the Timestamp field is refreshed with the value of the current local time.
Chapter 3.Implementation of the DSDV Algorithm 35
Changes in the path to a node may require either updation of the number of hops
alone,or even a change to the Next address field of the corresponding routing table
entry.These changes may arise upon receipt of either Hello packets or IRUs. Removing a routing table entry
The removal of a routing table entry can occur under two circumstances:
• When no information about a node is received for a time period greater than a
• When an IRUcontains an entry with an odd sequence number (See Section 2.6.2
for the significance of sequence numbers in the DSDV algorithm).
In the following paragraphs,each case is considered in turn.
The Timestamp field on each routing table entry is checked to see if the difference
between the current local time and the timestamp is greater than a pre-defined thresh-
old.If it is,the sequence number field is incremented by one to the next highest odd
number.The Status field is set to indicate that the entry is invalid and changed - this
results in the entry being included in the next IRU sent by the node.
When a node receives an IRU which contains an entry with an odd sequence num-
ber,the node increments the sequence number of the corresponding entry in its routing
table by one to the next highest odd number and sets the Status field to indicate that
the entry has changed and is invalid.Thus,information on the failure of a route is
propagated throughout the network.
3.3 Operational Example
This section contains a description of the operation of the DSDV algorithmillustrated
by means of an example.
The simple network taken into consideration as part of this example involves three
nodes.The example demonstrates,first,the creation of links between nodes,and the
propagation of network information to every node in the network.This is followed by
a description of data transmission across multiple hops.The last example demonstrates
the steps taken upon node failure.
Chapter 3.Implementation of the DSDV Algorithm 36
Figure 3.6:DSDV Node Discovery and Route Propagation:Stage 1
Figure 3.7:DSDV Node Discovery and Route Propagation:Stage 2
Chapter 3.Implementation of the DSDV Algorithm 37
Figure 3.8:DSDV Node Discovery and Route Propagation:Stage 3
Chapter 3.Implementation of the DSDV Algorithm 38
3.3.1 Node Discovery and Route Propagation
In the network taken as an example,mutual discovery of nodes and propagation of net-
work information takes place through three stages.The three stages are as represented
in the three figures above. Stage 1
Stage 1 of this operation is represented in Figure 3.6.Nodes 1,2,and 3 are mutually
unaware of each other,as is indicated by empty routing tables.Each broadcasts Hello
packets at regular intervals.Though unrepresented in thefigure,Node 2 receives Hello
packets fromNodes 1 and 3,while Nodes 1 and 3 receive Hello packets fromNode 2. Stage 2
The reception of Hello packets at each node fromits neighbours results in the formation
of the links represented in Figure 3.7.As is clear from the figure,Node 2 has two
neighbours,whereas Nodes 1 and 3 have one neighbour each.The sequence number
of the last Hello packet received from the node’s neighbours is stored in the routing
table entry for the neighbour,as shown in the figure.
At the conclusion of Stage 2,Node 2 broadcasts an IRU that contains routing in-
formation to Nodes 1 and 3. Stage 3
Upon receipt of the IRU from Node 2,Nodes 1 and 3 add entries to each other as
shown in Figure 3.8.It is to be noted that Nodes 1 and 3 ignore the routing paths to
themselves defined in the IRU.
The Sequence number field in routing table entries for nodes that are not direct
neighbours store the sequence number received in the IRU.
Chapter 3.Implementation of the DSDV Algorithm 39
Figure 3.9:DSDV Data Transmission:Stage 1
Chapter 3.Implementation of the DSDV Algorithm 40
Figure 3.10:DSDV Data Transmission:Stage 2
Chapter 3.Implementation of the DSDV Algorithm 41
3.3.2 Data Transmission
In the scenario under consideration,Node 1 transmits a data packet to Node 3
This requires multi-hop communication,and is performed in two stages as shown
in Figures 3.9 and 3.10. Stage 1
Node 1 finds from its routing table entry for Node 3 that the next address to which a
Data packet addressed to Node 3 must be sent is Node 2.Therefore,Node 1 constructs
a Data packet with the DSDV address field set to the address of Node 2,and the Des-
tination address field set to the address of Node 3.The local sequence number counter
is used to load an (even) sequence number to the Data packet. Stage 2
Node 2,upon receiving the Data packet addressed to itself (in the DSDVAddress field),
forwards this packet to Node 3,which is one hop away.It sets the DSDV Address as
well as the Destination Address field to the address of Node 3.Thus,Node 3 receives
the Data packet.
The transmission of an Acknowledgement packet from Node 3 back to Node 1,which is sent if
guaranteed transmissions are implemented,is not discussed in this section.
Chapter 3.Implementation of the DSDV Algorithm 42
Figure 3.11:DSDV Link Failure:Stage 1
Chapter 3.Implementation of the DSDV Algorithm 43
Figure 3.12:DSDV Link Failure:Stage 2
Chapter 3.Implementation of the DSDV Algorithm 44
3.3.3 Link Failure
In this subsection,the example considers the failure of Node 3.This is a two stage
process as represented in Figures 3.11 and 3.12. Stage 1
Node 2 realises the failure of Node 3 due to timer expiration.It then sets the status of
the routing table entry for Node 3 to indicate that the entry is invalid (and should not be
used to forward packets),and increments the sequence number field by one to the next
highest odd number.It then marks the routing table entry as changed,and broadcasts
the changed routing table entry in the next IRU it sends. Stage 2
When Node 1 receives the IRU from Node 2,it notices that the entry for Node 3 in
the IRU sent has a higher odd sequence number.Therefore,it updates its routing table
entry for Node 3 to reflect the failure of Node 3.It then broadcasts this information in
the next IRU it sends.
3.4 Summary
This chapter opened with a short description of the position of the DSDV implemen-
tation in the protocol stack.The next section described the MAC layer primitives and
data structures used in the network layer,packet types defined in the network layer,
and a description of the structure of the routing table.The final section demonstrated
the operation of the DSDV algorithmwith the help of an example.
Chapter 4
Applications using the DSDV
Algorithm- Visitor Tracking System
This chapter discusses an application implemented on the application layer atop the
DSDValgorithmdiscussed in the previous chapters.The motivation behind this appli-
cation - apart fromthe utility of the idea itself - was to investigate whether applications
for WSNs that could use MANET algorithms exist.
We begin with a discussion of the aims of the application,which is followed by a
brief presentation of the requirements of the VTS.
The next section describes the development environment,positions the VTS in the
protocol stack described in Section 3.1,discusses the top-level design of the application
layer,and concludes with a description of the packet types defined in the application
The final section of the chapter contains an exemplary description of the operation
of the application,which is followed,as always,by a short summary of the chapter
4.1 Aim
It is sometimes necessary to locate people and prevent their movement to restricted
or dangerous areas in small built-in environments.Human surveillance may be in-
sufficient to ensure this,and the consequences of failing to prevent human movement
to restricted areas can be potentially disastrous,especially if the humans involved are
The purpose of this application was to design,using Specks (4),a Visitor Tracking
Chapter 4.Applications using the DSDV Algorithm - Visitor Tracking System 46
System,referred to henceforth as the VTS,which would provide a monitoring agent
such as a security guard or a nursery teacher with information on the position and the
direction of motion of visitors under their watch,and warnings if any visitors tried to
move to restricted areas.
It is our belief that this application can,with slight modifications,be applied to
several different domains.
4.2 Requirements
At the outset,the following requirements were outlined for the VTS:
• There are three kinds of nodes - Visitor Nodes (VN),Infrastructure Nodes (IN),
and Monitor Nodes (MN).
• The VNs and the MN must be mobile.
• The INs are fixed.
• The VNs must be lightweight and power-efficient.This necessitates a simple
VN design.
• The INs can be powered by a larger (possibly even AC) source as they are not
intended to be carried on a person.However,this also implies that they cannot
be frequently recharged.
• Since the monitoring agent,and thus by extension the MN,is the nerve-centre
of the VTS,the MN’s architecture will have to be relatively complex.However,
it can be recharged more frequently than the INs.
• Both the location and the direction of the motion of the VNs will have to be kept
track of.
4.3 Architecture
This section presents a brief description of the hardware and software platform upon
which the application was built,followed by a detailed presentation of the architecture
Chapter 4.Applications using the DSDV Algorithm - Visitor Tracking System 47
4.3.1 Hardware and Software Platforms
This application was built on the Prospeckz IIK (4) hardware platform presented in
Section 2.2.2.The PSoC Designer IDE (29) was used to facilitate the development of
the system.
The SpeckMAC (38) algorithm described in Section 2.4 was used in the MAC
Layer,and the modified implementation of the DSDV algorithm presented in Chapter
3 was used in the network layer.
4.3.2 Protocol Stack
The protocol stack of the VTS application builds upon the one used in our implementa-
tion of the DSDV algorithm(see Section 3.1).New packet types - namely Ping,Pong,
and Visitor Information (VI) Packets - are defined in the VTS.
The DSDV algorithm in the network layer is used to construct a network of INs
and provide the sending and receiving primitives used by the application layer.This
section does not discuss the lower layers of the protocol stack.The protocol stack is
represented as shown in Figure 4.1.
4.3.3 The VTS in the Application Layer
In this section,we discuss the architecture of the three different node types used in the
VTS in some detail. VN Architecture
The architecture of the VNis the simplest of the three.It continuously polls the receive
buffer for Ping packets sent by the INs and MN.If a Ping packet is received and the
VN is not currently attached to any node,it attaches itself to the sender of the Ping
packet,and records the transmission strength at which the Ping packet was sent
VN then begins to send Pong packets addressed to the node that it received the Ping
packet from.The state information that the VN maintains is as shown below.
• Attached To:The IN/MN that the VN is currently attached to.
• Transmission Strength:The transmission strength at which the VNis attached to
the IN/MN.
The transmission strength,which is a 1 byte value ranging from 1 to 31,is stored in the data field
of the Ping packet sent.
Chapter 4.Applications using the DSDV Algorithm - Visitor Tracking System 48
Figure 4.1:VTS protocol stack
All of the VN’s transmissions are sent at the maximum signal strength of 0 dBm,
which corresponds to a value of 31.The VNhowever keeps recording the transmission
strength of the Ping packets received from the IN/MN that it is attached to.Every 4
seconds (a value greater than the time that it takes an IN/MNwhich sends Ping packets
at varying transmission strengths,cycling through from 1 to 31),the VN changes the
value of the Transmission Strength field described above to the lowest transmission
strength recorded over the last 4 seconds.
In addition to recording transmission strength,the VNalso listens for Ping packets
fromother INs (or the MN).
If it receives a Ping packet fromanother node at a transmission strength lower than
the strength with which it is currently attached,the VNattaches itself to the other node
and addresses the sent Pong packets to the new node.
Chapter 4.Applications using the DSDV Algorithm - Visitor Tracking System 49 IN Architecture
Since the IN runs the DSDV routing algorithm,this discussion will take into consid-
eration only the functionality added in the application layer.Each IN transmits 4 Ping
packets every second,cycling through the range of transmission strengths.This may
be represented mathematically as follows:
=[3k +1|k =1..10] (4.1)
=Transmission Strength of the k
k =A variable that takes values from1 to 10 before wrapping around to 1.
When it receives a Pong packet addressed to itself,it adds the sender of the Pong
packet to the list of VNs attached to it.If it does not receive a Pong packet froma given
CN for a period greater than a pre-defined threshold,it assumes the VN is no longer
attached to it and removes it fromthe list.
The IN periodically transmits a VI packet to the MN.This contains the list of VNs
attached to it.The VI packet is transmitted using the DSDV routing algorithm.This
allows INs which are not neighbours of the MN to communicate with it using the