Research on a Power Grid Cascading Failure Prevention and Control Method considering WSN

School of Electronic, Electrical Engineering and Physics, Fujian University of Technology, Fuzhou 350108, China Fujian Provincial University, Engineering Research Center of Smart Grid Simulation Analysis and Integrated Control, Fujian 350118, China Department of Applied Intelligent Mechanical and Electrical Engineering, Yu Da University of Science and Technology, Miaoli County, Taiwan Department of Business Administration, North Borneo University College, Sabah, Malaysia


Introduction
In recent years, WSNs have been applied in military, environmental, medical, power systems, and other fields [1]. The application in the military field mainly takes advantage of its rapid deployment, strong concealment, and good environmental adaptability to quickly collect battlefield information and facilitate leaders to formulate the next battle plan, to effectively monitor the ecological environment and effectively predict possible natural disasters and to reduce economic losses and social impact. The application in the medical field mainly focuses on the remote monitoring and care of patients' physical conditions, which can provide telemedicine services for patients in time [2].
In the field of power grid parameter monitoring, its wide application will promote the rapid development of the smart grid. Reference [3] proposed a power quality control system model based on the wireless network, which is used to realize efficient information transmission between sensors and facilitate the comprehensive analysis of power quality in the distribution area. Learn from ZigBee technology to establish a remote monitoring system, which is convenient for operators to grasp the current operation state of the power grid in time. If a failure occurs in the power grid, an alarm message will be sent to the monitoring center to remind the operators to take corresponding measures to prevent the further spread of the failure and even lead to a blackout, which is conducive to ensuring the stable operation of the power grid. Literature [4] analyzes the performance of the linear network model from the aspects of delay and load, introduces cellular communication technology, and proposes a reconfigurable network model, which reduces the delay of data transmission and improves the capacity of the network.
At present, cascading large-scale power outages occur all over the world, such as the large-scale power outage in Texas caused by the cold weather in 2021.2. Because the blackout caused by cascading failures in the power grid will bring significant economic losses and adverse social impact, many scholars pay extensive attention to the mechanism of cascading failures and control measures to prevent cascading failures and gradually get some research results that can be used for reference [5,6]. For example, in reference [7], considering the utilization degree of relevant transmission lines in the process of transmitting power from generator nodes to load nodes in the power grid and considering the influence of generation capacity and load level, the power flow intermediate index of transmission lines is proposed as the basis for judging key lines. In reference [8], aiming at the disadvantages of the previous active power safety correction control methods in power systems, a safe distance sensitivity index is proposed, which can provide a criterion for the adjustment of generators in the power grid.
According to the selection of control time, the current control for a large-scale power outage caused by cascading failures can be roughly divided into two categories: preventive control before the failures and blocking control in an accident [9]. If the power grid is disturbed by the expected accident set during normal operation so that the power grid is in an abnormal operation state, it is called preaccident preventive control by taking control measures to return the system to a safe operating state; If a failure has occurred in the power grid, taking blocking control to prevent the further spread of cascading failures is called blocking control in the accident [10].
For example, literature [11] proposes a curve fitting method for the cascading failures of transmission line under freezing disaster, monitors the icing thickness of transmission line in real time, and gives early warning before the ice thickness reaches the critical value of line breaking, to achieve the purpose of prevention and control. These studies do not consider the relationship between the security margin of the power grid and the cost of preventive control or blocking control, which may lead to the situation that the security margin of the power grid is still low under the condition of high cost.
According to the above analysis, we find that although the monitoring network has been adopted in the power system, it has not been comprehensively considered with cascading failures. Therefore, this paper will use it to analyze the prevention and control of cascading failures based on 24-hour continuous dynamic monitoring of power grid operation parameters. Firstly, the overall structure of the monitoring network and the architecture of power grid data acquisition are analyzed to analyze the disturbance of the remaining lines after the initial failure of the power grid. Then, the security of the power grid uses the node injection power to characterize the current operation state. To prevent cascading failures in the power grid, a preventive control model is proposed. The preventive control model belongs to a two-level optimization model, which is solved by the NSGA2-PSO algorithm. The effectiveness of this method is verified in the IEEE39 node system.

Prevention and Control of Cascading
Failures in Power Grid Based on WSN 2.1. WSN and Power Grid Monitoring. In the smart grid, to ensure the efficient and reliable transmission of the power grid, it is necessary to monitor the operation of the power grid in real time. The real-time monitoring, diagnosis, and protection of power system operation information can greatly avoid damage to the whole power grid due to power equipment failures or other natural disasters. Therefore, the application of it to the monitoring and data acquisition of power grid can help the operators to carry out online safety evaluation of the state of power equipment and give an alarm in time before the fault, to take necessary measures to prevent the occurrence of cascading failures [12,13].

2.2.
Overall Structure of Monitoring Network. Typical wireless sensor networks are composed of sensor nodes, sink nodes, and monitoring centers. Figure 1 shows the basic structure of the wireless sensor network system. In the monitoring area, according to the monitoring requirements, the wireless sensor node is deployed on the object to be monitored, such as the transmission line.   Wireless Communications and Mobile Computing is transmitted to the monitoring center to realize the monitoring and management of the system [14]. When transmitting data through the wireless communication channel, it will be affected by electromagnetic noise, which will lead to the loss of collected information. To solve this problem, we can learn from the data reconstruction algorithm of structural noise matrix completion and establish the packet index mechanism, to realize the data recovery [15]. In addition, how to reduce the energy consumption of sensor nodes and prolong the service life of nodes is an important content to be considered in deploying the system shown in Figure 1. Reference [16] proposes a reliable data transmission method for low-energy code distribution, which can effectively reduce energy loss and ensure the reliability of data transmission.
2.3. Sensor Node Structure. As can be seen from Figure 2, the sensor node is composed of four parts: sensor module, a processor module, wireless communication module, and energy supply module [16]. The sensor module mainly realizes the data acquisition of the monitoring object, then A/D conversion of the data and transmission to the processor module, which is responsible for the operation control, data storage, and processing of the whole sensor node. The wireless communication module is responsible for information exchange and communication. The energy supply module is responsible for providing energy sources to ensure the normal operation of each module [17].

Collection of Power Grid Parameters.
As an accurate index to evaluate and feedback the operation state of the power grid, power grid parameters must be monitored dynamically in real time. Therefore, this paper focuses on the sensor module in the sensor node, and its hardware system design is shown in Figure 3.
As shown in Figure 3, in the sensor module, the wireless sensor acquisition node deployed in the power network is responsible for the acquisition, processing, and wireless transmission of voltage and current. It mainly includes a data acquisition circuit, preprocessing circuit, and power module. The power grid parameter acquisition node collects the current signal and voltage signal through the highprecision current transformer and voltage transformer, which are processed by the analog conditioning circuit and input to the sampling unit of CC2530 to complete the A/D conversion of the signal. Finally, wireless communication is realized by the RF transceiver.
Herein, the measured sampling value is converted into a frequency-domain signal to obtain the voltage phasor U i of the node and the current phasor I ij of all lines connected to it, which can be expressed as where u k and i k represent the kth voltage sampling value and current sampling value, respectively, and N is the total number of samples. According to the voltage phasor and current phasor obtained above, the node injection power can be calculated by further using these data, and the calculation formula is as follows: where _ U i represents the voltage phasor of node i and _ I ij represents the current phasor flowing through the line; S ij is the complex power on the i side of the line; P ij is the real part of S ij , expressed as the active power of the line; and S i is expressed as the injection power of node i.

Prevention and Control Model of Cascading Failures in
Power Grid. This paper mainly establishes the chain failure prevention and control model from the perspective of safety and economy. At first, WSN is used to obtain the injected power of each node under the current operation state of the power grid and combined with the safety margin index given below to judge the current operation state of the power grid, to measure the safety level of power grid operation at this time. If the safety margin of the power grid is low, the power grid shall be adjusted according to the preventive control model to ensure the normal operation of the power system.

Safety Margin of Power Cascading Failures.
Power equipment data uses the monitoring network analyzed above to obtain, and its system structure is shown in Figure 4. The system is composed of sensor nodes and sink nodes. Deployed on the transmission line, it can continuously and dynamically obtain the real-time operation parameters of the power grid for 24 hours. It is necessary and important for the future transmission system and can also greatly improve the stability of the transmission system. The wireless communication network is constructed by the ZigBee wireless communication mode, in which the data is 3 Wireless Communications and Mobile Computing reliably transmitted by a low-energy code distribution algorithm [16]. Firstly, the sensor nodes on the transmission line measure the physical parameters of the conductor, such as voltage and current. Then, these parameters are transmitted to the sink node of the tower by multihop routing, and the sink node forwards them to the substation data terminal. Finally, with the help of an optical fiber network, the data is sent to the remote data monitoring center. Since the delay time of ZigBee technology for data transmission is usually between 15 ms and 30 ms, it meets the requirements of real-time monitoring [18].
In addition, in the process of monitoring information transmission, information loss may occur due to the influence of obstacles. Given this phenomenon, the redundant mechanism is adopted to eliminate the impact of data loss; that is, the system adds redundant nodes, and redundant data are used to improve the accuracy of target identification [19]. If the data is lost due to node failure, take the failed node as the center of the circle and the coverage hole area as the radius to find the nearest redundant node in the area to join the network as a substitute node. Moreover, when redundant nodes are deployed, all nodes in the network do not need to be activated at all times to continuously perform communication tasks [20]. Some nodes in the network can be activated while other nodes are dormant or energy-saving, to prolong the life cycle of the whole network monitoring task on the premise of ensuring the normal connection of the network [21].
There is no doubt that the application of WSN still faces some urgent problems to be solved, such as how to reduce the energy loss of sensor nodes, prolong the whole network life cycle, and design network communication mechanisms to meet the communication requirements of sensor networks.
Generally, whether the remaining lines in the power grid have interlocking tripping is closely related to the backup protection of the lines. If the electrical quantity of each branch enters the action range of backup protection after power flow redistribution, the backup protection will be started to remove the failure, resulting in secondary failure of the power grid and further aggravation of power flow transfer. When a new line trips due to failure, it is called Level 3 failure, and so on, which will be accompanied by a complex dynamic process.
Assuming that each line of the power grid is equipped with current type backup protection, and the power grid has m branches, when the ith branch L i has an initial failure and is removed, the operator can use the system in Figure 4 to obtain the current value of the remaining line, compare it with the set value, and judge whether there are cascade failures in the remaining line L k in the power grid, which is judged by equation (3) [22]: where I k,set is the backup protection setting value of the kth line, I k is the current measurement value of the kth line, and I k,dist is used to measure the interlocking disturbance degree of the remaining branches affected by the initial failure branch. If it is greater, it will be more obviously affected by the initial failures. It is the measured value of the kth line, which is used as the index of measurement and physical quantity. When I k,dist > 0, the branch does not have interlocking tripping; when I k,dist = 0, branch L k is at the boundary of the interlocking trip. When I k,dist < 0, the branch will have interlocking tripping. Each transmission line in the power grid is a closely connected whole. When a line fails due to impact or serious disturbance, it will be removed from the power grid to ensure the normal operation of the power grid, which will inevitably   The instantaneous tide transfer will not make the operation state of the power grid transient. That is, the injection power of the node remains approximately unchanged. It can be seen that the main factor determining whether cascading failures occur in the power grid is the node injection power of the power grid before the initial failures are removed [23]. Furthermore, the form of safety margin after the initial failures can be given according to the node injection power: where S is the node injection power vector in the current operating state and S′ is the corresponding node injection power vector in the critical state of cascading failures. When S changes, it will lead to different values of D′ðSÞ, so D′ðSÞ is approximately regarded as a function of S.

WSN and Power Grid Monitoring.
To prevent and control cascading failures of the power grid, we should effectively control the operation state of the power grid. Besides, we also pay attention to the economic cost of system operation. In this paper, the prevention and control cost C defined in the literature [24] can be expressed as where n is the set of generators participating in the adjustment in the system; P Gi and P G0 are, respectively, the active output of the generator on the node i before preventive control and the active output of the generator on the node i after preventive control; and α i is the control cost coefficient.

WSN-Based Power Grid Cascading Failure Prevention and Control
Model. According to the safety margin index, it can be judged that the power grid is likely to be in abnormal operation under the disturbance of expected initial failures. Therefore, preventive measures must be taken to improve the safety of power grid operation. In this paper, a double-layer optimization model of chain failure prevention and control is established from the perspective of safety and economy.
(1) Inner Layer Model. The inner layer considers the shortest distance between the current power grid operation state and the critical state of cascading failure, that is, optimize the minimum safety margin of the power grid, and its objective function can be expressed as [23] where the smaller the DðSÞ, the closer the system is to the critical point of the interlocking trip; that is, the power grid has a high probability of interlocking trips.

Constraints:
(1) Power flow constraints Equation (6) is an optimization problem, and the electrical constraints that must be satisfied include equality constraints and inequality constraints. On the one hand, the equality constraints mainly include the power flow constraints of the power grid before the initial failure and the power flow constraints of the power grid after the initial failures. Among them, the power flow constraints of the power grid before the initial failures can be abbreviated as where h 0 is the mapping relationship corresponding to the power flow before the initial failure occurs and x is the power grid state variable. Using equation (8) can record the power flow constraint of the power grid after the initial failure: where h 1 is the mapping relationship corresponding to the power flow after the initial failure occurs and x is the power grid state variable.
On the other hand, the inequality constraints to be satisfied during the normal operation of the power grid are shown in P Gi,min ≤ P Gi ≤ P Gi,max , i = 1, ⋯, N 1 , where P Gi and Q Gi , respectively, represent the active output and reactive output of the ith generator in the system; P Gi,min and P Gi,max are the lower limit and upper limit of the active output of the ith generator, respectively; Q Gi,min and Q Gi,max are the lower limit and upper limit of reactive output of the ith generator, respectively, and N 1 is the total number of generators in the power grid; P m is the active power transmitted by branch L m , and P m,max is the active power limit transmitted by branch L m ; and U k is the voltage of node k, U k,max and U k,min are the upper and lower limits of the voltage of node k, respectively, N 2 is the total number of nodes of the power grid, and equation (9) is written in abbreviated form, which can be expressed as Similarly, the inequality constraints that need to be satisfied after power grid failure can be abbreviated as 5 Wireless Communications and Mobile Computing (2) Constraints during critical operation of power grid Under the disturbance of initial failures, combined with the analysis of equation (3), it can be obtained that after the initial failure line is removed, the constraints of the critical state of cascading failures in the power grid are as follows: where I i,dist have the same meaning as I k,dist in equation (3).
(2) Outer Layer Model. From the perspective of complex network theory, considering the prevention and control of power grid cascading failures, on the premise of meeting the load requirements and power grid operation characteristics, if the active output of generator units in the power grid is changed to ensure that DðSÞ in equation (4) is greater than zero and as large as possible, the current operation state of the power grid is far away from the critical state, to achieve the effect of preventing cascading tripping. Moreover, in the prevention and control, the economic cost of power grid operation has also been paid more attention to. That is, when taking control measures, we should not only ensure the smooth and safe operation of the power grid but also consider the economy of different control methods. Therefore, its mathematical expression is where F 1 represents the optimization effect on power grid safety margin, F 1 and F 2 are the objective functions of the outer model, S represents the node injection power vector, and C is the cost control.

Constraint condition:
To meet the system power flow equality constraints and inequality constraints is necessary when the power grid is in normal operation, such as generator active power, reactive power output constraints, node voltage constraints, and line transmission power constraints. Its mathematical expression is where p 0 ðxÞ and p 1 ðxÞ are the mapping relations corresponding to the power flow before and after the initial failures, m 0 ðxÞ and m 1 ðxÞ correspond to inequality constraints, and x is the power grid state variable. When the power grid is in a safe operation state, equation (15) must be satisfied: where I i,dist have the same meaning as I k,dist in equation (3).

Solution of Prevention and Control Model
3.1. Calculate Fitness Function Value. In this paper, the objective function of the required solution is combined with the constraints to construct an augmented objective function, that is, the fitness function: where equations (12) and (15) are abbreviated as dðxÞ > 0 and eðxÞ > 0, respectively, and h k ðxÞ corresponds to the kth component in h 0 ðxÞ or h 1 ðxÞ; g k ðxÞ, p k ðxÞ, m k ðxÞ, and h k ðxÞ have similar meanings; α, β, and ζ is the penalty factor, which is given according to the actual situation and is positive.
3.2. The NSGA2-PSO Algorithm. Literature [25] compares multiobjective particle swarm optimization (MOPSO), nondominated sorting genetic algorithm (NSGA2), and archived multiobjective simulated annealing algorithm (AMOSA), respectively. It is found that the NSGA2 algorithm has the advantages of low complexity and high precision. Therefore, Wireless Communications and Mobile Computing in this paper, the outer layer of the double-layer optimization model uses the NSGA2 algorithm; the PSO algorithm solves the inner model. Among them, the inner model transmits the result of equation (6) to the outer model. The exterior model adjusts the generator's active power output according to the information of the inner model and transmits the current power grid operation state to the inner model for further optimization of the inner model. The population size of the NSGA2-PSO algorithm is usually between 20 and 50. If the total population exceeds 50, the optimization efficiency of the algorithm will not be improved, but the calculation time will be increased [26].

NSGA2 Algorithm.
In the traditional multiobjective optimization algorithm, multiple objective functions are usually converted into a single objective function for the solution. However, in the conversion process, it is easy to be affected by the subjective factors of decision-makers, which will cause deviation to the results. Moreover, in the multiobjective problem, each objective restricts and affects the other. On the contrary, the NSGA2 algorithm adopts crowding degree calculation and elite strategy. In the process of evolution, it retains some excellent individuals in the population and reduces the impact of human factors on solution set distribution [27]. The NSGA2 algorithm is a multiobjective intelligent optimization algorithm based on Pareto optimal solution theory. The specific process is shown in Figure 5.
(1) Initialization Define the number of iterations L c , crossover probability pc, and mutation probability pm. Since the number of variables to be optimized mentioned above is m, the length of each individual is set to m. Assuming that the population size is pop 1 , the initial parent population Ch is randomly generated according to where max v is the upper limit of the variable and min v is the lower limit of the variable and rand ðpop 1 , mÞ is a random matrix that generates a pop 1 row and m column with elements within 1.
(2) Crossover, mutation, and recombination The parent population Ch was crossed and mutated to generate the offspring population SCh. The parent population and the child population were recombined to form the population SCh1. The convergence of normal power flow and breaking power flow of ground-state data of each particle is verified. All particles can enter the next step only after passing the verification. If the power flow of a particle does not converge, the original ground state data is given to the particle. Crossover and mutation operation.Form offspring populations SCh.

Initialize the parent population Ch
Set the total number of iterations L C , number of iterations i, crossover probability pc, mutation probability pm. According to the individual's nondominated ranking value i rank , the whole population is nondominated stratified. Individuals with the same nondominated ranking value i rank belong to the same nondominated layer.

(5) Individual congestion distance calculation
The purpose is to selectively sort the individuals with the same nondominated order value and select the excellent individuals. Set the crowding distance of the ith individual in the same layer to 0, and record it as L d ½i = 0. The individuals in the same layer are arranged in descending order according to the fitness value. Next, let where M is a large number. Finally, calculate the congestion distance for the individuals in the middle of the ranking according to equation (18) [28]: where L d,m ½i + 1 represents the mth fitness value of the i + 1 st individual, f m,max represents the maximum fitness value corresponding to the mth objective function, and f m,min represents the minimum fitness value corresponding to the mth objective function.

(6) Elite strategy selection calculation
The population SCh 1 was screened to obtain a new parent population Ch. Therefore, according to the ranking of i rank from low to high, particles with the same i rank value are put into Ch in turn until they exceed the population size pop 1 when they are put into a certain layer of F i ; then, they are sorted from large to small according to the crowding distance of individuals in F i and continue to fill Ch until the population number is pop 1 . Enter the next cycle with the newly obtained parent population Ch.

PSO Algorithm. Particle swarm optimization (PSO)
simulates the predation process of birds and continuously approaches the best advantage of search according to each particle's learning and group experience. Each particle's speed and position can reflect its motion state, and the speed and position of each particle can be updated according to equation (19) [29]: where v k+1 i and x k+1 i are the iterative speed and position of particle i at k + 1st time, respectively; v k+1 i meets v min ≤ v k+1 i ≤ v max; P best , i is the optimal solution experienced by particle i itself; G best is the population optimal solution; W is the inertia coefficient, which generally decreases linearly from 0.9 to 0.1; c 1 and c 2 are acceleration factors, and their values are generally taken as 2; and r 1 and r 2 are random numbers on ½0, 1.
To search the critical operation state of interlocking tripping, the line most affected by the initial failure and the node-set that plays a pivotal role in the branch can be analyzed, which will help to improve the calculation speed. Therefore, when solving the inner model, this paper uses the power sensitivity matrix to find the key node set [30].
This paper assumes that the reactance value on the line is much greater than the resistance value. From the relevant knowledge, the relationship between branch current and node current can be obtained: where I B is the branch current vector, Y B is the branch susceptance matrix, A is the node branch incidence matrix, Y N −1 is the inverse of node susceptance matrix, and I N is the node current vector. For the convenience of the following description, let DðμÞ = Y B A T Y −1 N be the coefficient matrix representing the correlation degree between the branch current vector and the node injection current vector.
Assuming that there are n nodes and m lines in the power network, the expression of line i current can be obtained according to equation (20): Equation (21) is processed, converted into the relationship between branch power and node injection power, and sorted to obtain where P i,B and Q i,B represent the active power and reactive power flowing through the line i, respectively; μ i,N is the element in row i and column n of DðμÞ; U i,B and ϕ i,B are the voltage amplitude and phase angle of the first node of the i branch, respectively; and U i,N and ϕ i,N are the voltage amplitude and phase angle of the lth node. In this paper, only the active power of nodes is considered for the prevention and control of cascading failures, so equation (22) is simplified to equation (23). That is, the relationship between the active power of transmission line i and the active power injected by all nodes in the grid can be obtained as follows: λ i,l P l cos ϕ i,B cos ϕ l,N + sin ϕ i,B sin ϕ l,N À Á , Wireless Communications and Mobile Computing where P i is the active power passing through the transmission line i, P l is the active power injected by the lth node, N is the total number of nodes in the system, and μ i,l is the coefficient matrix DðμÞ of the element that intersects row i and column l. By further simplifying equation (23), the sensitivity coefficients of branch active power P i and node injection active power P l can be obtained, which can be expressed as where β i,j is the sensitivity coefficient, and the meaning of other parameters is consistent with equation (23). Define incidence matrix LðβÞ, β i,j is the element in the matrix L where the ith row and the lth column intersect. If β i,j < 0 is obtained, it can be multiplied by -1 to make it positive, and the sensitivity after treatment is still recorded as β i,j . It can be seen from equation (24) that the greater the value of β i,j , the more obvious the impact on the power of the ith branch when the node l power changes.
When searching for the key nodes in the critical state of the nearest cascading failures, the node injection power vector can be assigned to each particle. The specific methods are as follows: in the first step, calculate the current value I k,dist of the remaining lines in the power grid after the initial failure shutdown according to equation (3) from the expected initial failures, and calculate the minimum value of I k,dist and the corresponding branch number and record it as lm in the second step, solve the sensitivity matrix of the most seriously disturbed branch lm according to equations (23) and (24). According to the actual needs, an appropriate threshold E value is defined to judge the relationship between elements β i,j and E value of the sensitivity matrix. If β i,j > E value , the node number corresponding to element β i,j is classified into set A. Finally, the variable with the solution is set to the node injection power in set A, and the penalty function is defined and solved in combination with the particle swarm optimization algorithm.

Example Analysis
According to the previous ideas in this paper, the power grid security assessment using WSN is mainly to analyze the power grid based on the input power of the power grid nodes. In order to focus on the verification of the evaluation method, this example assumes that the IEEE39 node system has been configured with a parameter monitoring device according to the structure shown in Figure 6.
Use the system in Figure 4 with the equipment in Figure 7 to collect node voltage and line current data, as shown in Tables 1 and 2, and their values are expressed as per unit value. The study found that in the process of data transmission using a ZigBee routing protocol, part of data packets need to pass through multiple paths, which is easy to cause the drawbacks of uneven energy distribution and low routing efficiency. Therefore, there is a certain error when comparing the power grid operation parameters collected through the above network with the data of the IEEE39 node system [31]. According to the obtained voltage and current, it is easy to calculate the node injection power according to equation (2). Limited to space, the node injection power data will not be listed here. In the calculation, considering the actual characteristics of power flow, when considering the node injection power state, this paper mainly combines the active power and reactive power of PQ node and the active power of PV node to form the vector S for injection power combination [32]. The control cost coefficient in equation (5) can be used in the literature [9].
On the IEEE39 node system, the initial fault lines L ð17Þ and L ð20Þ are analyzed as the initial fault lines. Set the population number to 30; the maximum number of iterations of the NSGA2 algorithm is 40; the maximum number of   Figure 6: Diagram of IEEE39 bus system. 9 Wireless Communications and Mobile Computing iterations of the PSO algorithm is 40. The simulation diagram is as follows.
As can be seen from Figures 8 and 9, with the improvement of the power grid safety margin, the control cost of the generator set is also increasing. When adjusting, if only safety margin or control cost is considered, the following situations will occur. The first one is by only considering the improvement of power grid safety margin and ignoring the control cost, the increase of safety margin may not be obvious, but more control funds are invested. The second is only considering reducing control costs and pursuing economic benefits may lead to abnormal operation of the power grid. Therefore, in the actual operation of the power grid, it is  10 Wireless Communications and Mobile Computing necessary to consider the security margin of the power grid together with the control cost. For example, if the limited control cost (unit: USD) ranges from 400 to 600, from the above figure, the safety margin is between 10 and 15, which can meet the normal operation of the power grid. Moreover, within a given control cost range, it can be flexibly adjusted according to needs, which can ensure the reliable operation of the power grid. In this paper, the proposed system is verified not only by simulation in MATLAB but also by using the existing experimental equipment. The experimental equipment is shown in Figure 7.

Conclusion
This paper combines WSN technology with cascading failure prevention and control and establishes a prevention and control model considering economy and safety. The main conclusions are as follows: (1) Using WSN to monitor the power grid parameters can timely feedback the injected power information of the current power grid nodes to the monitoring center. Combined with the safety margin index in this paper, the safety level of the power grid can be quickly judged (2) This paper establishes a double-layer optimal preventive control model, and the NSGA2-PSO algorithm is used to solve the model. By adjusting the generator active power output strategy, the power generation cost is minimized based on improving the safety margin, so that the power grid can take into account the requirements of safety and economy at the same time In short, the method proposed in this paper can provide a reference for further research on cascading failures of the power grid.

Data Availability
The data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest
The authors declare that they have no conflicts of interest.