Research and improvement of energy balance in wireless sensor network based on LEACH

In view of the problem that LEACH routing algorithm does not consider the remaining energy of candidate nodes when electing cluster head nodes, the factors affecting the energy balance of nodes are analysed from the election process of cluster head nodes and transmission energy consumption. Regarding the deficiencies of LEACH routing algorithm in the cluster head election process, a new cluster head election and cluster head communication transmission path selection algorithm is proposed. The results show that the improved algorithm proposed in this paper can not only achieve node energy balance, but also effectively extend the life of wireless sensor networks and strengthen the integrity of the network in the working phase.


1.Introduction
LEACH routing algorithm solves the energy consumption problem of nodes through adaptive clustering. The LEACH routing algorithm dynamically selects the cluster head node in the wireless sensor network to average energy consumption as much as possible.
The selection of the cluster head node is carried out according to the "round", which includes the cluster establishment phase and the stable working phase. In the cluster establishment phase, cluster head election, cluster formation, and intra-cluster communication scheduling plan are determined; the stable working phase will last longer, occupying most of the round of time, and nodes will transmit data in this phase.
In the cluster head establishment phase at the beginning of each round, the network must independently select the cluster head node according to the algorithm. The cluster head node election process is as follows: First, each sensor node randomly generates a number in the interval [0,1]. If the number is less than the threshold T(n), the node will become the cluster head node. The calculation formula of T(n) is as follows: Where ρ is a constant representing the probability of becoming a cluster head node, r is the current round, and G is the set of nodes that have not yet become cluster heads in the past 1 /p round. The newly selected cluster head node will broadcast to notify neighbouring nodes that they are the new cluster head. Once other nodes receive broadcast messages from several clusters, these nodes themselves decide which cluster to join. After the cluster head finishes broadcasting, the nodes that want to join a certain cluster successively notify the cluster head nodes of the cluster. This is the cluster establishment phase. In this stage, a random access strategy based on CSMA is used to avoid collisions of data packets sent between nodes. After a cluster is formed, it enters the establishment phase of the communication scheduling plan. The TDMA mechanism is a communication scheduling method within the cluster, and each node can be sent to its corresponding cluster head node in the data reserved time slot. In addition, the cluster head node must also select the CDMA code for the cluster to prevent communication interference between adjacent clusters, and the nodes in the cluster will receive TDMA-based scheduling information. [1] At this point, the cluster establishment phase is over, and the node will enter the stable working phase. The network forms a stable cluster structure. At this stage, cluster member nodes can transmit information and data with cluster head nodes. After the stable work phase is over, all nodes enter the next round to re-establish clusters and communicate. [2] Figure 1. Cluster structure diagram of LEACH protocol.

Sink node
Cluster member node Cluster head node Figure 1. Cluster structure diagram of LEACH protocol LEACH algorithm has the advantages of dispersing network node energy, balancing network energy load, and good integration mechanism. Although LEACH algorithm has outstanding advantages, there are still some deficiencies that cannot be ignored. For example, the random election of cluster head nodes leads to uneven distribution of cluster head nodes, and excessive energy consumption of some nodes damages the integrity of the network. In addition, the cluster head ignores the remaining energy of the candidate node during the election process, which will cause the node to lose too much energy. The cluster head node and the convergence communication do not have a good selection path, which leads to some energy waste.
Aiming at the above-mentioned shortcomings, this paper presents a new cluster head election and cluster head communication transmission path selection algorithm.

Analysis of insufficient LEACH algorithm
LEACH algorithm has some shortcomings in the election of cluster head nodes. The LEACH cluster head election is random. After one or more rounds of election, the remaining energy difference between nodes is large. Such a phenomenon will inevitably cause some nodes to die first, which leads to a shorter life span of wireless sensor networks and damage to the integrity of the network. There is no good path selection scheme when the cluster head node communicates with the sink node. In this process, some energy of the node is wasted, causing unnecessary consumption. This is very detrimental to the remaining energy balance of the nodes in the entire network.

Improved LEACH algorithm
Aiming at the shortcomings of LEACH algorithm, a new cluster head election and cluster head communication transmission path selection algorithm is proposed in this paper.
Cluster head election process: In the first round of cluster head election, the original election method of LEACH algorithm is still used, namely, cluster heads are randomly selected. After the end of the first round, there are differences in the remaining energy of all nodes. These differences should be controlled to minimize the remaining energy differences between nodes. Therefore, in the second round, the average value of the remaining energy of all nodes is calculated, and then the cluster head is elected among the nodes that exceed the average value. The average value of the remaining energy of all nodes is calculated as: rave rem (2) In the formula, Erave is the average value of the remaining energy of all nodes, Erem(j) is the remaining energy of the current node, S is the number of inventory nodes, and D is the number of dead nodes.
However, the election of cluster heads among these nodes is not based on equal probability. It is the ratio of the remaining energy of these nodes minus the average energy consumption of all nodes in the previous round to the remaining energy as the probability of the node being elected as the cluster head. The number of cluster head nodes is 50% of the candidate nodes. The formula for calculating the probability of these nodes being elected as cluster head nodes is as follows: In the formula, Erem(i) is the remaining energy of the node, Eave is the average energy consumption of all nodes, and n is the number of candidate nodes.
The analysis of formula (3) shows that the probability of selecting nodes with more remaining energy is relatively increased, which is very beneficial for achieving node energy balance.
When the cluster head communicates with the sink node, it can use the neighboring cluster head node to communicate with it, or it can use direct communication, depending on which of the two cluster head nodes' remaining energy variance is estimated to be the lowest after the communication.
The direct communication variance is as follows: (4) Where Erch(a) is the remaining energy of the cluster head node after estimation, and Eremn (b) is the remaining energy of the nearest neighboring cluster head node. , (5) In the formula, Eremn (a) is the remaining energy of the cluster head node, and Eelec (a, d) is the total energy consumption of the communication between the cluster head node and the sink node.
The variance of the communication between the neighboring cluster head nodes is as follows: (6) Where Erch(a) is the remaining energy of the cluster head node after estimation, and Eremn (b) is the remaining energy of the nearest neighboring cluster head node after estimation.
(7) In the formula, Eelec (a) is the total energy consumption of cluster head node communication.
(8) In the formula, Eelec (b) is the sum of energy consumption in the communication between neighboring cluster head nodes.
When S12≥S22, the cluster head node communicates with the sink node through the neighboring cluster head node, and when S12<S22, the cluster head node directly communicates with the sink node. The method of comparing the magnitude of the variance is used to reduce the difference between the remaining energy of the nodes as much as possible in the energy consumption process of the nodes,

Performance evaluation index
The algorithm proposed in this paper aims to achieve the energy balance of the nodes in the wireless sensor network, so as to achieve the purpose of extending the life of the network. Therefore, the number of surviving nodes in the network and the life cycle of the network are the main indicators of the simulation results.

Simulation results and analysis
Under the MATLAB platform, the LEACH algorithm and the improved LEACH algorithm are simulated and the performance parameters are compared. The horizontal axis represents time, and the vertical axis is a reference index.  It can be seen from Figure 2 that compared with LEACH algorithm, the number of surviving nodes at the same time is obviously more than LEACH algorithm. The time for the occurrence of dead nodes has also been significantly delayed, and the life of the entire wireless sensor network has also been significantly extended. The curve in the figure is flatter, which also shows that the improved algorithm achieves node energy balance, and there is no large-scale death of nodes in a certain period of time. This not only prolongs the lifetime of the entire wireless sensor network but also ensures the integrity of the network. It can be seen from Figure 3 that the curve of the number of cluster head nodes in each round is synchronized with the curve of the number of surviving nodes. This proves the feasibility of the improved cluster head node election scheme. The number of cluster head nodes can ensure the stable operation of the network, and has no adverse effects on the realization of node energy balance.

4.Conclusion and Outlook
This paper briefly introduces and analyses LEACH algorithm, finds improvement points from its shortcomings, and proposes an improved algorithm. The algorithm is improved on the basis of LEACH algorithm, and its feasibility is verified by MATLAB simulation. This algorithm considers the remaining energy of the node when selecting the cluster head node, and the communication between the cluster head node and the sink node also uses energy routing. This not only ensures the node energy balance, but also reduces unnecessary energy loss, so that the network life and integrity are guaranteed. From the simulation results, it can be seen that the improved algorithm can better play the role of node energy balance, the time of node death is significantly delayed, and the network lifespan is also significantly increased. This shows that the algorithm proposed in this paper has stronger balance, reduces unnecessary energy loss, and improves energy utilization.
This article has made improvements from the perspective of cluster head election and transmission path selection, but has not improved in terms of data fusion and data forwarding direction, so there is still a lot of room for improvement based on LEACH algorithm. These areas will continue to be explored in depth in the future.