Sunteți pe pagina 1din 45

Cluster Head Selection Method based on LEACH Algorithm

MINOR PROJECT 2018

PROJECT REPORT

Submitted in partial fulfilment of the requirements for the award of the degree
of
BACHELOR OF TECHNOLOGY

in

ELECTRONICS & COMMUNICATION ENGINEERING

by

ADITYA SHARMA MUKUND SHAH KARTIK KIROULA MAYANK SHUKLA


00911502815 05211502815 04211502815 04611502815

Guided by

Name of the Mentor


Mrs. Shifaly Sharma

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING


BHARATIVIDYAPEETH’S COLLEGE OF ENGINEERING
(AFFILIATED TO GURU GOBIND SINGH INDRAPRASTHA UNIVERSITY, DELHI)
NEW DELHI – 110053
NOV 2018
CANDIDATE’S DECLARATION

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.

(Mayank Shukla) (Kartik Kiroula) (Aditya Sharma) (Mukund Shah)

(04611502815) (04211502815) (00911502815) (05211502815)

(Signature of External Examiner)


Project Coordinator
ABSTRACT

Wireless sensor networks composed of a number of small interconnected sensor


nodes deployed which are able to sense, process and transmit information to the
base station for applications like industrial, military and agriculture (etc.). Also,
sensor networks could be very helpful to gather and share information whenever
a natural calamity like landslides, tsunami, earthquake etc. occurs. This way we
can avoid loss of lives and protect our infrastructure from considerable damage.

Energy constraint is the most critical problem in WSNs. A conventional solution


employed in a sensor network to mitigate this problem is that instead of gathering
data from each and every sensor nodes, it is preferred to make clusters of nodes
and select a cluster head which gathers all the required data from sensor nodes to
transmit it to the base station. Clustering is used in WSNs because of its energy-
saving attributes, network topology stabilities and network scalabilities.
However, even clustering schemes suffer from several inherent deficiencies.
There are additional overheads for example clusters take time for their formation
and different clustering algorithms also result in additional control messages that
compete with data traffic for the wireless bandwidth. This happens during the
choosing of the cluster heads and their assignment their respective clusters.
ACKNOWLEDGEMENT

We express our deep gratitude to Mrs Shifaly Sharma, Associate Professor,


Department of Electronics& Communications Engineering for her valuable
guidance and suggestion throughout our project work.

Sign Sign Sign Sign

Mayank Shukla Aditya Sharma Kartik Kiroula Mukund Shah


(04611502815) (00911502815) (04211502815) (05211502815)
TABLE OF CONTENTS

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

1.1 Applications of wsn 12


1.2 Nodes 13

Chapter 2: Project Description 18

2.1 Classification of routing Protocols 18


2.2 HIERARCHICAL Protocols in WSN 19
2.3 Clustering Protocols 20
2.3.1 Advantages of Clustering 20
2.4 Related Work 21
2.4.1 LEACH 23
2.4.2 LEACH-C 24
2.4.3 HEED 25
2.5 Proposed Scheme 26
2.5.1 Introduction 26
2.5.2 Techniques to achieve goals 26
2.5.3 Architecture of LEACH 27
2.5.4 Cluster head selection ALGO 28
2.5.5 Cluster head formation ALGO 29
2.5.6 Flowchart 29
2.5.7 Steady state phase 30
2.6 Future work on K Means 31
2.6.1 Network Model 32
2.6.2 Energy Consumption Model 33
2.6.3 Proposed Scheme 34
2.7 Flow-chart 37
Chapter 3: Result And Conclusion 38

3.1 THE SIMULATED WIRELESS SENSOR NETWORK

3.2 NETWORK LIFETIME

3.3 OPERATING OR LIVE NODES PER ROUND

3.4 ENERGY CONSUMED IN EACH TRANSMISSION


LIST OF FIGURES

Figure 1 Wireless sensor network


Figure 2 The structure of one round of LEACH protocol
Figure 3 Example of routing with LEACH C protocol
Figure 4 LEACH distributed cluster formation for LEACH
Figure 5 Time line showing Leach operation
Figure 6 Flowchart for steady state phase
Figure 7 Energy Consumption model
Figure 8 A cluster with centroid
Figure 9 Ordering of nodes with cluster
Figure 10 Single hop routing
Figure 11 Flowchart of proposed model
LIST OF ABBREVIATION

PEACH Proxy Enabled Adaptive Clustering Hierarchy


WSN Wireless Sensor Network
CH Cluster Head
BS Base Station
LEACH Low energy adaptive clustering hierarchy
LEACH-C Low energy adaptive clustering hierarchy central constrained
ADV Advertisement
DEEAC Devon Energy efficiency advice centre
fs Full space
mp Multi path
AMRP Average minimum reliability power
EDACH Proxy Enabled Adaptive Clustering Hierarchy
HEED hybrid efficiency energy distributed
CHAPTER 1: INTRODUCTION

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.

Wireless Sensor Network(WSN) is a network which consists of hundreds to


thousands of sensor nodes, which collect the information on the surroundings
such as temperature, light, humidity, sound, vibration, and pressure.

In short you can say that Wireless sensor network is a collection of a large
number of intercommunicating sensor nodes.

The development of WSN was originally motivated by military applications for


battlefield surveillance. Although they are now used in diverse areas including
meteorology and healthcare application, industrial and home network, etc.

1.1 Applications of WSNs

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.

We can think of WSN as a network of tiny battery powered sensor nodes of


limited on-board processing, storage and radio capability. Sensor nodes are
usually deployed in a random fashion, and collect the context information and
perform the given mission through the cooperation with other nodes.

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.

We observe that direct communication to the BS is impractical if the number of


sensor nodes is large as in a few hundreds or thousands. Also, the sensor nodes
are typically mobile and limited in the computing power, communication range
and most importantly, energy supply.

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

Each node has three subsystems :-

Figure-1

1) Sensor Module- It senses the environment


2) Processing module – It carry out local computations and calculations on
the data sensed by sensor module.
3) Wireless Communication Module – It is in charge for the exchange of
messages with the neighbouring sensor nodes.

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

Also, network should be capable of adjusting itself to varying connectivity due to


failure of nodes and the routing protocols should be able to include/avoid sensor
nodes in their paths in a dynamic manner. Designing of sensor networks is
influenced by three important factors:

1) Scalability- if number of nodes increase, new schemes should be able to


alter itself according to work upon it.
2) Fault Tolerance- nodes may fail due to the lack of electrical power,
environmental interference or physical damage.
3) Power Consumption

To do this, there are many routing protocols available in WSNs. Routing in


WSNs is more demanding as compared to MANETs and cellular networks
because:

1) Severe constraints in energy, processing and storage capacities.

2) WSNs are application specific.

3) Require the flow of sensed data from multiple sources to a BS.


4) Stationary nodes result in predictable and non frequent topological changes.

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.

Computer simulation reveals that the proposed scheme allows higher


performance than the existing LEACH and HEED protocols in terms of residual
energy of the network and number of dead sensor nodes per round. Besides, it
lets the CH consume less energy than the other schemes. The simulation results
and evaluation of the proposed scheme are presented further.

LEACH along with K-Means are explained in detailed subsequently.


Classification of Routing Protocols

Routing protocols in WSNs are classified as follows:-

A. On the basis of Network structure


1) Flat Protocols- Same role is played by all the nodes present in the network.
2) Hierarchical Protocols- They impose a hierarchical structure on a network to
achieve energy efficiency, scalability and stability. In this class, nodes are
organized as clusters in which we select a leader known as the cluster
head.

B. Communication model

1) Query based protocols


2) Coherent and non-coherent protocols
3)Negotiation based protocols

C. Topology based protocols

1) Location based protocols


2) Mobile agent based protocols

D. Reliable routing protocols

1) Multipath based protocols-achieve load balancing and are more flexible to


route failures
2) QoS based protocols- network has to balance between energy consumption
and data quality
HIERARCHICAL ROUTING PROTOCOLS IN WSN

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-

based HRP can be set up by using distributed algorithm or centralized


algorithm. A stochastic approach is used to form clusters and chains. This is a
fully self-organized approach where no global knowledge is needed local
interactions are needed between nodes. However, random approach is deemed
not capable of producing optimal architecture. Thus, many newer protocols use
centralized approach where the hierarchical architecture is determined by the

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.

2.3.1 Advantages of clustering:

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.

2) It can also protect communication bandwidth since it restricts the scope of


inter-cluster interactions to the CHs and avoids unneeded message exchange
among sensory nodes.

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.

Clustering is chosen in WSNs because of itsenergy-saving attributes, network


scalability and network topology stability [4]. An important requirement for a
cluster heads is that such cluster heads much be energy efficient and has a
considerable battery lifetime. Lot of research is happening in this area to increase
energy efficiency of the sensor nodes, especially cluster heads. Generally, WSNs
have a large number of sensors ranging in the figures of hundreds or even
thousands. Clustering is an efficacious means for managing such high population
of nodes.

2.4 Protocols Studied

In this section the existing representative cluster-based routing protocols


proposed for WSN including LEACH, LEACH-C, and HEED are discussed.
2.4.1 LEACH

LEACH protocol is a typical routing scheme based on clustering. It is a popular


method where a random selection of cluster heads is done. There is a setup phase
where channel heads broadcast their identity to the member nodes. Then there is
a steady phase where member nodes deliver data to cluster head. This phase
involves consumption of lot of energy. In order to equilise/stabilise energy
consumption of nodes, each member has same opportunity to be the channel
head. A threshold value is set and if the node has value smaller than the threshold
value T(n), node becomes channel head (CH). Drawback of this protocol is that it
may cause unbalanced energy consumption among CHs.

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.

The CH selection method can be explained as follows: each node is randomly


assigned a value between 0 and 1 in each round. If the value is smaller than the
threshold value, T(n), the node becomes the CH. T(n)is calculated by

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

This protocol follows centralized control approach. It uses location information


of the sensor nodes. In the setup phase, each member nodes transmits the current
location information and energy level to the base station. Routing path is selected
based on nearest cluster head. Drawbacks of this protocol is that it doesn't always
provide better routing than LEACH protocol and exact location information
causes additional energy consumption.

LEACH-C protocol employs a centralized control approach using the location


information of the sensor nodes to solve the problem associated with LEACH
protocol. Figure below illustrates the routing steps with LEACH-C protocol.
During the set-up phase, each member node transmits the current location
information and energy level to the BS (marked as ཛ in Figure). Then the BS
calculates the average energy of the member nodes in the current round and
divides the network into a number of clusters. After a CH is selected in each
cluster, the member nodes send the data to the closest CH (Step ཛྷ in Figure
below). Finally, the set-up phase is completed after deciding the routing path.

Figure-3

This protocol has an advantage that energy consumption of CH can be reduced


by efficiently selecting the CH using the location information of the member
nodes. However, LEACH-C protocol does not always provide better routing than
LEACH protocol. Also, the requirement of getting exact location information of
all member nodes causes additional energy consumption.
2.4.3 HEED

HEED chooses CH by referring to the residual energy of each member node. It


also considers the inter-cluster communication cost as a secondary clustering
parameter. The clustering algorithm of HEED consists of three phases as follows.
In the first phase, each node identifies its neighbors and then computes the energy
required for the communication with them. It also calculates the primary CH
selection probability by Eq.

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 THE PROPOSED SCHEME (Cluster head selection method


established on LEACH Algorithm)

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.

2.5.2 Techniques (to achieve the design goals)


 randomized, adaptive, self-configuring cluster formation.
 Localized control of data transfers
 Low energy media access control (MAC)
 Application specific data processing, such as data aggregation and
compression.

2.5.3 Architecture of LEACH Protocol

● Randomized rotation of cluster heads among the sensors


● All non-cluster head nodes transmit data to their cluster head
● CH receives this data and performs signal processing functions on the data
and transmits data to the BS

LEACH Step by step

 Cluster head selection


 Cluster formation
 Steady state phase

2.5.4 Cluster Head Selection Algorithms

● 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.

● Each node will be Cluster Head once in N/k rounds.


● Probability for each node i to be a cluster-head at time t.
2.5.5 Cluster Formation Algorithm

● Cluster Heads broadcasts an advertisement message (ADV) using CSMA


MAC protocol.
● ADV = node’s ID + distinguishable header.
● Based on the received signal strength of ADV message, each non-Cluster
Head node determines its Cluster Head for this round.

Each non-Cluster Head transmits a join-request message (Join-REQ) back to its


chosen Cluster Head using a CSMA MAC protocol

● Join-REQ = node’s ID + cluster-head ID + header.


● Cluster Head node sets up a TDMA schedule for data transmission
coordination within the cluster
2.5.6 Flowchart of the distributed cluster formation algorithm for
LEACH.

Figure -4

2.5.7STEADY STATE PHASE

● TDMA schedule is used to send data from node to cluster head.


● Cluster head aggregates the data received from nodes in the cluster.
● Communication is via direct-sequence spread spectrum (DSSS) and each
cluster uses a unique spreading code to reduce inter-cluster interference.
● Data is sent from the cluster head nodes to the BS using a fixed spreading
code and CSMA.

● 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 this section we propose a CH selection method which employs the K-means


algorithm which we will be developing in future for MAJOR project workThe
network model of the proposed scheme is as follows.

2.6.1 Network Model

In the proposed scheme the WSN is assumed to have the following features:

 Each node has an ID number.


 All nodes are fixed or pseudo-static.
 All nodes are able to send the data to the BS.
 All nodes are able to control their energy consumption.
 The initial energy of all the nodes are same.
 The CHs are aware of their remaining energy.
 The sensor nodes are randomly distributed in the target area.

2.6.2 Energy Consumption Model

In this paper we use an energy consumption model to evaluate the performance


of the proposed scheme. As shown in Figure , the energy consumption model is
based on the transmitter and receiver.
Figure-6

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 energy taken to receive a k-bit message is calculated by Eq. (6).


2.6.3 Proposed Scheme

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.

Note that centroid of a cluster is a virtual node locating at the center


position of the cluster. Figure 4 shows an example of a cluster of 13 nodes
where the randomly selected CH in the initial round is denoted by
encircled sensor node.
Figure-7

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

Procedure: Reselection of cluster head

The residual energy of the CH is checked every round to retain the


connectivity of the network. If the energy of the CH is smaller than the
preset threshold, the node in the next order is selected as a new CH. The
newly elected CH informs other nodes of the change of the CH.

Figure-9

In each round, as shown in Figure 8, the proposed scheme adopts single


hop routing protocol for the CHs to directly transmit the data to the BS.
The collected data are them processed by the BS. The flow chart of the
overall operation with the proposed scheme is shown in Figure 9. Next the
performance of the proposed scheme is analyzed by computer simulation.
2.7 Flow-Chart

Figure -10
CONCLUSION

3.1 THE SIMULATED WIRELESS SENSOR NETWORK

3.2 NETWORK LIFETIME


3.3 OPERATING OR LIVE NODES PER ROUND

3.4 ENERGY CONSUMED IN EACH TRANSMISSION


REFERENCES

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.

[2] Nikolaos A. Pantazis, Stefanos A. Nikolidakis and Dimitrios D. Vergados “Energy-


Efficient Routing Protocols in Wireless Sensor Networks: A Survey,” IEEE Communications
Surveys & Tutorials, vol. 15, no. 2, Second Quarter 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;

%%%%%%%%%%%%%%%%%%%% Network Establishment Parameters %%%%%%%%%%%%%%%%%%%%

%%% Area of Operation %%%

% Field Dimensions in meters %


xm=100;
ym=100;
x=0; % added for better display results of the plot
y=0; % added for better display results of the plot
% Number of Nodes in the field %
n=100;
% Number of Dead Nodes in the beggining %
dead_nodes=0;
% Coordinates of the Sink (location is predetermined in this simulation) %
sinkx=50;
sinky=200;

%%% Energy Values %%%


% Initial Energy of a Node (in Joules) %
Eo=2; % units in Joules
% Energy required to run circuity (both for transmitter and receiver) %
Eelec=50*10^(-9); % units in Joules/bit
ETx=50*10^(-9); % units in Joules/bit
ERx=50*10^(-9); % units in Joules/bit
% Transmit Amplifier Types %
Eamp=100*10^(-12); % units in Joules/bit/m^2 (amount of energy spent by the
amplifier to transmit the bits)
% Data Aggregation Energy %
EDA=5*10^(-9); % units in Joules/bit
% Size of data package %
k=4000; % units in bits
% Suggested percentage of cluster head %
p=0.05; % a 5 percent of the total amount of nodes used in the network is
proposed to give good results
% Number of Clusters %
No=p*n;
% Round of Operation %
rnd=0;
% Current Number of operating Nodes %
operating_nodes=n;
transmissions=0;
temp_val=0;
flag1stdead=0;
%%%%%%%%%%%%%%%%%%%%%%%%%%% End of Parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% Creation of the Wireless Sensor Network %%%

% Plotting the WSN %


for i=1:n

SN(i).id=i; % sensor's ID number


SN(i).x=rand(1,1)*xm; % X-axis coordinates of sensor node
SN(i).y=rand(1,1)*ym; % Y-axis coordinates of sensor node
SN(i).E=Eo; % nodes energy levels (initially set to be equal to "Eo"
SN(i).role=0; % node acts as normal if the value is '0', if elected as
a cluster head it gets the value '1' (initially all nodes are normal)
SN(i).cluster=0; % the cluster which a node belongs to
SN(i).cond=1; % States the current condition of the node. when the
node is operational its value is =1 and when dead =0
SN(i).rop=0; % number of rounds node was operational
SN(i).rleft=0; % rounds left for node to become available for Cluster
Head election
SN(i).dtch=0; % nodes distance from the cluster head of the cluster in
which he belongs
SN(i).dts=0; % nodes distance from the sink
SN(i).tel=0; % states how many times the node was elected as a
Cluster Head
SN(i).rn=0; % round node got elected as cluster head
SN(i).chid=0; % node ID of the cluster head which the "i" normal node
belongs to

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

%%%%%% Set-Up Phase %%%%%%

while operating_nodes>0

% Displays Current Round %


rnd

% Threshold Value %
t=(p/(1-p*(mod(rnd,1/p))));
% Re-election Value %
tleft=mod(rnd,1/p);

% Reseting Previous Amount Of Cluster Heads In the Network %


CLheads=0;

% Reseting Previous Amount Of Energy Consumed In the Network on the


Previous Round %
energy=0;

% Cluster Heads Election %

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

% Fixing the size of "CL" array %


CL=CL(1:CLheads);

% 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

%%%%%% Steady-State Phase %%%%%%

% Energy Dissipation for normal nodes %

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;

% Dissipation for cluster head during reception


if SN(SN(i).chid).E>0 && SN(SN(i).chid).cond==1 &&
SN(SN(i).chid).role==1
ERx=(Eelec+EDA)*k;
energy=energy+ERx;
SN(SN(i).chid).E=SN(SN(i).chid).E - ERx;
if SN(SN(i).chid).E<=0 % if cluster heads energy depletes with
reception
SN(SN(i).chid).cond=0;
SN(SN(i).chid).rop=rnd;
dead_nodes=dead_nodes +1;
operating_nodes= operating_nodes - 1
end
end
end

if SN(i).E<=0 % if nodes energy depletes with transmission


dead_nodes=dead_nodes +1;
operating_nodes= operating_nodes - 1
SN(i).cond=0;
SN(i).chid=0;
SN(i).rop=rnd;
end

end
end

% Energy Dissipation for cluster head nodes %

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

if operating_nodes<n && temp_val==0


temp_val=1;
flag1stdead=rnd
end
% Display Number of Cluster Heads of this round %
%CLheads;

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

% Plotting Simulation Results "Operating Nodes per Round" %


figure(2)
plot(1:rnd,op(1:rnd),'-r','Linewidth',2);
title ({'LEACH'; 'Operating Nodes per Round';})
xlabel 'Rounds';
ylabel 'Operational Nodes';
hold on;

% Plotting Simulation Results %


figure(3)
plot(1:transmissions,tr(1:transmissions),'-r','Linewidth',2);
title ({'LEACH'; 'Operational Nodes per Transmission';})
xlabel 'Transmissions';
ylabel 'Operational Nodes';
hold on;

% Plotting Simulation Results %


figure(4)
plot(1:flag1stdead,nrg(1:flag1stdead),'-r','Linewidth',2);
title ({'LEACH'; 'Energy consumed per Transmission';})
xlabel 'Transmission';
ylabel 'Energy ( J )';
hold on;

% Plotting Simulation Results %


figure(5)
plot(1:flag1stdead,avg_node(1:flag1stdead),'-r','Linewidth',2);
title ({'LEACH'; 'Average Energy consumed by a Node per Transmission';})
xlabel 'Transmissions';
ylabel 'Energy ( J )';
hold on;

S-ar putea să vă placă și