DETERMINING LINK COSTS IN ZIGBEE ROUTING

pogonotomyeyrarΔίκτυα και Επικοινωνίες

26 Οκτ 2013 (πριν από 4 χρόνια και 17 μέρες)

226 εμφανίσεις

1


DETERMINING LINK COS
TS IN ZIGBEE ROUTING

by

Sudeepa Prakash

A Thesis submitted in

Partial Fulfillment of the

Requirements for the Degree of


Master of Science

i
n Computer Science

at

The University of Wisconsin
-
Milwaukee

August 2008


Major Professor









Date


Graduate School Approval








Date

2



ABSTRACT

DETERMINING LINK COS
TS IN ZIGBEE ROUTING

by

Sudeepa Prakash

The University of Wisconsin
-
Milwaukee, 2008

Under the Supervision of Dr. Mukul Goyal


In this thesis, we investigate the problem of determining routing cost of links in a
Zigbee/IEEE 802.15.4 wireless sensor network. Zigbee is a mesh routing protocol used in
large IEEE 802.15.4 based wireless sensor networks. This protocol is based on Adhoc

On
-
demand Distance Vector (AODV) routing protocol. Zigbee protocol allows a source
to determine the
minimum cost
route to a destination, where the cost of a route is the sum
of the costs of constituent links. Thus, assigning correct cost to a link, reflec
ting the link
quality or reliability, is critical to obtain best quality routes in a Zigbee network.
Commercial Zigbee vendors typically use
Received Signal Strength Indicator

(RSSI) and
so called
Correlation

values to determine the routing costs of the li
nks. RSSI is an
indication of radio energy in the communication channel during the transmission of a
packet and the Correlation value is a measure of
closeness
between the received and
3


presumably sent
chip
-
sequences

during the transmission of a packet. In
this thesis, we
argue that none of these values is a good indicator of
signal to noise
ratio on the
transmission channel in all cases. Hence, these values should not be used to determine the
link costs. We demonstrate that, from the perspective of receivin
g IEEE 802.15.4 PHY
layer, the signal to noise ratio on the transmission channel is either “good enough” (i.e.
almost all frames can be successfully received) or “not good enough” (i.e., almost all
frames have incorrigible errors) with very small transitio
n phase between the two states.
We suggest that the Zigbee level loss rate, maintained in the Zigbee
Neighbor Table
,
is
the best indicator of link quality and hence should be used to determine routing cost of a
link.


Major Professor









Date








4









To


MOM and DAD





5





TABLE OF CONTENTS


Chapter1

................................
................................
................................
..............................

1

Introduction

................................
................................
................................
.....................

1

1.1 An Overview of the Thesis and its Contributions

................................
.................

1

1.2 802.15

................................
................................
................................
....................

6


Chapter 2

................................
................................
................................
.............................

7

802.15.4 and Zigbee

................................
................................
................................
........

7

2.1 Overview

................................
................................
................................
...............

7

2.2 Architecture

................................
................................
................................
...........

7

2.3 Data rate and Range

................................
................................
...............................

8

2.4 The Physical
(PHY) Layer

................................
................................
....................

9

2.5 The Medium Access Control layer

................................
................................
......

12

2.6 The Network Layer

................................
................................
..............................

17

2.7 The Application Layer

................................
................................
.........................

25


Chapter 3

................................
................................
................................
...........................

28

Routing in Zigbee

................................
................................
................................
..........

28

3.1 Routing Addresses

................................
................................
...............................

28

6


3.2 Calculation of Routing Cost

................................
................................
................

28

3.3 Routing Tables

................................
................................
................................
.....

30

3.4 Upon Receipt of a Unicast
Data Frame

................................
...............................

32

3.5 Route Discovery

................................
................................
................................
..

35

3.6 Route Maintenance

................................
................................
..............................

40



Chapter 4

................................
................................
................................
...........................

41

Link Cost Calculation
................................
................................
................................
....

41

4.1 RSSI for link cost

................................
................................
................................

41

4.2 Correlation value for link cost

................................
................................
.............

42

4.3 Factors affecting communication in actual environments

................................
...

44

4.4 Packet transmission and

Error Rates

................................
................................
...

45

4.5 RSSI and Correlation not good indicators of Link cost

................................
.......

49


Chapter 5

................................
................................
................................
...........................

51

Mathematical Analysis and Graphical Results
................................
..............................

51

5.1. Hamming Distance

................................
................................
.............................

51

5.2 Error Rates considering AWGN

................................
................................
..........

52

5.3 Error Rates considering Rayleigh Fading

................................
............................

54


Chapter 6

................................
................................
................................
...........................

57

Proposed Link Cost Calculation

................................
................................
....................

57

6.1 Impact of SNR

................................
................................
................................
.....

57

6.2 Link Cost Assignment

................................
................................
.........................

57

6.3 Path Cost Calculation

................................
................................
..........................

58

7



Chapter 7

................................
................................
................................
...........................

59

Conclusion

................................
................................
................................
.....................

59

7.1 Future Work

................................
................................
................................
.........

60


Bibliography

................................
................................
................................
.....................

61

Appendix

................................
................................
................................
...........................

63

Tables

................................
................................
................................
............................

63

LIST OF FIGURES

Figure 2.1
:

802.15.4/Zigbee Protocol Stack

................................
................................
......

8


Figure 2.2
: The PHY Layer reference model.

................................
................................
..

11


Figure 2.3
: PPDU format

................................
................................
................................
.

12


Figure 2.4
: The MAC Layer reference model.

................................
................................
.

13


Figure 2.5
: Data transfer model from the coordinator to the device

................................

15


Figure 2.6
: Data transfer mo
del from the device to the coordinator

................................

15


Figure 2.7
: Star topology

................................
................................
................................
.

19


Figure 2.8
: Tree topology
................................
................................
................................
.

20


Figure 2.9
: Mesh topology

................................
................................
...............................

20


Figure 2.10
: The NWK Layer reference model

................................
...............................

24


Figure 3.1
:

Route Request Command Frame

................................
................................
...

36


Figure 3.2
:

Route Reply Command Frame

................................
................................
......

39


Figure 4.1
:

Bit Stream to transmitted Signal
................................
................................
....

46


8


Figure 5.1
: Hamming distance between any two chip sequences.

................................
...

51


Figure 5.2
: Complete Graph of Bit Error, Symbol Error Rate and Packet Error Rate
versus Signal to Noise Ratio.

................................
................................
............................

52


Figure 5.3
: Partial Graph of Bit Error, Symbol Error Rate and Packet Error Rate versus
Signal to Noise Ratio indicating the change in Packet Error Rate.

................................
..

53


Figure 5.4
: Graph of Bit Error, Symbol Error Rate and Packet Error Rate versus Signal
to Noise
Ratio considering Rayleigh fading.

................................
................................
....

54


Figure 5.5
: Partial Graph of Bit Error, Symbol Error Rate and Packet Error Rate versus
Signal to Noise Ratio considering Rayleigh fading indicating the change in Packet Error
Rate.

................................
................................
................................
................................
..

55


Figure 5.6
: Packet Error Rate v
ersus Signal to Noise Ratio for AWGN and Rayleigh
Fading.

................................
................................
................................
..............................

56

LIST OF TABLES

Table 3.1
: Routing Table

................................
................................
................................
..

30


Table 3.2
: Status Field Values
................................
................................
..........................

31


Table 3.3
: Route Discovery Table
................................
................................
....................

31


Table 4.1
: Sample RSSI to Link Cost Mapping

................................
...............................

42


Table 4.2
: Symbol to Chip
mapping

................................
................................
................

43


Table 5.1
: Variation of Bit Error Rate, Symbol Error Rate and Packet Error Rate with
Signal to Noise Ratio considering AWGN

................................
................................
.......

64


Table 5.2
: Variation of Bit Error Rate, Symbol Error Rate and Packet Error Rate with
Signal to Noise Ratio
considering Rayleigh Fading

................................
.........................

71




9









ACKNOLEDGEMENTS


I would like to express my gratitude to my advisor Dr Mukul Goyal, Assistant Professor,
Department of Computer Science, University of Wisconsin Milwaukee for his guidance,
support and advice during
the course of not only my thesis under him but also during the
course of my Masters. He has been a definite source of inspiration especially in terms of
working hard and shaping a career.

Dr Syed H Hosseini, Chair, Department of Computer Science, Universit
y of Wisconsin
-

Milwaukee is also a person I would like to thank for all the encouragement and advice
during my Graduate Studies.

I would like to thank Dr Brian Armstrong for being on my thesis committee.

10


This section could not be complete without thankin
g my parents who have constantly
been encouraging me to be what I am today. They have definitely helped me keep my
spirits high and motivated me not only to set goals but also achieve each one of them.

A special thanks to my mentor and guide Dr K.S Srinath
, Head of the department, MCA,
RNSIT, Bangalore for all the support he extended to make my Masters dream come true.

All my friends have been there for me at the most difficult times and helped me not to let
go, I would like to thank them for all that and m
ore.





11


Chapter1

Introduction

1.1
An Overview of the Thesis and its Contributions

In recent times, wire
less communication technology
is

rapidly replacing

existing wired
technology in different monitoring and non
-
critical control applications. The main
advanta
ge of wireless communication over wired communication

is
the
relative ease of
installation and maintenance. The main driving factor that has made this

transition from
wired to wireless communication feasible is the standardization of

IEEE 802.15.4
protocol [1
]. IEEE 802.15.4 defines low power and low data rate protocols for PHY and
MAC layers of a wireless sensor network. The PHY lay
er protocol defines
operation in

several frequency bands, the most prominent being the 2.4GHz ISM (
industrial, scientific
and medical
) band where the protocol uses O
-
QPSK (
orthogonal quadrature phase shift
keying
) modulation [
17
,

Chapter 7: Digital Modulation Techniques
.
] to
support a data
rate of 250 Kbps. The MAC layer protocol is based on CSMA/CA (
carrier sense multiple
access with collision avoidance
) [
11
] and can operate in two modes:
beacon
-
enabled

and
beaconless
. The beacon
-
enabled mode allows the organization of a sens
or network in
clusters

where nodes in one cluster have exclusive access of the

transmission channel
during their

active period. The nodes in a cluster do not transmit outside their active
period. In beaconless mode, there is no such restriction on a node.
A node competes with
all the other nodes in its hearing range for access to the transmission channel. The
12


beaconless mode operation allows the use of
mesh routing
in large sensor networks,
where the term
mesh routing

refers to the ability to send packets f
rom a source to a
destination via a
dynamic
route through other nodes in the network. This differs from the
hierarchical routing
that has to be followed in beacon
-
enabled networks, where a packet
can travel from its source to its destination only along the

hierarchy established by
coordinator
-
associated device
relationships.


Zigbee [
2
] is a mesh routing protocol for beaconless IEEE 802.15.4 networks. Zigbee
facilitates multi
-
hop routing and thus allows the creation of large sensor networks where
the nodes
need not be in each other’s hearing range to communicate. Zigbee routing
protocol is a version of
Adhoc On
-
demand Distance Vector
(AODV) routing protocol
[
10
], where the routes are discove
red by the source broadcasting
a
Route Request
through
the network a
nd the destination sending
Route Replies
back on receiving the route
requests via different paths between the source and the destination. A route reply travels
from the destination to the source along the reverse of the path taken by the
corresponding rout
e request. When the route request reaches the source, it carries the
cost

associated with this route, which is simply the accumulated sum of the costs associated
with links on the route. As the route replies reach the source, it chooses the route with
minimum cost for its future communication with the destination. Thus, the qua
lity of the
routes used in a Zigbee network clearly depends on how the link costs are determined.


13


In this thesis, we focus on the problem of determining the routing cost of a link in a
Zigbee network. As discussed later, the Zigbee specification suggests
that the link cost be
determined using a particular formula based on the probability of successfully sending a
packet across the link. However, the specification does not restrict the vendors from
using other methods to determine the link costs. Based on o
ur experience with
commercial Zigbee stacks, it appears that many vendors use the
Received Signal Strength
Indicator
(RSSI) value of the packets received from the other end of the link as the
determining factor of the cost of the link. Typically, the vendo
rs use a table to map the
signal strength to the link cost. A node sets the cost of its link to the other node to be low
as long as a good strength signal is received from the other node. The signal strength is
typically determined by accumulating the radi
o energy on the transmission channel
during the time a packet is being received. Clearly the radio energy consists of not only
the signal but also the noise and hence the RSSI value may be quite good even though the
signal to noise
ratio is poor. This has
been observed to be frequently the case in many
deployment environments with high levels of radio noise. Even though the signal to noise
ratio for the packets received from the other end of the link may be poor, the nodes would
continue to assign low costs

to a link since the RSSI value for these packets is good.
Thus, the low quality links continue to be used to route packets even though the loss rates
on such links are quite high. In this thesis, we argue that RSSI value is not a good
indicator of signal
to noise ratio and hence should not be used to determine the link costs
in Zigbee routing.


14


Another metric typically suggested as the determining factor of the routing cost of a link
is the so called
correlation value
in the packets received from the other

end of the link.
The correlation value is a measure of the
closeness

between the received
chip sequence
and the sent chip sequence for the bits in a packet. In IEEE 802.15.4 PHY operation, the
sending (or source) node translates each
symbol
(4 bits) of th
e MAC payload into the
corresponding 32 chip long sequence. The IEEE 802.15.4 specification defines 16 unique
32
-
chip long sequences for 16 possible symbols. As discussed later in this thesis, the
minimum
hamming distance
[
17
,
Chapter 8: Linear block codes
, Section:Minimum
Distance Considerations
] between any two chip sequences is 12. On receiving the chip
sequence corresponding to a symbol, the receiving IEEE 802.15.4 node compares it with
all 16 valid chip sequences and decides that the valid sequence clo
sest to the received
sequence must be the one sent by the source node. IEEE 802.15.4 PHY layer can tolerate
errors in the received chip sequence, presumably caused by the radio noise on the link, as
long as it continues to be closer to the actually sent ch
ip sequence than any other valid
chip sequence. The correlation value for a packet is a measure of the closeness between
the received chip sequences and the
perceived
sent chip sequences for the symbols in a
packet. The correlation value is a good indicato
r of the signal to noise ratio as long as the
receiver correctly identifies the chip sequences actually sent by the source node.
However, if the signal to noise ratio is so bad that the received chip sequence becomes
closer to another valid chip sequence t
han the one actually sent by the source, the
correlation value becomes meaningless. In fact, such errors in identifying the symbols
sent by the source would result in checksum failures for the packet and the packet would
15


be discarded. Thus, the correlation

value identifies signal to noise ratio only as long as it
is good enough to not cause any errors in symbol identification. We argue that as long as
the signal to noise ratio is good enough, the routing cost of the link should be small so
that minimum hop
routes could be realized. Thus, the correlation value over successful
packets does not help us in determining the routing cost of the link and the correlation
value over packets with incorrigible errors is meaningless. Thus, the correlation value is
not a
good base for determining the routing cost of a link.


We further
argue that even if it were some
how possible to determine the signal to noise
ratio on the link in all cases, the signal to noise ratio is not a good indicator of link quality
from the pe
rspective of an IEEE 802.15.4 node. This argument is based on the
relationship between the signal to noise ratio and the packet error rate at the PHY layer in
an IEEE 802.15.4 node. In this thesis, we show that the PHY level packet error rate
continue
s

to
maintain its very low value as long as the signal to noise ratio is better than a
threshold. Once the signal to noise ratio becomes less than this threshold, the PHY level
packet error rate jumps to very high levels (close to 1) within 2
-
3 db of further
de
terioration in the signal to noise ratio. Thus, from the perspective of an IEEE 802.15.4
node, the link quality is “good enough” as long as the signal to noise ratio is more than a
threshold and “not good enough” otherwise. Thus, there is no gradual deteri
oration in
packet error rates as the signal to noise ratio deteriorates and hence the signal to noise
ratio is not a good determinant of link cost for routing purpose.


16


We suggest that the cost of a link for Zigbee routing purpose be determined based on th
e
observed loss rate at the Zigbee layer for the packets sent on the link. This loss rate
automatically takes into account the radio level signal to noise ratio, the PHY level error
correction built in IEEE 802.15.4, the MAC level contention for channel ac
cess among
multiple nodes in each other’s hearing range in a network and MAC level packet
retransmissions allowed by IEEE 802.15.4 protocol. Moreover, such loss rates are
already being maintained in Zigbee neighbor tables. The exact mechanism to use such
l
oss rates to determine the link costs and then end
-
to
-
end route costs is left as work for
future. We do note that any end
-
to
-
end route cost should be a
multiplicative
function of
the individual link costs, based on success rates on the links, rather than a
n
additive
one
as suggested in
the
Zigbee specification.

1.2
802.15

The 802.15 is an IEEE working

group that
specializes in Wireless Personal Area
Networks.
Though all the standards under this group are defined for networks that are
smaller in size
,

they a
re bifurcated based on the data rate required for different
communications. Standards are defined for Bluetooth, very high data rates and very low
data rate networks. Under the very low data rate category comes the 802.15.4/Zigbee
standard. This is an infa
nt protocol and is making

great progress in the recent years.
Optimization and efficiency are the main concerns of this protocol especially because of
the constraint of po
w
er consumption.
There has

been constant changes be
ing
made to

the
protocol and thus

be considered as one of the
fastest
growing protocols in the industry.

17


Chapter 2

802.15.4 and Zigbee

2.1 Overview

802.15.4/Zigb
ee is

a standard for very low cost, very low power consumption and two
-
way wireless communications. This standard can be used over a varied set of solutions
such as home and office automation, military applications, toys, games, industrial control
systems, medi
cal applications etc.,

Presented in this chapter are the primary design factors of the 802.15.4/Zigbee standard.

2.2
Arc
hitecture

The 802.15.4/Zigbee standard uses the layered architecture similar to the OSI model.
Each of these layers is responsible to c
arry out a specific function. The layers could be
perceived as a chain in which the layer below functions in
a way in which it could
provide services for the layer above.
The services are provided through w
h
at are known
as the service access points. These
points
are
present between any two layers of the stack.
802.15.4 itself describes the lower layers namely the Physical layer and the MAC layer.
Zigbee

however describes the network and the application layers

over the foundation
built by 802.15.4
.


18


















Figure
: 2
.1 802.15.4/Zigbee Protocol Stack

2.3
Data rate and Range

The frequency band at which the s
ystem operates in North America

is 2.4GHz. For this
frequency the data rate is a maximum of 250kbps.

The modulation technique used
for
this
band is the
Orthogonal Quadrature Phase Shift Keying (
O
-
QPSK
)
.


Medium Access Control (MAC) Layer

Network (NWK) Layer

App
lication (APL) Layer




Application Support
Sublayer
(
APS)

Application Framework


Application
Object 240

Application
Obj
ect 1




ZDO
Management
plane

Physical

(
PHY
) Layer


2.4 GHz
Radio

868/915 MHz


Zigbee Device
Object

(ZDO)


PD
-
SAP

APSDE
-
SAP

MLD
E
-
SAP

MLM
E
-
SAP


NLD
E
-
SAP


PLME
-
S
AP

APSD
E
-
SAP

N
LME
-
SAP

APS
ME
-
SAP

APSD
E
-
SAP


Security

Service

Provider

19


The other band of operation is the 868MHz band used in Europe. The data rate at this
frequency is typically 40kbps and the
Binary Phase Shift Keying (
BP
SK
)

method of
modulation is used.

Besides BPSK, Amplitude Shift Keying and O
-
QPSK may be used
based on the application both of which are not mandatory.

Range of operation is approximately 50m in both cases. It could however vary from 5
-
500 m depending on
the environment at which the nodes are deployed.

It can be seen from the above description that Zigbee works for low data rate and short
range applications.

2.4
The Physical

(PHY)

Layer

The Physical layer is responsible for all the tasks related to the sys
tem at the device level.
It provides an interface between the M
edium
A
ccess
C
ontrol (MAC)

layer and the
physical radio channel through the RF firmware and hardware.
The PHY

layer basically
tells how the devices in the network should communicate with each o
ther.

T
he responsibilities of the Physical layer include:



The radio transceiver A
ctivation and Deactivation: this is a simple task

where
either the transmitter or

the receiver might have to be either activated or
deactivated based on whether data needs to be transmitted or received. Since
some of the devices are in the sleep mode so that energy is conserved,
they have
to be monitored and necessary action
be
taken.

20




Energy detection within the channel in use
: In order to select a channel, the
network layer can use the Energy detected at the PHY layer. The energy detected
is an estimate of the received signal power within the given bandwidth.



Link Quality
Indication (
L
QI) for the packets received
:
The LQI is determined
based on the
Signal to Noise Ratio (
SNR
)

and the
Energy Detection (
ED
)

for the
packets received over the link. This is a measure of how good a particular link is
so that packets can be transmitted without

losses. The LQI is used to determine a
path between the source and the destination. The path which has individual links
with a LQI that indicates possible reliable transmission is
the one which

is
selected.



Clear Channel Assessment for CSMA
-
CA
:
The CCA is

done in order to detect
whether a given channel is busy before it is selected for packet transmission. A
channel is said to be busy if a transmission is currently taking place over the
channel.

In order to determine whether a channel is in use three
different methods could be
used:



Check to see if the energy level over the channel is greater than a
threshold. ED can be used for this purpose.



Perform a carrier sense, to check if there a signal with the spectral and
modulation characteristics of 802.15.
4

21




Perform the carrier sense and also check if the energy detected is above
the threshold.



Channel frequency selection
:
The frequency band in which the communication
should take place is define
d

by the PHY layer.



Data transmission and Receptio
n:
The data
to be transmitted is through packets
each of which has headers involved. Once the packets are sent to the recipient an
acknowledgement is received.

2.4.1
Physical Layer Service Specifications

The PHY layer like the other layers can be conceptually divided

into the management
entity and the data entity providing the management and the data services respectively.
Each of these services can be accessed through Service access points namely, PLME
-
SAP and the PD
-
SAP

as shown in the reference model
.






Figure

2
.2
: The PHY

Layer

reference model
.

PD
-
SAP

PLME
-
SAP


RF
-
SAP

PHY Layer

PLME

PHY

PIB

22


The Mac Protocol Data Units (MPDUs) are handled by the PD
-
SAP. The PD
-
SAP
supports certain primitives that request and provide data transfer options between the
devices.

2.4.1.1

The PPDU format



Figure

2.3
: PPDU format

*SFD: Start of Frame delimiter

*SHR: The synchronization header. This field enables the device on the receiving end to
synchronize.

*PHR: The physical

header gives the length of the frame.

The Payload field carries the MAC sub layer frame.

2.5
The Medium Access Control layer

The MAC layer determines when a device can access a given channel over which the
communication is intended.
It handles all the acc
ess to the physical radio channel

using
the CSMA mechanism
.

Besides transmitting beacon frames and synchronization, the
other important responsibility of the MAC layer is to provide a reliable transmission
mechanism.


Preamble
SFD
*

Frame length/Reserved



PSDU


SHR*



PHR* PHY payload
(variable)

23


Features of the MAC layer:



Network bea
cons’ generation

and synchronization



Association and disassociation of the PAN



Channel access using CSMA
-
CA



GTS mechanism maintenance



Reliable link establishment between MAC entities


2.5.1
MAC Layer Service Specifications

The MAC layer can be conceptually

divided into two entities, just like the physical layer.
The two entities being the Management Entity and the MAC Common Part sub
-
layer. In
order to provide services to the layers above or the Physical layer, Service access points
are used.







Figure

2.4
: The MAC Layer
reference model.

MCPS
-
SAP

MLME
-
SAP


PLME
-
SAP


RF
-
SAP

MAC Common

Part Sub
Layer

PLME

MLME

PIB


PD
-
SAP


RF
-
SAP

24


MAC provides two different services:



Data Services: accessed through the MAC Common Part sub
-
layer
-
Service
Access Point.



Management Services: accessed through the MAC Layer Management Entity
-
Service Access Point.

2.5.2

The Data Transfer Model

Data transactions take place in three ways.



Data
transfer from the device to the coordinator.



Data transfer from the coordinator to the device.



Data transfer between peer devices in the network.

In the star topology only the first two types of transactions are used. This is due to the
fact that in the st
ar topology the only transactions that can take place are between the
coordinator and the devices. In the peer to peer topology transactions can be between any
two devices besides the coordinator and the devices and hence all the three types of
transaction
s are possible.




25


Non
-
Beacon enabled mode:







Figure

2.5: Data transfer model from the coordinator to the device








Figure

2.6: Data transfer model from the device to the coordinator

2.5.3

Channel Access

Channel Access can be done using the following two methods:



Contention based
: In this method the devices use the CSMA
-
CA back off
algorithm in order to determine whether a
given channel can be utilized.



Contention free
: The decision making capability in this case lies with the Pan
coordinator which makes use of GTSs in order to access a given channel.

COORDINATOR

NETWORK
DEVICE

Data Request

Acknowledgeme
nt


Data

Acknowledgeme
nt

COORDINATOR

NETWORK
DEVICE

Data Request

Acknowledgeme
nt


(If requested)

26


Slotted CSMA
-
CA is made use of in the beacon enabled mode, where as in the

non
beacon enabled mode
,

the un
-
slotted CSMA
-
CA is used. In both the cases the back off
periods, which are basically units of time, are utilized in order to implement the
algorithm.

In the slotted CSMA
-
CA algorithm the back
-
off units of different devices
in the network
are related. Precisely, every device within the network is aligned with the super frame
structure of the coordinator; also the start of the first back off is aligned with the start of
the beacon transmission.

The Un
-
slotted CSMA
-
CA works in
quite the opposite manner, the back
-
off periods of
any device within the network are not related in time with any other device. Our study is
over the non
-
beacon mode of transmission, hence described below is the Un
-
slotted
CSMA
-
CA algorithm.

The devices in

the network ma
intain three parameters, NB,
BE

and CW
.

NB: The NB value is set to zero every time a transmission is initiated. This value is
incremented based on the number of times the algorithm had to back
-
off while attempting
the transmission.

BE
:

This
gives the number of back
-
off periods a device should wait before accessing a
channel. This value is set to a predetermined minimum value.

CW: This parameter is used only in the slotted CSMA
-
CA algorithm. It gives the
contention window length.

27


2.5.4
Un
-
slo
tted CSMA
-
CA algorithm

As mentioned earlier the parameter used by the CSMA
-
CA algorithm is the time units
called the back
-
off periods. A device that is ready to transmit data uses the Un
-
Slotted
CSMA
-
CA algorithm to determine whether the channel over which

the transmission
needs to take place is currently free. Once ready, the device waits for a random amount of
back off periods. The back off periods has a set range from 0 to
2
BE
-
1.

A Clear Channel
Assessment (CCA) is then performed to check if the medium i
s idle. If the channel is
found to be clear, data transmission takes place. If the channel is found to be busy then
the device backs off. Each time the device backs off, the NB and BE values
is

incremented. Both NB and BE have threshold values that
are pre
defined, the maximum
value that NB can reach is macMAXCSMABackoffs. The maximum value that BE can
reach is maxBE. If the channel is found to be busy after the repeated tries, a Channel
Access Failure is reported and the CSMA
-
CA algorithm is terminated. The

entire
algorithm is restarted to determine whether the channel is still busy.

2.6
The Network Layer

The Network layer is defined by Zigbee over the base provided by 802.15.4. The network
layer plays
a
major role in determining how cost effective and power

efficient the given
WPAN is. Most of the dynamic functions of the devices such as network formation,
routing of packets, maintenance and repair of routes etc., are taken care of by the
Network layer.

28


Network layer functionalities:



Joining and leaving a ne
twork.



Securing the frames



Routing the packets from the source to a given destination



Discovery of routes



Route maintenance



Neighbor discovery



Storing the information related to the neighbors of a given device

2.6.1
Zigbee Devices

Conservation of power is
one of the prime requirements of the 802.15.4/Zigbee protocol.
In order to reduce energy utilization on
e of the implementation strategies

is to reduce the
functionality of certain devices that are not involved in performing a given set of tasks.
Thus the d
evices are assigned minimal functions just enough to ensure efficient working.
A few devices though will have the capacity to perform all the functions.

The devices thus can be bifurcated into:



Reduced Function Devices (RFD): They can only be network end

devices. These
devices have limited functionality
. Low cost, reduced complexity and low power
consumption are the main features of these devices.


29




Full Function Devices (FFD)
: The FFDs are fully loaded devices that can perform
all the functions that the
standard specifies. They can function as the Network
coordinator owing to the fact that they have full functionality. Any WPAN will
invariably contain at least one FFD. A FFD can also be used as a link coordinator
or simply a network end device.

2.6.2
Netw
ork Topologies

Three different topologies have been defined for Zigbee networks. The choice of a
topology is based on the application of the system.

2.6.2.1
Star Topology



Full
Function Device
Reduced Function Device
PAN Coordinator

Figure

2.7
:
Star topology

This is the most widely used

and a simple

topology characterized by
a single Full
Function Device which is the network coordinator, to which are connected the end
devices. The end devices are allowed to communicate only with the coordin
ator. Thus
any communication that has to be established between two end
-
devices should be through
the coordinator.

30


2.6.2.2
Tree

Topology








Full Function Device
Reduced Function Device
PAN Coordinator

Figure

2.8
:
Tree

topology

In the tree topology, the nodes are arranged based on a parent child structure. The
networks related operations such as starting the network and choosing different
parameters are the respons
ibility of either the ZigBee coordinator or ZigBee routers. The
data and control messages are propagated through the network based on the hierarchy of
arrangement of the nodes
.

2.6.2.3
Mesh Topology


Full Function Device
Reduced Funct
ion Device
PAN Coordinator


Figure

2.9
:
Mesh topology

31


The Mesh network is a little complex when compared to the other topologies mentioned.
The PAN coordinator is connected to either routers or end devices. The router could be
further connected to
additional routers and end devices, forming a chain with different
levels. The routers in this topology have the ability to communication with other routers
within its listening range. This helps e
fficient transmission since if

a link is broken
alternate r
outes can be easily established.

A mesh allows full peer to peer
communication.

2.6.3
Network Layer entities

In order to provide an int
erface to the application layer

the network layer can be
conceptually divided into two service entities, the Network Layer Data Entity (NLDE)
and the Network Layer Management Entity (NLME) to provide the data and the
management services respectively. The data transmission servic
e is pro
vided through the
NLDE
-
Service Access Point and the management services

are provided through the
NLME
-
Service Access Point. The Network Information Base (NIB) is also maintained
by the Network layer and is a data base of the managed objects.

The
functiona
lities mentioned are for the network layer as a whole. The services provided
by the NLDE and the NLME individually suffice for the general functional requirement
of the Network Layer.



32


2.6.3.1
NLDE Services



Network Level PDU generation: The NLDE should g
enerate the NPDU from the
APS
-
PDU.



Routing: The NPDU generated should be routed from the source to the destination
device either directly or through intermediate nodes or devices. The important
factor to be taken into consideration here is the network topo
logy

being
used.
Network top
ologies are described in section 2.6.2
.



Implementing Security features: It is the responsibility of the NLDE to ensure that
the transmission of the frames takes place in a secure manner. Both authenticity
and confidentiality ha
ve to be taken care of.

2.6.3.2
NLME Services

The interface between an application of the system and the stack is provided by the
NLME. As the name suggests,
considering the broader picture,
this entity manages the
networks in terms of
discovery, formation
, monitoring and maintenance.

The services provided by the NLME are:



New device configuration: A new device added to the network has to be
configured based on the role of the device in the network. Whether the device
should operate as a coordinator or an
end device should be determined, and
configured accordingly.

33




Starting a Network: Establishing a brand new network is the responsibility of the
NLME.



Joining and Leaving a Network: Devices that intend to join a network are
permitted to do so by the NLME. Li
kewise, a Zigbee coordinator or router might
request that a device leave the network, the permission to do so is granted by the
NLME.



Address Assignment: It is highly important to identify different devices within the
network based on an identity. The iden
tity could be an address assigned, which is
done by the Zigb
ee coordinator or the routers. The NLME of these devices is
responsible for assigning addresses to any new device joining the network.



Discovering Neighbors: Any device in a network should be awar
e of the devices
that are its neighbors in order to route packets efficient
ly

from a given source to
the intended destination. The NLME has the ability to discover, record and report
information of the one hop neighbors (devices that are directly connected

to the
given device) of a device.



Discovering routes: The frames that are to be sent from a given source to a
destination are sent through a well
-
defined path. This is important since they have
to be routed efficiently. The route is pre
-
determined,
in i.e
.

the route is discovered
before transmitting the frames.

34




Controlling the reception: A receiver has to be activated and kept active for
certain period of time. It is important that the receiver is put into the sleep mode
in order to conserve power, since
one of the motives of this protocol is low energy
consumption. Activation of the receiver enables either MAC sub layer
synchronization or direct reception.

2.6.4
Network Layer Service Specification

The two services, which establish an interface between the

MAC layer and the
Application layer, provided by the Network layer are the data service and the
management service. The interface is provided through the MLDE
-
SAP and the MLME
-
SAP. The network layer has an implicit interface between the NLDE and the NLME
internally, in addition to the external interfaces facilitating the NLME to utilize the
Network Data Services.






Figure

2.10
: The NWK Layer reference model
.

NLME
-
SAP

NLDE

NLME

NWK

IB

MLME
-
SAP

MCPS
-
SAP

NLME
-
SAP

35


The NLDE
-
SAP supports the transportation of the Application layer data units between
the application entities. The NLME
-
SAP is responsible for the network, discovery,
formation routing and maintenance.

Zigbee routing is a very important function of the Net
work layer. Since the emphasis of
this thesis is over the routing in the Zigbee protocol, it is discussed in detailed in the next
chapter.

2.7
The Application Layer

The highest layer in the Zigbee architecture stack is the Application layer. As the name
su
ggests, this is the layer in which the application of the Zigbee system could be defined.
The application layer provides an interface of the system to the end users.

The application layer can be divided into two components namely the Zigbee Device
Objects

(ZDO) and the
Application Support Sub
-
layer. Within the application
framework there could be various application objects also known as communicating
objects.

The ZDO is responsible for:



Deciding whether a given device is an end device or a coordinator.



D
etermining the application services provided by a device once they are
discovered within the network.



Initialization and responding to binding requests

36




Providing secure connectivity between network devices.

The APS sub layer is responsible for:



Maintaining

binding tables



Sending messages back and forth between devices that are bound.



Address definition



Address mapping



Fragmentation of the data frames



Reliable data transport.

2.7.1
Application Support Sub Layer

The Application Support Sub layer can be
divided into two components similar to the
other layers mentioned earlier, the APS data entity and the APS management entity,
providing the data services and the management services respectively.

2.7.2
Application Framework

The application objects are host
ed in the Application framework environment. The basic
functions provided by the Application objects are as follows:



Control and Management of the Zigbee device protocol layers.



Initiation of the standard network functions.

37


240 distinct application objects

may be defined for each device; the figure is the upper
bound on the limit.

Another task that the application layer is involved in is the addressing
,

where the nodes
are assigned distinct addresses.








38


Chapter 3

Routing in Zigbee

Zigbee

routing protocol is a version of
Adhoc On
-
demand Distance Vector
(AODV)
routing protocol [9,10], where the routes are discovered by the source broadcasting a
Route Request
through the network and the destination sending
Route Replies
back on
receiving th
e route requests via different paths between the source and the destination. In
order to make Zigbee routing efficient various methods have been studied in the past and
many protocols have been proposed [13, 14, 16]. These protocols typically focus on the
initial stages of routing; one of the final stages is the selection of the best route which is
studied in this thesis.

3.1
Routing Addresses

Zigbee devices
’ address is utilized in order to
route packets between the source and the
destination. The routing a
ddress of a device is its short address if it is a router or a
coordinator. If the device is an end device then the routing address is the short address of
its parent. Routing destination of the frame is the routing address of the frame’s NWK
destination.
The routing address of any device can be derived from the device address.


3.2
Calculation of Routing Cost

The routing cost is a metric used during route discovery and maintenance to determine
whether the route in question is indeed the best route between
the source and the
39


destination. A route from the source to the destination is composed of various links that
exist between the intermediate devices.

Link cost is associated with each link in the path which when added up giv
es

the effective
path cost.

Giv
en a path of length L with devices, [D
1
, D
2

… D
L

].

The Path cost
as a suggestion in
the Zigbee specifications
[2;
section:3.7.3.1
]

is given by,


(3.1)




7

Where C
{l} =




Min (7, round (1/P
l
4
))


P
l

is the probability of packet delivery on the given link l. This probability basically
reflects the number of attempts that may be required for a packet to be successfully
transmitted through the link each time it is utilized.

The estimation of P
l

is

an implementation issue. One method of estimation would be
observing the sequence numbers over a given period of time so as to detect the lost
frames.

An alternate fairly straightforward method would be to form an estimate based on an
average over per fra
me Link Quality Index which is provided by the MAC and PHY
40


layer. The initial cost of a link is typically based on the LQI. The LQI may be mapped to
the link cost C{l}.

The existing procedure for the Link cost calculation and a proposed efficient method fo
r
this calculation are explained in detail in the forth coming chapters of this document.

3.3
Routing Tables

The Routing Table and the Route discovery table are maintained by either the Zigbee
coordinator or the router. The various fields stored in these t
ables are utilized during
route discovery and maintenance
in order to take appropriate actions to ensure efficient
routing of the packets.

Table 3.1 Routing Table

Field Name

Size

Description

Destination
address

2
bytes


The 16
-
bit network address or Group ID of this route; If the
destination device is a ZigBee router or ZigBee coordinator,
this field shall contain the actual 16
-
bit address of that
device; If the destination device is an end device, this field
shall contai
n the 16
-
bit network address of that device’s
parent


Status

3 bits

The status of the route

Many
-
to
-
one

1 bit

A flag indicating that the destination is a concentrator that
issued a many
-
to
-
one route request


Route record
required

1 bit

A flag indicating

that a route record command frame should
be sent to the destination prior to the next data packet


41


GroupID
flag

1 bit

A flag indicating that the destination address is a Group ID


Next
-
hop
address

2
bytes

The 16
-
bit network address of the next hop on
the way to the

destination



Table 3.
2 Status Field Values

Numeric

Value Status

0x0

ACTIVE

0x1

DISCOVERY_UNDERWAY

0x2

DISCOVERY_FAILED

0x3

INACTIVE

0x4

VALIDATION_UNDERWAY

0x5


0x7

Reserved


Table 3.
3 Route Discovery Table

Field
Name

Size

Description

Route
request ID

1
byte


A sequence number for a route request command frame that is

incremented each time a device initiates a route request


Source
address

2
bytes

The 16
-
bit network address of the route request’s initiator


Sender
address

2
bytes

The 16
-
bit network address of the device that has sent the most

recent lowest cost route
request command frame corresponding to

this entry’s Rout
e request identifier and Source
address; This field

is used to determine the path that an eventual rou
te reply
command

frame should follow


42


Forward
Cost

1
byte

The accumulated path cost from the source of the route request to

the current device



Residual
cost

1
byte

The accumulated path cost from the current device to the

destination device


Expiration

time

2
bytes

A countdown timer indicating the number of milliseconds until

route discovery expires;
The initial value is

nwkcRouteDiscoveryTime



3.4
Upon Receipt of a Unicast Data Frame

When a data frame is received at a device, it is intended to be forwarded to a destination
device. There is a procedure followed by the device in order to route the packet all the
way to the destination
and
is described in this section.

If the receiving de
vice is either a Zigbee router or coordinator and if the destination
specified in the frame is a child of this device and also an end device the data frame is
directly relayed.

3.4.1
Device with routing capacity

If the device that receives the data frame
has routing capacity it checks the routing table
of the device to check if there exists an entry corresponding to the routing destination of
the frame
.



43


If the routing table entry exists, the STATUS field is checked.



STATUS: ACTIVE or VALIDATION_UNDERWA
Y implies the frame is
relayed. The status field is set to ACTIVE if it was not prior to being relayed. In
order to relay the frame, certain parameters related to the source and destination
has to be known.

o

SrcPANId and DestPANId are provided by the macPAN
Id attribute of the
MAC PIB of the device that is relaying the frame.

o

SrcAddr and DestAddr: the SrcAddr is extracted from the macShortAddr
attribute of the MAC PIB and the DestAddr is the next hop address field
of the routing table entry corresponding to t
he destination.



STATUS: DISCOVERY_UNDERWAY: for this value of the status field,

o

The frame is treated as though the route discovery has been initiated for
this frame

o

The other option is that the frame could be buffered pending the route
discovery or route
d using hierarchical routing. Hierarchical routing is
allowed based on whether the attribute, nwkUseTreeRouting is set to
TRUE.



STATUS: DISCOVERY_FAILED or INACTIVE: the frame may be routed using
hierarchical routing provided the nwkUseTreeRouting is set t
o TRUE.

44




STATUS: not ACTIVE and the frame is received from the next higher layer: the
source route table is checked for an entry corresponding to the destination, if such
an entry is found Source routing is employed to route the frame to the destination.

If

the routing table entry does not exist and if it is determined that source routing cannot
be used the other possibility would be that this device should initiate route discovery.
Route discovery is initiated depending on the value of the discover route su
b field which
is part of the NWK header frame control field. Hierarchical routing may be used in the
case where route discovery is not initiated based on the nwkUseTreeRouting value.

The frame is discarded after all the above mentioned possibilities are c
hecked for. Thus a
frame is discarded when:



The discover route subfield is not set



Hierarchical routing is not a possibility due to t
he

nwkUseTreeRouting being
FALSE



The routing table entry corresponding to the routing destination of the frame does
not
exist.

3.4.2
Device without routing capacity

The only possibility is this case is the hierarchical routing which can be carried out only
if nwkUseTreeRouting is TRUE.

45


3.5
Route Discovery

The motive behind route discovery is the selection of the best availa
ble route to the
destination when a message is to be sent. Route discovery is initiated when a
data
transmission is requested.

3.5.1
Types of Route discovery



Unicast Route Discovery: to discover a route between a particular source to a
particular destinati
on



Multicast Route Discovery: performed with respect to a particular source to a
multicast group



Many
-
to
-
one Route Discover: performed by a source device in order to establish
routes originating from various devices in the network to itself. The devices he
re
must be within a given radius.

The routing protocol employed in Zigbee is the Adhoc On
-
Demand Distance Vector
(AODV) Routing. The choice of this routing scheme is to ensure low power
consumption.

A device within the network broadcasts a Route Request co
mmand frame
to its neighbors
in order to find a route to the destination device. The neighbors further broadcast this
frame until the destination is reached.


46


3.5.2
Creation of a new Route Request Command

Frame

Each device that issues a Route request Command Frame maintains a counter to generate
route request identifiers. This counter is incremented each time a Route Request
Command frame is created. The value of the counter is stored in the Route Request
Identif
ier field of the route discovery table.

After the Route discovery table and routing table entries are created
,

the individual fields
of the command frame are populated.



The command frame identifier: indicates the frame is a command frame.



Route request Id
entifier: the value stored in the route Discovery table.



Multicast flag and destination address are set based on the type of route discovery
initiated.



Path cost: set to 0.

3.5.3.
Upon receipt of a Route Request Command Frame

Octets : 1

1

1

2

1

Command
Frame Identifier

Command
Options

Route Request
Identifier

Destination
Address

Path
Cost

NWK payload


Figure

3.1 Route Request Command Frame

The Route Request Command Frame once created is broadcast.
When a Route Request
Command frame is received by any device in the network, if the device is an end device
47


then the frame is dropped. If the device is not an end device

and has routing capacity
,
various parameters are checked to see if the frame
received
is legitimate based on the
routing table entries of the device.

3.5.3.1
Device is the destination or the parent of the destination

Once the route request is found to be valid it is checked whether the device is the
destination or if the destination is a ch
ild of this device. If yes, a reply with a Route Reply
Command Frame is sent. The Route Reply’s source address would be the address of the
device that creates the reply and the destination address would be the next hop address
considering the originator of

the route request to be the destination.

Link Cost: the Link Cost from the next hop device to the current device is computed and
inserted to the path cost field of the Route Reply Command frame.


3.5.3.2
Device is not the destination

In this case the de
vice computes the link cost from the previous device and adds it to the
path cost value in the Route Request command frame

and is forwarded towards the
destination. The next hop for this is determined in a manner as if the frame were a data
frame address t
o the device identified by the destination address.

3.5.4
Route Discovery Table Entries

During the course of a route discovery a
ny device within the network

device m
ight be
included in the
route

being developed
. The Route Discovery table of this device should
48


be updated with the values corresponding to the values present in the Route request
Command frame. The forward cost field however, is calculated using the previous sender
of the command frame to compute the

link cost which is added to the value obtained from
the path cost field of the route request command frame and the result of this calculation is
stored in the Forward cost field.

If the Route discovery table entries for the given route identifier and sour
ce address pair
already exists, the device checks if the path cost in the Route request Command frame is
less than the Forward cost that is stored in the Route Discovery table. In order to compare
these values,



The link cost from the previous device that s
ent this frame is computed and then
added to the path cost value in the Route Discovery table entry.



If the new value obtained is greater than the value stored in the Route Discovery
table the frame is dropped and no further processing is required.



If
the
new value is lesser, the forward cost and sender address fields are updated
with the new cost and the previous device address from the Route Request
Command frame respectively.




49


3.5.5.
Upon receipt of a Route Reply Command Frame

Octets : 1

1

1

2

2

1

Com
mand
Frame
Identifier

Command
Options

Route
Request
Identifier

Originator
Address

Responder
Address

Path
Cost


Figure

3.2 Route Reply Command Frame

When a device receives a RREP command frame, it has to make a decision either to
forward it or to discard.

The frame may be discarded in the following cases:



When the device does not have routing capacity and hierarchical routing is not a
possibility since the nwkUseTreeRouting is set to false.



When the device has

routing capacity but is neither

the intended d
estination nor
contains a table entry corresponding to the intended destination’s address.



If the device does have a table entry corresponding to the destination address and
if the STATUS field is set to VALIDATION_UNDERWAY, and the path cost in
the route
reply command frame is greater than the residual cost obtained from the
route discovery table.

The frame is forwarded though if the above mentioned cases are not encountered. Before
forwarding the Route Reply Command Frame, the device updates the path cost

field by
computing the link cost from the next hop device to itself and adding this to the value in
50


the Route reply path cost field provided it is lesser then the residual cost. The next hop
address is updated and is set to the previous device that forwar
ded the Route Reply
Command frame.

3.6
Route Maintenance

Once a route is formed it is important that the route is monitored to make sure all the
links involved in the route are fit to be able to transmit any packet it received

over a
period of time
.

The monitoring may be done in regular intervals of time by sending test packets to make
sure the links are working. Since Zigbee is a power saving protocol
,

this might not be the
best practice, since the intervals may have to be spaced quite far apart. Thi
s might lead to
a condition where in a link that is down may not be recognized for that entire period that
there was no monitoring.

As an alternative every device could maintain a counter for each if its outgoing link to
record the number of packet transmi
ssion failures that occurred, once this value reaches a
predetermined threshold value a route repair could be initiated and the other devices may
be notified of the failure.



51


Chapter 4

Link Cost Calculation

The determination of a route from the source to
the destination in order to provide
reliable yet efficient transmission of a packet depends on the path cost as seen in the
previous chapter. The decision whether or not a route needs to be selected depends on the
path cost being lower than the path costs
of any other alternate route between the source
and the destination devices.

The path cost is obtained by adding the individual cost of the individual links which is
described in section
3.5.4

of the previous chapter. The link cost
is a measure of the
rel
iability of the link and is inversely proportional to the probability of packet delivery
over the link in question. Thus a high link cost implies the link is not good enough.
During the process of route discovery, the path cost is compared at the intermedi
ate
devices to ensure that those devices that contribute a minimum value to the path cost are
chosen.

4.1
RSSI for link cost

On
e

of the methods used to determine the Link Cost is based on the Received Signal
Strength Index (RSSI). The RSSI is a measure of
the stre
ngth of the signal received at a
device over a given link. The link is considered to be good and hence reliable if it has
transmitted a signal well. Whether a signal is transmitted well can be determined by
52


measuring how strong the signal is at the

receiving end. If this value is high enough it
implies that the link has been successful in signal transmission and hence could be
considered reliable.

The RSSI is measured in dB. The value can be linearly scaled within a predetermined
range. A table cont
aining a mapping of RSSI to link
cost value is maintained. The link
cost is a value between 1 and 7 according to the Zigbee specifications. Different ranges in
the RSSI are mapped to link cost values.

A table might look similar (but not same as) to the ta
ble given below



Table 4.1

Sample RSSI to Link Cost Mapping

Link Cost

RSSI

1

>30

2

25
-
30

3

20
-
25

4

15
-
20

5

10
-
15

6

5
-
10

7

Other


4.2
Correlation value for link cost

For a p
acket

to be transmitted in 802.15.4, e
ach 4 bit symbol is converted to a
32 bit long
chip sequence. It is this 32 bit long sequence that is transmitted. Once the transmission is
done, on the receiving end the received sequence is compared to the 16 possible chip
sequences. Each in
dividual bit of the received sequence is XORed w
ith the 16
possibilities and the number of bits that are “same” are counted. This gives the
53


correlation value. Amongst the 16 possibilities, the sequence that has the highest
correlation value, in other words the one which has the maximum bits that match t
he
received sequence is considered as the actual sequence. The correlation value obtained
may be used as the link cost for further use.

The correlation value is nothing but the Hamming Distance which is used as the link cost.

4.2.1 Hamming Distance

Table 4
.2

Symbol to Chip mapping

Data
symbol

(decimal)

Data symbol

(binary)

(b0 b1 b2 b3)

Chip values

(c0 c1 … c30 c31)

0

0 0 0 0

1 1 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 1 0 1 0 0 1 0 0 0 1 0 1 1 1 0

1

1 0 0 0

1 1 1 0 1 1 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 1 0 1 0 0 1 0 0

0 1 0

2

0 1 0 0

0 0 1 0 1 1 1 0 1 1 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 1 0 1 0 0 1 0

3

1 1 0 0

0 0 1 0 0 0 1 0 1 1 1 0 1 1 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 1 0 1

4

0 0 1 0

0 1 0 1 0 0 1 0 0 0 1 0 1 1 1 0 1 1 0 1 1 0 0 1 1 1 0 0 0 0 1 1

5

1 0 1 0

0 0 1 1

0 1 0 1 0 0 1 0 0 0 1 0 1 1 1 0 1 1 0 1 1 0 0 1 1 1 0 0

6

0 1 1 0

1 1 0 0 0 0 1 1 0 1 0 1 0 0 1 0 0 0 1 0 1 1 1 0 1 1 0 1 1 0 0 1

7

1 1 1 0

1 0 0 1 1 1 0 0 0 0 1 1 0 1 0 1 0 0 1 0 0 0 1 0 1 1 1 0 1 1 0 1

8

0 0 0 1

1 0 0 0 1 1 0 0 1 0 0 1 0 1 1 0 0 0 0
0 0 1 1 1 0 1 1 1 1 0 1 1

9

1 0 0 1

1 0 1 1 1 0 0 0 1 1 0 0 1 0 0 1 0 1 1 0 0 0 0 0 0 1 1 1 0 1 1 1

10

0 1 0 1

0 1 1 1 1 0 1 1 1 0 0 0 1 1 0 0 1 0 0 1 0 1 1 0 0 0 0 0 0 1 1 1

11

1 1 0 1

0 1 1 1 0 1 1 1 1 0 1 1 1 0 0 0 1 1 0 0 1 0 0 1 0 1 1 0 0 0 0 0

12

0 0 1 1

0 0 0 0 0 1 1 1 0 1 1 1 1 0 1 1 1 0 0 0 1 1 0 0 1 0 0 1 0 1 1 0

13

1 0 1 1

0 1 1 0 0 0 0 0 0 1 1 1 0 1 1 1 1 0 1 1 1 0 0 0 1 1 0 0 1 0 0 1

14

0 1 1 1

1 0 0 1 0 1 1 0 0 0 0 0 0 1 1 1 0 1 1 1 1 0 1 1 1 0 0 0 1 1 0 0

15

1 1 1 1

1 1 0 0 1 0 0

1 0 1 1 0 0 0 0 0 0 1 1 1 0 1 1 1 1 0 1 1 1 0 0 0



54


4.3 Factors affecting
communication in actual environments

Though the above discussed methods may seem straight forward in calculating the link
cost, in the actual environments there are many other fact
ors that have to be taken into
consideration. These factors affect the RSSI and Correlation values and thus make them
unfit to be used for the calculation of the link cost.

Studies [5, 6, 7] related to
performance analysis of Zigbee using Matlab models or
simulations give details related
to the behavior of Zigbee networks in real time environments.

4.3.1
Noise in the environment

Any communication environment is characterized by noise. The noise could be
originating from various physical factors related to
the en
vironment or due to the
presence of other wireless networks in the vicinity of the Zigbee network.

4.3.1.1
Signal to Noise Ratio

(SNR)

The SNR is a measure of the signal power to the noise power that is interfering with the
given signal. If the SNR
value is high, it means the Signal quality is good a
nd that the
noise power is low; n
oise though present is not too obtrusive.
Different modules have
been devised to record the effect of noise in a given environment. Some of the modules
relevant to the Zig
bee environment that was considered are described below.



55


4.3.1.2
Rayleigh Fading

Rayleigh fading is a model that determines the effect of the propagation environment on
the wireless devices. Rayleigh fading is dominant in case of zigbee networks since th
ere
is no significant line of sight component between the source and the destination.

4.3.1.3
Rician Fading

Rician fading deals with the anomalies in the radio signal itself, due to the different
components of the signal that might lead to partial cancell
ation of the signal. The effect
of Rician fading however is negligible. It is prominent in cases in scenarios that have a
dominant line of sight component between the source and the destination.

4.3.1.4
Additive White Gaussian Noise

The other component tha
t has a significant impact on the signal quality is the Additive
White Gaussian Noise. This is the model that determines the effect of the linear wideband
or white noise. The
AWGN

t
h
ough does not account for the fading and interference due
to other wireles
s networks present in the propagation environment.

4.4
Packet transmission and Error Rates

Every 4 bit symbol is converted to a 32 bit sequence of symbols and this sequence is
what is transmitted. The modulation technique used for transmission is the Offse
t
-
Quadrature Phase Shift Keying.


56




Figure

4.1 Bit Stream to transmitted Signal

4.4.1
More about O
-
QPSK

The O
-
QPSK scheme is characterized by the fact that the information carried by the
transmitted wave is contained in the phase. The phase of the carrier

takes one of the four
equally spaced values. Thus the name “Quadrature” Phase shift keying.

4.4.2 Bit Error Rate, Symbol Error Rate and Packet Error Rate.

In a given communication environment, there are many factors that could contribute
to
erroneous tran
smissions [4,
12]. Error rates can be used to characterize
a given
transmission channel [8, 5]
.

4.4.2.1. Bit Error Rate

An integral part
of any communication is the errors associated with it. The average
probability of error is obtained based on the method used for modulation.

57


The probability of error for any O
-
QPSK modulated signal is given by


(4.1)

Where
is the energy transmitted per bit.

And

is the associated noise

The value obtained from the above equation is the Bit Error Rate.

4.4.2.2

Symbol Error Rate

As explained ea
rlier, every 4 bits to be transmitted is converted to 32 bit symbols. The
errors originating on the bit level would be propagated to the symbols as the symbols are
basically composed of bits. Any error occurring in the
chips
is thus reflected on the
symbol
s.

The

probability that a bit is not in error given the BER = B is 1
-
B.

Each symbol consists of 32 bits
; for a 32 bit
chip
sequence is recognized accurately at the
receiver, the maximum
number of errors

that can be tolerated is given by

maximum
hamming distance between any two sequences, say,
‘d’
.



58


The probability that no errors occur in a symbol could be thus given as a function of the
BER,’B’; which would be a summation over the probability that a maximum of d errors
occur, given by


(4.2)

The symbol error rate may be calculated from the Bit Error Rate using the formula


(4.3)

d: Hamming distance to accurately identify a 32 bit sequence.

4.4.2.3

Pac
ket Error Rate

The errors in the symbol are propagated further and reflected as the Packet Error Rate
.
Analysis exists that refer to the occurrence of packet errors in Zigbee due to the
environment in which a Zigbee network is setup [12].

The packet error
rate can be obtained using the symbol error rate using:


(4.4)

N: the number of symbols in a packet.

The packet size is assumed to be 100 bytes and hence the number of symbols would be
200.

59


4.5 RSSI and
Correlation not good indicators of Link cost


4.5.1
RSSI

RSSI when measured at the receiver device need not necessarily be just the measure of
the incoming signal; it in fact seldom is.
RSSI is a combination of both the original signal
and the noise in the environment
such as other wireless devices or even ambient noise.

The source that affects the existing signal the most is the interference due to other
wireless devices or wireless netw
orks that are present

in the vicinity of the Zigbee
devices or the Z
igbee network itself. This makes the SNR low, sometimes so low that the
signal itself becomes insignificant.
Thus the environment in which the Zigbee network
exists can cause variations in

the link quality [4].

There is existing analysis for the scenario in which a Zigbee network and other WLANs

coexist
. This is one of the most commonly encountered situations.

It has been observed that the Z
igbee packets may be corrupted in the presence of

other
WLANs

[12
]

even if the interference power is relatively small.
Thus the RSSI value
would
produce
e
rroneous
Link cost
s
. The link in consideration might not be able to
transmit the packets efficiently because of the interference, yet it would be consi
dered as
a good link if the RSSI is within an expected range.



60


4.5.2
Correlation

Correlation is the proximity

betwe
en the received symbol and the perceived

sent symbol
.
This value makes sense only if perceived sent symbol is same as the actual

sent
symbol
.

Correlation value makes sense if closest valid sequence (to the received sequence) is
same as the sent sequence
.
If channel is
of
good quality!!

Correlation value is
meaningless for bad quality channel
.

T
he distance between any two of the 16 symbols is uniform; say this has a value of ‘h’.
This value
is
nothing but the number of bits
those are

same in both the symbols. Errors in
the individual bits would thus reflect on the hamming distance calculation. A
maximum
of h/2 errors can be tolerated. If more than h/2 errors occur, the sy
mbol can be assumed
as a wrong “
actual” signal giving rise to an error.

Thus in summary both RSSI and Correlation
value are not good indicators of the link cost
for the following
reasons



They ignore MAC level packet losses



IEEE 802.15.4 has great in
-
built tolerance for deterioration in physical channel
quality.



We need to know when and how frequently channel quality becomes too bad



RSSI/Correlation value does not tell us when chan
nel quality is too bad
.


61


Chapter 5

Mathematical Analysis and Graphical Results

5.1. Hamming Distance

The hamming distance

[17,

Chapter 7: Digital Modulation Techniques
]

between any two
chip sequences is plotted below based on the values given in the table
4.1. The maximum
hamming distance between any two sequences is found to be 6. This limits the maximum
bit errors in a given sequence to 6.


Figure 5.1: Hamming distance between any two chip sequences.

0
5
10
15
20
25
0
5
10
15
20
Hamming distance different sequences and an individual
sequence

Individual sequences