Report 1
Report 1
PROJECT REPORT
Submitted in partial fulfilment of the requirements for the award of the degree
of
BACHELOR OF TECHNOLOGY
in
by
Guided by
It is hereby certified that the work which is being presented in the B. Tech Minor Project 2018
,Project Report entitled " CLUSTER HEAD SELECTION METHOD BASED ON
LEACH ALGORITHM" in partial fulfilment of the requirements for the award of the degree
of Bachelor of Technology and submitted in the Department of Electronics &
Communication Engineering of Bharati Vidyapeeth’s College Of Engineering, New Delhi
(Affiliated to Guru Gobind Singh Indraprastha University, Delhi) is an authentic record of
our own work carried out during a period from August 2018 to December 2018 under the
guidance of Mrs Shifaly Sharma, Asst. Professor.
The matter presented in the Minor Project 2018 has not been submitted by me for the award of
any other degree of this or any other Institute.
CANDIDATE DECLARATION ii
ABSTRACT iii
ACKNOWLEDGEMENT vi
TABLE OF CONTENTS v
LIST OF FIGURES vi
LIST OF TABLES vii
LIST OF ABBREVIATIONS viii
Chapter 1: Introduction 12
With the growth of wireless communication and device technology, the sensors
having sensing, computation and communication capability are widely used in
various fields. In today’s world, billions of wireless devices transfer data to the
cloud or communicate with each other. Although this interconnectivity is
advantageous, it is crucial that a proper, energy efficient and most importantly
wireless means to do so should exist.
In short you can say that Wireless sensor network is a collection of a large
number of intercommunicating sensor nodes.
The WSNs may be used in a variety of everyday life activities or services. For
example a common application of WSNs is for monitoring. In the area of
monitoring, the WSN is deployed over a region in order to monitor some
phenomenon. A practical use of such a network could be a military use of sensors
to detect enemy intrusion. In case that the sensors detect an event (change on heat
or on the blood pressure) then the event is immediately reported to the base
station, which decides the appropriate action (send a message on the internet or to
a satellite). A similar area of use may be the monitoring of the air pollution,
where the WSNs are deployed in several cities to monitor the concentration of
dangerous gases for citizens. Moreover, a WSN may be used for forest fires
detection to control when a fire has started. The nodes will be equipped with
sensors to control temperature, humidity and gases which are produced by fire in
the trees or vegetation. In addition to the above, an important area of use is the
healthcare sector. this area the WSNs may offer significant cost savings and
enable new functionalities that will assist the elderly people living along in the
house or people with chronic diseases on the daily activities. In wired systems,
the installation of enough sensors is often limited by the cost of wiring.
Previously inaccessible locations, rotating machinery, hazardous or restricted
areas, and mobile assets can now be reached with wireless sensors. Moreover, the
use of WSNs on agriculture may benefit the industry frees the farmer from the
maintenance of wiring in a difficult environment. The gravity feed water systems
can be monitored using pressure transmitters to monitor water tank levels, pumps
can be controlled using wireless I/O devices and water use can be measured and
wirelessly transmitted back to a central control center for billing. The water
industry may be benefited for power or data transmission can be monitored using
industrial wireless I/O devices and sensors powered using solar panels or battery
packs.
Each sensor node transmits the sensed data to other sensor nodes or Base
Station(BS). In wireless communication terminology, a Base Station is a
transceiver connecting a number of other devices( sensor nodes in this case) to
one another and/or to a wider area.
To effectively cope with this issue, the sensor network should be designed
considering the scalability and energy efficiency. Needless to say, all aspects of
sensor nodes, from the hardware to the protocols, must be extremely energy
energy efficient since we want our devices to consume as less power as possible.
Clustering the sensor nodes is one of the most effective solutions to this end.
1.2 Nodes
Figure-1
If we use individual sensors then the issues associated with it would be that they
would have limited sensing region, processing power and energy. Hence, we do
networking of great number of sensor nodes which enables a robust, reliable and
accurate sensor network covering a wider region.
Two very important jobs to be done by sensor nodes in any network is data
dissemination and data gathering. While designing sensor networks we need to
consider few challenges in WSNs
1) Energy efficiency
2) Lifetime
3) Synchronization and
4) Security
5) Position awareness
6)Redundant data
Thus, highly efficient routing scheme will offer sufficiently great reductions in
power cost and will improve the longevity of the network.
For this purpose, clustering approach is widely used. There exist various WSNs
employing the cluster structure, which efficiently allocate the resource and
energy and thereby maximize the network lifetime.
Here each cluster of sensor nodes is monitored and controlled by a node, called
Cluster Head(CH). Each CH aggregates the data sent from the sensor nodes
belonging to its cluster, and then transmits them to the BS. Forming the clusters,
especially CH selection, is one of the most critical tasks in the management of
WSNs since CHs consume much larger energy than other bodes in the network.
One of the most recognized protocols in this regard is LEACH protocol, and it
uses a probabilistic model for CH selection. It motivated the design of many
subsequent protocols employing a similar concept. LEACH-C proposes a
centralized clustering algorithm, while E-LEACH protocol improves the CH
selection procedure. DEEAC protocol extends the LEACH algorithm for the
network having spatiotemporal variations in the data reporting rates across
different regions. SLEACH is superior to LEACH when the collected data are the
minimum or maximum value of the range of interest, while it uses the same
method as LEACH for forming the clusters. In VLEACH it is unnecessary to
elect a substitute CH taking over the role of the current CH which dies during the
operation. The BCSA protocol extends the LEACH algorithm by modifying the
probability of each node to become the CH based on the energy required to send
a packet to the BS. We have also proposed Proxy Enabled Adaptive Clustering
Hierarchy(PEACH), which employs the same approach as LEACH but proposes
to use a proxy node for replacing the CH and thus extending the lifetime of the
sensor network. It is based on the consensus of healthy nodes for the detection
and manipulation of failure in the CH. The Energy-Driven Adaptive Clustering
Hierarchy(EDACH) further increases the lifetime of sensor network by forming
different number of clusters in each region of the network according to the
relative distance to the BS. It is based on the partitioning of the network for
assigning different probability to the nodes in each partition, with which the
nodes are decided to be the CH.
Unlike the random probabilistic approach of LEACH and its variations, the K-
Means algorithm employs a deterministic approach. The algorithm is used to
form the clusters such that the distances between the nodes and the CH become
minimal. The proposed approach thus allows to minimize the energy consumed
for the sensor nodes to send the data to the CH in their cluster. As a consequence,
the lifetime of the WSN can be prolonged.
B. Communication model
Hierarchical routing protocols (HRPs) are more energy efficient and scalable
compared to flat routing protocols. The special feature of this approach is that it
provides self-organization capabilities to allow large scale network deployment.
Basically, in a hierarchical architecture, some nodes take responsibility to
perform high energy transmission while the rest perform normal task. Power-
aware algorithm is used to select eligible high energy nodes to relay the data
from normal nodes to the BS. HRPs can be categorized into two types based on
the topology management, they are cluster-based HRPs [8–10] and chain-based
HRPs. In cluster-based HRPs, sensor nodes are grouped into clusters and each
of these clusters are led by one of the nodes, called the cluster head (CH). A CH
acts as an intermediate node between cluster members and the BS. In chain-
based HRPs, all nodes in the field are connected in a chain structure. Then, the
most energy healthy node is chosen as the chain leader to mediate the data
transmission from normal nodes and the BS. In both types of HRPs, there are
other design features applied to further enhance the performance such as data
fusion, threshold values set up, and sleep/idle pairing.
In terms of operation, a HRP consists of two phases. The first phase is the set-
up phase, when the sensor nodes are organized to form hierarchical architecture
either in a cluster-based or chain-based manner.
The second phase is the steady state phase, when data are routed from sensor
nodes to the BS. The hierarchical architecture of a cluster-based or chain-
BS. For example, LEACH-C [20] and APTEEN [10] use simulated annealing
technique to form optimal clusters. The simulation results from both works
show that optimal clusters can reduce data packet loss, thus increasing the
throughput and data accuracy. The drawback of applying centralized algorithm
is it limits the self-organization feature of the WSNs. However, the great
performance of centralized algorithm proves that optimal hierarchical
architecture is essential to guarantee good performance of a WSN. To maintain
both self-organization capability and energy efficiency, HRPs must be
accomplished with a distributed topology control algorithm that is capable of
providing optimal architecture.
CLUSTERING PROTOCOLS
Instead of collecting data from all sensor nodes separately, its convenient to form
clusters. In every cluster there is a cluster head which collects all the required
data and transmits it to the BS. This way we save energy and battery lifetime of
other nodes. There are many places e.g., forests, landslide areas, bridges etc.
where we need to deploy sensor nodes so that we receive pertinent information in
the event of any natural disaster. Disaster detection and alerting system are used
worldwide to reduce losses to human lives and property due to the occurrence of
natural disasters. In order to determine the amount of disaster which occurred in a
particular location, we need to measure physical parameters and their intensity,
for which sensor nodes are employed.
Once deployed in a network, it’s really difficult to maintain the energy and
lifetime of sensor nodes for a long time. In such cases, forming clusters and
cluster head is really helpful. Selecting a good cluster head based on their
potential, location, energy, and lifetime is one of the key research areas in WSN.
Also, we need to analyse various protocols and see which can be applied in the
analysis of different types of disasters like earthquake, tsunami, floods etc. WSN
is a good choice as they have attractive characteristics like they are auto
configurable, self-organizing and have small volumes .
Grouping sensor nodes into various clusters of equal nodes is being widely used
by the various researchers in order to attain the objective of scalable network.
Each cluster has a leader which is often called as the cluster-head (CH). Although
several clustering algorithms have already been proposed , their objective had
been basically to form stable clusters in the environment with mobile nodes.
These techniques care mostly about the reachability and route stability of the
node, but do not concern about the critical design goals of WSNs akin network
longevity and coverage. The most recent techniques vary widely by depending
upon the deployment of nodes and the bootstrapping schemes, the network
architecture, the attributes of all the CH nodes and the network operation model.
A CH is also a node that has richer resources than other nodes in the cluster. CHs
may form a second tier network or may just transport the data to interested
parties like base station or a command center.
1) It can restrict the route set up within the cluster and thus lessen the size of the
routing table reserved at the individual node.
3) It can also balance the network topology at sensory level thus cutting on
topology maintenance overhead.
4) CH can also implement advanced management strategies to further increase
the network operation and extend the battery life of the individual sensors and the
network lifetime.
5) CH can programme activities in the cluster so that nodes can shift to the low
power sleep mode most of the time and decrease the measure of rate of energy
consumption.
6) CH can accumulate the data gathered by the sensors in its cluster thus
decreasing the number of relayed/transmitted packets.
The basic principle of this protocol is to randomly elect the CHs to distribute the
energy consumption evenly among the nodes. The CHs fuse the data collected
from the member nodes and transmit them to the BS. The protocol is composed
by rounds, in which a round is divided into set-up phase and steady phase as
shown in Figure
Figure-2
The set-up phase consists of three steps: advertisement, cluster forming, and
schedule creation. The randomly selected CHs broadcast their identity to the
member nodes in the set-up phase. In the steady phase, the member nodes of each
cluster send the data to the CH. The CH in each cluster thus consumes large
energy for the communication with the member nodes. To effectively resolve this
problem, a CH selection method was proposed. Each member node has the same
opportunity to be the CH so that energy consumption of the nodes can be
balanced.
In Equation (1) P is the percentage of the number of CHs out of the total number
of nodes, and r is the current round. G is the set of nodes which have not been
elected as CH in the past 1/P rounds. Therefore, the network can balance the
energy consumption by letting all the nodes be able to be selected as CH.
However, this probabilistic approach cannot reflect the location information of
the nodes in the selection of CH. As a result, LEACH protocol may cause
unbalanced energy consumption among the CHs, and several nodes can spend
much more energy than other nodes in the cluster.
2.4.2 LEACH-C
Figure-3
Here Cprob is the initial percentage of CHs among n nodes. Eresidual is the
estimated residual energy of the node, and Emax is the reference maximum
energy. In the second phase each node transmits an advertisement(ADV)
message to other nodes of its cluster and receives the ADV message from other
candidate CHs. The ADV message contains the values obtained from the first
phase. The candidate CHs cancel their candidacy if the communication cost is
larger than other candidates. In the last phase, the non-CH nodes select a CH and
join its cluster. Here, if some nodes have same Cprob value, the one of the
smallest AMRP(Average Minimum Reachability Power) value obtained by Eq.
(3) is selected as CH.
In Eq. (3) M is the number of nodes in the cluster and MinPWRi is the minimum
power required for the transmission from a CH to node-i. The HEED protocol
thus results in a slightly different cluster structure from the LEACH-kind
protocol.
2.5.1 Introduction
LEACH protocol is the first protocol of hierarchical routing which proposed data
fusion; it is of milestone significance in clustering routing protocol. Routing
strategies and security issues are great research challenge. Nowadays in WSN,
numbers of routing protocols have been proposed for WSN but most well-known
protocols are hierarchical protocols like LEACH. Hierarchical protocols are
defined to reduce energy consumption by aggregating data and to reduce the
transmissions to the base station .
Leach protocol is a TDMA based MAC protocol. The main aim of this protocol
is to improve the lifespan of wireless sensor networks by lowering the energy.
Leach protocol consists of two phases:
1) Set-up phase
2) Steady phase
Operation of leach protocol consists of several rounds with two phases in each
round. Leach protocol is a typically representation of hierarchical routing
protocol. It is self-adaptive and self-organized.
● Pi (t) is the probability with which node i elects itself to be Cluster Head at
the beginning of the round r+1 (which starts at time t) such that expected
number of cluster-head nodes for this round is k.
Figure -4
● Assumptions:-
Nodes are all time synchronized and start the setup phase at same time.
BS sends out synchronized pulses to the nodes.
Cluster Head must be awake all the time.
Figure 5
2.6 Future Work
In the proposed scheme the WSN is assumed to have the following features:
Both the free space(fs) and multipath(mp) are accounted in estimating the energy
dissipated during the process of transmission and reception of the packets. The
energy consumption for transmitting a k-bit packet over a distance d is given by
Eq. (4).
Here Eelec is the energy required for processing 1-bit data with the electronic
circuits.εfs and εmp is the energy taken for transmitting 1-bit data to achieve an
acceptable bit error rate in the case of free space model and multipath model,
respectively. They are dependent on the distance of transmission. Note that
energy dissipation of free space and multipath is proportional to d2 and d4,
respectively. The threshold, d0,is calculated as
The proposed scheme uses K-means algorithm which forms the clusters of
objects based on the Euclidean distances between them. The proposed CH
selection scheme consists of three steps as follows.
1. Initial clustering
K-means algorithm is executed for cluster formation with the target WSN.
Assume that the WSN of n nodes is divided into k clusters. First, k out of n
nodes are randomly selected as the CHs. Each of the remaining nodes
decides its CH nearest to it according to the Euclidean distance.
2. Reclustering
After each of the nodes in the network is assigned to one of k clusters, the
centroid of each cluster is calculated. Assuming two-dimensional space,
the centroid of a cluster of s nodes is calculated as follows.
Observe from Figure 4 that the initial CH is not the closest one to the centroid,
and thus the closest one is selected as a new CH. Here it is the enboxed node.
With the new CH in each cluster, Step 2 is recursively executed until the CH is
not changed any more.
K-means Algorithm
3. Choosing the CH
After the clusters are formed, an ID number is assigned to each node of a
cluster according to the distance from the centroid, assigning smaller
number to the closer one. Figure 5 shows the ordering of the sensor nodes
with the ID number for the example of Figure 4. The ID number of a node
indicates the order to be chosen as the CH. Therefore, the ID number plays
an important role in the selection of a node as CH.
Figure-8
Figure-9
Figure -10
CONCLUSION
1] Geon Yong Park, Heeseong Kim, Hwi Woon Jeong, and Hee Yong Youn, “A Novel Cluster
Head Selection Method based on K-Means Algorithm for Energy Efficient Wireless Sensor
Network,” March 2013.
[3] Jeongyeup Paek, JeongGil Ko “K-Means Clustering-Based Data Compression Scheme for
Wireless Imaging Sensor Networks,” IEEE SYSTEMS JOURNAL, VOL. 11, NO. 4,
DECEMBER 2017.
[4] N. M. Abdul Latiff, N. N. Nik Abdul Malik, L. Idoumghar “Hybrid Backtracking Search
Optimization Algorithm and K-Means for Clustering in Wireless Sensor Networks,” 2016
IEEE 14th Intl Conf on Dependable, Autonomic and Secure Computing, 14th Intl Conf on
Pervasive Intelligence and Computing, 2nd Intl Conf on Big Data Intelligence and Computing
and Cyber Science and Technology Congress.
[5] Jiahu Qin, Member, IEEE, Weiming Fu, Huijun Gao, Fellow, IEEE, and Wei Xing Zheng,
Fellow, IEEE, “Distributed k-Means Algorithm and Fuzzy c-Means Algorithm for Sensor
Networks Based on Multiagent Consensus Theory,” IEEE TRANSACTIONS ON
CYBERNETICS, VOL. 47, NO. 3, MARCH 2017
APPENDIX
CODE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% LEACH Protocol
%
% Energy-Efficient Protocols In Wireless Sensor Networks
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
close all;
clear;
clc;
hold on;
figure(1)
plot(x,y,xm,ym,SN(i).x,SN(i).y,'ob',sinkx,sinky,'*r');
title 'Wireless Sensor Network';
xlabel '(m)';
ylabel '(m)';
end
while operating_nodes>0
% Threshold Value %
t=(p/(1-p*(mod(rnd,1/p))));
% Re-election Value %
tleft=mod(rnd,1/p);
for i=1:n
SN(i).cluster=0; % reseting cluster in which the node belongs
to
SN(i).role=0; % reseting node role
SN(i).chid=0; % reseting cluster head id
if SN(i).rleft>0
SN(i).rleft=SN(i).rleft-1;
end
if (SN(i).E>0) && (SN(i).rleft==0)
generate=rand;
if generate< t
SN(i).role=1; % assigns the node role of acluster head
SN(i).rn=rnd; % Assigns the round that the cluster
head was elected to the data table
SN(i).tel=SN(i).tel + 1;
SN(i).rleft=1/p-tleft; % rounds for which the node
will be unable to become a CH
SN(i).dts=sqrt((sinkx-SN(i).x)^2 + (sinky-SN(i).y)^2); %
calculates the distance between the sink and the cluster hea
CLheads=CLheads+1; % sum of cluster heads that have
been elected
SN(i).cluster=CLheads; % cluster of which the node got
elected to be cluster head
CL(CLheads).x=SN(i).x; % X-axis coordinates of elected
cluster head
CL(CLheads).y=SN(i).y; % Y-axis coordinates of elected
cluster head
CL(CLheads).id=i; % Assigns the node ID of the newly
elected cluster head to an array
end
end
end
% Grouping the Nodes into Clusters & caclulating the distance between node
and cluster head %
for i=1:n
if (SN(i).role==0) && (SN(i).E>0) && (CLheads>0) % if node is
normal
for m=1:CLheads
d(m)=sqrt((CL(m).x-SN(i).x)^2 + (CL(m).y-SN(i).y)^2);
% we calculate the distance 'd' between the sensor node that is
% transmitting and the cluster head that is receiving with the
following equation+
% d=sqrt((x2-x1)^2 + (y2-y1)^2) where x2 and y2 the coordinates
of
% the cluster head and x1 and y1 the coordinates of the
transmitting node
end
d=d(1:CLheads); % fixing the size of "d" array
[M,I]=min(d(:)); % finds the minimum distance of node to CH
[Row, Col] = ind2sub(size(d),I); % displays the Cluster Number in
which this node belongs too
SN(i).cluster=Col; % assigns node to the cluster
SN(i).dtch= d(Col); % assigns the distance of node to CH
SN(i).chid=CL(Col).id;
end
end
for i=1:n
if (SN(i).cond==1) && (SN(i).role==0) && (CLheads>0)
if SN(i).E>0
ETx= Eelec*k + Eamp * k * SN(i).dtch^2;
SN(i).E=SN(i).E - ETx;
energy=energy+ETx;
end
end
for i=1:n
if (SN(i).cond==1) && (SN(i).role==1)
if SN(i).E>0
ETx= (Eelec+EDA)*k + Eamp * k * SN(i).dts^2;
SN(i).E=SN(i).E - ETx;
energy=energy+ETx;
end
if SN(i).E<=0 % if cluster heads energy depletes with
transmission
dead_nodes=dead_nodes +1;
operating_nodes= operating_nodes - 1
SN(i).cond=0;
SN(i).rop=rnd;
end
end
end
transmissions=transmissions+1;
if CLheads==0
transmissions=transmissions-1;
end
% Next Round %
rnd= rnd +1;
tr(transmissions)=operating_nodes;
op(rnd)=operating_nodes;
if energy>0
nrg(transmissions)=energy;
end
end
sum=0;
for i=1:flag1stdead
sum=nrg(i) + sum;
end
temp1=sum/flag1stdead;
temp2=temp1/n;
for i=1:flag1stdead
avg_node(i)=temp2;
end