Download - Copyright 2011, Deepika Murali
AN ADAPTIVE GOSSIP PROTOCOL FOR IMPROVING COMMUNICATION
PERFORMANCE IN WIRELESS SENSOR NETWORKS
by
Deepika Murali, B.Tech
A Thesis
In
COMPUTER SCIENCE
Submitted to the Graduate Faculty
of Texas Tech University in
Partial Fulfillment of
the Requirements for
the Degree of
MASTER OF SCIENCE
Approved
Dr. Sunho Lim
Chair of Committee
Dr. Noe Lopez-Benitez
Peggy Gordon Miller
Dean of the Graduate School
May, 2012
Copyright 2011, Deepika Murali
Texas Tech University, Deepika Murali, May 2012
ii
ACKNOWLEDGMENTS
First and foremost, I would like to thank my supervisor, Dr. Sunho Lim, who
has extended his knowledge and support to me for the entire duration of my master’s
studies. I would like to thank him for allowing me work in my own way and providing
guidance and a helping hand whenever I was stuck on any problem. I could have not
completed my thesis without his constant encouragement and support.
I would also like to thank Dr. Noe Lopez-Benitez for agreeing to be a part of
my thesis defense committee and spending his valuable time for me.
Finally, I thank my friends and family for their understanding and endless love.
I thank my parents for their unconditional support all these years. They have given up
many things for me to be here and this thesis would certainly not have existed without
them. I would like to thank my brother and grandmother for their constant
encouragement and prayers. Also, special thanks to friends, Bruhadeesh, Anudeep,
Ashok and Ganessh Balaji for always being there for me and helping me overcome my
tough times.
Texas Tech University, Deepika Murali, May 2012
iii
TABLE OF CONTENTS
ACKNOWLEDGMENTS..……………………………………………………………ii
ABSTRACT…………………………………………………………………………...vi
LIST OF FIGURES…………………………………………………………………..vii
LIST OF ABBREVIATIONS………………………………………………………….x
I INTRODUCTION..…………………………………………………………………..1
II BACKGROUND AND RELATED WORK…………………………………………6
2.1 Gossip-Based Ad Hoc Routing………………………………………………...6
2.2 Smartgossip: An Improved Randomized Broadcast Protocol for WSN……….8
2.3 Parametric Probabilistic Sensor Network Routing…………………………….9
2.4 Gossip-Based Sleep Protocol for Energy Efficient Routing…………………..9
2.5 Random Asynchronous Wakeup protocol……………………………………11
2.6 Summary……………………………………………………………………...12
III AN ADAPTIVE GOSSIP PROTOCOL FOR IMPROVING COMMUNICATION
PERFORMANCE IN WSN……………...…………………………………………...14
3.1 Problem Definition and Motivation…………………………………………..14
3.2 System Model………………………………………………………………...15
3.3 An Adaptive Gossip Protocol………………………………………………...19
3.3.1 Generating Forwarding Candidates……………………………………..19
3.3.2 Determining Gossip Probability…………………………………………20
3.3.3 Determining Sleep Probability…………………………………………..21
Texas Tech University, Deepika Murali, May 2012
iv
3.4 Pseudo Code..…………………………………………………………………23
IV PERFORMANCE EVALUATION…………………………………………….....25
4.1 Simulation Testbed and Performance Comparison…………………………...25
4.2 Simulation Parameters………………………………………………………..28
4.3 Simulation Results ........................................................................................... 30
4.3.1 Random Network Deployment ................................................................ 30
4.3.2 Average Remaining Energy Comparison................................................. 31
4.3.3 Average Redundancy Comparison………………………………...…….35
4.3.4 Average Latency Comparison…………………………………………...39
4.3.5 Average Number of Messages Exchanged Comparison…………….......42
4.3.6 Total Number of Nodes Participated Comparison…………………..…..45
4.3.7 Average Delivery Ratio Comparison…………………………………....46
4.3.8 Simulation Results changing the fixed time intervals…………………...49
4.3.8.1 Comparison of Average Remaining
energy for fixed intervals 10, 20 and 30 in AGP………………..49
4.3.8.2 Comparison of Average Redundancy for
fixed intervals 10, 20 and 30 in AGP……………………………50
4.3.8.3 Comparison of Average Latency for
fixed intervals 10, 20 and 30 in AGP……………………………51
4.3.8.4 Comparison of Average Number of Messages
Exchanged for fixed intervals 10, 20 and 30 in AGP……….......52
Texas Tech University, Deepika Murali, May 2012
v
4.3.8.5 Comparison of Total Number of nodes participated
for fixed intervals 10, 20 and 30 in AGP………………………..53
4.3.8.6 Comparison of Average Delivery Ratio
for fixed intervals 10, 20 and 30 in AGP………………………..54
4.4 Summary…………………………………………………………………….55
V CONCLUSION AND FUTURE WORK…………………………………………..58
5.1 Conclusion……………………………………………………………………58
5.2 Future Work…………………………………………………………………..60
REFERENCES………………………………………………………………………..61
A. CODE IMPLEMENTATION……………………………………………………...63
Texas Tech University, Deepika Murali, May 2012
vi
ABSTRACT
A Wireless Sensor Network (WSN) consists of a set of battery-powered devices (later
in short, nodes) equipped with sensing, computing, and communicating capabilities,
and it is rapidly integrated with various real-world applications in civil and military
environments. Due to the limited amount of battery energy, however, a great deal of
research effort has been devoted on developing energy efficient techniques in the
WSNs. In this thesis, we propose an Adaptive Gossip Protocol (AGP) to improve the
communication performance in terms of packet delivery ratio, packet latency, and
energy consumption under the energy-constrained WSNs. In the proposed AGP, a
node decides whether it should participate in the communication based on a gossiping
probability. If the node participates in the communication, it judiciously selects a set
of candidate nodes for forwarding. Otherwise, the node decides whether it should
sleep based on a sleeping probability. Here, gossiping probability is determined by the
number of neighbor nodes but sleeping probability is determined by both the number
of neighbor nodes and remaining battery energy. We build a discrete-event driven
simulator using CSIM20 and compare the proposed scheme with conventional
flooding and simple gossiping techniques. Extensive performance study shows that the
proposed scheme can save energy consumption up to 12% and reduce the packet
latency 5 times in comparison to flooding and gossiping techniques. The proposed
scheme also shows the competitive packet delivery ratio, and thus it is a viable
approach for WSNs.
Texas Tech University, Deepika Murali, May 2012
vii
LIST OF FIGURES
1.1 Naïve flooding mechanism………………………………………………..............2
1.2 Controlled flooding mechanism…………………………………………...............3
2.1 An example of gossip1(p,k) with hop count k=2………………………….............7
2.2 (a) Synchronous GSP and Figure 2.2 (b) Asynchronous GSP…………….…….10
3.1 Random sleep periods…………………………………………………………....16
3.2 Wireless sensor network………………………………………………................18
4.1 Parameter table for gossip1(p,k) and flooding…………………………………...26
4.2 Parameter table for AGP………………………………………………................27
4.3 Random network deployment……………………………………………………30
4.4 Average remaining energy of gossip1 (p,k) where Gp = 0.65
flooding Gp = 1 and AGP comparison……………………………………32
4.5 Average remaining energy of gossip1 (p,k) where Gp = 0.75
flooding Gp = 1 and AGP comparison……………………………………33
4.6 Average remaining energy of gossip1 (p,k) where Gp = 0.85
flooding Gp = 1 and AGP comparison……………………………………33
4.7 Average remaining energy of gossip1 (p,k) where Gp = 0.95
flooding Gp = 1 and AGP comparison……………………………………34
4.8 Average redundancy of gossip1 (p,k) where Gp = 0.65
flooding Gp = 1 and AGP comparison……………………………………36
Texas Tech University, Deepika Murali, May 2012
viii
4.9 Average redundancy of gossip1 (p,k) where Gp = 0.75
flooding Gp = 1 and AGP comparison……………………………………37
4.10 Average redundancy of gossip1 (p,k) where Gp = 0.85
flooding Gp = 1 and AGP comparison…………………………………..37
4.11 Average redundancy of gossip1 (p,k) where Gp = 0.95
flooding Gp = 1 and AGP comparison…………………………………..38
4.12 Average latency of gossip1 (p,k) where Gp = 0.65
flooding Gp = 1 and AGP comparison…………………………………..40
4.13 Average latency of gossip1 (p,k) where Gp = 0.75
flooding Gp = 1 and AGP comparison…………………………………..40
4.14 Average latency of gossip1 (p,k) where Gp = 0.85
flooding Gp = 1 and AGP comparison…………………………………..41
4.15 Average latency of gossip1 (p,k) where Gp = 0.95
flooding Gp = 1 and AGP comparison…………………………………..41
4.16 Average number of messages exchanged of gossip1 (p,k)
where Gp = 0.65 flooding Gp = 1 and AGP comparison………………43
4.17 Average number of messages exchanged of gossip1 (p,k)
where Gp = 0.75 flooding Gp = 1 and AGP comparison………………43
4.18 Average number of messages exchanged of gossip1 (p,k)
where Gp = 0.85 flooding Gp = 1 and AGP comparison………………44
4.19 Average number of messages exchanged of gossip1 (p,k)
where Gp = 0.95 flooding Gp = 1 and AGP comparison………………44
Texas Tech University, Deepika Murali, May 2012
ix
4.20 Total number of nodes participated for gossip1 (p,k)
where Gp =0.60- 0.95, flooding Gp = 1 and AGP comparison…………..45
4.21 Average delivery ratio of gossip1 (p,k) where
Gp = 0.65 flooding Gp = 1 and AGP comparison……………………..47
4.22 Average delivery ratio of gossip1 (p,k) where
Gp = 0.75 flooding Gp = 1 and AGP comparison……………………..47
4.23 Average delivery ratio of gossip1 (p,k) where
Gp = 0.85 flooding Gp = 1 and AGP comparison……………………..48
4.24 Average delivery ratio of gossip1 (p,k) where
Gp = 0.95 flooding Gp = 1 and AGP comparison……………………..48
4.25 Average remaining energy of AGP
for Periodic Time = 10, 20 & 30………………………………………...49
4.26 Average redundancy of AGP for
Periodic Time = 10, 20 & 30…………………………………………....50
4.27 Average latency of AGP for Periodic
Time = 10, 20 & 30……………………………………………………...51
4.28 Average number of messages exchanged in
AGP for Periodic Time = 10, 20 & 30…………………………………..52
4.29 Total number of nodes participated in
AGP for Periodic Time = 10, 20 & 30…………………………………..53
4.30 Average delivery ratio of AGP for Periodic
Time = 10, 20 & 30……………………………………………………..54
Texas Tech University, Deepika Murali, May 2012
x
LIST OF ABBREVIATIONS
1. WSN Wireless sensor networks
2. AD Ad-hoc Networks
3. GSP Gossip based sleep protocol
4. RAW Random asynchronous wakeup protocol
5. Fc Forwarding candidates
6. Sc Sleep candidates
7. Ec Current energy
8. Eavg Average remaining energy
9. RST Random sleep time
10. SLP Sleep period
11. PT Periodic time
12. Gp Gossip probability
13. Sp Sleep probability
14. Rn Rear nodes
15. Fn Front nodes
16. Nn1 Neighboring nodes
17. Nn2 Neighboring nodes and rear nodes
18. SL Sender list
19. D2D Distance to destination
Texas Tech University, Deepika Murali, May 2012
1
CHAPTER I
INTRODUCTION
With recent technological advances, Wireless Sensor Network (WSN) has
been integrated with the existing network infrastructure and deployed in diverse
applications in civil and military environments. WSN has no centralized infrastructure
and each node relies on multi-hop relay for communication. The design of a sensor
network includes the deployment of small sensors over a network to monitor a specific
event. When a sensor node discovers a particular event, it propagates the gathered data
to the sink. This data should pass through the intermediate sensor nodes, which
indicates that sensor networks rely heavily on a network-wide broadcast service for
propagation of data.
The sensor networks are usually employed in the field of wildlife monitoring,
disaster relief operations etc., which result in random topology in almost all the cases.
These sensors are deployed in large areas and moreover they have a very limited
transmission range. This requires the necessity of one to one transmission resulting in
the deterioration of battery life. This limited battery life is a principal objective in the
design of WSNs due to the difficulty and high cost associated with replacing or
recharging exhausted batteries in a deployed network. A lot of on-going research is
being carried out in order to improve the lifetime of the sensor networks. Hence, we
investigate in improving the energy efficiency of the network by incorporating the
sleep mode of sensors and the routing protocols.
Texas Tech University, Deepika Murali, May 2012
2
Initially, flooding mechanisms were used to propagate messages to all the
nodes in the sensor network. Flooding is a simple routing protocol in which every
incoming packet is sent through every outgoing link. Eventually every part of the
network receives the message. Flooding is broadly classified into naïve and controlled
flooding [3]. In the case of naive flooding, each node upon receiving a packet
rebroadcasts the message to all its neighbors resulting in redundant transmissions.
Controlled flooding could partially overcome this problem by keeping track of the
node ids that have already transmitted the packet. Thus, a node broadcasts a packet
only if it has not done so previously. Though it does not forward the same packet,
there is a very high probability that each node receives multiple copies of the same
message. Flooding incurs unnecessary propagation of messages thereby increasing the
redundancy and reducing the lifetime of the network.
Figure 1.1: Naïve flooding mechanism
SINK
Texas Tech University, Deepika Murali, May 2012
3
Figure 1.2: Controlled flooding mechanism
The concept of gossiping was introduced to overcome the flooding overhead.
Gossiping limits the propagation of messages as some of the nodes are required to
discard the message instead of forwarding it. The basic concept behind the gossip
protocol is to spread the messages in a rumor like fashion such that each individual
node repeatedly exchanges data with a few randomly selected neighbors causing
information to eventually propagate through the system. The nodes decide whether to
forward or discard the message based on a certain probability. The main advantage of
a gossip based approach is that it provides scalability for communication in large
networks.
Despite optimizations in protocols that use gossiping, all the nodes continue to
keep listening even if there is no data traffic or message transmission. This results in
unnecessary power consumption and significantly reduces the lifetime of the network.
In this thesis, we propose a source based approach to improve the energy efficiency by
SINK
Texas Tech University, Deepika Murali, May 2012
4
introducing the concept of sleep probability. This protocol reduces the number of
nodes that are awake in the network which in turn reduces the energy consumption
considerably. The source decides the number of nodes that have to stay awake or fall
asleep based on the average remaining energy of the nodes. The nodes that are
deduced as forwarding candidates stay awake to gossip the message and the sleep
candidates fall asleep. The Gp and Sp varies with each and every transmission as Gp
and Sp are dynamically decided based on the number of neighboring nodes for Gp, the
number of neighboring nodes and remaining energy for Sp. Though both Gp and Sp are
dynamically calculated they both are independent of each other. The determination of
Gp does not affect the Sp and vice versa. When Gp and Sp are coupled the number of
redundant messages, total number of nodes participating and total number of messages
exchanged can be significantly reduced. Simulations are carried out to study the effect
of AGP using simulation parameters such as delivery ratio, latency, redundant
messages, number of messages exchanged, total number of nodes participating and
energy consumed.
The two major contributions to this thesis are
1. Firstly, the most significant contribution is choosing the forwarding candidates
(Fc) from the neighboring nodes in order to reduce the number of nodes
transmitting the message, secondly we determine the formulas for Gp and Sp
making both gossip and sleep protocols independent of each other.
Texas Tech University, Deepika Murali, May 2012
5
2. Simulations are carried out to compare the results of gossip1(p,k), flooding and
AGP in the CSIM environment. All the three protocols are implemented and
results are extracted to compare and analyze.
The remainder of this thesis is organized as follows. In chapter II we present a
brief overview of the background and related works. Chapter III deals with the details
of Adaptive gossip-based sleep protocol. Performance evaluation and simulation
results are presented in Chapter IV. Finally we discuss the conclusion and future work
in Chapter V.
Texas Tech University, Deepika Murali, May 2012
6
CHAPTER II
BACKGROUND AND RELATED WORK
This chapter focuses on the existing works of gossiping and flooding. First,
we give a brief description regarding the concept of gossiping and its shortcomings in
ad hoc networks. Then we illustrate the need for gossiping and the previous work
related to energy aware gossiping in WSNs. Finally, we deal with the prior gossip and
sleep protocols for achieving energy efficiency in WSNs. We describe Gossip-based
ad hoc routing [1], Smartgossip [2], Parametric Probabilistic sensor network routing
[3], Gossip based sleep protocol(GSP) [4] and Random asynchronous wakeup protocol
[12] respectively.
2.1 Gossip-Based Ad Hoc Routing
The source-based gossiping approach is a broadcasting protocol that was
introduced to disseminate information in a wireless sensor network. In the case of
gossiping protocol, a node decides whether to forward or discard a packet upon
receiving it. Gossip protocols are probability based and hence if the node decides to
forward the packet, it relays it with a probability p else discards it with a probability 1-
p [1]. This version of gossiping is called gossip1(p). The basic idea of the gossip1(p)
protocol underwent many modifications bringing out various versions such as the
gossip1(p,k) and gossip3(p,k,m). In the case of gossip1(p,k), messages are broadcast
with a probability 1 for the first k hops and then gossip with a probability p.
Texas Tech University, Deepika Murali, May 2012
7
Gossip3(p,k,m) is similar to the gossip1(p,k) technique with the addition that the
sender node waits until it receives the sent message from at least m neighbors within a
certain timeout period. If the sender node receives the same message from m
neighbors within the timeout period, it does not rebroadcast the message in order to
avoid redundant transmissions. Though this method reduces the number of
retransmissions, it does not take the factor of energy into consideration since each
individual node retransmits with probability p.
Figure 2.1: An example of gossip1(p,k) with hop count k=2
Texas Tech University, Deepika Murali, May 2012
8
2.2 SmartGossip: An Improved Randomized Broadcast Protocol for Sensor
Networks
SmartGossip [2] is another broadcasting protocol in which the author focuses
on four performance metrics namely coverage, energy efficiency, per hop latency and
overhead for various randomized broadcast protocols on a sensor network.
SmartGossip improves the performance of a sensor network since local information
can be exchanged either actively or passively thus making the system intelligent. In
order to achieve efficient exchange of local information, the author converts the
synchronous protocol into an asynchronous setting as it allows overhearing. With the
asynchronous setting, the author modifies gossip1(p,k), gossip3(p,k,m), push&pull
and SPIN protocol by introducing timers into the network protocol instead of hop
count. The probability with which the nodes transmit a message depends on the timer
value and each node waits for a particular timeout period to forward the received
message. If a node overhears the same message within the timeout interval, it does not
retransmit the message instead stays idle. SmartGossip(γ,T, µ1 ,µ2 , σ, δ) is arrived at
by analyzing the strengths and weaknesses of gossip1(p, T, µ), gossip3 (p,k, µ1 ,µ2),
spin-1(µ,k) and push&pull (p, T, µ1, µ2 ) protocol. SmartGossip ensures that the
network is energy efficient with minimum redundancy as it is a blend of gossip3 (p,k,
µ1 ,µ2), spin-1(µ,k) and push&pull (p, T, µ1, µ2 ). Although the Smartgossip reduces
the overall energy consumption by decreasing the number of retransmissions, it still
requires all the nodes to stay awake throughout the lifetime of the network thereby
resulting in unnecessary energy expenditure.
Texas Tech University, Deepika Murali, May 2012
9
2.3 Parametric Probabilistic Sensor Network Routing
When considering the efficiency of routing, it is believed that the overall
network is benefited significantly when the drawbacks of mis-informed nodes and
variable network topologies are overcome. The Parametric Probabilistic Sensor
Network Routing [3] is one such light-weight multi-path approach where an
intermediate sensor decides to forward a message with a certain probability which in
turn depends on various parameters. This substantially improves the performance of
previously used controlled flooding methods by involving retransmission as a function
of several parameters. Each node upon receiving a packet retransmits the packet to its
neighbors with a certain probability. There are two variations in Parametric
Probabilistic Sensor Network routing namely the Destination Attractor and the
Directed Transmission. Using this new technology the author claims to prove that
multi-path methods outperform single-path methods in the presence of noise. The
dependence of retransmission probability on network information parameters helps to
create very robust routing protocols in sensor networks.
2.4 Gossip-Based Sleep Protocol for Energy Efficient Routing
The energy constraint in wireless ad hoc and sensor networks calls for an
extension of routing methods. The primary cause for this apparent loss of energy is
that all the nodes keep listening even if the network is free of traffic. This reduces the
lifetime of the nodes which in turn reduces the lifetime of the network.
Texas Tech University, Deepika Murali, May 2012
10
T 2T 3T
T
Figure 2.2 (a): Synchronous GSP and Figure 2.2 (b): Asynchronous GSP [4]
Node 1
Node 1
Node 2
Node 2
Node 3
Node 3
Texas Tech University, Deepika Murali, May 2012
11
A lot of research is going on to make ad hoc and sensor networks as energy
efficient as possible. But, the Gossip-based sleep protocol (GSP) clearly distinguishes
itself from the rest by considering the factors simplicity, scalability and connectivity of
the network. Thus, Gossip-based sleep protocol [4] improves the energy efficiency of
the network by employing sleep mode to the nodes. With this GSP the nodes that do
not choose to participate get into sleep mode with a probability p and wake up after a
specific period. This process is repeated throughout the lifetime of the network. The
major assumption in the paper is that if p is the gossip sleep probability then 1-p is
probability for the nodes that are awake to transmit the message. This shows that
almost all the nodes stay connected without affecting the network connectivity. GSP is
designed for both synchronous (GSP1) and asynchronous networks (GSP2). Thus by
introducing sleep mode, the total energy consumption of the network can be reduced
thereby increasing the lifetime of the network.
2.5 Random Asynchronous Wakeup Protocol
Random Asynchronous Wakeup protocol [13] is a power saving technique in
which nodes make adaptive decisions whether to sleep or to stay awake. In this wake
up protocol, routing is based on forwarding sets and a random wake up scheme. This
paper focuses on high density networks where several paths exist between the source
and destination to employ the RAW protocol. Routing in this protocol is based
primarily on two kinds of sets namely, the Neighbor set and Forwarding set. The node
maintains local information about its two hop neighboring nodes using which it selects
Texas Tech University, Deepika Murali, May 2012
12
the next node to forward the messages to the sink. The author again discusses two
cases namely; the Hop-based forwarding candidate set (h-FCS) and greedy
forwarding. In h-FCS the sender randomly chooses a node among its one hop
neighbors to forward the message whereas in greedy forwarding the nodes takes into
account the geographic distance to forward the message to the node that is closest to
the destination. Another significant contribution of this paper is the random wake up
scheme where the nodes sleep and wake up at random time intervals within a fixed
time-slot. This enables the network to maintain connectivity all through network
lifetime and also reduces the latency significantly.
2.6 Summary
The most significant limitation with basic gossiping, SmartGossip, RAW and
parametric probabilistic routing is that all the nodes deployed in the network keep
listening all the time which is undesirable to achieve energy efficiency. Moreover in
the Gossip-based sleep protocol the potential disadvantage is that the packets may go
through longer paths resulting in more energy consumption. This reduces network
throughput and increases end to end delay. Moreover the nodes choose either to sleep
within the synchronous time (GSP1) interval or to stay awake. There is higher chance
that more than one neighbor of the sender node may sleep at the same time leading to
message loss. The other (GSP2) chooses asynchronous time intervals to sleep where
the sleep time is also not constant and hence probability that those nodes might sleep
for a longer period of time resulting in no connectivity is significantly high. Thus it is
Texas Tech University, Deepika Murali, May 2012
13
essential to achieve minimum energy consumption with minimum participation of
nodes. It is also necessary to maintain the connectivity between the nodes in the
network when we reduce the number of nodes participating in a network broadcast.
Texas Tech University, Deepika Murali, May 2012
14
CHAPTER III
AN ADAPTIVE GOSSIP PROTOCOL FOR IMPROVING
COMMUNICATION PERFORMANCE IN WSN
In this chapter, we propose an Adaptive Gossip Protocol, called AGP, for
improving the energy efficiency in WSNs. We first briefly introduce the problem
definition and motivation. Then we suggest the system model and initial deployment
procedures. Finally the methodologies for calculating major system parameters (i.e.,
Fc, Gp and Sp) are discussed.
3.1 Problem definition and motivation
In the current gossip protocols, most of the nodes participate in forwarding
every message received. When a sender node forwards a message, it chooses the
specified probability for gossiping the message without taking any other parameters
into consideration [1]. Moreover all the nodes in the network keep listening till the last
message reaches the sink. Thus every node participates in receiving all incoming
messages although in some cases it can restrict itself from forwarding the received
packet to its neighboring nodes. Therefore, each sender node forwards a copy of the
message only once but the receiver node might receive multiple copies resulting in
redundancy. Hence there is very limited chance that a node might not receive a
message packet more than once. From this we infer that there are large amounts of
energy wastage as most of the nodes participate in all sending and receiving thereby
reducing the lifetime of the network. Hence, gossiping would also act very similar to
Texas Tech University, Deepika Murali, May 2012
15
flooding as all the nodes would participate in the transmission thus incurring very high
redundancy and energy consumption.
Thus in order to achieve energy efficiency it is essential to reduce the number
of nodes participating in the transmission of messages. This can be done by selecting a
certain set of nodes to forward the message. This would in turn reduce the total
number of messages exchanged during transmission thereby reducing the number of
redundant messages received at every hop and at the sink. Since it is unnecessary for
at each node and if the nodes that do not participate in the transmission are made to
sleep, then a reasonable delivery ratio can be achieved with minimum energy
consumption.
3.2 System model
In this thesis we propose an Adaptive gossip protocol in which each node is
chosen to either gossip or sleep based on the average remaining energy of the
neighboring nodes. The forwarding candidates are the nodes that are selected to gossip
the message. The Gp is adaptively generated by the sender node based on its remaining
energy. The Sleep candidates (Sc) are the nodes that are assigned to sleep. These nodes
wake up after a specified sleep time period to take part in the next transmission. Thus,
we focus on reducing the number of nodes participating in message forwarding
thereby reducing the total number of messages exchanged, the number of redundant
messages and energy consumption. Moreover in this mechanism both gossip and sleep
protocols are independent of each other. Unlike existing methodologies, if the gossip
Texas Tech University, Deepika Murali, May 2012
16
probability is p then the sleep probability is not taken as 1-p. The sleep probability is
calculated by the receiver node based on its remaining energy (Ec) and number of
neighboring nodes (Nn). Thus, the entire functionality of the network such as
calculating the gossip and sleep probabilities, forwarding and sleep candidates is
dependent on the number of Nn and their Ec.
T 2T 3T
Figure 3.1: Random sleep periods
The Nodes are randomly deployed in a rectangular network and are made to
wake up at periodic time intervals at which point each node chooses a random time to
sleep before the next periodic clock tick. Although, the SLP (i.e. the time for which
the node sleeps) is fixed for the entire network, each node individually chooses the
time at which it should sleep. The node wakes up after the specified sleep interval and
NODE 1
NODE 2
NODE 3
Texas Tech University, Deepika Murali, May 2012
17
stays awake until the next periodic clock tick. At each periodic clock tick, the nodes
keep repeating the same process of choosing a RST at which the node should sleep
until an event is detected. Initially when the network is deployed, the sink voluntarily
sends one hop messages to all its one hop neighbors with the ‘distance to destination’
field of the control message packet assigned to a value of ‘Zero’. The D2D field is
initially set to zero for all nodes in the network. The field value is modified when a
node receives D2D information from one of its one hop neighbors. When a node
receives D2D information from its one hop neighbor, it modifies the field value by
adding one to the value being sent by the sender node only if its D2D value is set to 0
(i.e. the D2D field has not been modified before). When the D2D field value has been
set for all the nodes, each node is aware of its ‘distance to destination’ in terms of hop
count. When a node P receives a packet from one of its neighboring nodes, it first
checks the ‘distance to destination’ field. If the difference between the current node’s
D2D value and the received value is 1then P adds the sender node to the list of rear
nodes. On the other hand, if the difference between the current node’s D2D value and
the received value is -1, the sender node is added to the list of front nodes. If neither of
the aforementioned criteria is met, the sender node is added to the list of neighboring
nodes for node P where the received value and current value are same. Therefore, Rn
has all nodes whose values are one less than P, Nn1 has nodes whose values are same
as P and Fn has nodes whose values are one greater than P. In order to calculate the Fc
nodes using we combine both Nn1 and Rn to create the new Nn2. Thus each node
maintains four lists namely the rear node list, front node list and the neighbor node
Texas Tech University, Deepika Murali, May 2012
18
list1 and neighbor node list2 which are used for message transmission in the network.
Basically, the forwarding candidates and the sleep candidates are chosen from this
neighboring node2 list. Furthermore, at every periodic clock tick, each of the nodes in
Nn2 sends its remaining energy value to its front nodes and neighboring nodes. This in
turn helps to determine the forwarding and sleep candidates.
Figure 3.2: Wireless sensor network
Source
Node
Neighboring
Node
SINK
Texas Tech University, Deepika Murali, May 2012
19
3.3 An adaptive gossip protocol
3.3.1 Generating forwarding candidate nodes
When an event is generated at the source node, the sender node determines the
FC and Gp. However, only the Gp determines if the message is to be transmitted by the
current forwarding candidate. Sleep probability indicates how much time the node
should sleep when the node is chosen as a Sc. Firstly, the FC is determined based on
the remaining energy of the neighboring nodes. The sender node takes the average of
remaining energy of its nodes in the Nn2 and compares it with the remaining energy of
each of its neighboring node. If the remaining energy of a neighboring node is greater
than the average remaining energy of all the neighboring nodes, then that particular
node is chosen as a forwarding candidate. This process is repeated for all the nodes in
Nn2list of the sender and thus the Fc list is created.
Moreover if a node has only one rear node then the forwarding candidate is
always the same node and this node should stay awake throughout the lifetime of the
network except for the RST. Furthermore, each node maintains a sender node list
where it stores the entire node ID’s from which it received the messages. The
receiving node eliminates these node ID’s from the neighboring list while calculating
forwarding candidates. This is because a node can send only one copy of a specific
message ID and incase if the same sender node is chosen as the Fc by the receiving
node then the message is discarded. Hence, the neighboring node is first reduced to a
list that hold capable candidates and then the Fc are calculated. Thus the concept of Fc
Texas Tech University, Deepika Murali, May 2012
20
helps to select only a few nodes to participate in forwarding a packet thereby
eliminating the need for all nodes to stay active throughout the lifetime of the network.
3.3.2 Determining gossip probability
When a sender node chooses its Fc, it transmits the message to the selected
nodes at a random gossip probability. The sender gossips the packet along with
information about the captured event. The Gp at the sender node is determined
adaptively based on the number of neighboring nodes and it indicates the percentage
of messages that should compulsorily reach the forwarding candidates. The gossip
probability is calculated by taking the reciprocal of the number of forwarding
candidates and raising it to the power of reciprocal of its neighboring nodes. Since we
calculate the gossip probability for one current node from a set of forwarding
candidates, we arrive at a part of the formula - 1/Fc. This is then raised to the power of
1 over number of neighboring nodes, since the sender can gossip with a lower gossip
probability when the number of neighboring nodes is high and vice versa. Thus, as the
number of nodes increases, the Gp of the current node decreases. Therefore the source
node transmits the message with a suitable gossip probability to its neighboring nodes.
The forwarding candidate after transmitting the message double’s their RST and sleep
to conserve energy. On the other hand, neighboring nodes which are not chosen as
forwarding candidates fall asleep based on the Sp which is determined by each
individual node. Based on the Sp, the sleep candidates need to sleep for a particular
Texas Tech University, Deepika Murali, May 2012
21
time within the time slot. After the sleep period, the node wakes up and stays awake
for the rest of the time interval.
The gossip probability is calculated using
Gp - Gossip Probability
Fc - Forwarding Candidates
Nn - Neighboring nodes
3.3.3 Determining sleep probability
The Sp is also calculated adaptively by the receiving node based on the
remaining energy and neighboring nodes of the current node. The Sp indicates how
much time the nodes should sleep if it’s a sleep candidate. The sleep probability is
calculated by taking the reciprocal of the remaining energy of current node and raising
it to the power of reciprocal of its neighboring nodes. This is done to achieve
minimum sleep probability when the energy of the node is high and vice versa. Thus,
as the remaining energy decreases the sleep probability of the current node increases.
After the sleep period, the node wakes up and stays awake for the rest of the time
interval.
The sleep probability is calculated using
Gp = (1/Fc) (1/N
n2)
Sp = (1/Ec) (1/ N
n2)
Texas Tech University, Deepika Murali, May 2012
22
Sp - Sleep Probability
Ec - Current Energy
Nn - Neighboring nodes
The Adaptive gossip based sleep protocol thus reduces the total number of
nodes participating in any transmission thereby increasing the lifetime of the network.
This methodology also reduces the number of redundant messages as only a limited
number of nodes are participating in a message transmission. Moreover all the nodes
do not stay active throughout the lifetime of the network. Each node takes its turn for
both gossip and sleep which helps in preserving the energy at each node for a longer
time period.
Texas Tech University, Deepika Murali, May 2012
23
3.4 Pseudocode
curr_nde - current node
Fc - forwarding candidates
Fs - nodes chosen to sleep
Ec - current energy
EAvg - average remaining energy
Gp - gossip probability
Sp - sleep probability
RST - random sleep time
SLP - Sleep Period
PT –Periodic Time
SL - Sender List
Nn – neighboring nodes
Nrn – remaining neighboring nodes
A) /* when an event occurs */
Upon receiving a packet
If (curr_nde = Fc)
{
Continue to determine Fc ;
If (curr_nde.Nn[i] == sender node)
{
No participation in gossiping
}
If (curr_nde.Nn[i] != sender node)
{
Nrn = Nrn +1;
n
EAvg = ∑ Nrn->Ec[i]
i=0 ;
n
for (i=0;i<n;i++)
{
If (Nrn->Ec[i] >= EAvg) then
Fc = Fc+1;
Store the respective node id;
}
}
Else
{
Sc = Sc+1;
Store the respective node id;
Texas Tech University, Deepika Murali, May 2012
24
}
B) Upon receiving a packet
If (curr_nde == Fc)
{
Continue to determine Gp
Gp = ((1/Fc)^(1/ Nn))
Broadcast the message using the probability Gp
SLP= 2*RST
}
Wake up and stay idle until next message is received
C) Upon receiving a packet
If (curr_nde = Sc)
{
Continue to determine Sp
Sp = ((1/Ec)^(1/Nn))
SLP = Sp time of PT
}
Wake up and stay awake until next message is received
In the above pseudo code part A) represents the calculation of the forwarding
candidate nodes, part B) represents the calculation of Gossip probability and part C)
represents the sleep probability.
Texas Tech University, Deepika Murali, May 2012
25
CHAPTER IV
PERFORMANCE EVALUATION
In this chapter, we present simulation results of AGP and compare with the
existing methodologies, gossip1(p,k) and flooding. First, we describe the simulation
testbed and simulation parameters. . Then, we analyze the performance cons and pros
of each scheme in terms of delivery ratio, latency, number of redundant messages,
total number of messages exchanges, total number of nodes participated and energy
consumed.
4.1 Simulation Testbed and Performance Comparison
We develop the three protocols AGP, gossip1(p,k) and flooding using the C
Simulator (CSIM). The size of the network is 250x200 m2
with a total of 500 nodes
deployed randomly. In all three implementations, the deployment must take place such
that the number of isolated nodes is kept to a minimum. In the case of gossip1(p,k)
and flooding implementations each node has a one-hop range of 15 and moreover due
to the dense deployment of nodes each node has at least one neighboring node. The
sink is located at the (0,0) location and the source is located at the top right corner in
order to test if the message is propagating through a longer path to reach the sink. In
order to remove any anomalies in the results and to get a broader outlook on how the
performance metrics are varying, the results are extracted by varying the gossip
probability and number of packets sent. In the case of gossip1(p,k) algorithm, the
nodes gossip with a probability of 1 for the first k hops and with a probability of p
Texas Tech University, Deepika Murali, May 2012
26
(gossip probability specified by the user) from the k+1th hop. The gossip1(p,k) is
implemented by keeping the hop count value constant and varying the gossip
probability from 0.60 to 0.95 in intervals of 0.05. The performance metrics are
extracted for each of these probabilities by varying the number of packets sent from
10-100. The graphs are plotted for each of these performance metrics and similarly the
same is followed for the flooding algorithm. In the case of the flooding algorithm,
both p and k are made 1 so that all nodes gossip with a probability of 1 irrespective of
the hop count. Thus, the performance metrics for the gossip1(p,k) and flooding are
extracted and is used for comparison against the result of the Adaptive gossip
protocol. The following table describes the network parameters that is used for
simulating gossip1(p,k) and flooding.
Parameter Value
Number of nodes 500
Network Size 250 × 200 m2
Simulation Time 100sec
Communication Range 15m
Initial energy of each node 100 J
Receiving power consumption 0.01 J
Transmitting power consumption 0.02J
Probability 0.60-1
Hop Count (K) 4
Packet size 512Bytes
Mobility No Mobility
Bit rate 2Mbps
Figure 4.1: Parameter table for gossip1(p,k) and flooding
Texas Tech University, Deepika Murali, May 2012
27
For the proposed protocol each node has a one-hop range of minimum 22 so
that when we choose the forwarding candidates each node has at least one node to
transmit the message. The results for the proposed protocol are extracted by varying
the number of packets sent as gossip probability and sleep probability are calculated
adaptively by the nodes. The performance metrics are extracted for each of this
randomly generated gossip and sleep probabilities by varying the number of packets
sent from 10-100. The node which has only one forwarding candidate would
compulsorily gossip with the probability 1. Moreover the network has periodic
intervals for every 10ms and each node chooses to sleep randomly for any 0.1ms. The
nodes double this random sleep period (0.2) and sleep after gossiping the message.
Parameter Value
Number of nodes 500
Network Size 250 × 200 m2
Simulation Time 100sec
Communication Range 22m
Initial energy of each node 100 J
Receiving power consumption 0.01 J
Transmitting power consumption 0.02J
Sleep Power consumption 0.0005J
Random Gossip Probability 0-1
Random Sleep Probability 0-1
Packet size 512Bytes
Mobility No Mobility
Bit rate 2Mbps
Periodic Time 10ms
Random Sleep Time 0.1ms
Figure 4.2: Parameter Table for AGP
Texas Tech University, Deepika Murali, May 2012
28
4.2 Simulation Parameters
In this section we define the performance metrics considered for our
simulation.
1. Average remaining energy
Average remaining energy is the value obtained when the remaining energies
of all the nodes in the network are summed up and divided by the total number
of nodes.
2. Average redundancy
Redundancy is the total number of duplicate messages reached at the sink.
Total number of redundant packets divided by number of packets sent gives us
the Average redundancy.
3. Average messages exchanged
The total number of messages exchanged for an event is calculated by
summing up the sent messages at each node. Therefore, average messages
exchanged is the total sum by number of nodes in the network.
4. Average latency
Latency is the measure of time delay which is obtained by finding the
difference of packet received time and packet sent number. This value by
number of packets sent gives the average latency.
Texas Tech University, Deepika Murali, May 2012
29
5. Total number of nodes participated
It is count of total number of nodes participated in transmitting certain number
of packets. Even if a node participates in one single transmission it is added to
the list.
6. Average delivery ratio
The ratio of number of packets sent to the number of packets received is called
delivery ratio. The value eliminating the duplicate count gives the count of
total number of packets delivered.
Texas Tech University, Deepika Murali, May 2012
30
4.3 Simulation Results
4.3.1 Random network deployment
In the simulation that we are running, 500 nodes are deployed randomly
throughout a 250x200m2 area network. The destination sink is at (0,0) and the source
is placed at the top right corner of the network. Whenever a node detects an event, it
should transmit the message to the sink through the intermediate nodes. It is essential
that we maintain proper connectivity while deploying the nodes. Hence we try and
make sure that each node has at least one neighboring node to which it can forward the
messages. A neighboring node is any node that is deployed within the one-hop range
of the node. Hence we control the random deployment of the network by distributing
20 nodes for every 10m. The source node used in the simulation is node number 486
and the co-ordinates are (246,196).
Figure 4.3: Random network deployment
0
50
100
150
200
250
0 50 100 150 200 250 300
DEPLOYMENT depl
Texas Tech University, Deepika Murali, May 2012
31
4.3.2 Average remaining energy comparison
Energy efficiency is one of the most important parameters that are taken into
consideration when designing a network or while choosing transmission algorithm for
the network. WSN’s operate primarily on a battery source which has limited energy
capacity. Hence, in order to increase the lifetime of a network, the energy
consumption of a WSN needs to be minimized as much as possible. In the following
section, we make a comparison between the three protocols to determine the most
energy efficient protocol. The average remaining energy of each node in the network
is plotted against the number of packets sent.
The energy efficiency of a system is affected by various factors of the network.
One of the most prominent factors is the total number of nodes participating in the
message transmission. If the number of nodes participating in the message
transmission increases, then the energy expenditure is also very high. Also, if the
nodes in the network are always awake and are always snooping for new messages,
then the energy consumption rapidly increases. Energy efficiency of flooding is very
low because; almost all the nodes in the network take part in the transmission. Though
gossip1(p,k) made efforts to overcome this, the energy consumed still remained high.
This is because the main concentration of gossip1(p,k) was to limit the nodes from
participating but was not to completely terminate the participation.
Texas Tech University, Deepika Murali, May 2012
32
Based on the graphs we can infer that the energy consumption of AGP is
relatively low when compared to gossip1(p,k) and flooding. This is primarily because
AGP incorporates the sleep protocol, thereby reducing constant snooping for packets.
Also, the energy consumption in the sleep state is a lot lesser than the idle state for a
node. Furthermore, since only a few nodes are chosen as forwarding candidates, the
number of nodes participating in the transmission is also reduced. Thus from the
graphs we can say that in the case of gossip1(p,k) as the probability increases the
remaining energy level is more or less similar to flooding. But in the case of AGP as
the probability is random the energy level remains stable. The comparison of three
protocols evidently shows that AGP holds a better improvement in energy preserving.
Figure 4.4: Average remaining energy of gossip1 (p,k) where Gp = 0.65,flooding
Gp = 1 and AGP comparison
75
80
85
90
95
100
0 10 20 30 40 50 60 70 80 90 100
AVERAGE REMAINING ENERGY gossip1(p,k) Gp = 0.65AVERAGE REMAINING ENERGY Flooding Gp=1AVERAGE REMAINING ENERGY AGP Gp = random
AV
ER
AG
E R
EM
AIN
ING
EN
ER
GY
PACKETS SENT
Texas Tech University, Deepika Murali, May 2012
33
Figure 4.5: Average remaining energy of gossip1 (p,k) where Gp = 0.75,flooding Gp
= 1 and AGP comparison
Figure 4.6: Average remaining energy of gossip1 (p,k) where Gp = 0.85,flooding Gp
= 1 and AGP comparison
75
80
85
90
95
100
0 10 20 30 40 50 60 70 80 90 100
AVERAGE REMAINING ENERGY gossip1(p,k) Gp = 0.75AVERAGE REMAINING ENERGY Flooding Gp=1AVERAGE REMAINING ENERGY AGP Gp = random
AV
ER
AG
E R
EM
AIN
ING
EN
ER
GY
PACKETS SENT
75
80
85
90
95
100
0 10 20 30 40 50 60 70 80 90 100
AVERAGE REMAINING ENERGY gossip1(p,k) Gp = 0.85AVERAGE REMAINING ENERGY Flooding Gp=1AVERAGE REMAINING ENERGY AGP Gp = random
AV
ER
AG
E R
EM
AIN
ING
EN
ER
GY
PACKETS SENT
Texas Tech University, Deepika Murali, May 2012
34
Figure 4.7: Average remaining energy of gossip1 (p,k) where Gp = 0.95,flooding Gp
= 1 and AGP comparison
75
80
85
90
95
100
0 10 20 30 40 50 60 70 80 90 100
AVERAGE REMAINING ENERGY gossip1(p,k) Gp = 0.95AVERAGE REMAINING ENERGY Flooding Gp=1AVERAGE REMAINING ENERGY AGP Gp = random
AV
ER
AG
E R
EM
AIN
ING
EN
ER
GY
PACKETS SENT
Texas Tech University, Deepika Murali, May 2012
35
4.3.3 Average redundancy comparison
In this section, we compare the three protocols based on the number of
redundant packets received at the destination according to each algorithm. In the
current simulation, the average redundancy ratio is calculated as the ratio of duplicate
packets reached at the destination to the number of packets sent. Once this is
determined, the average redundancy ratio is plotted against the number of packets
sent. In the following graphs, it can be seen that the redundancy for flooding is the
highest since all nodes that receive the message re-broadcast it without any
constraints. Although this provides 100% delivery ratio, it is not a good practice to
achieve 100% delivery ratio with maximum loss of energy. Although gossiping
reduces the number of redundant messages by reducing the number of nodes
participating in the transmission, the redundancy factor is still high compared to AGP.
It can be seen that the average redundancy ratio for flooding is 5 i.e. for each packet
sent out from the source, the average number redundant messages being transmitted is
the same number. Similarly the gossip1(p,k) redundancy values varies from 2-5 based
on the gossip probability being specified.
However when we take a look at AGP, the average redundancy factor is
always maintained below 1. This is primarily because AGP limits the number of nodes
that take part in forwarding a message towards the sink. Moreover, sleep is
implemented twice apart from sleep probability one is after gossiping a node doubles
its RST and other is each node sleeps for once within every ‘n’ units of time.
Texas Tech University, Deepika Murali, May 2012
36
Moreover a node can transmit one message it only once, hence the redundant
messages reaching these nodes are never propagated again. Thus, based on the above
graphs it can be seen that AGP has a better implementation to contain the number of
redundant packets thereby improving the lifetime of the network significantly.
Figure 4.8: Average redundancy of gossip1 (p,k) where Gp = 0.65, flooding Gp = 1
and AGP comparison
0
1
2
3
4
5
6
0 10 20 30 40 50 60 70 80 90 100
AVERAGE REDUNDANCY gossip1(p,k) Gp = 0.65AVERAGE REDUNDANCY Flooding Gp = 1AVERAGE REDUNDANCY AGP Gp = random
AV
ER
AG
E R
ED
UN
DA
NC
Y
PACKETS SENT
Texas Tech University, Deepika Murali, May 2012
37
Figure 4.9: Average redundancy of gossip1 (p,k) where Gp = 0.75, flooding Gp = 1
and AGP comparison
Figure 4.10: Average redundancy of gossip1 (p,k) where Gp = 0.85, flooding Gp = 1
and AGP comparison
0
1
2
3
4
5
6
0 10 20 30 40 50 60 70 80 90 100
AVERAGE REDUNDANCY gossip1(p,k) Gp = 0.75AVERAGE REDUNDANCY Flooding Gp = 1AVERAGE REDUNDANCY AGP Gp = random
AV
ER
AG
E R
ED
UN
DA
NC
Y
PACKETS SENT
AV
ER
AG
E R
ED
UN
DA
NC
Y
PACKETS SENT
0
1
2
3
4
5
6
0 10 20 30 40 50 60 70 80 90 100
AVERAGE REDUNDANCY gossip1(p,k) Gp = 0.85AVERAGE REDUNDANCY Flooding Gp = 1AVERAGE REDUNDANCY AGP Gp = random
AV
ER
AG
E
RE
DU
ND
AN
CY
PACKETS SENT PACKETS SENT
Texas Tech University, Deepika Murali, May 2012
38
Figure 4.11: Average redundancy of gossip1 (p,k) where Gp = 0.95, flooding Gp = 1
and AGP comparison
0
1
2
3
4
5
6
0 10 20 30 40 50 60 70 80 90 100
AVERAGE REDUNDANCY gossip1(p,k) Gp = 0.95AVERAGE REDUNDANCY Flooding Gp = 1AVERAGE REDUNDANCY AGP Gp = random
A
VE
RA
GE
RE
DU
ND
AN
CY
PACKETS SENT
Texas Tech University, Deepika Murali, May 2012
39
4.3.4 Average latency comparison
In this section, we compare the average latencies of the data packets for the
three methodologies under discussion namely – gossip1 (p,k), flooding and the AGP.
In our simulations, the average latency is found for every variation in the number of
packets being sent from the source to the sink. Using these values, the graph is plotted
to project the variation in average latencies for an increase in the number of packets.
The above graphs show the values of average latencies for all the three methodologies
with the gossip probability being varied from 0.6-0.95 in the case of gossip1 (p,k), 1 in
the case of flooding and random in AGP.
The latency for a network is based on the path that the data packets have to
travel in order to reach the sink. Thus, if the distance travelled by the data packets is
lesser, then the latency of the network is also less. Furthermore, latency is also
affected by the redundancy in the network since latency increases with an increase in
the number of packets being transmitted.
From the above graphs, we can infer that the average latency for flooding is the
highest since more number of packets are exchanged from the source to destination. In
the case of gossip1(p,k) latency increases with an increase in the gossip probability.
The latency is almost as low as that of AGP when the gossip probability is 0.6 but it
increases drastically with an increase in the probability value. In the case of AGP the
latency is exponentially very low when compared to gossip1(p,k) and flooding. This is
because the total number of nodes participating in transmitting the message is
Texas Tech University, Deepika Murali, May 2012
40
considerable less and before transmitting the message from one hop to the next hop
there is a proper path assigned by the sender node.
Figure 4.12: Average latency of gossip1 (p,k) where Gp = 0.65, flooding Gp = 1 and
AGP comparison
Figure 4.13: Average latency of gossip1 (p,k) where Gp = 0.75, flooding Gp = 1 and
AGP comparison
0
100
200
300
400
500
600
0 10 20 30 40 50 60 70 80 90 100
Average Latency gossip1(p,k) Gp = 0.65Average Latency Flooding Gp = 1Average Latency AGP Gp = random
AV
ER
AG
E L
AT
EN
CY
PACKETS SENT PACKETS SENT
0
100
200
300
400
500
600
0 10 20 30 40 50 60 70 80 90 100
Average Latency gossip1(p,k) Gp = 0.75Average Latency Flooding Gp = 1Average Latency AGP Gp = random
AV
ER
AG
E L
AT
EN
CY
PACKETS SENT
Texas Tech University, Deepika Murali, May 2012
41
Figure 4.14: Average latency of gossip1 (p,k) where Gp = 0.85, flooding Gp = 1 and
AGP comparison
Figure 4.15: Average latency of gossip1 (p,k) where Gp = 0.95, flooding Gp = 1 and
AGP comparison
0
100
200
300
400
500
600
0 10 20 30 40 50 60 70 80 90 100
Average Latency gossip1(p,k) Gp = 0.85Average Latency Flooding Gp = 1Average Latency AGP Gp = random
AV
ER
AG
E L
AT
EN
CY
PACKETS SENT
0
100
200
300
400
500
600
0 10 20 30 40 50 60 70 80 90 100
Average Latency gossip1(p,k) Gp = 0.95Average Latency Flooding Gp = 1Average Latency AGP Gp = random
AV
ER
AG
E L
AT
EN
CY
PACKETS SENT
Texas Tech University, Deepika Murali, May 2012
42
4.3.5 Average number of messages exchanged comparison
In this section, we compare between the different protocols based on the
number of messages exchanged for each transmission. The total number of messages
exchanged in the network affects the parameters like energy efficiency, latency, and
redundancy. In the case of gossip1(p,k) and flooding , the number of messages
exchanged is very high since almost all the nodes in the network participate in
forwarding the message. Although gossip1(p,k) reduces the number of forwarding
nodes based on probability, in some cases when given gossip probability is high there
is a very high probability that all the nodes participate. Thus from the graphs we can
infer that the total number of messages exchanged in gossip1(p,k) and flooding is
twice that of AGP. This is because total number of participating nodes is directly
proportional to the number of messages exchanged. When the number of nodes
participating is high the messages exchanged is also high and vice versa.
Texas Tech University, Deepika Murali, May 2012
43
Figure 4.16: Average number of messages exchanged of gossip1 (p,k) where Gp =
0.65, flooding Gp = 1 and AGP comparison
Figure 4.17: Average number of messages exchanged of gossip1 (p,k) where Gp =
0.75, flooding Gp = 1 and AGP comparison
0
100
200
300
400
500
600
700
0 10 20 30 40 50 60 70 80 90 100
AVERAGE MESSAGE EXCHANGED gossip1(p,k) Gp = 0.65AVERAGE MESSAGE EXCHANGED Flooding Gp = 1AVERAGE MESSAGE EXCHANGED AGP Gp = random
AV
ER
AG
E M
ES
SA
GE
EX
CH
AN
GE
D
PACKETS SENT PACKETS SENT
0
100
200
300
400
500
600
700
0 10 20 30 40 50 60 70 80 90 100
AVERAGE MESSAGE EXCHANGED gossip1(p,k) Gp = 0.75AVERAGE MESSAGE EXCHANGED Flooding Gp = 1AVERAGE MESSAGE EXCHANGED AGP Gp = random
AV
ER
AG
E M
ES
SA
GE
EX
CH
AN
GE
D
PACKETS SENT PACKETS SENT
Texas Tech University, Deepika Murali, May 2012
44
Figure 4.18: Average number of messages exchanged of gossip1 (p,k) where Gp =
0.85, flooding Gp = 1 and AGP comparison
Figure 4.19: Average number of messages exchanged of gossip1 (p,k) where Gp =
0.95, flooding Gp = 1 and AGP comparison
0
100
200
300
400
500
600
700
0 10 20 30 40 50 60 70 80 90 100
AVERAGE MESSAGE EXCHANGED gossip1(p,k) Gp = 0.85AVERAGE MESSAGE EXCHANGED Flooding Gp = 1AVERAGE MESSAGE EXCHANGED AGP Gp = random
AV
ER
AG
E M
ES
SA
GE
EX
CH
AN
GE
D
PACKETS SENT PACKETS SENT
0
100
200
300
400
500
600
700
0 10 20 30 40 50 60 70 80 90 100
AVERAGE MESSAGE EXCHANGED gossip1(p,k) Gp = 0.95AVERAGE MESSAGE EXCHANGED Flooding Gp = 1AVERAGE MESSAGE EXCHANGED AGP Gp = random
AV
ER
AG
E M
ES
SA
GE
EX
CH
AN
GE
D
PACKETS SENT PACKETS SENT
Texas Tech University, Deepika Murali, May 2012
45
4.3.6 Total number of nodes participated comparison
In this section, we compare the results of parameter total number of nodes
participated in a data transmission. It can be seen that flooding and gossip1(p,k)
algorithms have almost all the nodes in the network participating in every
transmission. This reduces the energy efficiency by a large amount. Flooding and
gossip1(p,k) algorithms have no mechanism to choose a forwarding candidate to
transmit the messages to the sink. However, since AGP incorporates the sleep protocol
and chooses only a few forwarding candidates to transmit messages, the number of
nodes participating in any transmission is half the number when compared to the other
two protocols. This helps improve the energy efficiency, latency and redundancy of
the network.
Figure 4.20: Total number of nodes participated for gossip1 (p,k) where Gp =0.60-
0.95, flooding Gp = 1 and AGP comparison
0
100
200
300
400
500
600
0 10 20 30 40 50 60 70 80 90 100
NODES PARTICIPATED gossip1(p,k) Gp = 0.6 to 0.95NODES PARTICIPATED FLOODING Gp = 1NODES PARTICIPATED AGP Gp = random
NO
DE
S P
AR
TIC
IPA
TE
D
PACKETS SENT PACKETS SENT
Texas Tech University, Deepika Murali, May 2012
46
4.3.7 Average delivery ratio comparison
Based on the graphs of delivery ratio it is evident that when the probability is
high the number of messages delivered at the sink is also high. It can be seen that the
delivery ratio for the flooding algorithm is at 100% irrespective of the number of
packets being generated at the source. When the probability at which the node
transmits is high there is a higher chance that more number of message are exchanged
between the nodes which improves the delivery ratio immensely but at the cost of very
low energy efficiency. In the case of gossip1(p,k) the delivery ratio increases as the
gossip probability increases. As the delivery ratio increases the energy of the node will
considerably reduce. A high delivery ratio can be achieved only when sufficient
amount of messages are transmitted and this would in turn reduce the energy level of
the node. Hence it is very difficult to achieve a good moderation between these two
parameters. There should be a trade-off if we had to improve either of the two
parameters.
However if we consider the delivery ratio of AGP it also achieves 68%
delivery ratio on an average which is moderate when compared to the delivery ratio
other two protocols. The delivery ratio of AGP is comparatively low because we limit
nearly half the number of nodes from participating in the transmission of messages
and moreover we introduce sleep probability during which the node is inactive. The
node does not receive any messages when it is asleep. There might be a message loss
due to this sleep protocol. Thus AGP achieves moderate delivery ratio with very high
energy efficiency.
Texas Tech University, Deepika Murali, May 2012
47
Figure 4.21: Average delivery ratio for gossip1 (p,k) where Gp =0.65, flooding Gp =
1 and AGP comparison
Figure 4.22: Average delivery ratio for gossip1 (p,k) where Gp =0.75, flooding Gp =
1 and AGP comparison
0
10
20
30
40
50
60
70
80
90
100
0 10 20 30 40 50 60 70 80 90 100
DELIVERY RATIO gossip1(p,k) Gp = 0.65DELIVERY RATIO FLOODING Gp = 1DELIVERY RATIO AGP Gp = random
DE
LIV
ER
Y R
AT
IO
PACKETS SENT PACKETS SENT
0
10
20
30
40
50
60
70
80
90
100
0 10 20 30 40 50 60 70 80 90 100
DELIVERY RATIO gossip1(p,k) Gp = 0.75DELIVERY RATIO FLOODING Gp = 1DELIVERY RATIO AGP Gp = random
DE
LIV
ER
Y R
AT
IO
PACKETS SENT PACKETS SENT
Texas Tech University, Deepika Murali, May 2012
48
Figure 4.23: Average delivery ratio for gossip1 (p,k) where Gp =0.85, flooding Gp =
1 and AGP comparison
Figure 4.24: Average delivery ratio for gossip1 (p,k) where Gp =0.95, flooding Gp =
1 and AGP comparison
0
10
20
30
40
50
60
70
80
90
100
0 10 20 30 40 50 60 70 80 90 100
DELIVERY RATIO gossip1(p,k) Gp = 0.85DELIVERY RATIO FLOODING Gp = 1DELIVERY RATIO AGP Gp = random
DE
LIV
ER
Y R
AT
IO
PACKETS SENT PACKETS SENT
0
10
20
30
40
50
60
70
80
90
100
0 10 20 30 40 50 60 70 80 90 100
DELIVERY RATIO gossip1(p,k) Gp = 0.95DELIVERY RATIO FLOODING Gp = 1DELIVERY RATIO AGP Gp = random
DE
LIV
ER
Y R
AT
IO
PACKETS SENT PACKETS SENT
Texas Tech University, Deepika Murali, May 2012
49
4.3.8 Simulation results changing the fixed time intervals
4.3.8.1 Comparison of average remaining energy for fixed intervals 10, 20 and
30 in AGP
Figure 4.25: Average remaining energy of AGP for Periodic Time = 10, 20 & 30
From the above graph it is evident that when a node sleeps for 0.1ms for every
10ms the average remaining energy of the nodes is high when compared to the fixed
time intervals 20ms and 30ms. This is because nodes sleep less frequently in the case
of 20ms and 30ms due to which large number of nodes participate in forwarding a
message. In order to conserve more energy it is essential that nodes sleep more
frequently thereby reducing the number of forwarding candidates. Hence in this thesis
we simulate using 10ms as the fixed time interval and achieve relatively good average
remaining energy when compared to other two protocols.
75
80
85
90
95
100
0 10 20 30 40 50 60 70 80 90 100
AVERAGE REMAINING ENERGY AGP PERIOD = 10AVERAGE REMAINING ENERGY AGP PERIOD = 20AVERAGE REMAINING ENERGY AGP PERIOD = 30
AV
ER
AG
E R
EM
AIN
ING
EN
ER
GY
PACKETS SENT
Texas Tech University, Deepika Murali, May 2012
50
4.3.8.2 Comparison of average redundancy for fixed intervals 10, 20 and 30 in
AGP
Figure 4.26: Average redundancy of AGP for Periodic Time = 10, 20 & 30
Average redundancy of a transmission is high when more number of messages
is exchanged from source to destination. It is essential that we reduce the average
redundancy in order to conserve energy. In this thesis we analyzed the behavior of
average redundancy by varying the periodic time as 10ms, 20ms and 30ms. As the
time increases more number of nodes happens to participate in the transmission
thereby resulting in large number of message exchanges. In order to control this and
achieve less average redundancy we choose to simulate using 10ms instead of 20ms or
30ms.
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 10 20 30 40 50 60 70 80 90 100
AVERAGE REDUNDANCY AGP PERIOD = 10
AVERAGE REDUNDANCY AGP PERIOD = 20
AVERAGE REDUNDANCY AGP PERIOD = 30
AV
ER
AG
E R
ED
UN
DA
NC
Y
PACKETS SENT
Texas Tech University, Deepika Murali, May 2012
51
4.3.8.3 Comparison of average latency for fixed intervals 10, 20 and 30 in
AGP
Figure 4.27: Average latency of AGP for Periodic Time = 10, 20 & 30
In the case of latency it is essential that packet transmission consume less
amount of time as latency is directly proportional to energy. When packets sent take
more time to reach the destination in a dense network we can assume that more
number of messages are being exchanged which indirectly leads to more energy loss.
Moreover as the network is highly dense it does not affect the latency though nodes
sleep frequently in the case of 10ms. But when we consider 20ms and 30ms latency is
relatively high as more number of nodes participates in a message transmission. Hence
we decide to use 10ms as the periodic time for the nodes to wake up and choose the
random sleep time. This helps us achieve a comparative delivery ratio with less
latency, less redundancy and more remaining energy.
0
5
10
15
20
25
30
0 10 20 30 40 50 60 70 80 90 100
Average Latency AGP Period =10
Average Latency AGP Period =20A
VE
RA
GE
LA
TE
NC
Y
PACKETS SENT
Texas Tech University, Deepika Murali, May 2012
52
4.3.8.4 Comparison of average number of messages exchanged for fixed
intervals 10, 20 and 30 in AGP
Figure 4.28: Average number of messages exchanged in AGP for Periodic Time = 10,
20 & 30
Total number of messages exchanged for a transmission increases when more
number of nodes participate in the transmission. Therefore in order to conserve more
energy it is essential to limit the number of forwarding candidates. By limiting the
forwarding candidates we make the nodes sleep instead of staying idle. Hence if the
nodes sleep frequently within shorter time span it is possible to preserve more energy
with less number of forwarding candidates. Thus we opt 10ms as the periodic time
interval as in the case of 20ms and 30ms the number message exchanges are
comparatively high.
0
30
60
90
120
150
180
210
240
270
300
0 10 20 30 40 50 60 70 80 90 100
AVERAGE MESSAGE EXCHANGED AGP PERIOD = 10
AVERAGE MESSAGE EXCHANGED AGP PERIOD = 20
AVERAGE MESSAGE EXCHANGED AGP PERIOD = 30
AV
ER
AG
E M
ES
SA
GE
EX
CH
AN
GE
D
PACKETS SENT PACKETS SENT
Texas Tech University, Deepika Murali, May 2012
53
4.3.8.5 Comparison of total number of nodes participated for fixed intervals
10, 20 and 30 in AGP
Figure 4.29: Total number of nodes participated in AGP for Periodic Time = 10, 20 &
30
In all the existing works almost all the nodes participate in a message
transmission thereby consuming large amount of energy. Thus in AGP we reduce the
number of nodes participating by selecting forwarding candidates through source
based approach and making the remaining nodes sleep. From the above graph we can
infer that total number of nodes participating is comparatively high in the case of
20ms and 30ms whereas in the case of 10ms as the nodes sleep frequently it
considerably limits some of the nodes from forwarding the message. Hence in order to
achieve energy efficiency we choose to simulate using 10ms.
0
100
200
300
400
500
600
0 10 20 30 40 50 60 70 80 90 100
NODES PARTICIPATED AGP PERIOD = 10
NODES PARTICIPATED AGP PERIOD = 20
NODES PARTICIPATED AGP PERIOD = 30
NO
DE
S P
AR
TIC
IPA
TE
D
PACKETS SENT PACKETS SENT
Texas Tech University, Deepika Murali, May 2012
54
4.3.8.6 Comparison of average delivery ratio for fixed intervals 10, 20 and 30
in AGP
Figure 4.30: Average delivery ratio of AGP for Periodic Time = 10, 20 & 30
The delivery ratio of AGP is analyzed by varying the fixed time interval. It is
clearly evident that average delivery ratio increases as the fixed time period increases.
The delivery ratio in the case of 20ms and 30ms is relatively high because total
number of nodes participating in the transmission is high. Though there is a
comparative increase in the delivery ratio with the increase in time all the other
parameters have an inverse affect. On an average 10ms, 20ms and 30ms show a
delivery ratio of 68%, 69% and 71%. As the increase in delivery ratio has a very slight
impact and also considering rest of the parameters to achieve energy efficiency we
choose to simulate results for 10ms.
0
10
20
30
40
50
60
70
80
90
100
0 10 20 30 40 50 60 70 80 90 100
DELIVERY RATIO AGP PERIOD = 10
DELIVERY RATIO AGP PERIOD = 20
DELIVERY RATIO AGP PERIOD = 30
DE
LIV
ER
Y R
AT
IO
PACKETS SENT PACKETS SENT
Texas Tech University, Deepika Murali, May 2012
55
4.4 Summary
In this section, we summarize our simulation results for various parameters to
get an outlook on the advantages and disadvantages of the three protocols. We analyze
the results based on the six parameters described above by varying the number of
packets sent.
Based on the simulation results of average remaining energy we infer that the
remaining energy values of gossip1(p,k) is similar to the values of AGP when the
gossip probability is around 0.60 and as the gossip probability increases the graph
becomes a linear graph similar to flooding. When we compare the results of Flooding
with AGP we can infer that around 12% more energy is conserved in AGP whereas
when compared to gossip1(p,k) AGP conserves around 3-10% more energy for a
range of gossip probabilities 0.60 to 0.95. Hence AGP comparatively conserves more
energy than the other two existing protocols.
The parameters average redundancy and the average number of messages
exchanged also follow a pattern similar to the remaining energy. We can say that
redundancy and number of messages exchanged are directly proportional to each
other. So when the number of message exchanged between the nodes increases the
redundancy at the sink automatically increases. In the case of flooding all the nodes re-
transmit the messages the number of times it receives. Hence it is very evident that it
has very high message exchanges between the nodes and in turn very high
redundancy. In the case of gossip1(p,k) the number of messages exchanged reduces as
transmission is based on certain specified probability. In the case of AGP we reduce
Texas Tech University, Deepika Murali, May 2012
56
the number of nodes gossiping the message and there is no specific probability that
each node should use. In comparison with AGP, flooding populates 70% more
messages and gossip1(p,k) populates 40% more messages. Therefore, average
redundancy of flooding is 5 times that of AGP and for gossip1(p,k) it (2-5) times
higher than AGP which varies according to gossip probability (0.60-0.95).
The simulation results of average latency imply that flooding takes a very high
working time and gossip1(p,k) also follows a similar latency trend when the gossip
probability gets closer to 1. The latency of AGP is almost negligible when compared
to gossip1(p,k) or flooding and is exponentially lower than either of the two protocols.
For example in the case of transmitting 100 packets from the source to destination
flooding and gossip1(p,k) take around 65 times and 58 times more time than AGP
respectively. The parameter total number of nodes participated in forwarding the
message in the case of AGP is significantly less when compared to flooding and
gossip1(p,k). As more number of messages are populated in the case of flooding and
gossip1(p,k) at one instance most likely all the nodes participate in forwarding the
message. But in the case of AGP as the forwarding candidates are selected and also
gossip probability is random only two thirds of the total nodes participate in
transmitting.
Finally, as we know delivery ratio of flooding is always 100% as all the nodes
participate in forwarding the message. Similarly, in the case of gossip1(p,k) gossip
probability is directly proportional to delivery ratio that is lesser the gossip probability
lesser the delivery ratio and vice versa. In the case of AGP as we limit the number of
Texas Tech University, Deepika Murali, May 2012
57
nodes participating and introduce sleep probability the delivery ratio is comparatively
less. AGP also achieves 68% delivery ratio on an average which is moderate when
compared to the other two protocols.
Texas Tech University, Deepika Murali, May 2012
58
CHAPTER V
CONCLUSION AND FUTURE WORK
In this chapter, we summarize our work and list the possible advancements for
future work.
5.1 Conclusion
The adaptive gossip based sleep protocol is designed to conserve the energy of
the WSN as much as possible without significant data losses. Hence, we need to
moderate between energy efficiency and the delivery ratio of the network. In order to
achieve this, the AGP incorporates the sleep protocol with the gossiping protocol to
minimize energy consumption. The AGP also selects only a few selective forwarding
candidates to forward the data packets down to the sink at each node thereby reducing
the number of nodes participating in the data transmission. This also reduces the
number of redundant packets that are transmitted in the network further conserving the
energy of the network. The main purpose of implementing these concepts in the AGP
was to overcome the existing drawbacks of flooding and gossiping protocols.
The nodes in the network are randomly deployed and the sink is fixed at (0,0).
The source node is chosen such that the data packets have to travel the entire network
to reach the destination. The sender node selects a few neighboring nodes alone to act
as forwarding candidates and assigns the rest of the neighboring nodes to sleep. These
sleeping nodes do not take part in forwarding the data during the sleep period and
hence conserves a lot of energy by not staying awake. The forwarding candidates
forward data based on a gossip probability that is randomly generated and the process
Texas Tech University, Deepika Murali, May 2012
59
is continued until all the messages reach the sink. Furthermore, each node sleeps at a
random time period once every ‘n’ clock ticks. This further improves the energy
efficiency of the network.
Based on the simulation results, it can be seen that the AGP algorithm meets
the design criteria it was meant for. The energy efficiency of the adaptive gossip
protocol is comparatively better than gossip1(p,k) and flooding algorithms in most of
the parameters considered. Furthermore, the number of redundant messages, number
of nodes participating in the transmission and the number of messages exchanged in
the network is also considerably reduced when compared to the other two protocols.
There is also a significant improvement in the latency of the network when comparing
AGP with gossip1(p,k) and flooding algorithms. The delivery ratio is comparatively
less than gossip1(p,k) and flooding algorithm due to the reduction in number of
redundant messages and reducing the number of nodes participating in the
transmission. However, the gain in energy efficiency far outweighs the drop in the
delivery ratio of the system. Hence it can be seen that AGP is a more energy efficient
protocol that has numerous advantages over gossip1(p,k) and flooding such as -
Lower Latency, Lesser number of redundant messages, lesser number of nodes
participating in the transmission, lesser number of messages exchanged and a longer
network lifetime.
Texas Tech University, Deepika Murali, May 2012
60
5.2 Future work
In future, we plan to further improve the existing protocol to increase the
delivery ratio of the system. We know it is very difficult to achieve both high energy
efficiency and high delivery ratio in a network. In order to improve the delivery ratio
of the current network it is essential to modify the network setup to have multiple
sinks instead of one. In that case each node might deliver the packets to the nearest
available sink. In this case, the delivery ratio of the network should increase
substantially while maintaining the same energy efficiency that has been achieved
now. We also plan to test the network with multiple sources working together so that
multiple events are generated at the same time. This will also include dealing with
collisions among packets and arbitration for nodes. The future work can also include
implementing the same network in a mobile sensor network environment and simulate
results. In a mobile sensor network the neighboring nodes will keep changing every
time the node moves. Thus in future we plan to work on the above targets one after the
other to simulate and analyze the results.
Texas Tech University, Deepika Murali, May 2012
61
REFERENCES
[1] Zygmunt J. Haas, Joseph Y. Halpern, Li Li; “Gossip-Based Ad Hoc Routing”;
Proceedings of INFOCOM, 2002.
[2] Ananth V. Kini, Vilas Veeraraghavan, Nikhil Singhal, Steven Weber Drexel;
“SmartGossip: An Improved Randomized Broadcast Protocol for Sensor Networks” in
the Fifth International Conference, 2006.
[3] Christopher L. Barrett, Stephan J. Eidenbenz, Lukas Kroc, Madhav Marathe,
James P. Smith; “Parametric Probabilistic Sensor Network Routing” in WSNA, 2003.
[4] Xiaobing Hou, David Tipper; “Gossip-Based Sleep Protocol (GSP) for Energy
Efficient Routing in Wireless Ad Hoc Networks” in Wireless Communications and
Networking Conference, 2004.
[5] Pradeep Kyasanur, Romit Roy, Choudhury Indranil Gupta; “Smart Gossip: An
Adaptive Gossip-based Broadcasting Service for Sensor Networks”, in Mobile Adhoc
and Sensor Systems (MASS), 2006.
[6] David Braginsky, Deborah Estrin; “Rumor Routing Algorithm for Sensor
Networks”, WSNA, 2002.
[7] S. Murthy, J. J. Garcia-Luna-Aceves; “An efficient routing protocol for wireless
networks,” ACM Balzer Mobile Networks and Applications Journal, 1996.
[8] B. Karp, H. T. Kung; “Greedy perimeter stateless routing (GPSR) for wireless
networks”, in Mobile Computing and Networking (MobiCom), 2000.
[9] S-Y Ni, Y-C Tseng, Y-S Chen, J-P Sheu; “The broadcast storm problem in a
mobile ad hoc network”, in Mobicom, 1999.
[10] W. R. Heinzelman, A. Chandrakasan, H. Balakrishnan; “Energy efficient
communication protocol for wireless microsensor networks”, in IEEE Hawaii
International Conference on System Sciences, 2000.
[11] Y. Xu, J. Heildemann, D. Estrin; “Geography-informed energy conservation for
ad hoc routing”, in proceeding of ACM SIGMOBILE, 2001.
Texas Tech University, Deepika Murali, May 2012
62
[12] Intanagonwiwat C., Govindan R., Estrin D.; “Directed Diffusion: A Scalable and
Robust Communication Paradigm for Sensor Networks” in Mobile Computing and
Networks (MobiCOM), 2000.
[13] Vamsi Paruchuri, Shivakumar Basavaraju, Arjan Durresi, Rajgopal Kannan;
“Random Asynchronous Wakeup Protocol” in BroadNets 2004.
[14] B. Chen, K. Jamieson, H. Balakrishnan, R. Morris; “SPAN: an energy-efficient
coordination algorithm for topology maintenance in ad hoc wireless networks” in
MOBICOM, 2001.
[15] C. Schurgers, V. Tsiatsis, S. Ganeriwal, M. Srivastava; “Optimizing sensor
networks in the energy-latency-density design space” in IEEE Transactions on Mobile
Computing, 2002.
[16] X. Yang, N. H. Vaidya; “Wakeup scheme for sensor networks: Achieving
balance between energy saving and endto-end delay” in Technical report, CSL, 2003.
[17] C. E. Perkins, E. M. Royer; “Ad-hoc on-demand distance vectorrouting,” in IEEE
Workshop on Mobile Computing Systems and Applications, 1999.
[18] Z. Shi, H. Shen; Adaptive Gossip-based Routing Algorithm in IPCCC, 2004.
Texas Tech University, Deepika Murali, May 2012
63
APPENDIX A
CODE IMPLEMENTATION
In this appendix, we present the implementation of AGP using the CSIM. This section
describes an overview of the functions and modules that have been created, executed
and tested for AGP.
void init()
// initializations
//network topology
node[0].x=0;
node[0].y=0;
fprintf(fp1,"%d \n",node[0].x);
fprintf(fp2,"%d \n",node[0].y);
fprintf(fp3,"x=%d y=%d node 0 \n",node[0].x,node[0].y);
for(i=1;i<NUMNODES;i++)
{
if(tcount>=20)
{
tempx1=tempx1+xdist;
tempx2=tempx2+xdist;
tcount=0;
}
randx=uniform(tempx1,tempx2);
randy=uniform(0,NETWORKY);
node[i].x=randx;
fprintf(fp1,"%d \n",node[i].x);
node[i].y=randy;
fprintf(fp2,"%d \n",node[i].y);
fprintf(fp3,"x=%d y=%d node %d \n",node[i].x,node[i].y,i);
tcount++;
}
printf("\nNetwork Established!!!\n");
//The network of dimensions 250x200 was created with 500 nodes deployed in it.
Every 10 units in the x-axis have 20 nodes randomly deployed.
Texas Tech University, Deepika Murali, May 2012
64
void discovery(int n)
{
create("discovery");
printf("\n discovering network at time %lf",clock);
int temp1;
msg *m;
//creating message and populating message details
m = (msg *)do_malloc(sizeof(struct msg));
m->from = n;
m->type = 1;
m->hop_count=0;
hold(TRANS_TIME);
for(temp1=0;temp1<node[n].onehopcount;temp1++)
{
m->to=node[n].onehoplist[temp1];
printf("\n node:%d , loop:%d, value of m->to:%d",n,temp1,m->to);
send(node[m->to].input,(long)m);
}
}
//Create the process discovery in order to gather the one-hop neighbors of each node.
This is essential when we populate the D2D messages from the sink to determine the
front node, rear node and neighboring node list.
void sync(int n)
{
create("sync");
int i,j,rtime;
int temp1;
msg *m3;
hold(10);
while(1)
{
node[i].slept_once=0;
m3 = (msg *)malloc(sizeof(struct msg));
m3->from = n;
m3->type = 3;
m3->data=node[n].myenergy;
m3->hop_count=0;
m3->eventno=0;
for(temp1=0;temp1<node[n].frontcount;temp1++)
{
Texas Tech University, Deepika Murali, May 2012
65
m3->to=node[n].frontlist[temp1];
send(node[m3->to].input,(long)m3);
}
for(temp1=0;temp1<node[n].nbrcount;temp1++)
{
m3->to=node[n].nbrlist[temp1];
send(node[m3->to].input,(long)m3);
}
rtime = (unsigned int)(rand()*n) % SYNTIME;
hold(rtime);
if(node[i].slept_once!=1&& n!=nodeselected)
{
node[n].state = 0;
hold(0.1);
node[n].state = 1;
node[n].myenergy -= S_ENERGY;
hold(SYNTIME - rtime -0.1
}
}
//In the Sync function the network the network has periodic intervals of 10ms. All the
nodes decide to sleep at any random time 0.1 unit within 10 unit of fixed time. This 0.1
unit is chosen using the formula (rand()*n) % SYNTIME where we generate a random
number, multiply with the node number and then take a modulus of 10 for the obtained
value. After sleep each node stays awake until sync period. All nodes send its energy
information to the front nodes and neighboring during every sync period.
void random_event() //generating an even at random node
{
create("event");
int i,events=0,j=0;
printf("\nIn Random event\n");
FILE *fp
while(events<1) //Creating a single event
{
printf("\nBefore hold\n");
hold(50.0);
int nodeselected = 0;
nodeselected = 486;
event_node = nodeselected;
events++;
printf("\nEvent generated at node:%d time:%lf, event
number:%d\n",nodeselected,clock,events);
for(i=1; i<=NO_OF_PACKETS; i++)
Texas Tech University, Deepika Murali, May 2012
66
{
send_msg(nodeselected,nodeselected,0,i,events,1,0);
hold(TRANS_TIME);
}
}
}
//This function is to generate a random event at any node. When the random event is
triggered the node sends specified number of packets to the destination through the
intermediate nodes.
void send_msg(int n, int src, int hop_cnt, int msg_id, int event_no, int fc, int fs)
{
//INCLUDE GOSSIP PROB//////
ifc = (float)(1.0/fc);
ifs = (float)(1.0/(node[n].uniquecount));
gossip_prob = pow(ifc,ifs);
//The node calculates the gossip probability before forwarding the message to its
neighboring nodes. The variable uniquecount has the count of both and rear nodes
and neighboring nodes.
for(i = 0; i < fccounter; i++)
{
if(node[n].uniqueenergy[fclist[i]] >= avg_unique_energy)
{
fc++;
} //if greater than avg energy
}///for
fs = fccounter - fc;
///////////////////////////
m->fc = fc;
m->fs = fs;
if(fccounter==1)
gossip_prob=1;
Texas Tech University, Deepika Murali, May 2012
67
for(i=0; i<fccounter; i++)
{
prob = uniform(0,0.5);
if(prob <= gossip_prob)
{
send=1;
m->to = node[n].uniquelist[fclist[i]];
n1 = m->to;
node[n1].node_status = m->node_status;
if(m->from == src &&
node[event_node].ev[event_no][msg_id] == 0)
{
node[event_node].ev[event_no][msg_id] =
time(NULL);
}
node[n].exchange[m->eventno]++;
hold(TRANS_TIME);
//printf("energy = %lf",node[n].myenergy);
node[n].myenergy = node[n].myenergy - T_ENERGY;
//printf("energy = %lf",node[n].myenergy);
//DOUBLE SLEEP TIME!!!!
if(n!=nodeselected)
{
node[n].state = 0;
node[n].slept_once=1;
hold(T_DELAY);
node[n].state = 1;
}
}
}
}
//The node verifies if the energy of each node in the uniquelist other than the nodes
already forwarded is greater than the average remaining energy obtained. If this
condition is satisfied the node updates the Fc list else updates the Fs list. The node
then generates a random probability compares this probability with the calculated
probability value. If the generated value is less than the calculated value then the node
decides to gossip the message else it decides not to gossip. After gossiping the
message node decides to sleep for T_DELAY in order to conserve some energy.
Texas Tech University, Deepika Murali, May 2012
68
void node_recv(int n) // to receieve messages into the mailbox
{
switch(s1)
{
case 1://distance to destination message
send=0;
//printf("\nnoded2d %d
mdata:%d",node[n].d2d,(int)m->hop_count);
if(node[n].d2d==0&&n!=0)//if distance to
destination field is not set and node is not sink
{
node[n].d2d=(int)m->hop_count+1;
node[n].rearlist[node[n].rearcount]=m->from;
node[n].rearcount++;
node[n].uniquelist[node[n].uniquecount]=m->from;
node[n].uniquecount++;
send=1;
}
else if(node[n].d2d==(int)m->hop_count&&
node[n].d2d!=0)
{// neighbour node
if(n!=0)
{
node[n].nbrlist[node[n].nbrcount]=m-
>from;
node[n].nbrcount++;
node[n].uniquelist[node[n].uniquecount]=m->from;
node[n].uniquecount++;
}
}
else if( (node[n].d2d-(int)m->hop_count)==1)// rear
{
node[n].rearlist[node[n].rearcount]=m->from;
node[n].rearcount++;
node[n].uniquelist[node[n].uniquecount]=m->from;
node[n].uniquecount++;
Texas Tech University, Deepika Murali, May 2012
69
}
else if((node[n].d2d-(int)m->hop_count)==-
1)//front node
{
node[n].frontlist[node[n].frontcount]=m-
>from;
node[n].frontcount++;
}
//If we send the message of type 1 it is for calculating the D2D. At the initial
deployment the sink populates one hop messages to its one-hop neighbors appending
the message with a distance value 0. The receiving nodes update its D2D value by
adding one to the received value. If the current node’s D2D value and the received
value are the same the neighboring node list is updated. If the difference of current
node’s value and received value is equal to 1 then the node is added to the rear list
and if the difference is -1 it is added to the front node list.
Case2:
else
{
if(node[n].node_status == 1)
{
send_msg(n, m->src, m->hop_count, m-
>msg_id, m->eventno, m->fc, m->fs);
}
else if(node[n].node_status == 0)
{
// CALCULATE SLEEP PROB
ifs = (float)(1.0/node[n].myenergy);
sprobability = pow(ifs,
(1.0/node[n].uniquecount));
prob = uniform(0,0.5);
if(prob <= sprobability)
{
node[n].state = 0;
node[n].slept_once=1;
hold(sprobability);
node[n].state = 1;
Texas Tech University, Deepika Murali, May 2012
70
}
}
}
break;
//If the node receives the message of type 2 and the node is chosen as the sleep
candidate then the node calculates the sleep probability. The sleep probability is
calculated using the remaining energy and number of neighboring nodes of the
current node. The node then generates a random probability and compares this
probability with the calculated probability value. If the generated value is less than
the calculated value then the node decides to sleep else it decides not to sleep.
case 3://energy information of other nodes
tempid=m->from;
for(i=0;i<node[n].uniquecount;i++)
{
if(tempid==node[n].uniquelist[i])
node[n].uniqueenergy[i]=m->data;
}
break;
default:
printf("\n\n\n\n\n\n\???BUG???________default
case should not be executed\n\n\n\n\n\n ");
break;
}
}
break;
}//switch close
}//while close
//This is message type 3 which send energy information to the neighboring nodes and
rear nodes periodically.