An Energy-Balanced Routing Protocol for a Wireless Sensor Network

The wireless sensor network is an intelligent self-organizing network which consists of many sensor nodes deployed in the monitoring area. The greatest challenge of designing a wireless sensor network is to balance the energy consumption and prolong the lifetime of the network, seeing that the nodes can be powered only by batteries in most conditions. An energybalanced routing protocol (EBRP) for wireless sensor networks is proposed in this paper. In EBRP, we divide the network into several clusters by using K-means++ algorithm and select the cluster head by using the fuzzy logical system (FLS). Since the previous researches did not demonstrate how to get the fuzzy rules for different networks, we propose a genetic algorithm (GA) to obtain the fuzzy rules. We code the rules as a chromosome, and the lifetime of the network is treated as a fit function. Then, through the selection, crossover, and mutation of each generation, the best offspring can be decoded as the best rule for each network model. Through the simulation, comparing with the existing routing protocols such as low-energy adaptive clustering hierarchy (LEACH), low-energy adaptive clustering hierarchy-centralized (LEACH-C), and stable election protocol (SEP), the EBRP prolongs the network lifetime (first node dies) by 57%, 63%, and 63%, respectively.


Introduction
A wireless sensor network (WSN) consists of a large scale of cheap microsensor nodes deployed in the monitoring area.These nodes are usually networked in a multihop fashion, to enable cooperation among nodes and real-time delivery of sensed data to the users [1].Due to the limited resources of the computing power, battery, and communication capacity of sensor nodes in a large scale [2,3], it is a challenge to prolong the lifetime and balance the energy consumption in a WSN [4].
One of the popular techniques to balance the energy consumption in the nodes and prolong the lifetime of the network is clustering [5].The energy efficiency and the network lifetime of WSNs are extremely related to a self-organization and clustering mechanism, because of their benefits in these issues [6].Clustering is a method to divide the nodes into several groups called clusters.Each cluster chooses a special node as a coordinator named the cluster head (CH).In this method, the nodes do not need to communicate with the sink node directly.Alternately, the CHs integrate the data collected in the cluster and transfer it to the sink node.As a consequence, the clustering leads to a significant reduction in the energy consumption in the network.
This paper presents a routing protocol for WSN called an energy-balanced routing protocol (EBRP) for wireless sensor networks.The EBRP balances the energy consumption of the network and prolongs the lifetime of the network.The sink node divides the network into K clusters by using a K-means++ algorithm and broadcasts the fuzzy rules.In the first round, the sink node calculates the chosen value of each node by FLS and chooses the CHs with the maximum value in each cluster.The CH records the energy and distance information of the cluster member nodes for calculating the chosen value.The CH of this round selects the node with the maximum value as a CH of the next round in each cluster.The fuzzy rules are acquired by the sink node for the current network deployment through a designed GA.We code the fuzzy rules as chromosomes of individuals in GA while the fitness function is the lifetime of a specific network model.Then, through crossover, selection, and mutation, the best individual with the longest network lifetime is obtained which is decoded as the best fuzzy rules.In this protocol, the large computation such as for clustering and acquiring fuzzy rules is undertaken by a sink node while the small one is computed by nodes in a distributed way such as the CH selection without communicating with the sink node directly.Therefore, the EBRP is propagable since we can acquire appropriate fuzzy rules for different sizes or deployment of WSNs with it.
The rest of this paper is organized as follows.The related work is presented in Section 2. Section 3 shows the preliminaries including the WSN model and the energy model.The details of the proposed EBRP are illustrated in Section 4. Section 5 provides the simulation results of the network performance.Finally, Section 6 concludes the paper.

Related Work
Many efforts have attempted to design a clustering routing protocol to prolong the lifetime of WSN.In this section, the authors present the related existing protocols.
The most famous clustering routing protocol is LEACH [7].Since the CH is elected randomly and circularly to balance the energy consumption in every node, the LEACH achieves low energy consumption, well energy balance, and a long lifetime of the whole network.However, there are some shortcomings in LEACH.While the CHs are selected totally randomly without considering the position in the network, sometimes it is likely that there will be no CHs in an area and it will lead to a rapid energy consumption.For another, the consumption of the clustering process is huge since the cluster is generated in every round.Then, Heinzelman et al. proposed LEACH-C [8] which is a centralized protocol.The nodes send their residual energy and position data to the sink node at the beginning of each round, and the CHs are selected by the sink node.The consumption is huge if the nodes are far away from the sink node because the nodes need to communicate with the sink node in every round.The advanced routing transfer low-energy adaptive clustering hierarchy (ART-LEACH) [9] consumed less power than LEACH, but the lifetime of the network when the first node dies is much shorter than LEACH.The ART-LEACH achieved a poor energy-balancing effect.Mehmood et al. [6] proposed a secure and low-energy zone-based wireless sensor network routing protocol where the nodes of the WSN are split into zones and each zone is separated into clusters.They focused on security and energy efficiency in a specific area.An energy-efficient multilevel and distance-aware Clustering (EEMDC) mechanism is proposed to improve the energy efficiency of the multihop WSN [10].The hybrid energyefficient distributed (HEED) clustering approach [11] is a protocol which chooses the CH by residual energy and communication cost to evenly distribute the CHs.While the communication cost of each node does not change much during a period, every node is required to broadcast its communication cost in every round which may bring unnecessary consumption.Mehmood et al. [12] proposed an artificial neural network for WSN monitoring which is trained by huge data of a specific monitoring environment.Indranil et al. [13] applied the fuzzy logical system to CH selection with the position and residual energy of the node which has the same shortcoming as the LEACH-C.In GCHE-FL [5], the fuzzy logical system is used to select CHs and clustering.Izadi et al. [14] used a type-2 fuzzy logical system to determine the probability of CH selection.Roslin [15] used the genetic algorithm directly in CH selection without considering the computing power of the node.SEP [16] calculates the probability of a node being a CH by its residual energy and of the whole residual energy of the network to prolong the lifetime of network, assuming that each node knows the whole residual energy of the network.The LEACH-balanced protocol focused on energy-balancing, and the parameter of residual energy was introduced [17].However, they did not take the positions of the nodes into consideration.Khan et al. [18] balanced the energy consumption in a specific secure protocol by introducing a balanced factor.Yuea et al. [19] formulated a balanced cluster-based data aggregation algorithm.The WSN was divided into grids, and the CH was selected to manage the nodes and balance the energy consumption of the nodes.
Generally, the centralized protocol requires the sink node to select CHs of each round, and the nodes must communicate with the sink node in each round.It is difficult to achieve good performance of the network with the distributed protocols since the protocol implemented should be simple because of the limited computing and energy resource of the node.The protocol in [15] is hard to apply in practice because of the large amount of computing of the GA.The fuzzy logical system is suitable for distributed computing with simple if-then rules [20].But [5,13,20] only gave the fuzzy rules by experience and did not propose a common optimization method to obtain fuzzy rules for different sizes or deployment of the network.To overcome these drawbacks of the protocols mentioned above, this paper proposed an energy-balanced routing protocol for wireless sensor networks named EBRP.

Preliminaries
In this section, the WSN model and energy model we use to evaluate the protocols are presented in detail.

WSN Model.
The WSN model considered in this paper is composed of a sink node and many sensor nodes deployed in an area randomly [21].The sensor nodes collect the data from the area and then send to the sink node.Meanwhile, the sink node processes and transfers the data to a cloud or users [22].There are some assumptions of the WSN model in this paper: (e) The sensor nodes can adjust the transmission power to the transmission distance.
3.2.Energy Model.We use the first-order wireless model as the energy model in [5].The required energy for transmitting l bit to d distance can be calculated in where E elec is the transmitter energy or receive circuit, ε fs is the parameter in a free space model, ε mp is the parameter in a multipath fading model, and d 0 is the threshold which is calculated in The required energy for receiving l bit to d distance can be calculated by (3).

The Proposed Energy-Balanced Routing Protocol
In this section, the proposed EBRP is illustrated.Firstly, we provide the clustering method-based K-means++ and the selection method based on FLS.Then, a new GA is developed to acquire the suitable fuzzy rules for different WSNs in our designed FLS.At last, we demonstrate the whole operation process of EBRP.

K-Means++ Clustering.
To balance the energy and prolong the lifetime of the network, we need to design an appropriate clustering algorithm at the first time.In this paper, the K-means++ clustering algorithm [23] is modified to be suitable for WSN clustering.The sink node divides the nodes into K clusters in line with the positions of the nodes.Let X = x 1 , x 2 , … , x m , … , x n be the set of the coordinates of the node, and the algorithm is as follows: (a) A node in set X is chosen randomly as the number 1 cluster center c 1 .The distances between the new cluster center and other nodes are calculated by the sink node.A new node x m is chosen as a new cluster center c p , while the probability of being chosen is d 2 x m , c p /∑ n j=1 d 2 x j , c p , where p ∈ 1, … , k .d x m , c j is the Euclidean distance between x m and c j , and the p is the cluster number.(c) The distance between each node to each cluster center is calculated, and the node is computed to the nearest cluster center.It is denoted by x i ∈ C p , where the C p is the set of nodes in cluster p.
(d) The new cluster center in each cluster is denoted by (e) Repeat steps d and e until reaching the number of setting iterations.
The K clusters are obtained through the algorithm by the sink node.Then, the sink node broadcasts the center coordinate of each cluster and the cluster number to the corresponding node.

4.2.
The Selection of CH Based on a Fuzzy Logical System.As the clusters are formed, we need an efficient CH selection method.With a selection method in a centralized way, the energy consumption of WSN is huge since the sink node needs to transmit the information of selected CHs to all the nodes in each round.In particular, the selection method ought to be implement in a distributed way.Moreover, the lifetime of the whole network depends on the energy consumption related to the distance and residual energy of each node.It is hard to describe the exact mathematical model of the relationship between the network lifetime and the nodes' parameters.The FLS does not need an exact mathematical model of the system as well, and it can make decisions even if there is insufficient data.Thus, the FLS is strongly recommended for WSN due to its low computational complexity and its easy application in a distributed way with low cost compared to other methods.Therefore, we develop a FLS to select the CHs.
The position and residual energy of the nodes are the key parameters in the CH selection.There are three inputs in the proposed FLS: the distance from the sensor node to the sink node, the distance from the sensor node to the cluster center, and the residual energy of the node.For ease of handling, we normalize these three values to fit in [0,1] by min-max normalization [24].The normalize function is shown in where x max is the maximum value and x min is the minimum value in its cluster.
The distance from the sensor node to the sink node, the distance from the sensor node to the cluster center, and the residual energy of the senor node are denoted by D tos , D toc , and E res , respectively, as three inputs in FLS after the normalization.The D tos and D toc are divided into three levels: L, M, and H.The E res is divided into five levels: vL, L, M, H, and vH.The output of the FLS is the choosing priority denoted by P choose which is divided into nine levels: vvL, vL, L, rL, M, rH, H, vH, and vvH.The membership functions of inputs and outputs are trapezoidal-shaped or triangular-shaped that are demonstrated in Figure 1.

Journal of Sensors
The level number of fuzzy inputs D tos , D toc , and E res is 3, 3, and 5, respectively.Therefore, the total number of fuzzy rules is 45 = 3 * 3 * 5 in the proposed FLS.The output has 9 levels.Thus, the total number of possible fuzzy states is 9 45 .It is hard to develop the rules only by experience with so many states while the appropriate fuzzy rules of a specific network may be different as well.We obtain the rules by using a developed GA introduced in Section 4.3.

The Method to Obtain Fuzzy Rules.
To obtain the fuzzy rules for different sizes or deployment of WSN, we design a specific GA to solve this problem.The GA is a metaheuristic inspired by the process of natural selection.There are some elements in GA: parameter coding, the initial population setting, and fit function.How to code the fuzzy rules and design the fitness function are the keys to implementing the GA in obtaining the fuzzy rules for CH selection.
In this paper, the inputs and output are coded as integers.The states of D tos and D toc are denoted by integers 1, 2, and 3.The states of E res are denoted by integer 1, 2, 3, 4, and 5.The states of P choose are denoted by integers 1, 2, 3, 4, 5, 6, 7, 8, and 9.Then, the matrix form of the fuzzy rule is obtained as RuleList in Figure 2. The RuleList is a matrix of 45 rows and 4 columns.
It is demonstrated that the 1st, 2nd, and 3rd columns in the matrix include all the 45 input states.For different fuzzy rules, the first three columns of the matrix are constant which is denoted by the matrix List of 45 rows and 3 columns.The fuzzy rules are determined by the 4th column shown in the red box in Figure 2.Then, the 4th column is transposed as a  4 Journal of Sensors chromosome and it is a row vector of 45 columns which represents 45 genes.Therefore, each gene stands for a fuzzy rule.At the first time, the initial population denoted by ps is randomly generated which represents the ps fuzzy rules.Then, the selection method used in this paper is stochastic universal sampling which can avoid the selection deviation compared to the roulette wheel selection [25].The twopoint crossover method for a chromosome is introduced which is shown in Figure 3.In the mutation process, genes are randomly changed in the range of 1-9.
In order to apply the protocol to various types of network, the fitness function used in this GA is the lifetime of a given network.Since the sensor node is energy limited and supplied by battery with an initial energy, we define that a node "dies" when the battery runs out.That is to say, the node loses the ability to work and becomes a dead node once its residual energy denoted by E res is zero.The most important issue is to know when the network starts to fail [6].The round when first node dies (FND) is regarded as the lifetime of the network since the network is in an abnormal condition after the first node dies [26].After several iterations of the crossover, selection, and mutation, the optimal chromosome is acquired as the BestRule that is a row vector with 45 rows.Then, the optimal matrix form denoted by BestRuleList of the fuzzy rules is obtained by BestRuleList = List, BestRule T  5 In this method, we can get suitable fuzzy rules for a particular WSN.(c) In the first round, the sink node calculates the fuzzy output P choose of each node by the proposed FLS in Section 4.2 and chooses the node with the maximum value in each cluster as a CH.Next, the sink node informs the corresponding cluster nodes of the CHs' IDs, and each node records its CH's ID.
(d) Then, the nodes can start to send packets in an allocated TDMA schedule.The last time slot of the schedule is for transmitting the CH's ID to its cluster member nodes.The cluster member nodes send their residual energy, D tos , D toc , and the collected data to their CH.Then, the CH is required to receive, integrate, and transmit the data to the sink node.
(e) After the transmission within the cluster is completed, the CH normalizes the residual energy of each cluster member, as E res .The CH calculates the P choose of each node within the cluster by the proposed FLS in Section 4.2 and chooses the node with the maximum value as the CH in the next round.
Repeat the step d and step e, and the whole network works normally.
After the static clusters are generated, the CHs are determined by the sink node only in the first round.Then, the CH selection process works in a distributed way.The CHs can choose the CHs of the next round all by themselves without communicating with the sink node, which reduces the energy consumption.

Performance Analysis
In this section, we use a simulation to evaluate the performance of the proposed EBRP.We have to assume and determine several parameters, and the simulation parameters are listed in Table 1.
E 0 is the initial energy of each node, and E DA is the energy consumption for data integration.The size of the data packet per round per node is 4000 bits in our simulation.
In this simulation, the sensor nodes are randomly deployed over a 100 m * 100 m square area and the sink node is in the center.We run the simulation for different sizes of networks.In this simulation, the number of nodes is set to 50, 100, 150, 200, 250, and 300, respectively.To   5 Journal of Sensors compare with the other protocols, the CH ration is set to 10%; therefore, the number of clusters as K is n * 10%.The clusters are generated by using the proposed algorithm in Section 4.1, and the iteration number is the termination condition.The iterations are 10,000 times to generate the static clusters.Figure 4 shows the formed clusters in different networks with our clustering algorithm.
The blue dots are the nodes, the red X is the sink node, the points of junction are the cluster centers, and the dots connected together are a cluster.From Figure 4, we can see  To acquire suitable fuzzy rules for different networks, we use the developed GA in Section 4.3.In our simulation, the genetic parameters we chosen are listed in Table 2.
Ps is the population of the individuals, Mds is the number of iterations, Dg is the generation gap, Px is the probability of crossover, and Pm is the probability of mutation.The fit function is the round when the first node dies (FND).The fuzzy rules for the network with 100 nodes are obtained as shown in Table 3.Furthermore, the obtained appropriate fuzzy rules for 50, 150, 200, 250, and 300 nodes are listed in Tables 4, 5, 6, 7, and 8.
Since we get the suitable fuzzy rules for networks, we run our EBRP and the other three protocols (SEP, LEACH, and LEACH-C) in the network illustrated in Figure 4. Figure 5 shows the FND round for the four protocols under analysis.
The longest lifetime of network provide by EBRP is confirmed by the results in Figure 5. EBRP presents the highest FND round (above 230) in the networks while the other three present shorter FND times (below 174) which indicates that when we run EBRP, the first node will die later than the other three protocols.We can see that the lifetime of networks using EBRP when all the nodes are working properly (before the FND round) is the longest of all.It is calculated that the gains of FND with EBRP on average is 63%, 63%, and 57% compared with SEP, LEACH-C, and LEACH, respectively.
The numbers of dead node numbers by round with the four protocols for the networks are presented in Figure 6.
Figure 6 shows the comparison of the number of dead nodes along the time (rounds) in different sizes of networks in the simulation.Although the lifetime of a network defined in this paper is the FND round and the fitness function in a developed GA is the FND round as well, the round of 50% nodes have died in EBRP is much bigger than that in the other protocols when the number of nodes is 100, 150, 200, 250, and 300.Meanwhile, the EBRP within 50 nodes is better than the other protocols when 40% of the nodes have died.From Figure 6, the curves of the proposed EBRP have the largest slope related to the ones of SEP, LEACH-C, and LEACH which means the EBRP is the best energy-balanced protocol.It is illustrated that the energy of the network is mostly used to maintain the normal working state and the lifetime of the network is prolonged.The other three protocols will consume a lot of energy in the irregular period of the network when there are nodes that have died.
These results proved that EBRP is able to prolong the lifetime of a network and balance the energy consumption (a) The position of the nodes is permanent since deployment.The unique ID and position of the nodes are recorded in the sink node.(b) All the sensor nodes are the same. 2 Journal of Sensors (c) All the sensor nodes are supplied by batteries with the same initial energy.The sensor node dies and loses the ability to work when the battery runs out.(d) The sink has infinite energy and computing resource.
(b) Repeat the step b until all the cluster centers of K clusters are calculated.

Figure 2 :
Figure 2: The matrix form of the fuzzy rules.

4. 4 .
The Operation Process of EBRP.The specific steps of the proposed EBRP are shown as follows: (a) The sink node divides the nodes of the network into K clusters with the algorithm in Section 4.1 and then calculates the D tos s and D toc s of all the nodes.(b) The sink node obtains the BestRuleList by using the method in Section 4.3.After that, it distributes the fuzzy rules as the BestRuleList, D tos , D toc , and its cluster number to each node.

Figure 4 :
Figure 4: The deployment of nodes and the generated clusters in EBRP.

Figure 6 :
Figure 6: The curves of dead node numbers by rounds.

Table 3 :
The obtained fuzzy rules for 100 nodes.