INTERNATIONAL JOURNAL OF COMPUTERS COMMUNICATIONS & CONTROL ISSN 1841-9836, e-ISSN 1841-9844, 14(3), 344-358, June 2019. Selection of Cluster Heads for Wireless Sensor Network in Ubiquitous Power Internet of Things W. Hu, W.H. Yao, Y.W. Hu, H.H. Li Wei Hu, Wenhui Yao*, Yawei Hu, Huanhao Li School of Economics and Management, Shanghai University of Electric Power, Shanghai 200090, China *Corresponding author: 272828408@qq.com Abstract: This paper designs a selection algorithm of cluster heads (CHs) in wire- less sensor network (WSN) under the ubiquitous power Internet of Things (UPIoT), aiming to solve the network failure caused by premature death of WSN sensors and overcome the imbalance in energy consumption of sensors. The setting of the cluster head node helps to reduce the energy consumption of the nodes in the network, so the choice of cluster head is very important. The author firstly explains the low energy adaptive clustering hierarchy (LEACH) and the distance and energy based advanced LEACH (DEAL) protocol. Compared with the LEACH, the DEAL considers the remaining nodal energy and the sensor-sink distance. On this basis, the selectivity function-based CH selection (SF-CHs) algorithm was put forward to select CHs and optimize the clustering. Specifically, the choice of CHs was optimized by a selectivity function, which was established based on the remaining energy, number of neighbors, motion velocity and transmission environment of sensors. Meanwhile, a clustering function was constructed to optimize the clustering, eliminating extremely large or small clusters.Finally, the simulation proves that the DEAL protocol is more con- ducive to prolonging the life cycle of the sensor network. The SF-CHs algorithm can reduce the residual energy variance of nodes in the network, and the network failure time is later, which provides a way to improve the stability of the network and reduce energy loss. Keywords: Wireless sensor network (WSN), ubiquitous power internet of things (UPIoT), cluster head (CH) selection, clustering optimization. 1 Introduction The ubiquitous power Internet of Things is built around all aspects of the power system, fully utilizing modern information technologies such as mobile internet and artificial intelligence, and advanced communication technologies to realize the interconnection of all things and human- computer interaction in all aspects of the power system. It has comprehensive state perception, efficient information processing and application [18]. A smart service system with convenient and flexible features. It is a specific application of "5G" technology and the Internet of Things in the power industry system. It realizes a mode of interconnecting people-machine-devices inside and outside the power grid, and generates real-time shared data during the running pro- cess.Ubiquitous power Internet of Things (UPIoT) is a wireless sensor network (WSN) formed after applying the IoT technique in power systems. The wireless sensors in the network enable the information exchange between different links in power systems. The WSN is the key to the construction of the UPIoT, for it carries various strengths of distributed processing systems, including high monitoring accuracy, strong fault tolerance, large coverage, remote telemetry and control, self-organization and multi-hop routing [16]. In order to extend the network life cycle, the node energy in the sensor network can be balanced by randomly selecting the cluster head nodes to spread the energy consumption in the network. Copyright ©2019 CC BY-NC Selection of Cluster Heads for Wireless Sensor Network in Ubiquitous Power Internet of Things 345 However, there is a contradiction between the largescale and high complexity of the UPIoT and the limited energy of each sensor. When it transmits information to the sink, the sensor may lose efficacy due to excessive energy consumption, leading to the failure of the entire network. To extend the network lifecycle and balance sensor energy, the data transmitted by common sensors can be collected and integrated by a cluster head (CH), before being sent to the sink. This strategy eliminates the long-distance transmission between common sensors and the sink, and reduces the energy consumed in data transmission, thus extending the network lifecycle [5] [6]. Much research has been done at home and abroad on CH selection. For example, Ref- erence [10] proposes a CH selection algorithm based on grid dynamic energy threshold, which selects CHs according to the sensor-grid center distance and the remaining energy of each sen- sor; considering network dynamics, the algorithm enhances the energy efficiency of sensors [19]. Reference [11] takes account of the energy consumed in data transmission of CH selection and in- formation aggregation, and presents a reservation mechanism that lowers the energy consumption by controlling the number of messages generated in clustering and CH selection. Reference [13] designs a CH selection algorithm based on the fuzzy balance cost, which determines the how each sensor qualifies for CH by the sensor-sink distance and neighbor density, thus ensuring the load balance. Based on the dynamic characteristics of the nodes, residual energy and node location, the above papers provide an effective solution for the election of cluster heads, which plays an active role in improving the stability of wireless sensor networks and extending the life of the network. Overall, the existing studies on CH selection have the following defects:(1) The sensor’s propagation rate and energy consumption will change in the harsh environment, and the life of the sensor will be affected. Therefore, the network environment factor should be considered in the process of selecting the cluster head; (2) In the current research, the ubiquitous power Internet of Things is not combined with the wireless sensor network, and the description of the ubiquitous power Internet of Things is also less. How to ensure the stability of the ubiquitous power Internet of Things operation needs to be solved urgently. In the context of the UPIoT, this paper attempts to create a CH selection algorithm for the WSN to overcome the energy imbalance between sensors, which is common in WSNs [1] [2] [8] [9] [14]. Firstly, the author introduced the classic CH selection method called low energy adaptive clustering hierarchy (LEACH), and further optimized the selection results considering the remaining energy and sensor-sink distance, creating the distance and energy based advanced LEACH (DEAL) protocol [4] [17]. Next, the selectivity function-based CH selection (SF-CHs) algorithm was proposed based on sensor energy, the number of neighbors, sensor motion velocity, and transmission environment. To optimize the clustering results (clustering optimization), the clustering function was set up to prevent extremely large or small clusters. Finally, the simulation analysis shows that the DEAL protocol outperformed the LEACH protocol in extending network lifecycle and minimizing energy loss, and that the CH selected by the SF-CHs algorithm and the cluster allocated by the proposed function enhanced the stability and lifecycle of the WSN. 2 CH selection for the WSN 2.1 WSN In the UPIoT, wireless sensors and other intelligent acquisition devices are applied to vari- ous links, ranging from grid infrastructure, energy storage stations, thermal power plants, pho- tovoltaic power plants, wind farms to power users. These intelligent acquisition devices form a WSN, in which the links are called sensors [7] [15]. The wireless sensors are responsible for col- lecting information like power, device parameters, and environmental status [3]. During power dispatching, each sensor transmits its own information wirelessly to the control center at the 346 W. Hu, W.H. Yao, Y.W. Hu, H.H. Li virtual power plant. Known as the sink, the virtual power plant is responsible for making a scheduling plan based on the load and power generation information, aiming to effectively im- prove the grid access of distributed energy and the proportion of the controllable capacity in the grid. It is assumed that each WSN sensor has the following features: (1) Each sensor is deployed randomly through the network, knowing nothing about its location. (2) Each sensor has a limit on energy, which attenuates in data transmission and monitoring, and can sense its remaining energy. (3) Each sensor is unique, work independently of others, and can communicate directly with the sink. (4) Each sensor is free to send and receive data, and judge its distance to the data sender by the perceived signal strength. (5) Located at a fixed position, the sink has an unlimited amount of energy and can commu- nicate with all sensors. The energy consumed to transmit information between sensors can be calculated by: ETx(k,d) = { kEelec + kεfsd 2, d ≤ d0 kEelec + kεmpd 4, d > d0 (1) ERx(k) = k ×Eelec where ETx and ERx are the energies consumed by a sensor to send and receive information, respectively; k is the number of bits being transmitted; Eelsc is the energy needed to transmit 1 bit of information; εfs and εmp are the power amplification factors under the said two models, respectively; d is the sender-receiver distance; d0 is the threshold (if d ≤ d0 , the free space model should be adopted, which assumes that the energy consumed to send information is positively correlated with d2 ; if d > d0 , the multipath attenuation model should be adopted, which assumed that the energy consumed to send information is positively correlated with d4 ), d0 = √ εfs εmp . In the UPIoT, the energy of a sensor far away from the virtual power plant may be atten- uated to zero after multiple communication, owing to the limited amount of sensor energy. The attenuation could affect the lifecycle of the entire network. Thus, a clustering mechanism was introduced to the network, dividing the power network into several subsets. Each cluster consists of a CH and a few common sensors (Figure 1). In a cluster, cluster members mainly perform information collection or information trans- mission, and communicate with cluster heads in a single-hop or multi-hop manner. The cluster head is the same as the ordinary node, but can function like a gateway. It has a certain data pro- cessing capability, and communicates with the base station through the network formed between the cluster head and the cluster head. In the data transmission process, the ordinary node sends its own information to the cluster head, and the cluster head fuses the data in the cluster and sends it to the aggregation node. For the monitoring sensor nodes of each device, the distance from the cluster head is shorter than that of the sink node, so it consumes less energy, thus prolonging the life of the network, and also ensuring that the data communication effectively covers the entire network, and is easier. Optimize management of nodes within the network. Selection of Cluster Heads for Wireless Sensor Network in Ubiquitous Power Internet of Things 347 Figure 1: The WSN 2.2 CH selection (1)DEAL The LEACH is a typical clustering routing algorithm. Aiming to extend the lifecycle of the entire network, this protocol randomly selects CHs from the sensors that have never been CHs, such that the each sensor consumes a similar amount of energy. In the LEACH protocol, the CHs selection is carried out in the following manner: each sensor randomly generates a number in the interval of [0, 1], and the sensors whose numbers are smaller than threshold Ti will be the CHs. The CH selection contains rtotal cycles, where rtotal is the ratio of the number of sensors divided by the number of CHs. During the selection process, every sensor has the potential to be the CH. The only difference lies in the number of cycles. Once selected, a sensor should not be CH again in the following cycles. The threshold Ti can be expressed as: T(i) = { P 1−P×[r mod (1/P)] , i ∈ G 0 , Otherwise (2) where P is the proportion of CHs in all sensors; mode is the remainder; r is the number of the current cycle; G is the set of sensors that have never been selected as CHs. The LEACH algorithm effectively extends the network life cycle, but there are still some problems and some limitations: 1) Since LEACH assumes that all nodes can communicate directly with the aggregation node, and each node has the ability to support different MAC protocols, the protocol is not suitable for use in large-scale wireless sensor networks; 2) The protocol does not specify how the number of cluster head nodes can be distributed to the entire network. Therefore, it is very likely that the selected cluster head nodes are concentrated in a certain area of the network, so that there are no cluster head nodes around some nodes; 3) Since LEACH assumes that in the initial cluster head selection round, all nodes carry the same energy, and each node that becomes the cluster head consumes roughly the same amount 348 W. Hu, W.H. Yao, Y.W. Hu, H.H. Li of energy. Therefore, the protocol is not suitable for networks with unbalanced node energy; 4) In the cluster head election, the impact of the death node on the network is not considered. The number of cluster heads does not change dynamically with the death of the network node. The number of cluster heads cannot always be optimal, and the death time will be earlier. Affect the stability of the network; 5) Uneven clustering can cause uneven distribution of network energy consumption. Single- hop transmission makes energy consumption of cluster head nodes far from the base station large. As mentioned before, the DEAL is an advanced LEACH protocol through optimization based on distance and energy. It considers both the mean and variance of the remaining energy of each sensor. In the DEAL, the threshold for sensor i can be defined as: T(i) = (1 −P) ×Gp + P ×CSp (3) where P is the optimal proportion of CHs in all sensors; Gp and CSp are the probabilities for a common sensor and the current sensor to be selected as CH, respectively. The Gp and CSp can be calculated by formulas (4) and (5), respectively: Gp = k N −k × (rmodN k ) (4) where k is the number of CHs generated per cycle; N is the number of all network sensors; r is the number of the current cycle. CSp = ( std (Ei) mean(Ei) Eoi ) − ( P × ln2B lfarthestn2B ) + N xm ×ym (5) where std(Ei) and mean(Ei) are the mean and variance of the remaining energy of sensor i, respectively; Eoi is the initial energy of sensor i; li2B is the distance from sensor i to the sink; l farthest n2B is the distance from the sink to the farthest surviving sensor; xm ×ym is the size of the entire network. The DEAL retains the CH selection method of the LEACH: each sensor randomly generates a number in [0, 1], and the sensors whose numbers are smaller than the corresponding threshold will be the CHs. The optimization of the threshold function makes it more likely for sensors with high energy and close sensor-sink distance to be CHs. Thus, the CH selection is less random and the network can survive for a longer time. (2) SF-CHs In order to ensure the energy balance of sensor nodes, extend the life cycle of the network, and ensure the timely collection and effective management of power equipment information, this paper proposes a cluster head selection algorithm based on the selection function, and selects nodes with larger value of selection function in the network as the cluster head node, which effectively avoids the problem of node failure due to excessive energy consumption and prolongs the network life. Definition 1. Selectivity function The selectivity function can be established according to the remaining energy, the number of neighbors, the relative motion velocity, and transmission environment of each sensor: maxZ = λ1 ×Erest + λ2 ×ni + λ3 ×vi + λ4 ×ωr (6) where λ1 + λ2 + λ3 + λ4 = 1, and λ3 < 0. If the current sensor has the largest value of the selectivity function, it should be elected as the CH. Selection of Cluster Heads for Wireless Sensor Network in Ubiquitous Power Internet of Things 349 The remaining energy of a sensor Erest can be obtained as: Erest = Ecurrent Emax (7) where Ecurrent and Emax are the current remaining energy and the maximum initial energy of the sensor, respectively. The high energy sensor should be preferred in CH selection, because CH usually consumes more energy than common sensors. For example, the CH needs to collect the information about the power equipment from all common sensors in the cluster, sort out and integrate the information, and then send them to the sink. Let ni be the number of neighbors of a wireless sensor. Definition 2. Neighbor A neighbor refers to any sensor within the circle (radius: R = √ S π×Q) centering on the current sensor. The expression of the radius can be proved as follows: It is assumed that all sensors are located in a square with a side length of one, and all clusters have the same coverage. Then, the optimal number of CHs in the network can be defined as: Q = √ N ×d0 2π M d2BS (8) where N is the number of network sensors; M is the side length of the network; dBS is the mean sensor-sink distance. If the network remains stable, the number of CHs remains basically the same after the replacement in each cycle, and the communication radii of the CHs can cover the entire network. Suppose adjacent clusters do not overlap in their communication ranges between adjacent clusters, the network coverage S must satisfy: Q×πR2 ≥ S (9) Thus, we have: R = √ S π ×Q (10) The sensors with many neighbors should be preferred in CH selection, because the distance to CH is positively correlated with the energy loss in information transmission. Let vi be the motion velocity of the sensor i. In the WSN, some sensors are constantly moving. If these sensors be CHs, the stability of the network may be dampened. What is worse, such a CH may enter the adjacent clusters, increasing its distance to the sensors in its cluster and to the sink. In this case, more energy will be consumed to transmit the same amount of data, and the data may even get lost. Considering the negative effects of the moving sensors, the author set up a weighting factor λ3 < 0 for the motion velocity of the sensors. The sensors with a low motion velocity will be preferred in the selection process. Letωr be the environmental impact factor of the transmission process. This factor was introduced to the selectivity function to describe how the natural conditions affect the wireless communication bandwidth and thus the data transmission rate, as well as the impacts of other unknown, uncontrollable changes. 350 W. Hu, W.H. Yao, Y.W. Hu, H.H. Li 3 Clustering optimization 3.1 Extremely large and small clusters Let X = {X1,X2,X3 · · ·Xn} be the CHs being selected, with n be the number of clusters. The remaining common nodes determine the joined cluster according to the clustering function, and communicate with the cluster head of the cluster. After receiving the "Request to Join" message of all member nodes, the cluster head allocates the order in which the member nodes in the cluster send data, calculates the sending time of each cluster member, and sends the generated TDMA message to all member nodes in the cluster. The member node receives the message and saves its own time slot, and it is the turn to communicate with the cluster head when it sends itself. Definition 3. Clustering function Each sensor selects its cluster according to its distance to and the energy of each CH. In general, a sensor prefers a nearby CH with the most remaining energy. The clustering function can be expressed as: minRi = α×dij −β ×E xj rest (11) where α and β are the influence factors of distance and energy, respectively; dij is the distance between sensor i and CH j; Exjrest is the remaining energy of CH j. Sensor i will be allocated to the cluster of the CH that minimizes the value of the clustering function. It is difficult to predict the size and number of sensors of each cluster, as the CHs generated in each cycle differ in remaining energy and have random positions. This may lead to extremely large and small clusters (Figure 2). Figure 2: Extremely large and small clusters As shown in Figure 2, the randomly distributed sensors can be divided into 7 clusters, in which clusters 3, 4, 5 and 7 are extremely small clusters while clusters 1, 2 and 6 are extremely large clusters. For each extremely large cluster, more energy is consumed as each sensor transmits its data to the CH, and as the CH integrates the received information; for each extremely small cluster, the CH is far away from the sink, pushing up the energy consumption in data transmission to the sink; Also, because the number of nodes in the cluster is small, the time for collecting and processing data is much shorter than that of extremely large cluster, so the data is sent to the sink node more frequently, resulting in excessive consumption of extremely small clusters and unbalanced energy consumption; in addition, extremely small clusters frequently send data to the sink node, and the sink node needs to participate in the collaborative acceptance of data, thereby Selection of Cluster Heads for Wireless Sensor Network in Ubiquitous Power Internet of Things 351 occupying the sink node more frequently, so that other cluster head nodes cannot cooperate with the sink node when data needs to be transmitted, thereby a conflict of collaboration has arisen. Therefore, both extremely large and small clusters may cause energy depletion and premature death of the CHs, resulting in a shorter network lifecycle. To solve the problem, the maximum and minimum capacity constraints can be defined for each cluster: CAj ≥ Nav + η(E xj rest −E av rest) × Nav Eavrest (12) CAj ≤ Nav + η(E xj rest −E av rest) ×Nav (13) where CAj is the number of sensors in the cluster of CHj;Nav is the mean number of sensors of all clusters in the network; Exjrest is the remaining energy of CHj; E av rest is the mean remaining energy of all CHs; 0 < η < 1 is the relationship factor between remaining energy and the number of sensors. 3.2 Data transmission procedure The data transmission process in the network was divided into cycles. Each cycle was further splits into the cluster formation stage and the stable transmission stage. The former involves CH selection and clustering. The specific process is shown in Figure 3. (1) Cluster formation stage. Before the first cycle, the sink confirms all surviving network sensors, while each sensor transmits its information about the initial energy to the sink, and the CHs are determined according to the best number of CHs and the selectivity function. The sensors elected as CHs will broadcast its information to the entire network, so that each common sensor selects its desired cluster according to the clustering function. The common sensor will send the clustering request to the corresponding CH, applying to join the cluster. The CH will always keep its receiver open. If the cluster being applied is saturated with sensors, the common sensor will apply to enter the cluster with the next optimal conditions. If failing to join any cluster after the end of the current cycle, the general cluster will form a cluster itself. After confirming the sensors accepted to its cluster, the CH will return an acceptance signal to these sensors and assign a time interval for communication to each of these sensors. In addition, the CH will also create a time division multiple access (TDMA) schedule, and broadcast it across the network. After that, the common sensors will send data according to the schedule, preventing timing disorder in the transmission process. In order to reduce energy consumption, each cluster node uses the energy control mechanism to set the amount of energy used for transmission according to the strength of the cluster head transmission signal. When the time slot is not in turn, the nodes in the cluster can turn off the wireless communication module to save energy, and the cluster head node must remain active to receive data. (2) Stable transmission stage. In the stable transmission stage, each common sensor trans- mits its monitored information to the corresponding CH. After receiving all the information, the CH will integrate the information and send the result to the sink. The data fusing process can remove unnecessary information, reduce traffic and energy consumption, and extend the network cycle. During data transmission, the time is divided into a number of intervals according to the TDMA schedule, so that each intra-cluster sensor can send data to the CH at its time interval. If a part of data is not sent in the current time interval, it should be transmitted gain in the next time interval. After receiving certain data, the cluster head node integrates the data, strengthens mean- ingful signals, reduces uncorrelated noise, and sends the data to the sink node. This mode can 352 W. Hu, W.H. Yao, Y.W. Hu, H.H. Li Figure 3: Data transmission procedure reasonably reduce the traffic, but when the cluster head is far away from the sink node and the data packet is large, the energy of the cluster head node is quickly consumed. In order to reduce the inter-cluster interference, the DSss mechanism is used for inter-cluster communication. The intra-cluster nodes use a unique spreading code to transmit data to the cluster head. The cluster head uses the spreading code to filter all received energy. In order to reduce inter-cluster interference and its own energy consumption, the node can adjust the transmit power by itself. The cluster head sends data to the sink node using a fixed spreading code. The cluster head transmits the data using the CSMA sounding channel mechanism. If another cluster is transmitting data using the spreading code, the cluster head waits for other Selection of Cluster Heads for Wireless Sensor Network in Ubiquitous Power Internet of Things 353 cluster heads to complete the data transmission; if not, the cluster head node directly uses the spread spectrum based The code is used for data transmission. After the data is stably transmitted for a period of time, the network restarts a round of cluster head elections, and the above process is repeated. 4 Simulation experiment 4.1 Parameter setting The three CH selection algorithms, namely, the LEACH, the DEAL and the SF-CHs, were simulated on the Matlab, aiming to test the algorithm’s network lifetime and network perfor- mance. The network coverage was set to 100m × 100m, with the sink at the center. All the sensors were evenly distributed in the network, all of which know the coordinates of the sink. The initial energy of each sensor was set to 1J, the data packet size was set to 4,000 bits, the energy consumed to transmit 1 bit of data Eelec was set to 50nJ/bit, the εfs and εmp were set to 10pJ/bit/m2 and 0.0013pJ/bit/m4, respectively, and the number of cycles were set to 300. After each cycle, the energy of each sensor will be attenuated to a certain extent. If the energy of a sensor falls to zero, the sensor can be deemed as failed. Multiple sensor failures will make the monitoring ineffective. Hence, the end of the network lifecycle was defined as the failure of 95% of all network sensors [10]. 4.2 Results analysis The three algorithms were simulated under a 200-sensor network and a 300-sensor network. The CH selection and clustering results are shown in Figure 4 below. Figure 4: Clustering results It can be seen from that the sink was located at the network center, and the sensors were clustered relatively evenly, the number of nodes in each cluster is within the range of suitable cluster capacity, with no extremely large or small clusters. The clusters had no significant difference in energy loss. Taking the 200-sensor network as an example, the relationships between the number of failed sensors and the number of cycles of the three algorithms are presented in Figure 5. Under the operation conditions of the LEACH algorithm, the first sensor failure appeared in cycle 25, and the network lifecycle ended at cycle 225. Under the operation conditions of the DEAL, the first sensor failure occurred in cycle 35, and the network stopped operation in cycle 231. Under the 354 W. Hu, W.H. Yao, Y.W. Hu, H.H. Li CH selection and clustering by the SF-CHs, the first sensor failure was observed in cycle 42 and the network lifecycle terminated at cycle 275. Figure 5: Number of failed sensors of the three algorithms The above results show that the network lifecycle ended at basically the same moment under the DEAL and the LEACH. However, the first sensor failure appeared later and the network survived longer under the DEAL. Under the proposed SF-CHs, the network lifecycle was longer than that under the LEACH and the DEAL, the death of the first sensor was further delayed, and the network lifecycle was extended by 16.5%. To sum up, the proposed SF-CHs can ensure the balance of energy consumption and extend network lifecycle, thanks to the consideration of neighbors, motion velocity and transmission medium and the optimization of the clustering process. In order to study the stability of the network, this paper compares the average residual energy of the nodes in the network and the variance of the residual energy of the nodes under the three algorithms. The results are shown in Figure 6 and Figure 7. Figure 6 compares the residual energy of the network under three different algorithms, reflecting the change in energy consumption rate. When using the LEACH algorithm, due to poor cluster head selection, the energy consumption of the previous network is large, and the slope of the curve is large. In the later stage, the number of nodes in the network is reduced, the network energy consumption is also reduced, and the slope is reduced. The DEAL algorithm is used for the LEACH algorithm. Optimized, so the energy consumption is lower, the slope of the curve is smaller and smaller as the surviving node is reduced. The SF-CHs algorithm is not only better in cluster head selection, but also better clustering result. The consumption is basically the same, the curve tends to be a straight line, and the same, the overall energy consumption is reduced due to node death in the later stage. As shown in Figure 7, the LEACH brought about the maximum variance of remaining energy, while the SF-CHs minimized the variance, and the variance is reduced by 32%. This means the DEAL protocol reduces the variance of remaining energy from the level of the LEACH, while the proposed SF-CHs can effectively enhance network stability and extend network lifecycle. Figure 8 compares the energy values consumed per round under the operating conditions of the three algorithms. The energy consumption per round reflects the cluster head selection and clustering results. When the cluster head selection is correct, the energy consumed per Selection of Cluster Heads for Wireless Sensor Network in Ubiquitous Power Internet of Things 355 Figure 6: Network residual energy comparison curve Figure 7: The variance of remaining energy of sensors of the three algorithms round is naturally less. Large networks typically consume less energy than smaller networks. As shown in Figure 7, based on the optimized LEACH algorithm, the DEAL algorithm consumes less energy than the LEACH algorithm. Therefore, it can be seen that the DEAL algorithm has a better selection of cluster heads. In addition, before 240 rounds, the SF-CHs algorithm The energy consumption per round is much less, indicating that the clustering result of the SF-CHs algorithm is better; at the end of the running cycle, the energy consumption per round of SF-CHs and DEAL is higher than that of the LEACH algorithm. The reason may be In the LEACH algorithm, the node is too dead, so it consumes less energy, while in the other two algorithms, there are more surviving nodes, which naturally consume more energy. In addition, this paper analyzes how the location of the aggregation node affects the number of dead nodes, as shown in Figure 9. The two cases are simulated separately. One case is that the aggregation node is located at the center of the network, and the other case is that the aggregation node is located at the edge 356 W. Hu, W.H. Yao, Y.W. Hu, H.H. Li Figure 8: Comparison of energy consumption per round under the three algorithms Figure 9: Number of dead nodes when the sink node is in different locations of the network. It can be seen from the figure that the aggregation node has a dead node in the network center and the network failure time is later, and the network life is longer. Based on the above analysis, the proposed SF-CHs algorithm is beneficial to improve net- work stability and extend network lifetime, and can play a positive role in the development of ubiquitous power Internet of Things. 5 Conclusion The UPIoT is an important research topic of the future power industry. The performance of the UPIoT depends heavily on wireless sensors. Improving the stability and survival period of wireless sensor networks can better promote the development of ubiquitous power Internet of Things. To solve the energy depletion of wireless sensors in data transmission, a common Selection of Cluster Heads for Wireless Sensor Network in Ubiquitous Power Internet of Things 357 method is to set up CHs and divide WSN sensors into several clusters, thus enhancing the energy efficiency. In this paper, a WSN is set up in the context of the UPIoT, taking the application links of the power system as sensors, and the information exchange between the sensors is realized through sensors. On this basis, the basic principle of the LEACH and DEAL protocols was explained: each sensor generates a random number, and the sensors whose numbers are smaller than the corresponding threshold will be the CHs. Next, the SF-CHs algorithm was designed in two steps: the cluster selectivity function was created based on the remaining energy, number of neighbors, motion velocity and data transmission environment of each sensor, and the clustering function was established to optimize the clustering method, eliminating extremely large or small clusters. Finally, the simulation shows that compared with the LEACH protocol and the DEAL protocol, the SF-CHs algorithm has a late failure node, the network lifetime is extended by 16.5%, and the variance of the remaining energy of the nodes in the network is reduced by 32%, which effectively improves the stability of the network. In addition, when the aggregation node is located in the center of the network, the time of the failed node is later, and the network life is longer. Therefore, the SF-CHs algorithm can provide a solution for extending the network life and improving the stability of the network. The research work of the thesis is based on the ubiquitous power internet of things, but all the research is only based on the theoretical level. The simulation results are only verified in the virtual environment. The future research work will apply the research results to the actual environment for verification. Development and application verification for specific wireless sensor network monitoring environment. Funding This work is supported by the Humanities and Social Sciences Project of Chinese Ministry of Education (Grant No.: 17YJCZH062). Author contributions. Conflict of interest The authors contributed equally to this work. The authors declare no conflict of interest. Bibliography [1] Aghera, K.; Pambhar, H.; Tada, N. (2017). MMR-LEACH: Multitier multi-hop routing in LEACH protocol, Proceedings of International Conference on Communication and Networks, 205–214, 2017. [2] Amirthalingam, K.; Anuratha, V. (2017). Improved LEACH: A modified LEACH for wireless sensor network, IEEE International Conference on Advances in Computer Applications, 255– 258, 2017. [3] Awad, F. H. (2018). Optimization of relay node deployment for multisource multipath rout- ing in wireless multimedia sensor networks using gaussian distribution, Computer Networks, 145, 96-106, 2018. [4] Bao, X.; Xie, J.; Nan, L.; Li, S. (2014). WRECS: An improved cluster heads selection algorithm for WSNs, Journal of Software, 9(2), 78-89, 2014. [5] Baranidharan, B.; Santhi, B. (2016). DUCF: Distributed load balancing unequal clustering in wireless sensor networks using fuzzy approach, Applied Soft Computing, 40, 495-506, 2016. 358 W. Hu, W.H. Yao, Y.W. Hu, H.H. Li [6] Batra, P. K.; Kant, K. (2016). LEACH-MAC: A new cluster head selection algorithm for Wireless Sensor Networks, Wireless Networks, 22(1), 49-60, 2016. [7] Chidean, M. I.; Morgado, E.; Del Arco, E.; Ramiro-Bargueno, J., Caamano, A. (2015). Scalable data-coupled clustering for large scale WSN, IEEE Transactions on Wireless Com- munications, 14(9), 4681-4694, 2015. [8] Jia, Y. L.; Chang, X. M. (2017). Cluster heads selection algorithm for wireless sensor net- works based on cluster heads sending energy consumption, Computer Engineering and Ap- plications, 53(22), 82-86, 2017. [9] Lee, J. Y.; Jung, K. D.; Moon, S. J.; Jeong, H. Y. (2017). Improvement on LEACH protocol of a wide-area wireless sensor network, Multimedia Tools & Application, 76(19), 19843-19860, 2017. [10] Liang, P.; He, W. (2017). Grid dynamic energy threshold-based cluster header algorithm in wireless sensor network, Chinese Journal of Sensors and Actuators, 30(10), 1583-1588, 2017. [11] Mehra, P. S.; Doja, M. N.; Alam, B. (2018). Fuzzy based enhanced cluster head selection (FBECS) for WSN, Journal of King Saud University - Science, 2018. [12] Mittal, N. (2019). Moth flame optimization based energy efficient stable clustered routing approach for wireless sensor networks, Wireless Personal Communications, 104(2), 677-694, 2019. [13] Shalabi, M.; Anbar, M.; Wan, T. C.; Khasawneh, A. (2018). Variants of the low-energy adaptive clustering hierarchy protocol: Survey, issues and challenges, Electronics, 7(8), 136- 164, 2018. [14] Snigdh, I.; Gupta, N. (2016). Quality of service metrics in wireless sensor networks: A survey, Journal of the Institrtion of Engineers, 97(1), 91-96, 2016. [15] Srikanth, B.; Kumar, H.; Rao, K. U. M. (2018). A robust approach for WSN localization for underground coal mine monitoring using improved RSSI technique, Mathematical Modelling of Engineering Problems, 5(3), 225-231, 2018. [16] Sun, L. M.; Li, J. Z.; Chen, Y. (2005). Wireless sensor networks, Beijing: Tsinghua university press, 1-5, 2005. [17] Thakkar, A. (2017). DEAL: Distance and energy based advanced LEACH protocol, Interna- tional Conference on Information and Communication Technology for Intelligent Systems, 370-376, 2017. [18] Wei, X. (2014). Power wireless sensor network clustering routing optimization algorithm research, North China electric power university (Beijing), 2014. [19] Zahedi, A.; Arghavani, M.; Parandin, F.; Arghavani, A. (2018). Energy efficient reservation- based cluster head selection in WSNs, Wireless Personal Communications Wireless Personal Communications, 100(3), 667-679, 2018.