keywords: wireless sensors networks, routing, algorithm

advertisement
Algorithm For Routing Data Used In Wireless Sensor
Networks
I. Petrescu
M. C. Surugiu
O. V. Barna
Faculty of Engineering in Foreign
Languages, Polytechnic University
of Bucharest
FILS, UPB
Bucharest, Romania
ionelpetrescu@clicknet.ro
Lecturer - Department of Telematics
and Electronics in Transportation,
Polytechnic University of Bucharest,
Faculty of Transportation
UPB
Bucharest, Romania
surugiuclaudia@yahoo.com
Assistant - Department of Telematics
and Electronics in Transportation,
Polytechnic University of Bucharest,
Faculty of Transportation
UPB
Bucharest, Romania
ciobanuoanavasilica@yahoo.com
This technique can be used in wireless sensor networks which do
not have a specific layer or function for routing. It is not
necessary to know all the nodes that make up the route, only the
neighbor node that provides the shortest route, the one that is
delivering the message to the gateway with as few hops as
possible. The algorithm can be easy implemented in the CPU of
each node using C or Assembler programming language.
KEYWORDS: WIRELESS SENSORS NETWORKS, ROUTING, ALGORITHM
I.
INTRODUCTION
Routing is an important issue in wireless sensor networks
(WSNs). The essential function of a WSN is to monitor a
phenomenon in a physical environment, such as industrial
control and monitoring, home automation and consumer
electronics, security and military sensing, asset tracking and
supply chain management, intelligent agriculture, health
monitoring, and report sensed data to a central node called a
sink. All the sensor nodes form a network and collaborate to
perform one or more tasks.
Each node has a transmission range, depending on radio
module and power. When a sensor needs to communicate with
another sensor that is inside its transmission range, the
communication can be single hop (or direct). If a node needs to
communicate with a node which is not in its communication
range it must be multihop (or indirect) via other intermediate
sensors that act as relays between the two communicating
sensors.
The design of routing protocols for WSNs is challenging
because of several network constraints. These constraints are
imposed by the characteristics of individual sensors, the
behavior of a network, the nature of sensor fields and by the
requirements of a sensing application. WSNs suffer from the
limitations of several network resources, for example, energy,
bandwidth, central processing unit (CPU), and storage, where
energy is the most crucial resource because it determines the
lifetime of a sensor. When the energy of a sensor reaches a
certain threshold, the sensor will become faulty and will not be
able to function properly, which will have a major impact on
the network performance.
The algorithms designed for sensors should be as energy
efficient as possible to extend their lifetime, and hence prolong
the network lifetime while guaranteeing good performance
overall. Another challenge that faces the design of routing
protocols is to manage the locations of the sensors.
The architecture of a network can be flat in the sense that
all sensors have the same role. In other words, all sensors
forward their sensed data to the sink without necessarily
passing through a particular node.
The sensors in a network can be grouped into clusters, each
of them is managed by a specific sensor called a cluster head.
The presented routing protocol is a multihop routing
protocol used in flat networks. In flat networks, each node
typically plays the same role and sensor nodes collaborate
together to perform the sensing task. It is some like GradientBased Routing which is a variant of Directed Diffusion, a
popular data aggregation paradigm. The main idea of the
Directed Diffusion paradigm is to combine the data coming
from different sources enroute (in-network aggregation) by
eliminating redundancy, minimizing the number of
transmissions; thus saving network energy and prolonging its
lifetime. The key idea in Gradient-Based Routing is to
memorize the number of hops when the interest is diffused
through the whole network[1-6].
II.
ROUTING TECHNIQUE
The approach presented in this paper can be applied in
small and medium WSNs. It is designed to use as few as
possible resources of the CPU. The principle is that every node
transmits data only to the gateway nodes and optionally, the
gateway sends confirmation message to the sender node. The
approach, combined with a proper radio technique, such as
CSMA-CA (Carrier Sense Multiple Access with Collision
Avoidance),
OFDM
(Orthogonal
Frequency-Division
Multiplexing) or spread spectrum techniques, gives good
results. This technique is inspired from graph theory. We
consider that a single hop communication has a cost of 1 and a
multihop communication has a cost equal with the number of
relay nodes. Each node knows only the neighbor nodes, it do
not know the topology of the network.
confirmation message is sent in response to a broadcast
message.
A. Discovering Routes
It is assumed that:

data from sensor nodes are transmitted to a user or to a
data collector (DC) outside the network,

nodes are distributed randomly,

there are one or more nodes that communicate with the
outside of the network, which will be detected and will
function as gateways,

data from sensors are transmitted to the gateway in the
form of messages and further conveyed outside de
network,

nodes communicate with each other by two types of
messages, those sent by a transmitter node to the
gateway and those returning as a confirmation from the
gateway,

After sending a message to the neighboring node, there
is a receipt service implemented in the used wireless
technology.
This is done in 2 phases:
Phase 1: Setting gateway nodes – those nodes that can
communicate with the outside network (user / data collector).
After deploying the nodes, the user / data collector sends a
message to initialize the communication. The nodes are
receiving this message because the gateway can communicate
with the outside (communicate with data collectors).
Phase 2: Setting routes – after establishing the gateway
nodes, these nodes send once a broadcast message, to discover
the neighbor nodes.. This message is different from the
messages used in data transmission. It is not sent to a specific
destination node, but to any node which is receiving it, being
used to discover neighbor nodes. The format of broadcast
message is shown in the table 1.
TABLE I.
ID_route
ID_node_source
MESSAGE FORMAT
ID_node_dest
cost
info_sup
The fields of the broadcast message are:

ID_route field, which contains the gateway node
identifier,

ID_node_source field is the identifier of the node that
sends the message; any node sending this message will
complete this field with its own ID,

ID_node_dest field is the identifier of the node that
receives the message; for the broadcast message this
field is 0,

cost field contains the number of nodes through which
the message propagates,

info_sup field is reserved for supplementary
informations and default is 0. The value is 1 if a
Identify applicable sponsor/s here. If no sponsors, delete this text box.
(sponsors)
The nodes who receive a broadcast message transmit a
confirmation message to the sender. The message format is
identical to the broadcast message, but the value of
ID_nod_dest field is different from 0 and contains the actual
transmitter node ID.
To establish the routes, we use three types of messages: (1)
the broadcast message – used for discovering neighbors, (2)
confirmation message – used as a reply to a broadcast message,
(3) error message – a confirmation of receipt, with or without
error, to one of the previous two messages.
The format of the error message is shown in table 2.
TABLE II.
FORMAT OF THE ERROR MESSAGE
ID_node_source
ID_node_dest
error_type
The error_type field is 0 if the message was received
without errors and 1 if the message has errors. The number of
bits for each field depends on the number of network nodes.
Each node, except the gateway nodes, records the neighbors
in three lists:

list_ul – contain the IDs of the neighbour nodes with
cost lesser than its own cost,

list_dl – contain the IDs of the neighbour nodes with
cost greater than its own cost,

list_eq – contain the IDs of the neighbour nodes with
cost equal with its own cost,
The gateway node has the smallest cost, always 0, whereas
the most distant node usually has the biggest cost.
B. Operation Description
Phase 1. The gateway node sends the message to determine
routes. The fields ID_route and ID_node_source are filled with
its own ID and the cost field is 0. Routing messages are not
processed by gateway nodes, they only transmit messages to
user / data collector.
Phase 2.
1. The gateways node transmit the broadcast message for
discovering the neighbors. ID_route and ID_node_source fields
are completed with their own ID. ID_node_dest, info_sup and
cost fields are 0.
2. The nodes which receive such a message increment with
1 the cost field and become their own cost, then add the
ID_node_source to list_ul. Each node transmits to the
broadcast sender, successively, the confirmation message in
which the ID_node_source field is its own ID, ID_node_dest
field is the broadcast sender ID, the cost field is its own cost
and info_sup field is 1. To a broadcast message can respond
only the nodes which have their own cost equal with 0, except
for the gateway nodes, or if the cost is lesser then own cost. If
the received cost is lesser then own cost mean that it discover a
node that is closer the gateway and will make the necessary
adjustments.
3. After sending the confirmation message, they wait for
the error message. If there are no errors, they transmit,
successively, a broadcast message for discovering their
neighbors. The ID_route field is the gateway ID, the
ID_node_source field is the node own ID, the cost field is the
node own cost and the ID_node_dest and info_sup fields are 0.
4. If a node receive a message with the cost field greater
than its own cost, the ID_node_source field is added to the
list_dl, if it does not already exist in it and, if the cost field is
equal with the node cost, the ID_node_source field is added to
the list_eq, if it does not already exist in it.
5. Steps 2 to 4 are repeated until there are no nodes sending
broadcast messages.
C. Pseudocode Algorithms
Pseudo code algorithm for sender node of a broadcast
message:
send broadcast message
n=1
while n
receive message
if message has errors
send error message
else
if own ID_node_dest == received ID_node_dest
if info_sup == 1
send ok to ID_node_source
if own cost < received cost
add ID_node_source to list_dl
else
process message()
endif
else
process message()
endif
else
process message()
endif
endif
endwhile
The logic diagram of the pseudo code algorithm for the
sender node of the broadcast message is given in Fig 1.
Figure 1. Logic diagram for broadcasting sender
The pseudo code algorithm for the sender of the
confirmation message:
n=1
while n
receive message
if message has errors
send error message
else
if ID_node_dest == 0
if own cost == 0
own cost = receivedcost + 1
add ID_node_source to list_ul
send confirmation message to ID_node_source
ID_node_save = ID_node_source
else
process message()
endif
else
if own ID == received ID_node_dest
if error message==OK &&
ID_node_source==ID_node_save
send broadcast message
else
process message()
endif
else
process message()
endif
endif
endif
endwhile
The logic diagram of the pseudo code algorithm for the
sender node of the confirmation message is given in Fig 2.
Figure 3. Logic diagram for processing unaddressed and error messages
III.
Figure 2. Logic diagram for confirmation sender
The nodes can receive messages that are not addressed to
them, but must still be processed. This is important for a good
update of those three lists. The lists are very important for an
efficient routing so must be very well created.
The pseudo code algorithm for processing unaddressed or
error messages
function process message()
receive message
if error message
send last message
else
if own cost < received cost
if ID_node_source !exist in list_dl
add ID_node_source in list_dl
endif
else
if own cost > received cost
if ID_node_source !exist in list_ul
add ID_node_source in list_ul
endif
else
if ID_node_source !exist in list_eq
add ID_node_source in list_eq
endif
endif
endif
endif
The logic diagram of the pseudo code algorithm for
processing unaddressed or error messages is given in Fig 3.
SENDING A MESSAGE ALONG THE ROUTE
After finishing the routing process (phase 2), the network is
ready for operation. When a node must transmit data to the
gateway, it selects the first node from the list_ul and send to it.
The receiver node must transmit a confirmation message as
replay. If the sender node does not receive a confirmation
message in a fixed time, the node transmits the data to a next
node on the list_ul. If there are no more nodes in list_ul, try to
transmit the data to a node from the list_eq. In this way is
realized an automatic rerouting if one or more nodes are
destroyed, without having to restart the whole process from the
gateway.
If new nodes are added to the network is enough to
communicate with neighbors nodes and build his lists. Also the
neighbor nodes must to update their lists. These avoid a
rerouting procedure for all nodes from the network.
In WSN is very important to manage the energy
consumption most carefully. The messages are not send to the
same node from the list until its energy will be depleted. To
consume the energy nodes, from the list_ul, in a balanced way,
the messages are transmitted by rotation. Thus the energy is
save as much as possible. This approach is also good to
alleviate collisions and latency in case of an intense data traffic.
The routing method described here was simulated in
Matlab with good results. The simulation was done considering
the random nature of the distribution of the nodes and the fact
that any node knows the location of only neighboring nodes,
not of all the nodes in the network.
In figure 4 is shown a network with 50 nodes randomly
distributed. The node 46 is the gateway node. If the node 5
must transmit a message to gateway, it will transmit to the first
node from the list_ul, in this case the node 1. This node will
transmit the message to the first node from its own list_ul, in
this case the node 13, and so on, until the gateway is reached.
The found route is: 5, 1, 13, 32, 26, 23, 35, 46.
transmitting node awaits a confirmation message from DC. The
message is saved only if the communication implicates a
confirmation message from the DC.
The format of this table has the one in table 4:
TABLE IV.
ID_
route
FORMAT OF THE REGISTRATION TABLE
ID_node_
source
ID_node_
rec
ID_node_
send
ID_
message
Where:

ID_route field contains the gateway node identifier,

ID_node_source field is the identifier of the node that
sent the message,

ID_node_rec field contains the ID of the neighbor node
from which receives the message,

ID_node_send field contains the ID of the neighbor
node to which send the message,

ID_message field contains a number that is completed
by the source node and not change along the route.
Figure 4. Matlab example
IV.
The message for data transmission has the format in table 3:
TABLE III.
ID_
route
ID_node_
source
ID_
message
MESSAGE FORMAT
type_
message
message
checksum
CONFIRMATION MESSAGE
This part can be skipped if the communication do not
require a confirmation message from DC.
After the message is received by node DC, it sends a
confirmation message to the node transmitter. Confirmation
message has the following format (table 5):
TABLE V.
where:
CONFIRMATION MESSAGE

ID_route field contains the gateway node identifier and
is the destination node,

ID_node_source field identifies the node sending the
message,

ID_node_source field is the identifier of the node that
sent the message,

ID_message field contains a number that is completed
by the source node and does not change along the
route. Each node has a counter that records the number
of messages sent. The field ID_message is unique for
each node.

ID_message field contains ID_message field from data
message,

Type_message field represents the type of message
sent, in this case being a confirmation message, field
contains the value 1,

Type_error field contains a code that represents the
error code, namely the value 0 if it received no errors
or 1 if the value was received with errors.

type_message field represents the type of message
sent. It can be message data or confirmation message.
For message data, it contains the value 0, and for the
confirmation message, it contains the value 1.

The checksum field contains the error detection code.
Each node through which the message passes, tests this
field and, if errors are detected, sends an error message
to the source node, while the message is no longer sent
to the gateway.

The message field contains the payload.
Before sending the message, it is saved in memory as a
table recording the node traffic. It is only necessary while the
ID_node_source
ID_message
type_message
type_error
Where:
The issue of confirmation of the gateway is that it is
possible for a node to become inactive after sending message
data, in which case the route to the node transmitter can not be
undone. In this case, registered in the registration table the
traffic is removed after a while if it not receives the
confirmation message. Also node data transmitters of the
message resend the message data if it not receives the
confirmation message after a certain time.
In most cases the confirmation messages between nodes
technique is sufficiently reliable so that there is no need
confirmation message from the gateway, this making a
redundancy procedure.
V.
CONCLUSIONS
The design of the algorithm presented here is focused on
the energy efficiency to prolong as much as possible the
lifetime of the network.
Some standards are implemented in physical layer,
automatic routing facilities, but using standards that are not
implemented such facilities it is necessary to develop a routing
algorithm. The algorithm described in this article can be
improved and adapted to better satisfy the application
requirements.
This algorithm can be also use in cluster based organized
WSN. In many applications it is not needed a confirmation
message from the DC nodes, which greatly simplify routing
procedure CSMA-CA, OFDM or spread spectrum radio
techniques, such as FHSS (Frequency-Hopping Spread
Spectrum) and DSSS (Direct-Sequence Spread Spectrum) also
can be sufficiently reliable, which makes the procedure of
confirmation redundancy, so that can be removed from
application. The confirmation from neighbor node is often
enough to transmit the message safely so that the confirmation
from DC node procedure can be used only in special cases.
REFERENCES
[1]
[2]
[3]
[4]
[5]
[6]
M. Ilyas, I. Mahgoub, Handbook of Sensor Networks: Compact Wireless
and Wired Sensing Systems, CRC Press, 2005.
M. A. Labrador, P. M. Wightman, Topology Control in Wireless Sensor
Networks, Springer, 2009.
E. Hossain, K. Leung, Wireless Mesh Networks Architectures and
Protocols, Springer, 2008.
A. Boukerche, Algorithms And Protocols For Wireless Sensor
Networks, Wiley, 2009.
E. H. Callaway, Wireless Sensor Networks: Architectures and Protocols,
CRC Press, 2004.
J. Zheng, A. Jamalipour, Wireless Sensor Networks, Wiley, 2009.
Download