Context Routing in Wireless Sensor Networks

spleenabackNetworking and Communications

Jul 18, 2012 (5 years and 29 days ago)

655 views


1
Master Project
Context Routing in
Wireless Sensor Networks
of
Arturas Lukosius
Matriculation Number: 1966797
Bremen, November 7, 2006
Communication Networks
University of Bremen
Prof. Dr. rer. nat. habil. C. Görg
Supervised by:
Prof. Dr. rer. nat. habil. C. Gö
rg
Dipl.-Ing. Bernd-Ludwig Wenning
Table of Contents
1
Introduction
..........................................................................................................
3
1.1
Routing types in Sensor Networks
..............................................................
3
1.2
Routing challenges
......................................................................................
4
2
Context Awareness
..............................................................................................
6
2.1
Context attributes
........................................................................................
6
2.2
Utilization function and adaptive routing
...................................................
8
2.3
Routing Protocols
........................................................................................
9
3
Surge Application
..............................................................................................
12
3.1
TinyOS
......................................................................................................
12
3.2
The Surge application
...............................................................................
12
3.3
Surge for Telos motes
...............................................................................
16
4
TOSSIM Simulator
............................................................................................
19
4.1
Introduction
...............................................................................................
19
4.2
TOSSIM Radio Model
..............................................................................
20
4.3
Set-Locations and Power-Profiling Plug-ins
.............................................
21
5
Radio Propagation Modeling
.............................................................................
23
5.1
Introduction
...............................................................................................
23
5.2
Procedure
...................................................................................................
23
5.3
Final Topology Results
.............................................................................
29
6
Results and Conclusions
....................................................................................
33
7
Illustration Index
................................................................................................
34
8
Bibliography
......................................................................................................
35

2
1
Introduction
Nowadays wireless communication becomes more and more popular. A large variety

tending from Wireless Personal Area Networks (WPAN) to Wireless Regional Area

Networks (WRAN) and Satellite Communications allows to build any specialized or

general purpose network.
Wireless sensor network (WSN) is a small device network which consists of spatially

distributed autonomous devices using sensors to cooperatively monitor physical or

environmental conditions, such as temperature, sound, vibration, pressure, motion or

pollutants, at different locations [1]. WSN belongs to the WPAN type. Here, personal

means short range communication. Every device in the network is called a sensor node.

It includes processing unit (micro controller), radio unit (low-power transceiver),

sensing unit (board with sensors).
The main requirements for WNS are low power consumption, long network lifetime,

low data rates, in-network stability, mobility tolerance, scalability, etc.
Nodes are ad-hoc interconnected but must handle large scalability. Main WSN

limitations are battery capacity, bandwidth and computing power. Hence, routing

techniques [2] must be applied to provide long-range and large-scale communication in

WSNs.
Routing in ad-hoc networks selects the optimal path to send a message from a source to

a sink. Optimal path does not always refer to an optimal routing in WSNs. To extend

maximum network lifetime, the context information must be considered as most

important feature (for example, energy awareness [5]). Here, we step into context

routing analysis of WSN. Context awareness answers computational power questions

about WSN requirements and limitations.
1.1
Routing types in Sensor Networks
The are three main routing types [2, 3] (see Figure 1):

flat network routing,

hierarchical network routing,

location-based routing.
In flat network routing (a), nodes communicate in an ad-hoc way and they reach the

base station (BS) by multi-hop routing. If a far node tries to reach the sink it needs to

find an optimal or efficient (context routing) path. Data is centralized at the BS.
In hierarchical networks (b), nodes cannot communicate directly. They are all

controlled by a local base station called cluster head (CH). Large networks can be

divided into clusters and interconnect through CH. Routes are defined by CHs. This is a

managed infrastructure.
Location based routes (c) are set by node locations. The space is divided into quadrants.

Each node knows its position in space (e.g., GPS). Routing type – geographical.

3
1.2
Routing challenges
Routing algorithms must overcome some requirements called routing challenges [2].

The main tasks are:

energy consumption,

node deployment,

data reporting method,

sensor/link heterogeneity,

fault tolerance,

scalability,

mobility,

quality of service (QoS).
Wireless sensor networks consist of a huge number of sensor nodes. Mainly all them are

battery powered. Routing algorithms should always be power aware because sensor

network lifetime is equal sensor node lifetime, i.e. when first node in a network dies,

network is considered as dead.
Manual node deployment is difficult when number of nodes increases noticeably but

again it has predefined paths. Random deployment is less costly, nodes form ad-hoc


4
Fig.
1
:
Routing topologies. Flat (a), hierarchical (b) and location-based (c)
CH
CH1
CH2
CL3
BS
(c)
(b)
(a)
infrastructure (complex routing algorithms).
Data reporting method can be variable. Time, event, query, hybrid driven reporting is

possible. In sensor networks, sensor nodes can operate as nodes, cluster heads, base

stations, etc. It means sensor node must be heterogeneous (different routing techniques).

Interference, power lack, error, physical damage always threatens sensor nodes. Fault

tolerance must always be taken into account. Scalability is variable number of active

nodes in a network. High number of active nodes can cause infinite queues (context

awareness necessary). Mobility tolerance in target detection and tracking, adaptive

routing techniques is needed. Quality of services requires limited delays. All these

challenges place routing on the sharp edge. The requirements summary points to

context aware routing – advanced routing in sensor networks.

5
2
Context Awareness
One of the main tasks in WSN is to extend network lifetime. Routing searches for the

best path to send a message from a source to a sink. The best path in context of power

and energy consumption often is not generally the best. We need to acquire context of

the current environment and to adapt behavior of a sensor node. This then leads to

efficient routing.
“Context is any information that can be used to characterize the situation of an entity.

An entity is a person, place, or object that is considered relevant to the interaction

between a user and an application, including the user and applications themselves” [4].

This a formal definition of context. In WSN it is referred to interacting objects such as

sensor nodes.
We can divide context into two groups: infrastructure and domain context.

Infrastructure context cares about information surrounding the sensor node, e.g.

bandwidth, reliability, signal strength. In Figure 2, it can be seen field of sensor nodes.

One of them intends to send a message to a sink (red) using multi-hop route. The node

must have beneficial signal strength in order to communicate efficiently. Domain

context deals with relations between sensor nodes, e.g. what is the next sink in network.

In Figure 2, the lower sensor node with circle is broadcasting information about itself.

Spanning tree is formed considering efficient routes.
2.1
Context attributes
Context awareness is a process where context information is treated with evaluation

feature called context attribute. Context can be divided into these groups of awareness:

power/energy [5],

mobility [6, 7],

information [8],

privacy [9],

quality of service (QoS) [10].

6
Fig.
2
:
Context types
We can apply one or several attributes from same or different groups. For example,

when mobility of sensor nodes is considered appropriate attributes should be used in

analysis as well.
Power/energy attributes group exploits energy resource context information such as

battery level, bandwidth, transmission cost, connectivity. These are basic attributes.

Some are used in classical routing algorithms not considered as context information.

For example, relying on signal strength or link quality which is kind of transmission

cost. In Figure 3 yellow sensor node indicates battery level attribute as low. Possibly

battery will be depleted faster and it will lead to loss of information.
Mobility attributes group includes relative mobility and collocation with sink context

information. This leads to adaptive algorithms. Suppose two sensor nodes are mobile

platforms and move in space. It is possible to exploit information about node

collocation with sinks and predict possibility of setting the path which is impossible at

that moment but will be available in the future. It means that we exploit mobile node as

virtual path to the sink or continuation of real path. In Figure 3, it is shown the mobility

scenario. Source node with relative mobility has three neighbors in the coverage zone.

Two of them are incapable to participate in routing and indicate it with appropriate

attributes (low power and buffer full). Third with high mobility is chosen as predictive

to be in the field of sink after time period.
Information attribute group contains attributes related to data context. Maximum

information gain, data aggregation, data compression are main attributes of this group.

For example, sensor node must route 10 messages with temperature data from other 5

sensor nodes. Applying one of the attributes we group, compress, aggregate incoming

data and reduce transfer rates.
Privacy group is aware of routing security. Data encryption, cloaking, authentication,

access rights are major attributes of privacy awareness. For example, someone tries to

hack on WSN. Cluster head or even sensor node requires authentication and appropriate

access rights. Prevent network sniffing: sensor node encrypts data knowing it is in an

unsafe environment (radio signal propagates outside the building).
Last group indicates quality of service attributes. Energy reservation, limited delays,

service rate attributes ensures required quality of service. For example, some sensor

nodes carry critical sensing information (shock detectors, fire sensors). QoS must be

high for these nodes.

7
Fig.
3
:
Context awareness
2.2
Utilization function and adaptive routing
In previous section context awareness was defined. Evaluation of attributes is necessary

in order to have significance-based evaluation of context-aware information. Adaptive

routing prediction theory [7] identifies future values of context information and we get

more realistic values. Suppose, sensor network is given and account several context

information attributes are taken into account.
Attributes are grouped into so called set of attributes:
X
i
=

X
1
,
X
2
,
...
,
X
n

(2.1)
Delivery probability (utilization function) to neighbor nodes is defined as function of

set of attributes:
U
i
=
U

x
1
,
x
2
,
...
,
x
n

(2.2)
Utilization function contains all probabilities of jumping to a neighbor node according

to applied context. It is necessary to choose the best neighbor, i.e. neighbor node with

maximum utilization. The goal function defines the next node in a route
Maximize
{
f

U

x
i


}
=

i
=
1
n
w
i
U

x
i

(2.3)
where
w
i
- significance weight.
Significance weights are fixed. Hence we have static analysis. No adaptivity is defined

here.
In order to have adaptive prediction we introduce adaptive weights
a
i

x
i


w
i
related

to a variation of context. Now we set adaptive goal function
Maximize
{
f

U

x
i


}
=

i
=
1
n
a
i

x
i

w
i
U

x
i


(2.4)
Adaptive weights are defined as follows
a
i

x
i

=
a
range
i

x
i


a
pred
i

x
i


a
avail
i

x
i


(2.5)
Criticality of certain ranges of values
a
range
i

x
i

is considered as acceptable region of

sensor values (confidence interval). Predictability of context information is
a
pred
i

x
i

.

Availability of context information
a
avail
i

x
i

indicates whether the attribute is

available (e.g., battery powered = 1, mains powered = 0).

8
Fig.
4
:
Predictive routing
Other prediction techniques like autocorrelation of data, Kalman filtering can be applied

in routing analysis of WSN.
As an example see Figure 4. WSN is deployed on the field and source sensor node

initiates transmission to the sink node. Using static prediction node calculates

probabilities of jumping to the neighbor nodes using goal function and jumps to a node

with biggest probability. Then route nodes repeat this procedure until sink is reached.

Probability 1.0 means that node is next to a sink and jumping to a sink is always 1.0.
2.3
Routing Protocols
Routing protocols [3] are specific routing algorithms with properties. In previous

chapter we defined different routing topology classes: flat, hierarchical and location-
based. Some of them are shown in Table 1. In this table we describe each routing

protocol with some operational features in power, mobility, position, negotiation and

information aspects. These aspects can be accepted as context measure. If context

attribute is included into the protocol, this protocol is context-aware.
First on the table is given Sensor Protocol for Information via Negotiation (SPIN) [2,

3]. In belongs to the flat routing type. Sensor nodes disseminate information from node

to node and each node is a potential base station (BS). This allows fast query of data

from any sensor node. Suppose in the region number of nodes can have similar data

which is not necessary to transmit. Nodes instead use such called meta-data to identify

main data to be sent. Hence only advertisement of data is sent over the network and can

be requested by BS. This allows less redundancy. Queries can be time driven.

Advertisement and request are repeated in some periods of time. Also a BS can initiate

a transmission. SPIN is adaptive routing protocol as it can adapt energy consumption by

remaining energy level indicators (energy awareness). Classical flooding of sensor data

from overlapping areas cause redundancy which is called implosion and energy

wasting.
SPIN family includes lot of protocols. The main versions are SPIN-1 and SPIN-2.

SPIN-1 is a three step protocol using three types of sensor messages: data advertisement

of new data (ADV), data request (REQ) and transmission of requested data (DATA).

The procedure is shown in Figure 5. A sensor node advertises new data by ADV packet

to BS. BS indicates data as important and sends data request REQ. Then BS advertises


9
Table
1
:
Routing protocols [2]
Class
Power usage
Mobility
Position
Negotiation
Information
SPIN
Flat
Ltd.
Possible
No
Yes
Yes
Flat
Ltd.
Ltd.
No
Yes
Yes
GBR
Flat
N/A
Ltd.
No
No
Yes
LEACH
Hierarchical
Max.
Fixed BS
No
Yes
Yes
TTDD
Hierarchical
Ltd.
Yes
Yes
No
No
GEAR
Location
Ltd.
Ltd.
No
No
No
GOAFR
Location
N/A
No
No
No
No
SPEED
N/A
No
No
No
No
Directed
Diffusion
QoS
new data to all surrounding nodes by ADV. Again advertised data contains important

information and is requested by all (not necessary) neighbor nodes and data

transmission is initiated (DATA). SPIN-2 is same as SPIN-1 except energy threshold is

included. Node indicates its participation in conversation if personal energy level is not

lower than low energy threshold. It participates only in case when all three steps ADV,

REQ and DATA7 energy consumption will not decrease below energy threshold.
SPIN protocol allows mobility as neighbor nodes make local decisions and adapt

behavior to current context information. Advantages of SPIN protocol are energy

saving, possible mobility, no implosion because data redundancy is eliminated in
query-driven fashion. Data from overlapping areas are processed by negotiation. Main

disadvantage of SPIN is that this algorithm has no guarantee of data delivery.
Directed diffusion routing protocol also belongs to the flat routing type. It has similar

context properties as SPIN. Only elimination of redundancy is made by data

aggregation. Similar data is grouped (in-network aggregation) that minimizes the

amount of transmitted messages. Directed diffusion is application-aware protocol. BS

indicates interest of data and nodes make gradient of information. Interest diffuses hop-
by-hop in a network and is sent back when interest coincides with available data.

Gradient strength can be different in different sectors of sensor nodes. Different from

SPIN data communication is done node by node where each node has capability to

perform data aggregation. Hence there is no necessity to make spanning tree of routing

paths. This could be problematic in environment monitoring as it requires continuous

transmission to BS.
Gradient Based Routing (GBR) protocol [2] is similar to directed diffusion except

number of hops from BS is memorized as interest propagates. Then packet is sent to the

link with less number of hops (largest gradient).
In hierarchical routing we can expose sensor nodes with largest energy as cluster heads.

They act as routers of information between clusters and inside a cluster. Cluster head

performs data aggregation, multi-hop routing, channel allocation, etc. Hierarchical

routing protocols are energy efficient protocols in sensor networks where energy

consumption of sensor nodes is not uniform. Low Energy Adaptive Clustering

Hierarchy (LEACH) and Two-Tier Data Dissemination (TTDD) protocols belong to


10
Fig.
5
:
SPIN algorithm
this type of routing. LEACH uses CH to control cluster operation and CH is fixed and

switched to other sensor node when power dissipates. TTDD base stations can be

mobile and data is delivered between BS. Sensor nodes are assumed to be stationary

and location-aware.
Location based routing exploits node locations. Distance between neighbors is

estimated by received signal strength (RSSI). Information about node location is

exchanged. Geographic and Energy Aware Routing (GEAR) routing uses similar

functionality as directed diffusion only diffusion gradient is limited according to routing

zones specified by node locations. Interest can be sent only into regions that are needed.

Mostly all location based routing algorithms exploit location data and other context

attributes are not used.
One of the routing protocols not listed in the Table 1 is Sensor Context Aware Routing

(SCAR) protocol, which exploits movement and resource prediction techniques to

smartly forward data towards the right direction at any point in time [6]. SCAR uses

probabilistic approach (prediction theory) explained in Section 2.2. This approach also

can be named as adaptive routing. Mobile neighbor nodes can be the best carriers to

forward information to the sink. We predict probability of jumping to one of these

mobile neighbors. Nodes exchange mobility, collocation with sinks, battery level, rate

of connectivity. All these context attributes are set into goal function. Nodes calculate

probability of data delivery and exchange this information. Multiple neighbor nodes can

be chosen as carriers. Source node sets up a list of neighbor with decreasing order

according the probability of delivery (jumping). Replica is sent to the node with highest

probability (see Figure 4). Messages from neighbors are buffered. Choise of best carrier

is done with the best neighbor to reach the sink. Context information is exchanged

between nodes (node ID, probability of delivery, available slots in a buffer).
SCAR algorithm is deterministic and probabilistic routing protocol. Exploiting context

information it is one of the advanced algorithms for WSN.

11
3
Surge Application
3.1
TinyOS
TinyOS is an event based operating environment designed for use with WSN [3]. It is

capable to simulate a sensor network in complex conditions and analyze not only a

single node behavior but interaction between multiple nodes in WSN. It is difficult to

deploy a large network and avoid hardware failures in a real situation. Simulation can

be repeated, debugged, analyzed on the bit and packet levels. It is fully controllable and

the environment can be changed easily without redeploying thousands of nodes.
TinyOS CVS include dozens of sample applications and development state

contributions. Applications are programmed in the NesC programming language

(modified C) . TinyOS is specialized for embedded platforms. Embedded system

consists of a radio module (e.g., Chipcon CC2420, Atmel AT86RF230, etc.), a micro-
controller (TI MSP430, Atmel Atmega128, etc.) and a sensor board including

temperature, humidity, light, IR, image, acceleration, etc. sensors. TinyOS software

includes hardware control, a radio stack, networking and interfacing procedure flows.

User applications can be easily developed by integrating existing modules. The second

part of TinyOS software provides Java applications for simulation, testing, control and

debugging of real operating motes or simulated applications.
Simulations of the written applications in TinyOS can be driven with TOSSIM

simulation tool. It is a discrete-event simulator described in the next chapter.
TinyOS application Surge is used in this work. It includes basic routing algorithms and

will be used for simulation by radio propagation model described in Chapter 5.
3.2
The Surge application
In TinyOS, two basic routing algorithms are broadcasting (Bcast) and multiple hops

routing (MultiHopRouter). Surge is a basic TinyOS application for multi-hop routing. It

includes both routing algorithms in the program structure (see Figure 6). Program

structure contains modules (M), configuration (C) and interfaces (I).
Bcast is a flooding protocol. BS floods "commands" to all the nodes, such as to sleep,

wakeup or set the interval for how often sensors are read. Bcast is controlled by the

SurgeM module. MultiHopRouter – transfers packets from any sensor to the BS. It

forms a dynamic spanning tree. The spanning tree contains paths which have the least

number of hops over "reliable" links. Reliable means the best link quality with one of

the neighbor nodes. Every 10 secs, spanning tree is refreshed again by Bcast and

MultiHopRouter. All nodes are then detected in a network. Every single node tends to

send a message to a root node (BS). It takes readings and sends or routes received

reading up the tree. Every node memorizes the network address of its parent in the tree

and also the depth. Address and depth are specified from received messages.

12
SurgeM (see Figure 7) initializes reading from A/D converter (ADC) Photo sensor data.

It receives broadcast information (Bcast.receive( ) ) and controls MultiHopRouter

which contains the spanning tree and provides the interface to control the Comm

transmitter part. Messages are sent over Comm. The Comm structure (see Figure 8)

includes the Active Message (AM) format standard interface (AMPromiscouous). This

module transmits and receives active messages from other motes, CRC failure check

(RadioCRCPacket) and UART control. In a real setup, a root node with network

address 0x00 is connected to a serial port or virtual serial port (via USB) of a PC. Data

is imported through the UART interface. It is possible to inject AM control messages

into the sensor network from a PC.

13
Fig.
7
:
SurgeM module structure
Fig.
6
:
Surge program structure
Queuing of messages is used (queue length = 32 by default) when the sensor node is not

able to send a message or failed messages are waiting for retransmission. The queue

buffer has circular structure. Retransmission is attempted to be repeated several times (5

times by default), then the message is purged. If a queue overflow takes place, packets

are dropped. This can cause loss of information during network bursts.
The AMPromiscuous interface provides AM control by a specified AM address. It can

send packets by a radio interface (RadioPacket) or to the UART. The default WSN

active message AM group address is 0x7d (dec 125). The Surge AM message address is

0x11 (dec 17). When a packet is received, an acknowledgment ACK or NAK active

message AM is sent. If a NAK is often corrupted, it causes queue overflow. The

RadioPacket component controls the radio transceiver (in our case Chipcon CC2420).

The CommControl component checks CRC and gives information to AMPromiscuous.
HPLPowerManagementM module controls the transceiver power. It is possible to

enable/disable power management and adjust power (set new value).
An example for the Surge application routing algorithm is shown in Figure 9. The BS

initiates broadcasting (a) to AM address = 0xFF and all senors memorize the parent

address and depth. Then messages are routed to the BS (b). Multi-hop route active

message address is AM = 0xFA (dec 250). If message is send initially not routing, AM

= 0x11 (dec 17).

14
Fig.
8
:
GenericCommPromiscuous component structure
Fig.
9
:
Basic routing types in TinyOS (Surge). Broadcasting (a), multi-hop (b)
(a)
(b)
Running the Surge application in the simulated TinyOS environment is started from

command line
Running the code above runs a Surge simulation with 5 sensor nodes, compiled for the

PC environment. The debugging is filtered only for routing messages. The extracted

part of debug data from node 2 looks like
addr
– address (ID),
prnt
– parent,
misd
– missed packets,
rcvd
– received packets,
lstS
– last sequence no.,
hop
– hop count (255 if not existing link),
rEst
– receiving estimation factor (255 is best),
sEst
– sending estimation factor (255 is best).
We can notice that node 2 can communicate with nodes 3, 4 and root 0. Sending

message estimate factor (2 -> 0) is only 25 comparing to 255 of nodes 3 and 4. Cost is

too large sending message directly to root 0. Then nodes 3 and 4 are suitable, while

route to node 1 is not valid (hop = 255). Hop count is 1 for nodes 3 and 4, therefore we

can choose arbitrary one of them as send estimate factor is 255 for both.
The sensor network topology can be viewed with a specialized Java tool. It

communicates through the UART, hence we need to forward packets from the

application to the Java topology viewer using another Java application called

SerialForwarder. The topology viewer shows an interaction between sensor nodes:


15
routing paths, message count, link yield (quality). The sequence of running this

simulation (assumed that Surge is running, see code above) is shown in the following

lines:
After running with the AM debug filter, information about all active messages is

received. Address and AM message type are specified at the beginning of the AM

message. The broadcast address is equal to 0xFFFF. A fraction example from AM

debug mode { $export DBG=am }:
3.3
Surge for Telos motes
Another TinyOS application practically identical to Surge is written and tested only

with Motiv company's Telos motes. SurgeTelos has the same structure but two main

routing components are changed. The program structure is specified in Figure 10. This

application uses the Chipcon C2420 radio stack, hence we can simulate the full radio

protocol stack of this model on the packet level. Simulation is faster than classical

Surge. The Bcast and MultiHopRouter components are changed by the CC2420RadioC

stack implementation and multi-hop router with the LQI (Link Quality Indication)

value – LQIMultiHopRouter. As in Surge, nodes set spanning trees routing packets to

root node 0, parent address and in-network depth are obtained by sniffing

(eavesdropping). The best parent is chosen by lowest depth and best LQI. Nodes select

new parents if LQI drops below the desired threshold. AM acknowledgments ensure


16
reliability. The CC2420RadioC performs all radio communication steps. It includes:

MAC control (ACK on/off),

back-off,

FIFO buffer,

CC2420 RAM control,

transceiver control:

read frequency,

read power,

set power,

auto ACK,

short address,

address decoding,

etc.
The SurgeTelos application can be compiled with the energy model PowerTOSSIM.

PowerTOSSIM is a beta product in the TinyOS source. If an application is compiled

with this model, we can analyze application power consumption and use additional

plug-ins in TOSSIM which are described in Section 4.3. Compilation with

PowerTOSSIM:
After the simulation with TOSSIM with additional Set-Locations plug-in, node


17
Fig.
10
:
Surge for Telos motes program structure
communication is location dependent. Routes are set by LQI values calculated from the

distance between every two nodes, see Figure 11.
It can be noticed that nodes 4, 7 and 8 route messages through the node 5. In order to

have a simulation with a real world conditions, it is necessary to specify an

environmental model. The radio propagation modeling is described in Chapter 5. The

SurgeTelos application caused undefined errors in the Java topology tool and TOSSIM,

hence the Surge is used for testing and simulation purposes.
Detailed explanations of application development in TinyOS, description of basic

models and sample programs, interaction and control of WSN, mote programming and

code explanations are provided in the TinyOS tutorial [11].

18
Fig.
11
:
SurgeTelos application with TOSSIM Set-Locations plug-in
4
TOSSIM Simulator
4.1
Introduction
We have introduced TinyOS and the sample application Surge. Presented simulation

results were obtained using the TinyOS TOSSIM simulator. So what is TOSSIM?
TOSSIM is a TinyOS discrete-event simulator [12]. It is a tool to analyze the behavior

of large-scale sensor networks. The TOSSIM architecture is shown in Figure 12. It

includes compilation of applications for the simulation environment, a discrete event

queue, hardware implementations, an extensible radio model, communication services.

Different component graphs allow running a simulation of multiple nodes. A

simulation runs the same code as real motes. Key Requirements for TOSSIM are

scalability, completeness, fidelity and bridging. The Java application TinyViz is a

graphical user interface (GUI) for the simulator. It provides detailed visualization and

control and plenty of plug-ins. In TOSSIM implemented simulation methods are

selective debugging where filtering of required debug data (DBG flags) can be done and

TOSSIM radio model, which uses bit error probabilities for link communication (BER

tables). The LossyBuilder tool can generate these tables by given topologies but not

based on the environment. Hardware emulation components are: ADC, clock, raw radio

stack. User can interactively extend TOSSIM by writing own plug-ins. For example, in

this work a multi-wall radio propagation model is able to generate BER tables for

TOSSIM simulator input.

19
Fig.
12
:
TOSSIM architecture [12]
4.2
TOSSIM Radio Model
The TOSSIM provides an empirical radio model. It uses an abstraction of the

independent of each other bit error rates (BER). All nodes have a link bit error

probability. The link between two nodes is asymmetric. That means that
P
b

a
,
b


P
b

b
,
a

(4.1)
The BER is simulated in a random way considering scaling a distance between two

nodes. The distance is not real because the environment is not exploited. Simulation of

an application in lossy mode allows BER data input. A certain BER data file can be

specified as input for the lossy TOSSIM empirical radio model. In a simple model, all

nodes can hear each other. In the lossy model, BER data provides information about

pairs of nodes, where link BER are asymmetric as explained earlier.
Simulation in TOSSIM in lossy mode with BER data file can be initiated by
The BER data file consists of
We can map these BER from the desired radio model. One of the possible ways is

described in Chapter 5.
TOSSIM's empirical radio model has two operational modes. The GUI panel is shown


20
Fig.
13
:
TOSSIM radio model control panel (TinyViz)
in Figure 13. First mode operates as lossy empirical mode with communication links

dependent on distance between nodes. See Figure 14. In this case, the routing protocol

can select parents in spanning tree according to link quality (LQI) or received signal

strength indication (RSSI), or randomly scaled BER from empirical model. In this

figure, link quality is indicated by color and value between 0..100. It can be noticed that

values are random and are not linearly dependent on the distance. The second type of

mode is a simple fixed radius model with limited node coverage. As an example, this

situation is shown in Figure 15. Nodes are limited with radius 10.0. If a neighbor node

is inside this circle, then the communication link is ideal (BER = 0.0). Simulating Surge

application, the routing tree should contain a route with least hops to root node 0. In

case with 2 different routes with equal weight, the node choses the right path randomly.
Running TOSSIM from command line works as follows:
4.3
Set-Locations and Power-Profiling Plug-ins
TOSSIM includes additional functionality provided by plug-ins. SurgeTelos

compilation including the PowerTOSSIM energy model allows enabling the two

additional plug-ins Set-Locations and Power-Profiling. By default, while simulating


21
Fig.
14
:
TOSSIM empirical radio model (example)
sample applications, Radio-links, Debugging, Radio-messages, Radio-model and

Breakpoints plug-ins can be exploited.
Compiling application with the option
sim,telosb
, the old AVR radio stack CC1000

is replaced by the Chipcon CC2420.
CC2420 provides LQI and RSSI readings to the

transmission packet. Simulator generates LQI, RSSI (X, Y) values dependent on node

location. Packet loss probabilities (X, Y) now are mapped to these values. The Set

Locations plug-in allows dynamic models in TinyViz. The positions of motes can be

freely changed during runtime. LQI and RSSI dynamically update depending on mote

location (X, Y). Important fact is that the static model with constant loss probabilities

was used before. The Power Profiling plug-in exploits PowerTOSSIM. It can extend

used model with the power calculation property. Tracking of the power state (CPU,

Radio, LEDs, Sensors, ADC, etc.) and summing up is done on every node. Power

directed analysis now can be performed by the TOSSIM simulation. As example of

power profiled simulation is shown in Figure 16. We can notice that node 3 is routing 3

messages from nodes 1, 2 and 4. Power consumption by node 3 theoretically should be

largest. In our case, it is minimal which it is not correct. all nodes can hear each other in

this TOSSIM radio model and decision is made only by BER. That is why the radio

power consumption is almost equal with small variance. But according to the power

consumption by LEDs, it can be noticed that the node 3 is the most busy node in

network. The routing protocol must be tuned to include this remark.

22
Fig.
16
:
TOSSIM Power profiling plug-in
Fig.
15
:
TOSSIM fixed-radius (10.0) radio

model (example)
5
Radio Propagation Modeling
5.1
Introduction
There are two types of node deployment in WSN. It is possible to measure the signal

strength walking around in an environment or to use a software model for planning the

radio propagation using environmental data. The last one is the more efficient way.

Indoor propagation modeling requires a detailed description of the environment. Wall

thickness, material, doors, windows, openings, furniture, etc. must be taken into

account. Physical propagation properties like reflection, diffraction, free space and

material attenuation provide realest modeling. There are two types of indoor

propagation models: deterministic and empirical. Deterministic models are most

accurate and closest to real environment with accurate physical propagation properties.

Empirical models are simplified, less costly and accurate enough.
In this chapter we will analyze an indoor [13] multi-wall, semi-empirical radio

propagation model based on a building plan. We will only consider the wall attenuation

and free space path-loss, one type of wall attenuation factor but different thickness is

possible. Reflection, diffraction and ground-floor is not modeled. The main purpose of

radio propagation modeling in our project is to generate the Bit Error Rate data file to

be used in TinyOS with the TOSSIM simulator. The used development platform for

building a radio model is MATLAB programming language.
An example of coverage prediction by deterministic modeling [14] can be seen in

Figure 17.
We can notice that signal is mostly attenuated by walls and propagates far in

the corridor.
5.2
Procedure

23
Fig.
17
:
Coverage prediction by deterministic model [14]
The procedure of our modeling consists of some steps:

input data entry,

control data setup,

deployment of nodes in the modeling environment,

path-loss calculation,

RSSI calculation and BER mapping.
Input data stands for environmental information like a building plan or manual setup.

Building plan can be simplified (uniform walls, no door/window information) or

detailed. Wall attenuation can be uniform or varying. If it is planned to be changed then

it is grouped with the control data. In our project we use a simplified building plan of

NW1 (Figure 18). Here, internal walls are uniform and thickness is considered. The

picture resolution describes the number of points used. For simulation of the real

environment, scaling of the picture size is necessary. Here, e.g., scaling is ~7.03

(symmetric).

24
Fig.
18
:
Building plan of NW1, 2nd floor (Uni-Bremen). Scaling = ~7.03
Control data includes transceiver information: transmitter/receiver gains, power,

frequency, antenna gain, antenna-cable loss. These parameters are tunable and can be

taken from the transceiver manual. An example is shown in Figure 19. Receiver

sensitivity and transmitter power are important parameters on which communication is

mainly dependent. The Received Signal Strength can be increased gaining some power

from a techniques like Spread Spectrum, external Antenna, etc. Wall attenuation factor
L
w
(measured in dB) defines 1x element of normal concrete wall. In this model the

internal wall is 2x thick. Exact values of wall attenuation can be obtained by

experiments. For simplification
L
w
=
3.0
dB
is used.
After the initialization is done, deployment of nodes comes as next step. The command

ginput
is used to set points on the map. The left mouse button picks points, the right

button picks the last point. Data is written to
xy
matrix. A topology map file

deploy.mps
is generated as well. It is used to import initial node locations in

TOSSIM. An example of node deployment in Matlab is shown in Figure 20.
When the distance between base station and receiver increases, the signal strength

decreases. The phenomenon is called path-loss. In free space, a radio signal propagates

with attenuation and if there exist no objects on the way, attenuation is gained. Formula

for calculation of path-loss in multi-wall environment is
L

d

=
L
0

10n

log

d



i
=
1
N
k
wi

L
wi
, where

(5.1)
L
0
– reference loss at 1m (dB),
n
– power decay factor,
d
– distance (m),
k
w
– number of walls of type i,
L
w
– wall attenuation factor (dB).

25
Fig.
19
:
Transceiver parameters (example)
The first part of the equation is the free space path-loss. It is the same as the One-Slope

prediction model,
n
=
2.0
. The second part represents wall part.
L
w
are statistical

not physically obtained. It means if the receiver is hidden behind a metal wall with

limited dimensions, the prediction cannot result in an infinite attenuation, even though

metal itself can be considered as a total reflector of the electromagnetic energy [14].
In Figure 21, the free space path-loss dependence on the distance is shown. The

attenuation reaches its major in the first decades. When there is a wall on a way, we

would notice a steep rise of a curve in some dB.
Calculation of path-loss in a multi-wall propagation model includes walls on the direct

way between two sensor nodes placed in a distance apart. Image processing on the

building plan after node deployment starts now. The iterative path-loss calculation

algorithm procedure include such steps as: distance calculation between sensor nodes,

finding how many walls and how thick they are on a way (vertical and horizontal

projection), calculation of path-loss and mapping to BER.

26
Fig.
20
:
Deployment of sensor nodes
First the Euclidean distance between sensor nodes directly from the
xy
matrix is

calculated:
In building plan, the line between nodes is drawn, then conjugate it with the original

image and what is left is the intersection with walls.
From here horizontal and vertical projections of intersection points on the image (see

Figure 22) is taken. In this example there are 3 walls between node 0 and node 1. From

the figure, it is noticed that 3 walls in V and H projections exist with weight factor

matrix
L
w
=
[
2
2
2
]

3.0
dB
.
Now it is necessary to count the number of walls and the thickness. This is done by

counting the number or peaks in projection matrices. e.g. [0 1 0] means one wall with

1x thick, [0 1 2 2 0] – one wall 5x thick and finally [0 1 0 1 0] – two walls 1x thick

each.

27
Fig.
21
:
Free space path-loss
In case when two nodes are deployed in a line vertically or horizontally data about the

wall number can be lost. That is why the both directions are used. Then the one with

largest number of walls is taken:
When all these steps are done, calculate the total path-loss
L
using the formula given

before. The BER is set equal to zero if it is the same sensor node. It is always true for

the sensor node to hear itself (required by simulator when collecting statistical data).

28
Fig.
22
:
Signal intersection with walls. Horizontal and vertical projections
After path-loss, the Received Signal Strength Indication (RSSI) value is calculated:
RSSI
=
P
Tx

G
Tx

G
Rx

L

d

, where
(5.2)
P
Tx
– transmitter power (dBm),
G
Tx
– transmit gain (dB),
G
Rx
– receive gain (dB),
L

d

– path-loss dependent on distance (dB).
In digital transceivers, RSSI is often referred to a digital value in a range [0..255],

sometimes with limitation to [0..100]. When comparing soft and measurement results,

the digital RSSI value should be mapped according to the transceiver manual.
The Bit Error Rate calculation is the last step in order to get a loss data for TOSSIM.

The BER cal be calculated according to the formula (O-QPSK modulated signal)
P
b
=
1
2

erfc


RSSI
N

,


(5.3)
where
N
– noise.
The noise power should be tuned accordingly. For simplicity use
N
=
1
. The error

function complement determines the BER by signal-to-noise ratio (SNR). Assume that

the signal still can be received if the RSSI level is not lower than receiver sensitivity
S
Rx
, otherwise we evaluate the BER as total loss

RSSI

S
Rx

P
b
=
1.0

(5.4)
The BER and deployment data are exported as ASCII files
5.3
Final Topology Results
The final topology results of the multi-wall radio propagation model are shown in

Figure 23. The blue lines connecting sensor nodes are drawn if the BER threshold is

satisfied. In this case it was equal to 0.25. To equalize with the TOSSIM threshold, a

better value is

Th
BER

0.2

(5.5)
From Figure 23,

it can noticed that in corridors, the signal propagates more farther than

in rooms. When there are no walls on the direct way between two sensor nodes, signal

propagation is assumed as in the One-Slope model.

29
The blue lines are drawn
Now starts the simulation with TOSSIM including the generated BER data file. In

Figure 24, it can be seen the simulation result in Surge topology viewer (Java

application). Nodes are interconnected as expected from the MATLAB simulation.

Simulation results with TOSSIM are comparable with those simulated in TinyOS

operating environment. Radio stack implementation in TOSSIM allows simulation of

applications which run on real motes.

30
Fig.
23
:
Final topology result. Matlab.
Th
BER

0.25
Running the simulation again with
TinyViz
, similar results are acquired (see Figure

25). Motes are communicating in the same way as seen in the previous figure.

31
Fig.
24
:
Final topology result.
Surge
Fig.
25
:
Final topology result.
TinyViz
The simulation is static. To have a different topology, rerun of the Matlab algorithm is

necessary. This is suitable to deploy sensor nodes in an environment and analyze how

they act under applied conditions in TinyOS.

32
6
Results and Conclusions
In this work, introduction to context aware routing, TinyOS and TOSSIM is done. A

multi-wall radio propagation modeling algorithm is written with the purpose to involve

a real environment situation in empirical TOSSIM radio model to have a controllable

wireless sensor network simulation.
Comparing the output results from TOSSIM and MATLAB simulations, is was realized

that the model approximation considered in this work is accurate enough and suitable

for TOSSIM even when our model only considers the wall attenuation, not taking into

account other physical properties. Detailed building plans and multi-wall information

would gain better results.
It was shown that exploiting the infrastructure context information and power

awareness attribute (signal strength), it is possible to model wireless sensor network

behavior under real conditions. Despite the simulation is static, this model can be

applied for the radio planning and analysis of sensor node deployment. It is necessary

to mention that dynamic models are complicated. Adaptive models are more complex

when additional context attributes (like mobility) must be considered.

33
7
Illustration Index
Fig. 1: Routing topologies. Flat (a), hierarchical (b) and location-based (c)
....................
4
Fig. 2: Context types
.........................................................................................................
6
Fig. 3: Context awareness
.................................................................................................
7
Fig. 4: Predictive routing
...................................................................................................
8
Fig. 5: SPIN algorithm
....................................................................................................
10
Fig. 6: Surge program structure
.......................................................................................
13
Fig. 7: SurgeM module structure
.....................................................................................
13
Fig. 8: GenericCommPromiscuous component structure
................................................
14
Fig. 9: Basic routing types in TinyOS (Surge). Broadcasting (a), multi-hop (b)
............
14
Fig. 10: Surge for Telos motes program structure
...........................................................
17
Fig. 11: SurgeTelos application with TOSSIM Set-Locations plug-in
...........................
18
Fig. 12: TOSSIM architecture [12]
.................................................................................
19
Fig. 13: TOSSIM radio model control panel (TinyViz)
..................................................
20
Fig. 14: TOSSIM empirical radio model (example)
.......................................................
21
Fig. 15: TOSSIM fixed-radius (10.0) radio model (example)
........................................
22
Fig. 16: TOSSIM Power profiling plug-in
......................................................................
22
Fig. 17: Coverage prediction by deterministic model [14]
.............................................
23
Fig. 18: Building plan of NW1, 2nd floor (Uni-Bremen). Scaling = ~7.03
....................
24
Fig. 19: Transceiver parameters (example)
.....................................................................
25
Fig. 20: Deployment of sensor nodes
..............................................................................
26
Fig. 21: Free space path-loss
...........................................................................................
27
Fig. 22: Signal intersection with walls. Horizontal and vertical projections
..................
28
Fig. 23: Final topology result. Matlab.
...........................................................................
30
Fig. 24: Final topology result. Surge
...............................................................................
31
Fig. 25: Final topology result. TinyViz
...........................................................................
31

34
8
Bibliography
[1] Römer, Kay, Friedemann Mattern (2004). "
The Design Space of Wireless Sensor

Networks
".
IEEE Wireless Communications

11
(6): 54-61.
[2] Al-Karaki, J. N., and A. E. Kamal. 2004. Routing techniques in wireless sensor

networks: A survey. IEEE Wireless Communications 11 (6, December): 6-28.
[3] K. Akkaya and M. Younis,
"A Survey of Routing Protocols in Wireless Sensor

Networks,
" in
Elsevier Ad Hoc Network Journal,
Vol. 3/3

pp. 325-349, 2005.
[4] Anind K. Dey, Gregory D. Abowd,
“Towards a Better Understanding of Context

and Context-Awareness”
, Submitted to the 1st International Symposium on Handheld

and Ubiquitous Computing (
HUC '99
), June 1999.
[5] Rahul C. Shah, Jan M. Rabaey,
“Energy Aware Routing for Low Energy Ad Hoc

Sensor Networks”
, IEEE Wireless Communications and Networking Conference

(WCNC) March 17-21, 2002, Orlando, FL.
[6] Cecilia Mascolo, Mirco Musolesi,
“SCAR: Context-aware Adaptive Routing in

Delay Tolerant Mobile Sensor Networks”
, In Delay Tolerant Mobile Networks

Symposium of Int. Wireless Communications and Mobile Computing Conference

(IWCMC 2006). Vancouver, Canada. July 2006.
[7] Mirco Musolesi, Stephen Hailes, Cecilia Mascolo,
“Adaptive Routing for

Intermittently Connected Mobile Ad Hoc Networks”
, In Proc. of IEEE International

Symposium on a World of Wireless, Mobile and Multimedia Networks

(WOWMOM05). Taormina, Italy. June 2005.
[8] Juan Liu, Feng Zhao, Dragan Petrovic,
“Information-Directed Routing in Ad Hoc

Sensor Networks”
, IEEE Journal on Selected Areas in Communications, Volume 23,

Issue 4, April 2005, pp:851-861.
[9]
John

P. Walters, Zhengqiang Liang, Weisong Shi, and Vipin Chaudhary,
Wireless

Sensor Networks Security: A Survey
, book chapter of

Security in Distributed, Grid, and

Pervasive Computing, Yang Xiao (Eds.), CRC Press, 2007.


[10] Limin Wang,
“Survey on Sensor Networks”
, 2004.
[11] “TinyOS ver.1.x Documentation”,
http://www.tinyos.net/tinyos-1.x/doc/index.html

35
[12] Philip Levis , Nelson Lee , Matt Welsh , and David Culler,
“TOSSIM: Accurate

and Scalable Simulation of Entire TinyOS Applications”
, in
Proceedings of the First

ACM Conference on Embedded Networked Sensor Systems (SenSys 2003).
[13] RobertAkl, Dinesh Tummala,
“Indoor Propagation Modeling at 2.4 Ghz for IEEE

802.11 networks”.

From Proceeding
(510) Wireless Networks and Emerging

Technologies - 2006
.
[14] Stanislav Zvanovec, Pavel Pechac, Martin Klepal.
“Wireless LAN Networks

Design: Site Survey or Propagation Modeling?”
, 2003.
Exploited tools:
TinyOS operating environment.
http://www.tinyos.net
Cygwin.
http://www.cygwin.com
Eclipse.
http://www.eclipse.org/
TinyOS plug-in for Eclipse.
http://www.dcg.ethz.ch/~rschuler/
MATLAB.
http://www.mathworks.com

36