 Research
 Open Access
 Published:
Cluster tree topology construction method based on PSO algorithm to prolong the lifetime of ZigBee wireless sensor networks
EURASIP Journal on Wireless Communications and Networkingvolume 2019, Article number: 199 (2019)
Abstract
For wireless sensor networks (WSNs) based on ZigBee technology, the network topology plays an important role for improving the energy efficiency and the network lifetime. An appropriate construction method of network topology should be designed for saving the energy of the battery in each network node so as to prolong the lifetime of ZigBee WSNs. In this paper, a novel cluster tree topology construction method based on particle swarm optimization (PSO) algorithm is proposed. In order to transform the network topology construction problem into an energy consumption optimization problem, an evaluation function reflecting the network energy consumption is designed, and the network topology is mapped into a particle population individual suitable for the PSO algorithm. In order to prolong the network lifetime as long as possible, two network topology reconstruction methods with the PSO algorithm based on fixed and variable energy thresholds are further proposed, respectively. The simulation results show that the proposed methods can prolong the lifetime of ZigBee WSNs effectively.
Introduction
With the development of information industry, the application of information technology is more and more extensive. Especially with the arrival of the era of big data, the acquisition and processing of massive information has attracted more and more attention. Wireless sensor networks (WSNs) are a selforganizing network composed of a large number of sensor nodes with functions of information collection, processing, and transmission. Each sensor node can collect, process, and transmit data in the sensing area, which can cooperate to collect massive information in the target area [1, 2]. As one of the key technologies of WSNs, ZigBee technology based on the standard of IE802.15.4 has been widely used in smart home [3], intelligent agriculture [4], smart grid [5], health monitoring [6], industrial control [7], and other fields because of its low power consumption, low speed, low cost, and ad hoc network characteristics.
There are three types of nodes in ZigBee networks: coordinator, router, and enddevice [8]. In addition to the coordinator nodes powered by stable power supply, routers and enddevices are generally powered by dry batteries or storage batteries. The enddevices send data directly or through routers to the coordinator, and the low power characteristic allows it to turn off/turn on the transceiver periodically to save energy. The randomness of data forwarding makes routers have to turn on receivers at all times. Moreover, in application scenarios of WSNs such as industrial and farm, data is collected and transmitted frequently, which causes the routing nodes to consume much energy and premature failure to work because the battery is exhausted. As a result, the network is divided into isolated parts which are difficult to connect, and the network life time is greatly reduced [9, 10]. Therefore, how to use the limited energy to make WSNs work as long as possible, and reduce the cost of battery has become a hot issue in the current research of WSNs based on the ZigBee technology.
For WSNs with limited energy, a good network topology construction method can save a lot of energy, reduce the energy consumption of nodes, and effectively prolong the network lifetime [11]. In recent years, the research on WSN topology control algorithm mainly focuses on power control and hierarchical topology construction algorithms [12, 13]. In terms of power controlbased topology construction method, the typical algorithms that have been proposed are nodebased local mean algorithm and local mean neighbors algorithm [14], relative neighborhood graph algorithm based on neighbor graphs [15], etc. In terms of hierarchical topology construction method, typical algorithms include topological control algorithms based on uniform clustering, such as the lowenergy adaptive clustering hierarchy algorithm and hybrid energyefficient distributed clustering approach, etc. [16, 17].
From these research results, it is known that the network topology construction that reduces the number of routers as much as possible is considered to be an effective method for suppressing power consumption. In addition, in order to prolong the network lifetime, it is important to use the power of all nodes evenly. Currently, there are no good known methods for analyzing the network structure that minimizes the number of routers. Furthermore, it is not possible to study all possible network structures of largescale networks during processing time. For problems that cannot be solved by graph theory or combinatorial mathematical analysis, the particle swarm optimization (PSO) algorithm can find suboptimal solutions for these problems in real time [18, 19]. Therefore, in this paper, we use the PSO algorithm to study the construction method of the cluster tree topology for ZigBee WSNs with low power consumption and long network lifetime.
The rest of this paper is organized as follows. The system model is given in Section 2. In Section 3, the principle of the PSO algorithm is introduced first, and the proposed cluster tree topology construction method based on the PSO algorithm is described in detail. The effectiveness of the proposed method is examined in Section 4 by computer simulation compared from multiple perspectives. Finally, Section 5 concludes the paper.
Methods
In this paper, the construction method of the network topology for ZigBee WSNs is based on the PSO algorithm which is a swarm intelligence algorithm. The cost function reflecting the energy consumption of the network is fist designed. Then the real number sequence is designed to represent the possible solution of the network topology. Thus, the network topology construction problem studied in this paper is transformed into an optimization problem that can be solved by PSO algorithm. To verify the effectiveness of the proposed scheme, we compare the performance of the proposed scheme with the traditional method in several aspects.
System model
Cluster tree topology
ZigBeebased WSNs have three network topologies: star topology, mesh topology, and cluster tree topology. In a star network since only the range from the central node to one hop can be communicated, the delay time of data transmission is short and collisions hardly occur. On the other hand, there is a disadvantage that the coverage of the network is relatively small and the communication reliability is low because only onehop communication is possible. The merit of mesh network is that multihop communication can be performed beyond the onehop limit. In addition, communication reliability can be improved by making communication routes redundant. Cluster tree network has strong expansion ability, and has the advantages of star network and mesh network.
The cluster tree topology mainly used in WSNs is shown in Fig. 1. The cluster tree topology differs from the mesh topology in that the relationship between nodes is not equal, and there is a clear parentchild relationship, and it is a pyramidal tree structure. In this structure, the top nodes of the network are the coordinator, the other parent nodes are routers, and the terminal nodes are enddevices. The advantages of cluster tree topology are as follows.

1.
Since the network is hierarchical, the delay time of data transmission can be predicted.

2.
The router always keeps tracking the status of its own child nodes, and the connection status of the network is aggregated along the tree root. Therefore, the coordinator can easily understand the connection status of the entire network.
On the other hand, there are some disadvantages of cluster tree topology.

1.
Since there is only one communication route, sometimes information may not reach the destination node when a communication failure occurs.

2.
Because information is aggregated to the coordinator, traffic jams occur closer to the coordinator, and the balance of network resource utilization is not good.
Energy consumption model
The energy consumption model considered in this paper is the firstorder radio model as shown in Fig. 2. E_{elec} is the amount of energy required to transmit and receive one bit message, and ε_{amp} is the amount of energy required to amplify the transmitter signal. The energy consumption of transmission and reception denoted as E_{T} and E_{R} are calculated using (1) and (2), respectively [20].
where the amount of communication is k bits and the communication radius of the node is d meters. When the communication time is t seconds and the communication rate is v [bps], the transmission power P_{T} and the reception power P_{R} are calculated using (3) and (4), respectively.
It is assumed that E_{elec} is 50 (nJ/bit), ε_{amp} is 100 (pJ/bit/m^{2}), d is 30 m, v is 250 kbps, and there is no delay due to radio wave collision or communication error. The results of P_{T} and P_{R} can be calculated as 35 mW and 12.5 mW, respectively.
Figure 3 shows the time series of the operation of WSNs, where T_{s} is the transmission time, P_{T} is the transmission power, P_{R} is the reception power, and n is the number of child nodes of the router. Here, the enddevice enters a sleep mode when no information is transmitted, while the router waits for a receivable state when no information is transmitted.
Figure 4 shows an example of two WSNs with the same number of nodes but different cluster tree topology networks. As shown in Fig. 4a, there are three enddevices that only transmit information. From Fig. 3a, the total energy consumption of enddevices can be calculated as shown in (5). The second and third node acts as routers to transmit information and also receives information, that is combining the data it owns with the data received from them child nodes and sends it to the coordinator. From Fig. 3b, the amount of energy consumption of routers can be calculated based on (6) in a similar way. Therefore, the power consumption of a network round is the sum of the power consumption of each node, and is calculated using (7).
As shown in Fig. 4b, it has one more routing node than Fig. 4a, and the power consumed can be calculated by the same method as described in (8).
Substituting the values of P_{T} and P_{R} calculated in (3) and (4), it can be found that the value of P_{WSN2} is greater than that of P_{WSN1}. This indicates that different network topologies affect the power consumption of the network due to the difference in the number of routes, thereby affecting the lifetime of the network.
Cluster tree topology construction method based on particle swarm optimization algorithm
Particle swarm optimization algorithm
Particle swarm optimization (PSO) algorithm was first proposed for solving the continuous optimization problem in 1995 by Kennedy and Eberhart [19]. Its basic concept stems from the study of predation behavior of birds. On this basis, they proposed a discrete binary version of PSO in 1997 to solve the combinatorial optimization problem in engineering practice.
Similar to other evolutionary algorithms, the PSO algorithm also adopts the concepts of “group” and “evolution.” The difference is that the PSO algorithm does not use evolutionary operators for individuals like other evolutionary algorithms, but treats each individual as a nonweight and nonvolume particle flying at a certain speed in the search space. The speed of the flight is dynamically adjusted by the individual’s flight experience and the group’s flight experience.
Suppose that in a Ddimensional target search space, the population size is m particles, and the position of the ith particle in the Ddimensional search space is represented as a Ddimensional vector
The position of each particle is a potential solution for the problem being optimized. By substituting a vector x_{i} into an objective function, the fitness value of the objective function can be calculated, and then the quality of the particle x_{i} can be measured according to the fitness value. The flight speed of the ith particle is also a Ddimensional vector
The optimal position vector that the ith particle has searched so far is
where pbest_{i} is called an individual extreme point. The optimal position vector that the entire particle swarm has searched so far is
where gbest is called a global extreme point. In each iteration, every particle updates its velocity and position according to the above two optimal values. The renewal equation is
where v is the dth velocity of the ith particle in the kth iteration; c_{1,} c_{2} are learning factors used to adjust the maximum step size of the flight toward the global optimal particle and the individual optimal particle; if they are too small, the particles may be far away from the target area, if they are too large, the particles may fly over the target area. The appropriate value of c_{1}, c_{2} can accelerate the convergence and not easily fall into local optimum, usually let c_{1} = c_{2} = 2; rand_{1, 2} is a random number between [0, 1]. \( {x}_{id}^k \) is the current position of the dth dimension of the ith particle in the kth iteration; pbest_{id} is the position of the ith particle at the individual extreme point of the dth dimension; gbest_{d} is the dth dimensional position of the global extreme point of the entire population.
In (14), \( sig\left({v}_{id}^{k+1}\right) \) is the threshold function that converts the velocity to a value between [0, 1], which is defined as
where usually take a = 1, c = 0. The individual components ρ_{i} of the vector ρ_{id} are random numbers between [0, 1]. It can be seen that if the value of v_{id} is larger, the position of the particle x_{id} is more likely to select as 1; otherwise, x_{id} is more likely to select as 0. Therefore, v_{id} is equivalent to a probability threshold, indicating the tendency of the particle i to take 1 or take 0 at the ddimensional position.
During the running of the PSO algorithm, the individual extreme of a single particle and the global extreme of the entire particle swarm are continuously updated, and the global extreme output at the end of the algorithm is the optimal solution of the problem.
Cluster tree topology construction for ZigBee WSNs using PSO
Construction method of cluster tree topology based on the PSO algorithm actually uses the global search and combination optimization capabilities of the PSO algorithm to determine the optimal combination of routers and enddevices in the solution space for ZigBee WSNs.
Based on the introduction and analysis of Section 2.2, we define the evaluation function as in (16) by extending (7) to general cases. Fitness P_{WSN} represents the power consumption of one round of WSNs. One round is the period during which all nodes in WSNs complete once data transmission.
Here, T_{t} is the transmission time, T is one round time of the network, R is the number of routers, H is the total number of hops of the network, P_{T} is the transmission power, P_{R} is the reception power, and k represents the sum of the number of child nodes of each router.
The process steps of the proposed network topology construction method using PSO is described as follows.

1.
Particle population initialization
The generation of the initial population is an operation that randomly generates a preset number of particles. Here, we use the adjacency matrix to generate particles. As shown in Fig. 5, nodes that can communicate with each other are first connected by dashed lines to create an adjacency matrix. Here, 1 indicates a connection state, and 0 indicates a nonconnection state. Next, the lower left half of the adjacency matrix is taken out and rewritten as one line as shown in Fig. 5. Finally, particles can be generated by randomly extracting a number from each part.

2.
Evaluation of particle fitness
Particle fitness evaluation is an operation of calculating the fitness of each particle in the population using the evaluation function of (16). The value of fitness can reflect the quality of the particle. In order to prolong the lifetime of the network, it is desirable that the smaller the value of the fitness (the smaller the power consumption) the better.
In the first iteration of the particle population, the initial population of N particles is randomly generated according to the method in the step (1). The individual extreme value pbest is set to the current particle position. The positional coordinates of each particle are substituted into the evaluation function (16) to calculate the fitness value, and the position of the particle with the largest value is set as the global extreme value gbest.
If it is not the first iteration of the particle population, current position vector for each particle is substituted into the evaluation function to calculate the fitness value of the particle. If it is greater than the current individual extreme value of the particle, pbest will be set to the current position of the particle. If the largest of the individual extreme value of all particles is greater than the current global extreme value, gbest will be set to the position of the best particle.

3.
Velocity and position of particle updating
For each bit on each particle code string, the velocity and position are updated according to formula (13) and (14).

4.
Judgment of stop condition
If the current number of iterations reaches the predetermined maximum number of generations, the iteration is stopped, and the result of the cluster tree topology is outputted; otherwise, the process proceeds to step 2, and the algorithm is continued.
Simulation results and discussion
In this study, environmental monitoring in a wide area is assumed. Nodes are randomly distributed in the observation area, and the information of each node is managed by the coordinator. Specifically, as shown in Figs. 6, 100 nodes are placed in an observation area of 100 m × 100 m to collect information. The communication radius of the node is 30 m. The position of the coordinator is located at the center of the viewing area (50, 50). The coordinator is powered by an external power source, while the node is powered by the battery.
Here, the roles of routers and enddevices can be exchanged with each other, and the movement of the node is not considered. In addition, it is assumed that data collisions do not occur during wireless communication. The experimental parameters are shown in Table 1. In the following section, the cluster tree topology constructed by the traditional method and the PSO algorithm are experimented respectively, and the performance is compared and analyzed.
Construction result of the network topology based on the PSO algorithm
Experiments are carried out using the traditional method and PSO. The experimental results are the average of ten simulation results. Figure 7 shows a comparison of network power consumption. It can be seen that the power consumption of the network constructed with PSO algorithm is smaller than that of the traditional method.
An example of a network construction with the lowest power consumption obtained by the PSO algorithm is shown in Fig. 8. Here, the red node is the coordinator, the yellow node is the router, and the green node is the enddevice. It can be observed that the number of routers is 8, and the number of enddevices is 91.
Simulation and analysis of network lifetime
Based on the network topology with lowest power consumption obtained in Section 4.1, we study its network lifetime in this section. We compare the network lifetime when the network is not reconfigured and the network is reconstructed, respectively. To calculate the lifetime of the network, a capacity of 100 J battery power is supplied to nodes other than the coordinator.
After the network is constructed, the network starts running. We assume that the remaining energy of any node is less than 0, the lifetime of the network stops. The comparison of the performance in term of the network lifetime and the remaining energy at the end of network lifetime is shown in Figs. 9 and 10, respectively.
It can be seen that there is little difference in the lifetime of the network, although the network constructed by the PSO algorithm consumes less energy in one round than traditional method. In addition, the energy consumption is lower but the remaining energy is still kept at about 70% using the proposed method. This means that the network should be reconstructed to deplete the remaining power and prolong the lifetime of the network.
Network reconstruction with fixed power threshold
The flow chart of the network reconstruction method based on a fixed power threshold is shown in Fig. 11. First, configure the network and then operate it. Next, network reconstruction is performed when the remaining rate of battery energy of any router falls below the threshold that is set to 10%. In this case, it is required that the node whose remaining rate of battery energy is lower than the threshold cannot be a router. If reconstruction is not possible, leave the network structure remains unchanged and run until the remaining energy of any node is below zero. Here, we do not consider the power consumed during network reconstruction for simplicity.
The performance comparison in term of the network lifetime and the remaining energy is shown in Figs. 12 and 13, respectively. Comparing Figs. 10 and 13, in the case of the proposed PSO scheme, it is confirmed that the remaining energy of the network with reconstruction is 46.3% less than that of the network without reconstruction. And as can be seen from Figs. 12 and 13, it is shown that it is successful to reduce the network remaining energy and prolong the network lifetime by reconstruction the network compared to the case without reconstruction. In addition, the lifetime of the network constructed with PSO algorithm is about 1.9 times that of the traditional method, which proves the effectiveness of our proposed PSO scheme.
Network reconstruction with variable power threshold
The flow chart of the network reconstruction method with the variable power threshold is shown in Fig. 14. When the remaining rate of battery energy of any router drops below the threshold that is set to 80%, network reconstruction is performed. It is required that nodes whose remaining power is below the threshold cannot be set as a router. If network reconstruction becomes impossible in the current threshold, the threshold is reduced by 10%. In this case, the node with the remaining power higher than the threshold can be set as the router, and the node below the threshold can only be set as the enddevice. In this way, the threshold decreases with 10% step size, and network reconstruction is carried out in a circular way. When the threshold becomes less than 10%, the network structure is maintained and the operation of the network is performed until the remaining energy of any node is below zero.
Figures 15 and 16 show the comparison of the network lifetime and the remaining energy using the proposed network reconstruction method with the variable power threshold. It can be seen that the proposed reconstruction method with the variable power threshold can improve the performance of reconstruction method with the fixed power threshold.
Figures 17 and 18 show the distribution of the energy consumption of the network constructed by the proposed reconstruction method. We note that the energy of the nodes near the coordinator is almost exhausted. This is because all the data are transmitted to the coordinator via the router directly connected to the coordinator, so the power consumption of the router closer to the coordinator is eliminated first.
In addition, we can observe that compared to the fixed threshold method, the number of nodes with remaining energy of 90% is decreased significantly using the variable threshold method. It is understood that the remaining power of the battery can be used uniformly for constructed network using the PSO algorithm. This is because by using the variable threshold method, the number of network reconstructions is increased, and the data transmission load can be prevented from being concentrated on the router and the power of all nodes can be uniformly used, thereby prolonging the network life time.
Conclusions
This paper presents new methods to construct the cluster tree topology for ZigBee WSNs. Firstly, based on the number of routers, the number of enddevices and the total number of hops, an evaluation function is constructed to reflect the energy consumption of the network, thus converting the problem of network topology construction into an optimization problem. Then, in order to make the optimization problem suitable for solving with the PSO algorithm, the network topology is transformed into particle individuals of the PSO algorithm. On these bases, the construction method of the cluster tree network topology based on the PSO algorithm is proposed. The simulation results show that the proposed method can construct a network topology with lower energy consumption. From simulation results, we also find that it is necessary to reconstruct the network to further prolong the network lifetime. Therefore, two network topology reconstruction methods with the PSO algorithm based on fixed and variable energy threshold are further proposed, respectively. The simulation results prove that the proposed network topology reconstruction methods can prolong the network lifetime effectively.
Availability of data and materials
Data sharing not applicable to this article as no datasets were generated or analyzed during the current study.
Abbreviations
 PSO:

Particle swarm optimization
 WSNs:

Wireless sensor networks
References
 1.
J. Yick, B. Mukherjee, D. Ghosal, Wireless sensor network survey. Comput. Netw.. 52(12), 2292–2330 (2008)
 2.
Z. Fei, B. Li, S. Yang, C. Xing, H. Chen, L. Hanzo, A survey of multiobjective optimization in wireless sensor networks: metrics, algorithms, and open problems. IEEE Commun. Surv. Tutorial. 19(1), 550–586 (2017)
 3.
C. Kaiwen, A. Kumar, N. Xavier, S.K. Panda, in 2016 International Conference on Sustainable Energy Technologies (ICSET). An intelligent home appliance controlbased on WSN for smart buildings (2016), pp. 282–287
 4.
T. Ojha, S. Misra, N.S. Raghuwanshi, Wireless sensor networks for agriculture: the stateoftheart in practice and future challenges. Comput. Electron. Agric. 118(3), 66–84 (2015)
 5.
P. Yi, A. Iwayemi, Z. Chi, Developing ZigBee deployment guideline under WiFi interference for smart grid applications. IEEE Trans. Smart Grid. 2(1), 110–120 (2011)
 6.
B. Pandya, F.K. Chuang, C.H. Tseng, T.D. Chiueh, An energyefficient communication system using joint beamforming in multihop health monitoring sensor networks. EURASIP J. Wirel. Commun. Netw. 2017, 172 (2017)
 7.
S. Tummalapalli, M.V.D. Prasad, ZIGBEE operated FPGA based nodes in wireless industrial automation monitoring and control. Int. J. Eng. Trends Technol. 4(5), 1569–1572 (2013)
 8.
P. Baronti, P. Pillai, V.W.C. Chook, S. Chessa, A. Gotta, Y.F. Hu, Wireless sensor networks: a survey on the state of the art and the 802.15.4 and ZigBee standards. Comput. Commun. 30(7), 1655–1695 (2007)
 9.
G. Omojokun, A survey of zigbee wireless sensor network technology: topology, applications and challenges. Int. J. Comp. App. 130(9), 47–55 (2015)
 10.
M. Ouadou, O. Zytoune, D. Aboutajdine, Y.E. Hillali, A. MenhajRivenq, Improved clustertree topology adapted for indoor environement in ZigBee sensor network. Procedia Comput. Sci. 94, 272–279 (2016)
 11.
P. Nayak, A. Devulapalli, A fuzzy logicbased clustering algorithm for WSN to extend the network lifetime. IEEE Sensors J. 16(1), 137–144 (2015)
 12.
A.A. Aziz, Y.A. Sekercioglu, P.G. Fitzpatrick, M.V. Ivanovich, A survey on distributed topology control techniques for extending the lifetime of battery powered wireless sensor networks. IEEE Commun. Surv. Tutorial. 15(1), 121–144 (2013)
 13.
J. Esch, A survey on topology control in wireless sensor networks: taxonomy, comparative study, and open issues. Proc. IEEE 101(12), 2538–2557 (2013)
 14.
M. Ashouri, H. Yousefi, J. Basiri, A.M.A. Hemmatyar, A. Movaghar, PDC: predictionbased dataaware clustering in wireless sensor networks. J. Para. Distri. Comp. 2(12), 24–36 (2015)
 15.
J. Szurley, A. Bertrand, M. Moonen, Distributed adaptive node specific signal estimation in heterogeneous and mixed topology wireless sensor networks. Signal Process. 7(4), 44–61 (2015)
 16.
W. Heinzelman, A. Chandrakashan, H. Balakrishnan, An applicationspecific protocol architecture for wireless microsensor networks. IEEE Trans. Wirel. Commun. 1(4), 660–670 (2002)
 17.
O. Younis, S. Fahmy, HEED: a hybrid, energyefficient, distributed clustering approach for ad hoc sensor networks. IEEE Trans. Mob. Comput. 3(4), 366–379 (2004)
 18.
Y. Zhang, S. Wang, G. Ji, A comprehensive survey on particle swarm optimization algorithm and its applications. Math. Probl. Eng. 2015, 1),1–1)38 (2015)
 19.
J. Kennedy, R.C. Eberhart, in Systems, man, and cybernetics conference. A discrete binary version of the particles swarm algorithm (1997), pp. 4104–4108
 20.
W.R. Heinzelman, A.P. Chandrakasan, H. Balakrishnan, 33rd Annual Hawaii International Conference on System Sciences. Energyefficient communication protocol for wireless sensor networks, (2006) (2006), pp. 1–10
Acknowledgements
Authors would like to express the sincere thanks to the National Natural Science Foundation of Jiangsu province and China for their funding support to carry out this project.
Funding
This work is supported in part by the Natural Science Foundation of Jiangsu Province (Grant No.BK20160294) and National Natural Science Foundation of China (Grant No. 61601208).
Author information
Affiliations
Contributions
YY and BX conceived the main idea and proposed the algorithm. ZYC performed the experiments and analyzed the simulation results. YY and ZWQ wrote the paper. All authors have read and approved the final manuscript.
Corresponding author
Correspondence to Yang Yu.
Ethics declarations
Competing interests
The authors declare that they have no competing interests.
Additional information
Publisher’s Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.
About this article
Received
Accepted
Published
DOI
Keywords
 Cluster tree topology
 PSO algorithm
 ZigBee
 Wireless sensor networks
 Lifetime