A new energy aware cluster head selection for LEACH in wireless sensor networks

Reza Javidan, Computer Engineering and IT Department, Shiraz University of Technology, Shiraz, Iran. Email: javidan@sutech.ac.ir Abstract Internet of Things (IoTs) as a new network pattern for the intelligent world usually uses wireless sensor networks (WSNs) as a perception layer which consisted of numerous number of sensor nodes scattered in the environment to gather intended information. The selected information then is sent to a base station (BS) to be sent to cloud server for further processing. Since the energy of sensor nodes is limited, the most significant challenge in these networks is reducing the energy consumption of the network. It is proved that dividing the network to clusters can significantly reduce the energy consumption. One of the most popular clustering protocols in WSNs is the Low‐Energy Adaptive Clustering Hierarchy (LEACH). In this protocol, cluster heads (CHs) are selected randomly which results in poor performance in real scenarios. In this article, a new energy aware CH selection algorithm is proposed which selects CHs based on the residual energy, the position and centrality of nodes. It uses a variable range upon which the centrality and the number of neighbours of each node are calculated. Simulation results show that the proposed algorithm outperforms LEACH, Multi‐hope Routing with LEACH (MR‐LEACH) and Enhanced Multi‐hop LEACH (EM‐LEACH) in terms of reducing energy consumption, increasing network lifetime and improving network reliability.


| INTRODUCTION
A wireless sensor network (WSN) comprises of a large number of small sensors which run on battery and their energy resources are limited [1]. Sensor nodes of WSNs are usually deployed randomly in the environment. These distributed nodes are used for monitoring environmental conditions (e.g. temperature, pressure), such as the security analysing weather condition and military applications [2]. Collected data is sent either directly to the base station (BS) or to a local cluster head (CH). The CH aggregates receive data and sends it to the BS. Since these nodes run on battery, their energy is limited and the battery cannot be replaced easily in many cases. When the battery of the nodes runs, it can lead to communication failure and data cannot be transmitted on time. Therefore, the lifetime of the nodes needs to be increased and the energy consumption should be decreased [1,2].
Internet of Things (IoT) is a world in which physical objects are addressable and can communicate with each other. It is conspicuous that IoT consists of two terms: Being one of the most traditional and popular WSN protocol, Low-Energy Adaptive Clustering Hierarchy (LEACH) has been widely studied. Generally, LEACH can increase the network lifetime compared with flat algorithms [7]. However, this protocol selects CHs randomly and does not take energy level, position and other properties of nodes into consideration. Many LEACH-based algorithms have been proposed to decrease the energy consumption and prolong the network lifetime by selecting the most desirable CHs, such as Advanced LEACH (ALEACH), EE-LEACH, LEACH-N, LEACH-T etc. [8][9][10][11]. However, these algorithms have been proven to be energy efficient; either they do not balance the load among CHs or have high overhead and required computations.
To date, a significant number of studies have sought to reduce the energy consumption and prolong network lifetime in WSNs. Many criteria have been examined and among them, residential energy of nodes and their distances from the sink can be considered as the main factors on which the prominent CHs can be selected. However, previous studies were carried out regardless of the fact that the density of WSNs was dynamic in nature and over time. To address this limitation, in this article, a new energy efficient CH selection algorithm is proposed called as DRE-LEACH, which utilises a dynamic range and the work is based on four criteria: the residual energy of the node, distance between the nodes and the sink, intercluster centrality of nodes and finally the number of neighbours of each node. First, at the beginning of each round, a range is calculated based on the size of the network and alive nodes. As more nodes become dead, the range will increase and becomes is proportional to the network density. The number of neighbours for each node is calculated within its range; and, therefore, less computation is required. Furthermore, it was considered that the number of neighbours in CH selection results in an energy balanced algorithm. In addition, the centrality of each node is calculated within its range and locally, and only nodes which are within its range are considered for calculation. According to the four mentioned factors, a score is assigned to each node, and nodes with the highest score are selected as CHs in each round. Furthermore, in each round, 5% of the alive nodes are selected as CHs.
The key features of this article are highlighted as follows: � Despite several studies, a new energy efficient CH selection algorithm is proposed which is based on the dynamic behaviour of the network. � A variable range is used to localise the required calculations, which leads to less computation. � Residual energy of nodes, their distance to sink, the number of neighbours they have and their local centrality are taken into consideration which make the algorithm both energy efficient and energy balanced. � Range is calculated depending on the network density during each round.
The rest of this article is organised as follow. The related work is presented in Section 2. In Section 3, the proposed algorithm is presented in detail along with energy models. The simulation setup and results are presented in Section 4. Finally, Section 5 concludes the article.

| RELATED WORK
One of the most imperative constraints in WSNs is the limited energy of the sensor nodes. This limitation is due to the fact that sensors deployed in WSNs run on embedded batteries and in majority of applications, batteries cannot be replaced. Therefore, minimising the energy consumption in WSNs has always been a topic of interest among the researchers. Several algorithms have been proposed to reduce the energy consumption of WSNs, and in this section, some of these algorithms are reviewed.
Heinzelman et al. [12], proposed a clustering algorithm for WSNs named LEACH. LEACH uses a distributed algorithm to form clusters without using any centralised control. It consists of several rounds in which some nodes are selected as CHs randomly. Cluster members send their data to the CH and the CH sends the aggregated data to a sink.
Loscri et al. [13], proposed a two-level (TL-LEACH) algorithm as an extended version of the LEACH. The main difference between TL-LEACH and LEACH is in the setupphase. In TL-LEACH, two types of CHs are introduced: the primary CHs and secondary CHs. First, the primary CHs are selected in each round after which the secondary CHs are selected. Primary CHs communicate to BS directly, while secondary CHs transmit their aggregated data to the primary CHs they belong to. Each normal node sends its data to a secondary CH. In this regard, a two-level hierarchy is constructed. Using this approach, the number of nodes transmitting data to BS is effectively reduced. This results in a decrease in total energy consumption and increasing network lifetime. Results have shown that if TL-LEACH is deployed, the number of rounds consumed when the first node dies (FND) and the last node dies (LND) is approximately 200 and 500 more than that when the LEACH is used respectively.
Manjula et al. [14], introduced LEACH-CE in which 5% of the live nodes are CHs. Before the selection of the CHs begins, 10% of the nodes are forced to go into the sleep mode by the BS. These nodes neither receive any information from the BS nor sense any data. All operations are controlled by the BS. Nodes are selected randomly to go to sleep mode; therefore, this method prolongs the network lifetime, but the quality of the network is not guaranteed.
Ali et al. [8], introduced ALEACH. In this study, a new CH selection is proposed that enables selecting the best suited node to be selected as the CH. In the proposed algorithm, nodes generate CHs according to their own autonomous decisions. ALEACH decreases the die rate of the nodes which in turn increases the network lifetime.
Wang et al. [15], proposed a hybrid cluster selection algorithm to improve LEACH called LEACH-H. In the proposed algorithm, in the first round, the sink selects a CH set using a simulated annealing algorithm. In the following rounds, each CH is responsible for selecting a new CH for its cluster. The proposed algorithm has tried to solve uneven distribution of CHs in the LEACH and maintain the characteristics of distribution. LEACH-H increases the network lifetime and decreases the energy consumption.
Farooq et al. [16], introduced a multi-hope routing with LEACH called as the MR-LEACH in which a network is partitioned into several cluster layers. The CHs in a higher level transmit their data to sink through the CHs of lower levels. Ordinary nodes select their CHs based on the received signal strength indicator (RSSI). The sink is responsible for selecting the upper layer CHs which act as super CHs for lower level CHs. Also, the sink is responsible for TDMA scheduling for each CH. This approach decreases the energy consumption by using a multi-hope routing and increases the network lifetime.
Geo et al. [17], proposed an extended LEACH protocol called ACHTH-LEACH. In this approach, an adaptive CH selection and multi-hop communication is used to increase the network lifetime and decrease energy consumption. Nodes are tagged as 'near' or 'far' depending on their distance from the sink. While all near nodes are considered as a single cluster, far nodes are divided into several clusters, using a greedy K-means algorithm. In each round, the node with the maximum residual energy is selected as CH in each cluster. A far CH can either communicate directly with the sink or through the near CHs. The result has shown that the network lifetime is doubled when ACHTH-LEACH is used rather than LEACH.
Tong et al. [18], proposed an improved LEACH protocol called LEACH-B. In this approach, in the first round, CHs are selected similar to the LEACH protocol; however, in next rounds, the residual energy of nodes is taken into consideration. In this approach, the number of CHs in each round is constant and near to optimal. The proposed method has balanced the network energy consumption and outperforms LEACH in terms of the network lifetime.
Yektaparast et al. [19], proposed cell-LEACH in which each cluster is divided into seven subsections known as cells. Each cell has its own cell-head which communicates directly with its CH. Cell-heads aggregate data of their own cell and, therefore, prevent sensors from communicating. Results have shown that cell-LEACH outperforms LEACH and LEACH-C in terms of energy consumption.
Wang et al. [20], proposed LEACH-R to enhance the efficiency of CH selection. In the proposed method, the residual energy of node is considered as a key factor for CH selection. In this regard, nodes with low energy have much lower chance to be selected as CH. Furthermore, relying nodes in LEACH-C are selected according to their residual energy and distance from the sink. Relying nodes are selected among cluster nodes and they are responsible for forwarding packets from CHs to the sink. In comparison with the LEACH, the proposed algorithm saves about 20% of the network energy.
Xu et al. [21], proposed a modified version of LEACH called E-LEACH. In this algorithm the residual energy of nodes is considered in order to balance the network load, and the round time is changed according to optimal cluster size. Compared with LEACH, E-LEACH increases the network lifetime by 40%.
Haneef et al. [22], proposed an energy efficient routing algorithm based on LEACH called MG-LEACH. The proposed algorithm works by minimising the redundancy in WSNs, as many sensors are deployed in such networks, and redundant data is sent in these environments. In MG-LEACH, the redundant data is discarded by CHs before being forwarded to the sink. The proposed algorithm uses the redundancy of deployed nodes as a merit for increasing the network lifetime.
Ahlawat et al. [23], proposed a new version of LEACH called improved VLEACH to increase the network lifetime. In this method a vice CH is selected to be considered as an alternative to the current CH. If the CH dies, it will be replaced by the selected vice CH and in this way the existence of the CH is guaranteed to increase the lifetime of the network.
Liao et al. [24], proposed an energy-balanced clustering algorithm based on the LEACH protocol relying on the residual energy and distance. The selection method of the threshold for choosing CHs is optimised by the proposed algorithm. This algorithm outperforms the traditional LEACH protocol in terms of balancing node energy consumption, improving the efficiency of data transmission and prolonging the network life.
Kole et al. [25], introduced a distance-based LEACH algorithm to improve the network performance. The performance is improved by applying a cluster formation technique based on distance parameter. In this study, the cluster formation phase of the traditional LEACH algorithm is modified, taking both the distance of the sensor nodes from the CHs and distance of CHs from the sink into account.
Nayak et al. [26], proposed a fuzzy logic-based clustering algorithm called FLLEACH. In this approach, a super CH is introduced between the CHs and the sink. The aggregated data is sent to sink from the CHs through the super CH. In FLLEACH, the residual energy, mobility and centrality are considered as the three fuzzy inputs to calculate the chance of each node to become a super CH. The result has shown that it prolongs the network lifetime and decreases the energy consumption in comparison with the LEACH.
Zhang et al. [27], proposed an intra-cluster energy efficient and weighted scheme for WSNs. In the proposed approach, it is assumed that the sink is equipped with a GPS unit. Similar to LEACH, the operations are divided into different rounds. The information about sink location is advertised before the setup phase is started. Nodes estimate their location based on the received RSSI and forward their location information back to the sink. In the steady phase, a weighted relay is elected in each cluster according to the residual energy of its members and their distance from sink. CHs aggregate data and send it to the sink via weighted relays.
Kaddi et al. [28], introduced a new routing protocol for WSNs called LEACH_KANG. The energy consumption is decreased by using a hybrid protocol between the LEACH and a heuristic method. This method uses the kangaroo method which is an approximation technique based on the stochastic descent consisting of a random descent from several randomly chosen points in the search space. The proposed method improves the lifetime of the network in comparison with the LEACH. POUR AND JAVIDAN Al-Sodairi et al. [29], examined the effectiveness of LEACH and LEACH-based clustering algorithms. Then an improved LEACH clustering protocol called enhanced multi-hop LEACH (EM-LEACH) is proposed. The proposed algorithm decreases and balances the energy consumption of the network, leading to longer network lifetime. A new set of rules for CH selection is proposed based on the residual energy of nodes. Moreover, a multi-hop communication model is used. EM-LEACH increases both the packet delivery rates and the network lifetime.
Salem et al. [30], proposed an enhancement of LEACH protocol. Similar to LEACH, it has two stages, namely: the setup and steady stages. However, its setup stage is different from the LEACH protocol. CHs in the proposed algorithm are selected based on the lowest degree of distance from the sink in order to reduce the energy consumption. The proposed algorithm enhances the network lifetime and reduces the power consumption of the network.
The purpose of this literature review is to provide a comparison between the LEACH-based algorithm in WSNs in terms of energy efficiency and prolonging the network lifetime. The differences of the extended LEACH-based clustering protocols are summarised in Table 1. The studied protocols are compared in terms of cluster formation type, energy efficiency, connectivity and performance improvements.
Although, the previous studies improved energy efficiency in LEACH, most of them did not improve the load balancing among CHs which leads to an unbalanced network. In the proposed method in this article, a variable range is defined depending on which the calculation is done; therefore, less memory consumption and overhead is guaranteed compared with the previous studies. In our proposed method, at the beginning of each round, a variable range is defined based on the network density. Each node finds its neighbours according to this range. Then a score is assigned to each node based on the residual energy, distance between nodes and the sink, the number of their neighbours and their centrality. Then, 5% of nodes with the highest score are selected as CHs in each round. The extensively proposed algorithm is presented in Section 3.

| THE PROPOSED METHOD
In the proposed method, the nodes of the WSN are distributed in the environment in a random and uniform manner. The position of nodes is fixed, and the initial energy level of every node is the same. Nodes have similar hardware capabilities; therefore, the network is homogeneous. The position of the sink is fixed and it is situated in the middle of the upper side of the network outside the area.
Each node is equipped with a GPS module and hence it knows its own as well as other nodes' and sink's positions. Similar to LEACH, the proposed method is established over the round concept and each round consists of two phases. The first phase is responsible for the CHs' selection and clustering, while the second phase is responsible for the creation of schedule and transferring of data. The second phase is similar to the steady stage of the traditional LEACH algorithm. During the first phase, CHs are selected according to their residential energy, number of neighbours, distance from the sink and centrality. In the second phase, similar to LEACH, the data of each node is sent to its corresponding CHs, after which the aggregated data is sent to the sink.

| Clustering
In the proposed method, in each round, a variable called range is calculated and for each node, those nodes whose distance from this node are less than the range are considered as its neighbours. The range is calculated as follows: Range ¼ ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffiffi where, x m , y m and n are the width of the area, the length of the area and number of alive nodes respectively. When the number of nodes decreases, the range increases. If the range does not change according to the number of alive nodes, the number of clusters will increase dramatically with the gradual demise of nodes. Therefore, in the proposed method, in the beginning of each round, the range is calculated based on the density of the nodes. After each node i fills its neighbour table, its centrality is calculated according to the following equation: ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi À where, no. of nbr is the number of node i 's neighbours, (x i , y i ) is the location of node i and (x j , y j ) is the location of its neighbours. In addition, each node's distance from the sink is calculated according to the following equation: D iÀ sink ¼ ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi where, D iÀ sink is the distance between node i and sink, (x sink , y sink ) is the location of the sink and (x i , y i ) is the location of the node. Then, a score is allocated to each node according to the following criteria: its residual energy, its number of neighbours, its distance from the sink, its distance from its furthest neighbour and the distance of its furthest neighbour to the sink. The score of each node is calculated as follows: where, E i , E 0 and D iÀ sink are the current energy of the node, initial energy of the node and distance between the node and the sink, respectively; and D iÀ fnbr represents the distance between the node and its farthest neighbour. Each node calculates the score of itself and its neighbours; and if its score is higher than any of its neighbours, it announces itself as the CH and its neighbours become the members of its cluster. Nodes which are not within the range of any CH forward their data directly into the sink. After clustering has been performed, each member of the cluster sends its data to its CHs which aggregate the data and send it to the sink.
The flowchart of the CH selection algorithm is illustrated in Figure 1. As previously mentioned, the proposed method is Geo et al. [17] � Nodes are tagged as near and far � All near nodes are included in one cluster. � Far nodes are included in different clusters, using the greedy K-means algorithm.
Multi-hop � A more stable routing environment is established � Network lifetime is increased.
Tong et al. [18] � Considers the residual energy of nodes. � the number of CHs is near optimal.
Single-hop � Balance network energy � Increase network lifetime.
Yektaparast et al. [19] � Each cluster is divided into seven cells. � Cell-heads communicate with CH directly.

Two-hop
� Reduce energy consumption. � Increase network lifetime.
Wang et al. [20] � Relay nodes are used between sink and other CHs.
� Relay nodes are chosen based on residual energy and distance from sink.
Multi-hop � Reduce energy consumption.
Xu et al. [21] � The residual energy of nodes is considered. � Round time is changed based on optimal cluster size.
Single-hop � Network lifetime is increased.
� CHs discard redundant information before sending.
Single-hop � Increase network lifetime.
� Take residual energy and distance into consideration.
Single-hop � Increase network lifetime.
Liao et al. [24] � Take residual energy and nodes' location information into account. � Optimise the threshold for CH selection.
Single-hop � Balance network energy.
� Increase network lifetime.
Kole et al. [25] � CHs are selected based on their distance with other nodes and their distance to sink.
Single-hop � Increase network lifetime.
Zhang et al. [27] � Next hop is selected by CH based on residual energy and distance to sink. Multi-hop � Increase network lifetime.
Nayak et al. [26] � A fuzzy approach is used to select SCHs which are used as relay nodes to transfer data to sink.
Multi-hop � Increase network lifetime.
� Uses optimal path to transmit data from nodes to sink.
Multi-hop � Increase network lifetime.
Al-Sodairi et al. [29] � New rules are introduced for cluster selection and round time computing based on residual energy.
Multi-hop � Increase network lifetime.
Salem et al. [30] � CHs are selected according to the lowest degree of distance from sink. Single-hop � Reduce power consumption.
� Increase network lifetime.
POUR AND JAVIDAN a round-based method similar to LEACH; however, its CH selection algorithm is different. The pseudo code of the cluster selection stage of the algorithm is illustrated in Figure 2. As it is clear from the pseudo code, first the distance between each node and the sink is calculated. Then, at the beginning of each round, first, the energy of each node is checked; the nodes with residual energy higher than zero are considered as alive nodes and labelled as normal nodes and finally the number of alive nodes (N_alive) is calculated. At this point, all alive nodes are considered as normal nodes and no CH is selected yet. Next, based on the number of alive nodes in the current round, the range (R) is calculated according to Equation (1), after which, the score of each node is set to 0 in the current round. In each round, the neighbours of each node are calculated based on the new range (R). After determining the neighbours of each node in the current round, the centrality of each node is calculated according to Equation (2). At this point, neighbour nodes exchange their info tables. Nodes with highest score among their neighbours become CHs of the current round and advertise themselves. If a normal node receives multiple advertisements, it joins the CH with the highest score. Line 28 of the pseudo code assures that only 5% of the alive nodes become CHs in each round.

| Energy model
The second phase of the algorithm is similar to the LEACH, and each ordinary node collects data from the surrounding environment and sends it to its CH in a TDMA manner. Depending on the distance between the sensor nodes and their destinations, the free space and the two-ray ground propagation models can be considered for energy consumption. Given a threshold distance of d 0 , the free model will be used when d < d 0 as follows [31].
where, E Tx (l, d ) is the energy consumption to send l bit of data, E elec is the amount of energy reduced by the conveyor and the receiver circuit, ε fs is the amplifier parameters of transformation corresponding to the free space technique and d is the Euclidian distance between nodes and their destinations. However, if d > d0, the energy consumption is calculated by the following equation [31].
where, ε mp , is the amplifier parameter of the transformation corresponding to the multi-path fading model.

| SIMULATION RESULTS AND ANALYSIS
MATLAB R2015b is used to simulate the proposed algorithm. The results have been compared with LEACH, EM-LEACH and MR-LEACH methods and illustrated as diagrams. The parameters of the simulations are provided in Table 2. To provide a fair comparison, and simulations have been run under the same circumstances. Figure 3 shows the result in which round the first, and the entire nodes die for each method. The first node dies in MR-LEACH method far sooner than other methods. The first node of LEACH and our proposed method dies almost after a similar number of rounds has passed; however, the first node of EM-LEACH algorithm dies sooner than these methods. With the increase in the number of rounds, the difference between these algorithms become clearer. However, all nodes in LEACH die before round 1200, the last node in EM-LEACH dies at round 1390 and the last node on applying MR-LEACH and our algorithm dies at rounds 1509 and 1593 respectively.
The energy consumptions of LEACH, EM-LEACH, MR-LEACH and the proposed algorithm are depicted in Figure 4. Initially, there are 100 nodes in networks and each node has 5 J of energy. Therefore, the total energy for all methods at first is 500 J. LEACH algorithm loses 50% of its energy in approximately 200 rounds. The equivalent figure for MR-LEACH is around 300 rounds. EM-LEACH loses 50% of its energy before 200 rounds, and the proposed algorithm loses 50% of its energy almost after 400 rounds. The total network lifetime has increased by 32%, using the proposed algorithm, compared with LEACH. The number of packets delivered to the sink per number of alive nodes is depicted in Figure 5 for LEACH, MR-LEACH, EM-LEACH and our proposed algorithm. It is conspicuous that EM-LEACH and the proposed algorithm outperform LEACH and MR-LEACH. While the proposed algorithm performs better than EM-LEACH, the difference between these two algorithms is not significant. Therefore, network reliability is improved by the proposed algorithm.
The relation between the number of delivered packets and energy consumption for LEACH, MR-LEACH, EM-LEACH and our algorithm is illustrated in Figure 6 which can be considered as another metric for network reliability. It is clear that the energy consumption of the proposed algorithm and EM-LEACH algorithm is far less than LEACH and MR-LEACH algorithms. The proposed algorithm reduces the energy consumption by trying to select CHs that minimise the total distance between nodes and their respective CHs. It also uses a different range for its calculation in each round, and the range increases when the network density decreases, which in turn reduces the chance of nodes to become isolated and sends their data directly into the sink.

| CONCLUSION
The purpose of this study was to propose a new CH selection algorithm to improve the network lifetime and reduce energy consumption in WSNs. We proposed a clustering method which took the distance between nodes and sink, network density and residual energy of nodes into consideration before choosing CHs. It also makes the calculation in each round based on a variable range which is defined based on the network density. In this regard, less calculation is required. Moreover, due to the fact that when more nodes die, the range decreases. The network connectivity and the number of direct transmissions also decrease between the nodes and the sink. Considering the number of neighbours, residual energy and centrality helps to have an energy balanced network.
The proposed method was evaluated by MATALAB R2015b and compared with LEACH, MR-LEACH and EM-LEACH and the results showed that the proposed algorithm outperforms these methods in terms of increasing the network lifetime, decreasing energy consumption and improving network reliability. Furthermore, as the number of rounds increases, the declined power consumption will reduce to a great extent.
The subject of decreasing power consumption in WSNs has always been a topic of interest due to the effect of the network lifetime. A future objective of this study is to extend the proposed method over a multi-hop routing between different CHs. In the current study, we employed the single hop routing in which CHs directly communicate with the BS. It has been proved that multi-hop communication in WSNs leads to less energy consumption. Therefore, if some CHs play the role of relay nodes and other CHs send their data to the BS through these nodes, the energy consumption of the network will be decreased. Our goal is to define a multi-hope routing protocol in which the selected CHS send their data according to the present approach through the relay nodes rather directly. However, in this case, we should keep routing tables updated since routes in WSNs dynamically change.