Wireless sensor network (WSN) is a new generation sensor network. The representative discussion related to it appeared as early as 1999. With the development of science and technology, some experts predict that the development and wide application of WSN will bring great influence and impetus to people’s social life and industrial transformation  . WSN is a kind of wireless communication network composed of a large number of sensor nodes without infrastructure. It integrates sensor technology, embedded technology, distributed information processing technology and wireless communication technology. It senses and collects environmental information (such as temperature, humidity, noise, light intensity, etc.) of the node deployment area, then processes the data to remove redundancy based on the ability to obtain detailed and accurate information, and eventually transmits the data to the observer over the wireless network  . The development of wireless sensor network technology has experienced three stages: intelligent sensor phase, wireless intelligent sensor phase and wireless sensor network phase  . For the future of wireless sensor network technology, its development prospects are more optimistic; in environmental monitoring, emergency relief, smart home, medical care, industrial production control and commercial and other fields will have a wide range of applications  .
Different from traditional networks, WSN network has its own characteristics, so the routing protocols and algorithms used in traditional networks cannot meet the requirements of WSN applications. In WSN, sensor nodes form a data transmission path by cooperating with each other and send the data from the source node to the destination node. Data transmission cannot be separated from routing protocol; routing protocol is the basis of networking. Because sensor nodes have little energy and distribute randomly, long-distance transmission of data consumes a lot of energy. Unreasonable routing algorithm can easily lead to rapid death of local nodes. It can even lead to the energy black hole. As an important factor for network performance, routing directly determines the efficiency of sensor nodes in the transmission of data  . The different speed and time of data transmission in different paths can influence the energy consumption. Sensor nodes are microelectronic devices with limited energy, and their lifetime is largely dependent on battery power  . They are mostly distributed in work places where the environment is very bad, so it is very difficult to replace batteries. Therefore, it is very important to design a routing algorithm with low energy consumption, high data transmission speed and high success rate, which directly affects the performance of the whole wireless sensor network system  . This paper introduced the typical LEACH protocol, and pointed out its problems, improper selection of cluster heads and uneven distribution of energy consumption. We took steps to improve its shortcomings. First, we used a new threshold probability formula to improved cluster head electing phase. Second, we optimized clustering phase by adding a reference for clustering. This improvement method aiming at two aspects performed better than the previous methods.
2. Related Model
2.1. Network Model
This paper assumes that the sensor network has the following properties:
・ The base station is unique, located in the center of the network area. The location is known to all other nodes, and the energy is not limited.
・ Nodes are randomly distributed in the network, the locations are known and fixed.
・ Each node has limited energy.
・ Each node has same initial energy and data processing capability.
・ Base stations can communicate with all nodes  .
2.2. Energy Model
The simulation model of this experiment is based on the first order radio model, as shown in Figure 1  .
According to Figure 1, the energy , consumed by the sensor node to transmit k bit data is composed of two parts, one is the energy consumption of the signal transmitting circuit, and the other is the energy consumption of the signal amplifying circuit, as in (1).
where, is the energy consumption for transmitting or receiving each bit of data, is the power amplification factor of the multipath fading model, is the power amplification factor of the free space model, is the distance for transmitting data, . When the transmitting distance , the multipath fading model is adopted, the energy consumption is proportional to the 4th power of the distance; when , the free space model is adopted, and the energy consumption is proportional to the 2nd power of the distance  .
The energy , consumed by the sensor node to receive k bit data is shown as (2).
3. LEACH Protocol
Combined with the limited energy of sensor nodes, many effective algorithms have been designed, among which, the most classical one is the low energy adaptive cluster hierarchical protocol (LEACH). The idea of this algorithm was to select cluster head nodes randomly in a cyclic way, it’s shown in Figure 2. The cluster head nodes collected data from member nodes and sent them to the base station. In that way, the energy consumption can be evenly distributed to each node of the network  .
LEACH routing protocol was a low power adaptive clustering routing algorithm designed by Heinzelman (MIT, Department of Electronics and Computing) for WSN in 2000. The concept of “wheel” was introduced into the working process of LEACH protocol. Each round was divided into three phases: cluster head selecting phase, clustering phase and stable communicating phase. In the cluster head selecting phase, all nodes ran for cluster head nodes in a specific method. The unselected nodes chose a appropriate cluster head to participate in the cluster a in the clustering phase. In the stable communicating phase, the member nodes transmited data to the cluster heads. The cluster heads then sent them to the base station.
Figure 1. First order radio model.
Figure 2. Clustering diagram of LEACH protocol.
Cluster head selecting phase and clustering phase were the core parts of the LEACH protocol. The details are described as follows:
・ Each node generated a random number between  and 1.
・ Each node got a threshold T(i) according to the following formula, which we can get in  .
where, P was the percentage of cluster heads in all nodes, r was round, G was the set of nodes that had not been selected as cluster head.
・ The nodes whose random number was less than the threshold were selected as cluster heads and sent the massages to other nodes. Remarkably, those selected nodes could not be cluster heads in the after rounds.
・ The unselected nodes chose a cluster head according to the strength of the received information to participate in the cluster.
・ The cluster heads generated a time division multiple access (TDMA), and sent them to their member nodes.
・ Member nodes collected the around data then sent to their cluster heads on the basis of TDMA.
・ The cluster heads fused the data and then sent them to the base station  .
In the LEACH protocol, the balanced distribution of the load in the network saved the energy consumption caused by communication. The method of being cluster head circularly could distribute the load to different nodes in turn. It could also prolonged the system lifetime. Cluster heads fused the data from member nodes reduced the amount of data. However, there were still some shortcomings in LEACH protocol. Scholars had put forward different improvement methods for different problems. In LEACH protocol, no matter how far the cluster head was from the base station, it was necessary to send the data directly to the base station. The energy consumption for data transmission showed exponential relationship with the distance. When the distance was over a certain level, the energy consumption would increase sharply. The author in  took an improvement by selecting a sub-cluster head in each cluster. It allowed the cluster head far away from the base station to transmit data by multi-hops through the sub-cluster head, so as to reduce energy consumption for long distance transmission. In  , a self-guided adaptive clustering method was proposed to prolong the lifetime of network by allowing or prohibiting nodes to participate in the clustering phase. Some nodes in dense clusters were allowed to enter dormant mode. It could reduce the communication with cluster heads. Thus, it prolonged the network lifetime. This paper introduced an improved algorithm, optimized clustering LEACH protocol based on energy and distance of cluster head (O-LEACH). The algorithm took two steps to improve the LEACH. Firstly, optimize the cluster head selecting to prolong the stability period. Then optimize the clustering phase to average energy consumption among clusters.
4. Improvement Plans
4.1. Optimize Cluster Head Selecting Phase
The cluster head is randomly selected in LEACH algorithm, regardless of the current energy remaining of the node and the transmitting distance between the node and the base station. The node which is selected as the cluster head could be low in energy or far from the base station. This may result in uneven distribution of energy consumption. In this case, the node will die prematurely and the network will be unstable. In order to solve this problem, there is an improved algorithm, Cluster-head-selecting Optimized Advanced LEACH Protocol (COAL). A new threshold probability is used in the algorithm. The new threshold probability has two parts, as shown in (4). includes parameters such as the mean and standard deviation of the current energy of the node in each round and the distance between the node and the base station. The energy parameter and distance parameter make the nodes with higher energy and shorter distance from the base station more likely be selected as the cluster heads.
There are still problems in the COAL protocol. Since the generation of clusters in each round has great randomness, the number of cluster heads may be too much or too small, and the sensor nodes are randomly distributed. The density of nodes around each cluster head is different. In the same time, member nodes join the cluster only depending on the strength of the received message. Because of those, there will be minimal clusters or maximal clusters. The minimal cluster indicates that excessive cluster heads need communication with the base station. This will increase the energy consumption in per round. The maximal cluster indicates that there are large numbers of member nodes in the cluster. This will increase the energy consumption for cluster head to receive the information member nodes, and the coverage of the cluster will increase. Some nodes have to communicate with the cluster head for a long distance, which increases the energy consumption of the member nodes and shortens the network life cycle. Maximal cluster also means that the range covered by the cluster is very large. Some nodes have to communicate with the cluster head over a long distance. It increases the energy consumption of member nodes. Thus, network’s lifetime will be greatly shortened. Therefore, it is necessary to optimize the clustering phase  .
4.2. Optimize Clustering Phase
In order to optimize the clustering phase and prolong network’s lifetime, the clustering optimized LEACH Protocol based on energy and distance of cluster head (O-LEACH) is proposed.
O-LEACH protocol has three phases, cluster head selecting phase, clustering phase and stable communicating phase. In cluster head selecting phase, each node generates a random number between 0 and 1 to compare with a threshold calculated according to (4). And if the random number is less than the threshold, the node is selected as a cluster head; In clustering phase, each member nodes calculate a parameter, , according to (5), the parameter is related to the cluster heads. Each node chooses a appropriate cluster head to participate in according to the value of . Its stable communicating phase is the same as LEACH protocol. The steps in cluster head selecting phase and clustering phase are shown in Figure 3.
The key part of O-LEACH protocol is the clustering phase. It is important to calculate and choose the cluster head which minimum value of corresponding to.
where, indicates the distance from the node to the cluster head, The maximum distance between any two surviving nodes, and represent the initial energy and the current energy of the cluster head, represents a collection of non-cluster head nodes. The smaller is, the smaller is. And the larger a is, the smaller b is. The minimum value indicates that the cluster head is closer to the node or has higher residual energy.
5. Simulation and Results
5.1. Simulation Environment
We use MATLAB to simulate these three protocols (LEACH, COAL and O-LEACH). Then compare and analyze the results. The simulation parameters are listed in Table 1. We set this experiment to run 250 rounds. The two evaluation steps are to analyze the behavior of the three protocols in terms of the dead nodes and average of current energy. As shown in Figure 4, 100 nodes distribute randomly.
Table 1. Simulation environment parameters.
Figure 3. Chart of cluster head selecting phase and clustering phase.
Figure 4. Node distribution.
5.2. Simulation Results
The energy of the node decreases with each round. If its energy is less than zero, the node is considered dead. When most nodes in the network die, the monitoring has no mean. The network’s life ends, if the proportion of dead nodes reaches 98%  .
As shown in Figure 5, the number of dead nodes varied over rounds of simulation. It could be seen that all nodes survive until 30th rounds. The first dead node appeared in the 31st round. Later, the number of death nodes increased dramatically. The network’s lifetime completely ended in the 125th round. The Figure 6 illustrated the average of current energy varies over simulation rounds. The energy decreased drastically. Until the 125th round, it was close to zero.
Figure 7 showed the comparison of the number of dead nodes for the three protocols in one experiment. From the simulation results we could see in LEACH protocol the first node died in the 39th round, and the network’s lifetime ended in the 126th round; In COAL protocol the first node died in the 58th round, and the network’s lifetime ended in the 128th round; In O-LEACH protocol the first node died in the 60th round, and the network’s lifetime ended in the 245th round.
To avoid contingency, we did several experiments, and then calculated the mean value of the simulation results. According to the first node dead time (FND) and the most nodes dead time (MND), we listed the improvement effect in Table 2. The data show, LEACH protocol and COAL protocol had almost the same MND, but COAL protocol had later FND, its network-stability increased by 54%; Compared to LEACH protocol, O-LEACH protocol had both later FND and MND, its network-stability increased by 62%, its network lifetime prolonged by 92%. O-LEACH protocol has made two improvements. In the new threshold probability of the cluster head selecting phase, we added the average value and the standard deviation of the current energy. As we all know, that the standard deviation can describe the stability of the data. The smaller the variance, the higher the stability. Because of the parameters, the more stable nodes were more likely to be selected a cluster head. This could make the COAL protocol have longer stablility period and shorter unstability period. So the network is more stable. After we optimized the clustering phase by adding a parameter. Number nodes could select a cluster head depend on a more specific basis. So the clusters were more uniformity and rational. The energy consumption distributed more evenly. Thus the network lifework was longer. This could also be seen from the change in the residual energy of the network in Figure 8.
Figure 8 showed the comparison of the average of current energy for the three protocols in one experiment. Along with the simulation rounds, the death of nodes continued to increase and the current energy of nodes continued to decrease. According to Figure 8, from the beginning to the 40th round the current energy of the three protocols was similar. From 40th to about 120th, the current energy of the three protocols all recreased rapidly. At the same time, the difference among them gradually increased. The value of the two improved protocols were higher than LEACH protocol. After the 120th round, the energy of LEACH protocol and COAL protocol was almost zero. In the simulation process, under the same round, two improvement protocols always had more energy.
Table 2. Comparison of node dead time.
Figure 5. Change of death node number of LEACH protocol.
Figure 6. Change of average residual energy of LEACH protocol.
Figure 7. Comparison of death node number.
Figure 8. Comparison of average residual energy.
This paper introduced the LEACH protocol and analyzed its problems. In response to its problems, the O-LEACH protocol was proposed. The improved protocol optimized cluster head selecting phase through adding parameters, the mean and standard deviation of the current energy of the node and the distance between the node and base station, and also optimized clustering phase through adding parameters, the current energy of the cluster head and the distance between the node and clusters. The simulation results showed that the O-LEACH protocol increased the network stability and prolonged the network lifetime.
 Ding, X.X., Ling, M. and Wang, Z.J. (2017) DK-LEACH: An Optimized Cluster Structure Routing Method Based on LEACH in Wireless Sensor Networks. Wireless Personal Communications, 4, 6369-6379.
 Padmavati, T.C.A. (2014) Comparison of Routing Protocols in Wireless Sensor Network Using Mobile Sink—A Survey. Engineering and Computational Sciences, Chandigarh, 6-8 March 2014, 1-4.
 Heinzelman, W.R., Chandrakasan, A. and Balakrishnan, H. (2000) Energy-Efficient Communication Protocol for Wireless Microsensor Networks. Proceedings of the 33rd Annual Hawaii International Conference on System Sciences, Maui, HI, 7 January 2000, 10.
 Heinzelman, W.B., Chandrakasan, A.P. and Balakrishnan, H. (2002) An Application Specific Protocol Architecture for Wireless Microsensor Networks. IEEE Transactions on Wireless Communication, 1, 660-670.
 Aghera, K. (2017) MMR-LEACH: Multi-Tier Multi-Hop Routing in LEACH Protocol. Proceedings of International Conference on Communication and Networks. 205-214.
 Thakkar, A. (2017) DEAL: Distance and Energy Based Advanced LEACH Protocol. International Conference on Information and Communication Technology for Intelligent Systems, Ahmedabad, 25-26 March 2017, 370-376.
 Darabkh, K.A., Al-Rawashdeh, W.S. and Al-Zubi, R.T. (2017) C-DTB-CHR: Centralized Density- and Threshold-Based Cluster Head Replacement Protocols for Wireless Sensor Networks. Journal of Supercomputing, 5, 1-22.
 Manjeshwar, A. and Agrawal, D.P. (2002) TEEN: A Routing Protocol for Enhanced Efficiency in Wireless Sensor Networks. Parallel and Distributed Processing Symposium, San Francisco, 23-27 April 2002, 189.