DECLARATION………………………………………………………………………………………...ii
ACKNOWLEDGEMENT……………………………………………………………………………...iii
CERTIFICATE………………………………………………………………………………………....iv
ABSTRACT……………………………………………………………………………………………...v
ABBREVIATION………………………………………………………………………………………vi
LIST OF FIGURES…………………………………………………………………………………...viii
INTRODUCTION .................................................................................................................................... 1
1.1. WIRELESS SENSOR NETWORK ........................................................................................ 1
1.1.1. Sensor Nodes. ..................................................................................................................... 3
1.1.2. Base Station ........................................................................................................................ 4
1.1.3. Radio Model ....................................................................................................................... 4
1.1.4. Characteristics Of WSN ..................................................................................................... 5
1.1.5. Applications of WSN.......................................................................................................... 6
1.2. ROUTING PROTOCOLS ....................................................................................................... 7
1.2.1. Classification of Routing Protocols .................................................................................... 7
1.3. MOTIVATION ......................................................................................................................... 8
1.3.1. Design challenges in WSNs ............................................................................................... 8
1
2.3.5. MULTIHOP LEACH ....................................................................................................... 18
2.3.6. TL-LEACH (Two-Level Low Energy Adaptive Clustering Hierarchy) .......................... 18
2.3.7. LEACH-M (Mobile Low Energy Adaptive Clustering Hierarchy) .................................. 19
CODING.................................................................................................................................................. 30
4.1. MAIN PROGRAM…………………………………………………………………………………….………………….…32
CONCLUSION ....................................................................................................................................... 46
REFRENCES…………………………………………………………………………………………...48
2
CHAPTER 1
INTRODUCTION
In this chapter, we first provide an overview of wireless sensor network, then we focus on the
energy efficient routing algorithms. In addition, we describe the components of WSNs and an
energy efficient routing protocol in wireless sensor network.
Wireless sensor network (WSN) refers to a group of spatially dispersed and dedicated
sensors for monitoring and recording the physical conditions of the environment and
organizing the collected data at a central location. WSNs measure environmental
conditions like temperature, sound, pollution levels, humidity, wind, and so on.
These are similar to wireless ad hoc networks in the sense that they rely on wireless
connectivity and spontaneous formation of networks so that sensor data can be
transported wirelessly. WSNs are spatially distributed autonomous sensors to monitor
physical or environmental conditions, such as temperature, sound, pressure, etc. and to
cooperatively pass their data through the network to a main location. The more modern
networks are bi-directional, also enabling control of sensor activity. The development of
wireless sensor networks was motivated by military applications such as battlefield
surveillance; today such networks are used in many industrial and consumer applications,
such as industrial process monitoring and control, machine health monitoring, and so on.
The WSN is built of "nodes" – from a few to several hundreds or even thousands, where
each node is connected to one (or sometimes several) sensors. Each such sensor network
node has typically several parts: a radio transceiver with an internal antenna or
connection to an external antenna, a microcontroller, an electronic circuit for interfacing
with the sensors and an energy source, usually a battery or an embedded form of energy
1
harvesting. A sensor node might vary in size from that of a shoebox down to the size of
a grain of dust, although functioning "motes" of genuine microscopic dimensions have
yet to be created. The cost of sensor nodes is similarly variable, ranging from a few to
hundreds of dollars, depending on the complexity of the individual sensor nodes. Size
and cost constraints on sensor nodes result in corresponding constraints on resources
such as energy, memory, computational speed and communications bandwidth. The
topology of the WSNs can vary from a simple star network to an advanced multi-hop
wireless mesh network. The propagation technique between the hops of the network can
be routing or flooding.
2
The WSN consist of two main components:
1.Sensor Nodes, and
2.Base Station (Central Gateway).
Sensors nodes are typically built of few sensors and a mote unit as shown in Fig.1.2. A
Sensor is a device which senses the information and pass it on to mote. Sensors are
typically used to measure the changes in physical environmental parameters like
temperature, pressure, humidity, sound, vibration and changes in the health parameter of
person e.g. blood pressure and heartbeat. MEMS based sensor have found good use in
sensor nodes. A mote consists of processor, memory, battery, A/D converter for
connecting to a sensor and a radio transceiver for forming an ad hoc network. A mote and
sensor together form a Sensor Node. A sensor network is a wireless ad-hoc network of
sensor nodes. Each sensor node can support a multi-hop routing algorithm and function
as forwarder for relaying data packets to a base station.
3
1.1.2. Base Station
A base station links the sensor network to another network. It consists of a processor,
radio board, antenna and USB interface board. It is preprogrammed with low-power mesh
networking software for communication with wireless sensor nodes. Deployment of the
base station in a wireless sensor network is very important as all the sensor nodes
handover their data to the base station for processing and decision making. Energy
conservation, coverage of sensor nodes and reliability issues are taken care of during
deployment of base station in sensor network. Generally base stations are assumed static
in nature but in some scenarios they are assumed to be mobile to collect the data from
sensor nodes. (Fig 1.3)
We have assumed the same radio model which has been used in earlier works. For the
radio hardware, the transmitter dissipates energy to run the transmitter radio electronics
and power amplifier, and the receiver dissipates energy to run the receive radio electronics
as shown in Fig.1.4. For the scenarios described in this project work, both the free space
(d2 power loss) and the multi path fading (d4 power loss) channel models were used
depending on the distance between the transmitter and the receiver. If the distance is less
4
than a threshold, the free space (fs) model is used; otherwise, the multi path (mp) model
is used.
5
1.1.5. Applications of WSN.
Area monitoring is a common application of WSNs. In area monitoring, the WSN is deployed
over a region where some phenomenon is to be monitored. A military example is the use of
sensors to detect enemy intrusion; a civilian example is the geo-fencing of gas or oil pipelines.
There are several types of sensor networks for medical applications: implanted, wearable, and
environment-embedded. Implantable medical devices are those that are inserted inside the human
body. Wearable devices are used on the body surface of a human or just at close proximity of the
user. Environment-embedded systems employ sensors contained in the environment. Possible
applications include body position measurement, location of persons, overall monitoring of ill
patients in hospitals and at home. Devices embedded in the environment track the physical state
of a person for continuous health diagnosis, using as input the data from a network of depth
cameras, a sensing floor, or other similar devices. Body-area networks can collect information
about an individual's health, fitness, and energy expenditure.In health care applications the
privacy and authenticity of user data has prime importance. Especially due to the integration of
sensor networks, with IoT, the user authentication becomes more challenging; however, a
solution is presented in recent work.
There are many applications in monitoring environmental parameters, examples of which are
given below. They share the extra challenges of harsh environments and reduced power supply.
6
1.2. Routing Protocols
The applications of wireless sensor networks comprise a wide variety of scenarios. In most
of them, the network is composed of a significant number of nodes deployed in an extensive
area in which not all nodes are directly connected. Then, the data exchange is supported by
multihop communications. Routing protocols are in charge of discovering and maintaining
the routes in the network. However, the appropriateness of a particular routing protocol
mainly depends on the capabilities of the nodes and on the application requirements.
1.1.2.1.Data Centric
Data centric protocols are query based and they depend on the naming of the desired data,
thus it eliminates much redundant transmissions. The BS sends queries to a certain area
for information and waits for reply from the nodes of that particular region. Since data is
requested through queries, attribute based naming is required to specify the properties of
the data. Depending on the query, sensors collect a particular data from the area of interest
and this particular information is only required to transmit to the BS and thus reducing
the number of transmissions. e.g. SPIN was the first data centric protocol.
7
1.1.2.2.Hierarchical
Hierarchical routing is used to perform energy efficient routing, i.e., higher energy nodes
can be used to process and send the information; low energy nodes are used to perform
the sensing in the area of interest. e.g. LEACH, TEEN, APTEEN.
1.1.2.3.Location Based
Location based routing protocols need some location information of the sensor nodes.
Location information can be obtained from GPS (Global Positioning System) signals,
received radio signal strength, etc. Using location information, an optimal path can be
formed without using coding techniques. e.g. Geographic and Energy-Aware
Routing(GEAR).
1.3. MOTIVATION
There are some major design challenges in wireless sensor networks due to lack of
resources such as energy, bandwidth and storage of processing. While designing new
routing protocols, the following essentials should be fulfilled by a network engineer.
Wireless sensor networks are mostly battery powered. Energy shortage is a major issue in
these sensor networks especially in aggressive environments such as battlefield etc. The
performance of sensor nodes is adversely affected when battery is fallen below a pre-
defined battery threshold level. Energy presents a main challenge for designers while
designing sensor networks. In wireless sensor network, there are millions of motes. Each
8
node in this network has restricted energy resources due to partial amount of power. So, the
routing protocol should be energy efficient.
1.3.1.2. Complexity
The complexity of a routing protocol may affect the performance of the entire wireless
network. The reason behind is that we have inadequate hardware competences and we also
face extreme energy limitations in wireless sensor networks.
1.3.1.3. Scalability
As sensors are becoming cheaper day by day, hundreds or even thousands of sensors can
be installed in wireless sensor network easily. So, the routing protocol must support
scalability of network. If further nodes are to be added in the network any time then routing
protocol should not interrupt this.
1.3.1.4. Delay
Some applications require instant reaction or response without any substantial delay such
as temperature sensor or alarm monitoring etc. So, the routing protocol should offer
minimum delay. The time needed to transmit the sensed data is required to be as little as
possible in above cited WSN applications.
1.3.1.5. Robustness
Wireless sensor networks are deployed in very crucial and loss environments frequently.
Occasionally, a sensor node might be expire or leaving the wireless sensor network. Thus,
the routing protocol should be capable to accept all sorts of environments including severe
and loss environments. The functionality of the routing protocol should be fine also.
9
1.3.1.6. Data transmission and transmission models
There are four modes of data transmission depending on the applications in wireless sensor
networks namely as query driven, event driven and continuous type and hybrid type. A
node begins to transmit the data only when sink creates the query or an event occurs in
query driven model and event driven model. The data is sent out periodically in continuous
transmission mode. The performance of the routing protocol is a function of network size
and transmission media. So, transmission media of good quality enhances the network
performance directly.
Another major challenge that is faced by wireless sensor network designers is to correctly
locate of the sensor nodes. Most routing protocols use some localization technique to obtain
knowledge concerning their locations. Global positioning system (GPS) receivers are used
in some scenario.
1.3.2. LEACH
LEACH gives birth to many protocols. The procedures of this protocol are compact and
well coped with homogeneous sensor environment. According to this protocol, for every
round, new cluster head is elected and hence new cluster formation is required. This leads
to unnecessary routing overhead resulting in excessive use of limited energy. If a cluster
head has not utilized much of its energy during previous round, than there is probability
that some low energy node may replace it as a cluster head in next cluster head election
process.
There is a need to limit change of cluster heads at every round considering residual energy
of existing cluster head. Hence an efficient cluster head replacement algorithm is required
to conserve energy. In clustering protocols as LEACH, nodes use same amplification
energy to transmit data regardless of distance between transmitter and receiver. To
preserve energy, there should also be a transmission mechanism that specify required
10
amplification energy for communicating with cluster head or base station. For example,
transmitting a packet to cluster head with same amplification power level as required by
a node located at farthest end of network to base station results in wastage of energy. One
solution can be having global knowledge of network and than nodes decide how much
they need to amplify signal. Locating and calculating distances with in full network
topology needs lot of routing and so, this approach do not work for saving energy.
11
CHAPTER 2
LITERATURE REVIEW
The needed detailed literature survey, to get preliminary knowledge and search scope of inves-
tigation, to implement Low energy adaptive clustering hierarchy, is explained in this chap-
ter.This Report presents investigational studies in several energy efficient routing algorithms and
its general purpose. This Chapter contains the overview of Leach and its variants.
12
FIG 2.1 : LEACH Algorithm
2.1.1. OPERATION
1.Setup phase
2.Steady phase
In the setup phase, the clusters are formed and a cluster-head is chosen for each
cluster. While in the steady phase, data is sensed and sent to the central base station.
The steady phase is longer than the setup phase. This is done in order to minimize the
overhead cost.
13
T(n) = p/1-p[r mod(1/p)] if n E G
T(n) = 0 otherwise
Every node wanting to be the cluster-head chooses a value, between 0 and 1. If this
random number is less than the threshold value, T(n), then the node becomes the
cluster-head for the current round. Then each elected CH broadcasts an advertisement
message to the rest of the nodes in the network to invite them to join their clusters.
Based upon the strength of the advertisement signal, the non-cluster head nodes
decide to join the clusters. The non-cluster head nodes then informs their respective
cluster- heads that they will be under their cluster by sending an acknowledgement
message. After receiving the acknowledgement message, depending upon the number
of nodes under their cluster and the type of information required by the system (in
which the WSN is setup), the cluster-heads creates a TDMA schedule and assigns
each node a time slot in which it can transmit the sensed data. The TDMA schedule
is broadcasted to all the cluster-members. If the size of any cluster becomes too large,
the cluster- head may choose another cluster- head for its cluster. The cluster-head
chosen for the current round cannot again become the cluster-head until all the other
nodes in the network haven’t become the cluster-head. (Fig 2.2.)
FIG 2.2: Flow chart of the Set-up phase of the LEACH protocol
14
2. Steady phase :- During the steady phase, the sensor nodes i.e. the non-cluster head nodes starts
sensing data and sends it to their cluster-head according to the TDMA schedule. The cluster-head
node, after receiving data from all the member nodes, aggregates it and then sends it to the base-
station.
After a certain time, which is determined a priori, the network again goes back into the setup
phase and new cluster-heads are chosen. Each cluster communicates using different CDMA
codes in order to reduce interference from nodes belonging to other clusters. (Fig 2.3)
FIG 2.3: Flow chart of the Steady phase of the LEACH protocol
15
2.2. ASSUMPTION
LEACH protocol takes into a number of assumptions which may create a lot of
problems in the real-time systems. A few of these assumptions are as follows:
• All nodes can transmit with enough power to reach the base station if needed.
• Each node has computational power to support different MAC protocols.
• Nodes always have data to send.
• Nodes located close to each other have correlated data.
• All nodes begin with the same amount of energy capacity in each election round,
assuming that being a CH consumes approximately the same amount of energy for each
node.
Leach-B uses the decentralized algorithms of cluster formation where each sensor node
only knows about its own position and the final receiver and does not know about the
position of all the sensor nodes. Leach-B involves the following techniques. Cluster head
selection algorithm, Cluster formation and data transmission with multiple access. By
evaluating the energy dissipated in the path between final receiver and itself, each of the
sensor node chooses its cluster head. Efficiency of Leach-B is better than Leach (Pantazis
et al.[2013]).
16
2.3.2. LEACH-C (Centralized Low Energy Adaptive Clustering Hierarchy)
It involves a centralized clustering algorithm. The steady state will remains the same
whereas the setup phase contains each node sending information about the current
location and also the energy level to the base station .The base station thus by utilizing
the global information of the network produce better clusters that requires the less energy
for data transmission..It needs GPS or the other location tracking method. The base
station then broadcasts the information to all nodes in the network (Muruganathan et
al.[2005]).
17
energy.To do this, the proposed routing algorithm selects sensor nodes by considering the
following factors:-
The distance between the cluster head and the base station is increased enormously when
the network diameter is increased beyond a certain level in which the scenario is not
suitable for Leach routing protocol. The energy efficiency of the protocol can be increased
by using multi- hop communication within the cluster. Multihop-Leach is a complete
distributed clustering based routing protocol. The multihop approach is utilized inside the
cluster and outside the cluster (Xiangning and Yulin[2007]).
18
nodes collect data from their respective secondary clusters. Data-fusion can also be
implemented at the primary cluster head level. The two-level structure of TLLEACH
reduces the amount of nodes that need to transmit to the base station, effectively reducing
the total energy usage (Loscri et al.[2005]).
19
CHAPTER 3
PROJECT WORK
3.1. INTRODUCTION
To cope with these constraints, initially direct transmission approach was discussed. In
direct transmission, a node sense data from its environment and transmits it straight to
base station. This method, no doubt, ensures data security however, on the other hand we
have to compromise on nodes life time due to excessive power consumption (if BS is far
away). Hence, using direct transmission technique, nodes that are far away from BS die
early as they require more power to propagate their signal, making a portion of field
vacant for sensing.
To solve this problem, minimum transmission energy (MTE) emerged. In this technique,
data is transmitted to base stations via multi hop. This gives birth to almost same problem
we faced in direct transmission. Difference is only this that in minimum transmission
energy algorithm, far away nodes remain alive longer with respect to the nodes nearer to
BS. Reason behind early expiry of nearer nodes is routing of all data traffic to base station.
More over, transmitting bulk of sensed data from each node use much energy. To
overcome this problem, concept of Directed Diffusion was introduced that discuss data
processing and dissemination.
20
According to this mechanism, all participating nodes of network are distributed in 2-hop
cluster. Though this protocol is not much energy efficient for wireless sensor nodes
however, it gives way to hierarchical clustering algorithms (Liu et al.[2011]). Clustering
for energy conservation is proven as efficient mechanism for wireless sensor networks.
When a sensor network is deployed, nodes establish clusters and nominate one node from
each cluster as a cluster head. These cluster head nodes are responsible for receiving data
from other nodes of cluster, do data aggregation/ fusion of received data and transmit it
to base station. In this way, bandwidth consumption and lifetime of network is optimized.
They prove that regardless of transmitting fused data direct from cluster head to base
station, if data is transmitted in multiple hopes i.e. from one cluster head to another and
finally to base station, it would further enhance network life time. Considering cluster
based algorithms, today numerous protocols are developed, each having different
attributes and enhancements mainly in cluster head selection algorithms. Though one
thing is common, all protocols focus on energy conservation and data aggregation
(Mahmood et al.[2013]).
In DEEC existing energy in node is election criteria of a node to become a cluster head
(Smaragdakis et al.[2004]). LEACH, TEEN, SEP, DEEC and PEGASIS are prominent
routing techniques for WSNs. Main procedure of electing a cluster head was given by
LEACH and that is further enhanced by SEP and DEEC. TEEN introduces the concept
of thresholds that gives good results in network life time by showing reactive nature.
These thresholds can be implemented in any routing protocol to enhance its performance
with respect to utility or application. Considering LEACH, the algorithm is divided into
three parts, i.e. advertising phase, Cluster Set up phase and Scheduling phase. Based on
LEACH, SEP and DEEC, numerous protocols are proposed which gives a detailed
comparison analysis on different variants of LEACH as A-LEACH, S-LEACH and M-
LEACH in terms of energy efficiency and applications.
21
3.2. System Model
LEACH is a time division multiple access (TDMA)-based MAC protocol that uses
clustering mechanism to evenly distribute the supply energy among sensors within the
network. The sensor nodes are responsible for the processing of the aggregated data and
transmit the useful information to the BS through CH. The CH is the specially selected
sensor node of each cluster, which is only allowed to communicate with the BS. The end
user is then able to receive the data through the core network/Internet as shown in LEACH
protocol operates in several rounds, where each round consists of two broad phases, i.e.
the setup phase and the steady state phase .In the initial set-up phase, the clusters are
formed and the CH node is selected. Each node of a particular cluster can participate in
the CH selection process by generating a random priority value between 0 and 1. If this
number for a member node is less than a threshold value T(n) then that node becomes the
CH. The value of the threshold T(n) is given by. The CH is also responsible for assigning
TDMA schedule for the corresponding cluster members
where p is the desired percentage of sensor nodes that can become CH, r denotes the
current round and G is the set of nodes that have not participated in CH selection process
in the previous 1/ p rounds. Since a node which is elected as CH for a particular round r
is not allowed to participate for the next 1/ p rounds, hence every sensor node in a cluster
gets fair and equal chance to become CH. Hence the energy dissipation among the sensor
nodes is distributed uniformly in a network. During the steady-state phase, the cluster
member nodes transmit the sensed data to the respective CH nodes based on TDMA
schedule. Any node can transmit the data during a particular time slot, the other nodes go
to the sleep state. In this way, the intra-cluster collision can be avoided. The main
22
objective of LEACH protocol is to increase the energy efficiency by adopting rotation-
based CH selection procedure using a random number. We use the first-order radio energy
model for communication in our modified protocol as shown in Fig. 3.1. Based on the
distance between the sensing and the receiving nodes, the first-order radio model can be
divided into the free space model and multi-path fading model. The communication
channel is assumed to be symmetrical and the energy consumed by a sensor node in
sending k bits/packet to a node d meters away can be written as
Similarly, the energy consumed by a sensor node in receiving k bits/packet can be written
as
ERx(k) = ERx_elec(k) + kEelec (4)
where Eelec is the energy consumed per bit by the transmitter or the receiver and Eamp and
Efs are the amplifier parameters of transmission corresponding to the multi-path fading
model and the free-space model, respectively. Each packet contains data bits along with
overhead. The data bits carry useful information and the overhead has information related
to packets, such as coding scheme for reliable data transmission, encryption technique
used for security and address of the source and the destination. The size of the overhead
is fixed irrespective of the packet size. So for large packet size, the spectrum and energy
used by the overhead may be negligible and alleviate the WSN spectral and energy
efficiency. Moreover, the throughput is also increased. If Ndata represents the number of
data bits in a packet and Noverhead represents the number of overhead bits with Edata and
Eoverhead be the energy associated with each data bits and overhead bits, respectively. Then
total energy of the packets is given by
23
EPacket = Ndata × Edata + Noverhead × Eoverhead (5)
For large value of Ndata, the efficiency will be almost equal to 100%. To calculate a
threshold limit for CH selection, the energy dissipated by a CH in each round has to be
calculated. In our proposed scheme, we estimate this threshold value of energy in order
to preserve energy and increase network lifetime.
24
3.3. Proposed Scheme
LEACH protocol works with a random selection of CH in each round. For every round,
the clusters are formed according to the advertisement message sent by the CH. For
example, we deployed 200 nodes in an area of 100m × 100m. Fig. 3.4 shows the initial
CH and cluster formation. In the next round, the CHs change and new clusters are formed.
However, in case a CH has not used much of its energy during its term and it can still
remain CH for the next round on the basis of remaining energy, but according to the
LEACH algorithm once a CH is selected it cannot become CH for the next 1/P rounds.
This limitation can be overcome by setting a threshold value in the existing LEACH
protocol, now called as IoT-LEACH (I-LEACH). If the CH is found to have more energy
than the threshold value, then it remains as CH for the next round also. In this way, the
energy wastage during routing information to the new CH in each round can be
controlled. The extra energy consumed for a new cluster formation due to new CH can
also be controlled.
Moreover, in a cluster-based network, there are three modes of data transmission namely
intra-cluster, inter-cluster and longhaul communication. The intra-cluster transmission
occurs when the cluster members send data to the respective CH on the basis of a TDMA
schedule. The inter-cluster transmission deals with the exchange of data between CHs
and in the long-haul transmission, the CHs transmit its fused data to the BS. The energy
requirement in all these three modes of transmission cannot be same. A low power level
is required for intra-cluster transmission with respect to long-haul transmission in order
to save an enormous amount of energy as well as a packet drop ratio. In the proposed
scheme, when a node is elected as CH, the algorithm directs it to use a high energy
amplification level. During the subsequent rounds when it changes to a cluster member,
the algorithm switches it to low power level. The algorithm of the proposed LEACH
modification is shown in Fig. 3.3.
For example, let A, B, C, D, E and F be the CHs of five different clusters in a network
with the initial energy EInit as shown in Fig. 3.2 (a). After completion of the first round,
all the nodes dissipate energy depending upon various criteria such as distance, signal
25
strength and data packet size. Let E and F are two CHs which has not expended much of
its energy and has sufficient power to be elected as CH for the next round. According to
the conventional LEACH algorithm, all the CHs A, B, C, D, E and F are not eligible for
selection of CH in the next round. However, in the proposed algorithm (Fig. 3.2 b), a
threshold limit PTh is set and any node (e.g. E and F here) that has an energy level above
it can continue to be CH with the same cluster for the next round. As a result, the energy
utilised in CH and cluster formation decreases to a considerable amount. Let us consider
there are ‘n’ nodes in a network with C percentage of clusters and R is the count of CH
replacement. PkTx and PkRx are the transmitted and received packet sizes, respectively.
Let N = nC denotes the number of nodes in each cluster. During cluster formation stage,
some energy will be utilised in the CH replacement process. Let this energy be denoted
by PHR, such that
where PTx = Energy transmitted in the transmission of 1 byte data. PRx = Energy
transmitted in the reception of 1 byte data.
26
FIG. 3.3: I-LEACH algorithm
27
Then the total energy of each cluster PWEC will be the product of the initial power given
to each node and the total nodes in a cluster which can be written as:
where EInit is the initial energy supplied to each node. To calculate the total energy
granted in each cluster unit, we need to know the energy consumed by each cluster ‘i’ per
round. This can be evaluated by calculating the energy cost both when it acts as CH and
as member node. Therefore
The amount of energy consumed in transmitting data from member node to CH is nPTx.
The member node then switches off the radio and goes to sleep mode until the next round
TDMA slot. The CH removes redundancy by performing data aggregation at this stage.
The energy consumed in the process is given as n(N − 1)PRx .The CH then sends the fused
data to sink node expending n(N − 1)PTx energy.
For the calculation of the threshold value for the decision of CH replacement, we also
have to get the information about the number of rounds to active as member node within
a cluster. CountRnd represents the number of rounds of operation in the network which
can be calculated by
28
From (10) and (11), we can estimate a minimum level of energy which can be considered
optimum for CH replacement method
Equation (12) represents a threshold value of power which can be applied to the LEACH
algorithm to improve the network life time while also minimising the total energy of the network.
29
CHAPTER 4
CODING
clc
clear
close all
%Computation of do
do=sqrt(Efs/Emp);
30
% load cords_1765
plot(nodes(total_nodes+1).x_cord,nodes(total_nodes+1).y_cord,'c
olor','k','marker','x')
end
%
%First Iteration
figure(1);
31
for i=1:total_nodes
nodes(i).G=0;
end
end
hold off;
figure(1);
% checking dead condition of sensor nodes
for i=1:total_nodes
hold on;
end
if nodes(i).E>0 % If energy is sufficient
nodes(i).type='N'; % Label ith node as node
% Plot the nodes
if showgraph==1
plot(nodes(i).x_cord,nodes(i).y_cord,'o','markerfacecolor','b')
;
end
% hold the figure
hold on;
end
end
% plot the sink node
32
if showgraph==1
plot(nodes(total_nodes+1).x_cord,nodes(total_nodes+1).y_cord,'x
');
end
% drawnow
% storing the dead counter into a variable dead_node
dead_node(r+1)=dead_counter;
% Store all nodes energy into a variable total_energy
total_energy=cat(1,nodes.E);
% store the total energy of the network into the variable
energy_per_round
energy_per_round(r+1)=sum(total_energy);
%When the first node dies store the iteration in which it dies
if (dead_counter==1)
if(first_dead==0)
first_dead_round=r;
first_dead=1;
end
end
CHs_count=0;
cluster=1;
% Selection of cluster head
dd=[];
for i=1:total_nodes % Looping for total number of nodes
if(nodes(i).E>0) % Checking for the energy of nodes
temp=rand; % randomly generated a number between 0 and 1
and stores it into temp
% the node can only become the cluster head if the value
of G is
% less than or equal to zero
if ( (nodes(i).G)<=0)
% Cluster Heads selection
Th=Thresh(p,r); % Checking the threshold
if(temp<= Th) % If the generated random number is
less than or equal to threshold
CHs_count=CHs_count+1; % increase the cluster
head count
packets_BS=packets_BS+1; % increase the packet
to BS
nodes(i).type='C'; % make the node type cluster
nodes(i).G=round(1/p)-1; % make the value of G
greater than zero
% store the cluster head x coordinate into C
C(cluster).x_cord=nodes(i).x_cord;
% store the cluster head y coordinate into C
C(cluster).y_cord=nodes(i).y_cord;
33
% plotting the cluster head
if showgraph==1
plot(nodes(i).x_cord,nodes(i).y_cord,'r*');
end
% storing the cluster head nodes coordinate
into chn
chn=[nodes(i).x_cord nodes(i).y_cord];
% storing the sink node coordinate into sn
sn=[nodes(end).x_cord nodes(end).y_cord];
% calculating the distance between chn and sn
distance=nodeDist(chn,sn);
% storing the distance into the variable C with
field
% distance
C(cluster).distance=distance;
% Assign cluster an ID
C(cluster).id=i;
% Increase the cluster variable to 1
cluster=cluster+1;
% Follow the below energy model if distance is
greater than do
if (distance>do)
nodes(i).E=nodes(i).E- (
(ETX+EDA)*packet_size + Emp*packet_size*distance^4);
end
% Follow the below energy model if distance is
less than or
% equal to do
if (distance<=do)
nodes(i).E=nodes(i).E- (
(ETX+EDA)*packet_size + Efs*packet_size*distance^2);
end
end
end
end
end
for cl=1:length(C)
C(cl).packetCH=0;
end
%Election of Associated Cluster Head for Normal Nodes
for i=1:total_nodes % Looping for total number of nodes]
% Checking the node and wheter the node has sufficient
energy
if ( nodes(i).type=='N' && nodes(i).E>0 )
% Checking whether cluster exists or not
34
if(cluster-1>=1) % if cluster exists
% store the node coordinate into ref_node
ref_node=[nodes(i).x_cord nodes(i).y_cord];
% store the sink node coordinate into sink_node
sink_node=[nodes(end).x_cord nodes(end).y_cord];
% calculate the distance between ref_node and
sink_node
min_dis=nodeDist(ref_node,sink_node);
% creating a min_dis_cluster variable
min_dis_cluster=1;
for c=1:cluster-1
% store the cluster head x and y coordinate into
cluster node
cluster_node=[C(c).x_cord C(c).y_cord];
% calculating the distance between ref_node and
cluster_node
dist=nodeDist(ref_node,cluster_node);
% checking whether cluster head in nearer to the
node or the
% sink
temp=min(min_dis,dist);
% If distance between cluster head and node is
minimum as
% compared to the node and the sink then assign the
distance
% between cluster head and the node into min_dis and
update the
% min_dis_cluster variable also
if ( temp<min_dis )
min_dis=temp;
min_dis_cluster=c;
end
end
%Energy dissipated
if(min_dis>0)
nodes(C(min_dis_cluster).id).E =
nodes(C(min_dis_cluster).id).E- ( (ERX + EDA)*packet_size );
35
C(min_dis_cluster).packetCH=C(min_dis_cluster).packetCH+1;
end
nodes(i).min_dis=min_dis;
nodes(i).min_dis_cluster=min_dis_cluster;
end
end
end
% sort(dd)
% mean(dd)
% vpa(sum(dd))
% pause
disth(r+1)=mean(dd);
hold on;
disp(['Iteration ',num2str(r),' alive
nodes',num2str(total_nodes-dead_counter)])
shg
if dead_counter>= total_nodes
break
end
nd=length([nodes.type]~='D');
for cc=1:length(C)
if (C(cc).distance>do)
Ptx=( (ETX+EDA)*8 + Emp*8*C(cc).distance^4);
else
Ptx= ( (ETX+EDA)*8 + Efs*8*C(cc).distance^2);
end
Prx = ( (ERX + EDA)*8 );
Pwec=Eo*C(cc).packetCH;
PHR=nd*(5*C(cc).packetCH-3)*Ptx;
Countrnd=(PHR/Pwec)*100;
C(cc).Pth=Countrnd*(1+C(cc).packetCH)*Ptx;
C(cc).energy=nodes(C(cc).id).E;
end
if dead_counter>=total_nodes-
2,dead_node(r+1)=total_nodes;break,end
if ~isempty(C)
mn=mean([C.Pth]);
cidx=[C.Pth]>mn;
for cc=1:length(C)
if cidx(cc)==1 && nodes(C(cc).id).type~='D'
nodes(C(cc).id).G=0;
end
end
no_ch=[no_ch length(C)];
36
pcktBS(r+1)=packets_BS;
pcktCH(r+1)=sum([C.packetCH]);
end
C=[];
end
alivenodes=total_nodes-dead_node;
%%
[epr,alv,no_ch1,pcktBS1,pcktCH1,alv_i,len1,len2,pcktCH,fnd_leac
h,lnd_leach, ...
fnd_ileach,lnd_ileach,energy_per_round]=LeachFn(sink,p,[nodes(1
:end-1).x_cord]', ...
[nodes(1:end-
1).y_cord],Eo,alivenodes,energy_per_round,pcktCH);
%%
figure,
plot(1:length(alv),alv,'r-')
hold on
plot(1:length(alv_i),alv_i,'k-')
xlabel('Rounds')
ylabel('Alive nodes per round')
legend('LEACH','I-LEACH')
figure,plot(len1,epr,'color','r','marker','.','markeredgecolor'
,'r')
hold on
plot(len2,energy_per_round,'color','k','marker','.','markeredge
color','k')
xlabel('Rounds')
ylabel('Network energy per round')
legend('LEACH','I-LEACH')
%
figure,plot(1:length(no_ch1),no_ch1,'r')
xlabel('Rounds')
ylabel('No. of CHs - LEACH')
figure,plot(1:length(no_ch),no_ch,'k')
xlabel('Rounds')
ylabel('No. of CHs - I-LEACH')
lnt=min(length(pcktBS),length(pcktBS1));
figure,plot(1:lnt,cumsum(pcktBS1(1:lnt)),'r-')
hold on
plot(1:lnt,cumsum(pcktBS(1:lnt)),'k-')
xlabel('Rounds')
ylabel('Packets sent to BS')
legend('LEACH','I-LEACH')
xlim([0 lnt])
37
lnt=min(length(pcktCH),length(pcktCH1));
figure,plot(1:lnt,cumsum(pcktCH1(1:lnt)),'r-')
hold on
plot(1:length(pcktCH),cumsum(pcktCH),'k-')
xlabel('Rounds')
ylabel('Packets sent to CH')
legend('LEACH','I-LEACH')
xlim([0 lnt])
%%
fprintf('\nFirst node dead (FND) iteration: LEACH = %i\nLast
node dead (LND) iteration: LEACH = %i',...
fnd_leach,lnd_leach)
fprintf('\nFirst node dead (FND) iteration: I-LEACH = %i\nLast
node dead (LND) iteration: I-LEACH = %i\n',...
fnd_ileach,lnd_ileach)
38
4.2. SUB FUNCTIONS
function [d]=nodeDist(node1,node2)
% distance between two nodes
% examples:
% node1=[3 4]; i.e x=3 and y=4
% node2=[5 6]; i.e x=5 and y=6
% d= nodeDist(node1,node2)
t= (node1-node2).^2;
d= sqrt(sum(t,2));
4.2.2. THRESHOLD
function [T]=Thresh(P,r)
% Threshold function according to the paper
T=P/(1-P*mod(r,round(1/P)));
39
CHAPTER 5
In this chapter, firstly, MATLAB software used for deploying WSN is presented. Secondly,
simulation of Homogeneous-Leach, Heterogeneous-Leach and Modified-Leach
(MODLEACH) routing protocol for WSNs are discussed in detail.
5.1. Introduction
Today, most of the research is done to develop ultra-low powered WSN which is only
possible only if the overall network lifetime increases, energy consumption decreases and
the network run with high stability and reliability. To achieve this, many algorithms have
been implemented. They are called energy-efficient algorithms. These algorithms in their
basic form have already been implemented on various network protocols including
LEACH, AODV, TEEN etc. However, these algorithms need further research for increase
in network lifetime, energy efficiency etc.
40
MATLAB code can be integrated with other languages and applications, and gives out
various new algorithms and applications.
5.3. Implementation
Simulations are conducted using MATLAB 8.2.0.701 (R2013b) and to get precise
plots, confidence interval is taken. Sensor nodes are deployed in random manner and
made homogeneous and heterogeneous WSN using MATLAB. The wireless channel
is used because the nodes deployed in the network are communicating wirelessly based
on their distance, transmission range etc. Simulations show that MODLEACH
performs better considering metrics of throughput, network life time,location of base
station and initial energy of sensor nodes.
100
90
80
70
60
50
40
30
20
10
0
0 10 20 30 40 50 60 70 80 90 100
41
100
90
80
70
60
50
40
30
20
10
0
0 10 20 30 40 50 60 70 80 90 100
42
FIG 5.3: CLUSTER COUNT
12
10
0
0 200 400 600 800 1000 1200 1400 1600 1800
Rounds
(a) Leach
50
45
40
35
No. of CHs - I-LEACH
30
25
20
15
10
0
0 200 400 600 800 1000 1200 1400 1600
Rounds
(b) I-Leach
43
FIG 5.4: NETWORK PERFORMANCE
50
LEACH
45 I-LEACH
40
30
25
20
15
10
0
0 500 1000 1500 2000 2500 3000
Rounds
100
LEACH
90 I-LEACH
80
70
Alive nodes per round
60
50
40
30
20
10
0
0 500 1000 1500 2000 2500 3000
Rounds
44
FIG 5.6: PACKETS COMMUNICATED
4
x 10
12
LEACH
I-LEACH
10
8
Packets sent to CH
0
0 200 400 600 800 1000 1200 1400 1600
Rounds
(a) To CH
10000
LEACH
9000 I-LEACH
8000
7000
Packets sent to BS
6000
5000
4000
3000
2000
1000
0
0 200 400 600 800 1000 1200 1400 1600
Rounds
(b) To BS
45
CHAPTER 6
CONCLUSION
Since, its existence in the world of WSN, LEACH protocol still gains attention among researchers
which itself proves the importance of the protocol. Different descendants of LEACH have also
been focused on various applications. In this project, we modified the protocol based on efficient
CH selection with simultaneous switching of different power levels. Through simulation results,
we found that this modified protocol outperforms the LEACH algorithm and can be adopted in
sensor networks used for IoT applications which require extra power to process huge data. The
protocol also succeeds in enhancing network lifetime by reducing energy consumption in a
distributed manner. When compared with other energy-efficient protocols, it was found that the
proposed protocol will be best suited for the diverse applications changing area, energy and
number of nodes. The work can be extended for heterogeneous routing protocols to find various
results.
46
CHAPTER 7
FUTURE PROSPECT
47
REFRENCES
Trupti Mayee Behera, Umesh Chandra Samal, Sushanta Kumar Mohapatra, Energy-efficient
modified LEACH protocol for IoT application, ISSN 2043-6386, Accepted on 19th May
2018 doi: 10.1049/iet-wss.2017.0099 www.ietdl.org.
Meena Malik, Dr. Yudhvir Singh , Anshu Arora, Analysis of LEACH Protocol in Wireless
Sensor Networks, in International Journal of Advanced Research in Computer Science and
Software Engineering, Volume 3, Issue 2, February 2013 ISSN: 2277 128X.
Jianguo SHAN, Lei DONG, Xiaozhong LIAO, Liwei SHAO , Zhigang GAO, Yang GAO,
Research on Improved LEACH Protocol of Wireless Sensor Networks, in Beijing Institute
of Technology , Shenyang Institute of Engineering.
Fan Xiangning, Song Yulin, Improvement on LEACH Protocol of Wireless Sensor Network,
in 2007 International Conference on Sensor Technologies and Applications.
Yuling Li, Luwei Ding and FengLiu, The Improvement of LEACH Protocol in WSN, in 20
II International Conference on Computer Science and Network Technology
Beiranvand, Z., Patooghy, A., and Fazeli, M. (2013). I-leach: An efficient routing algorithm
to improve performance & to reduce energy consumption in wireless sensor networks. In
Information and Knowledge Technology (IKT), 2013 5th Conference on, pages 13–18.
IEEE.
48
Muruganathan, S. D., Ma, D. C., Bhasin, R. I., and Fapojuwo, A. (2005). A centralized
energy-efficient routing protocol for wireless sensor networks. Communications Magazine,
IEEE, 43(3):S8–13.
Chaurasiya, S. K., Pal, T., and Bit, S. D. (2011). An enhanced energy-efficient protocol with
static clustering for wsn. In Information Networking (ICOIN), 2011 International
Conference on, pages 58–63. IEEE.
Loscri, V., Morabito, G., and Marano, S. (2005). A two-levels hierarchy for low-energy
adap- tive clustering hierarchy (tl-leach). In IEEE Vehicular Technology Conference,
volume 62, page 1809. IEEE; 1999.
Deng, S., Li, J., and Shen, L. (2011). Mobility-based clustering protocol for wireless sensor
networks with mobile nodes. IET wireless sensor systems, 1(1):39–47.
Liu, Z., Liu, Z., and Wen, L. (2011). A modified leach protocol for wireless sensor networks.
In Advanced Computational Intelligence (IWACI), 2011 Fourth International Workshop
on, pages 766–769. IEEE.
Mahmood, D., Javaid, N., Mahmood, S., Qureshi, S., Memon, A., and Zaman, T. (2013).
Modleach: A variant of leach for wsns. In Broadband and Wireless Computing, Com-
munication and Applications (BWCCA), 2013 Eighth International Conference on, pages
158–163. IEEE.
Smaragdakis, G., Matta, I., and Bestavros, A. (2004). Sep: A stable election protocol for
clustered heterogeneous wireless sensor networks. Technical report, Boston University
Computer Science Department.
https://www.wikipedia.org/
49