Fast Realization of Collision Risk Calculation in Power Line Patrol Flight Based on CUDA

In this paper, a low-altitude risk collision model based on CUDA is designed to avoid problems that may occur in the process of unmanned aerial power patrol. By collecting and analyzing the data related to the unmanned aerial power patrol task, the collision accident probability is extracted and the probability distribution model and the influence of weather factors on the collision risk are combined. -e model validates the collision risk of unmanned aerial vehicles in different locations and verifies the reliability and computational efficiency of the model based on different operating systems. -e model algorithm can effectively improve the response time to avoid collision risk during UAV patrol and reduce the risk level of UAV collision accidents.


Introduction
Due to many distribution points, wide area, complex terrain, and harsh natural environment, traditional manual inspection methods are becoming more and more expensive, time-consuming, and risky, which increasingly cannot meet the needs of safe and stable operation of smart grids. In recent years, the State Grid Company has vigorously promoted the application of a new patrol mode in which transmission line helicopters, unmanned aerial vehicles, and manual patrols work together. In the popularization of applications, the operation efficiency is effectively improved, the site security risk is reduced, and the line is reduced. e rush repair time of road outage enriches the means of operation and maintenance of power network and effectively guarantees power network with safe and stable operation. However, the security risks of unmanned aerial vehicles are gradually highlighted.
Scholars at home and abroad have conducted a lot of research on the risk of aircraft flight collision in lowaltitude airspace [1]; based on the concept of free flight, the positioning error of aircraft under the influence of anticollision system, wind, and other factors were analyzed. Meanwhile, a data fusion algorithm combined with inertial navigation and satellite positioning was proposed to periodically correct the positioning error. In [2], the event collision risk assessment model was adopted to assess the collision risk of aircraft in flight and based on horizontal and vertical directions, the conflict resolution methods were given. In [3], the longitudinal separation between aircrafts and the lateral separation of parallel routes based on ADS-B signal monitoring mode were proposed. At the same time, the flight separation standard in the flight training state was provided in combination with the actual flight training requirements of flight training institutions. In [4], the three-dimensional Monte Carlo location distribution model of UAV was explored to evaluate the collision risk of UAV to civil aircraft in the airport. By establishing the boundary of warning area, the collision caused by UAV eyewitness in various operation scenarios was determined. In [5], through the statistics of the day and night situation of birds, the characteristics of their main flight height and range were analyzed. In addition, the collision probability of bird activities on transmission lines and wind power generation facilities was offered. e study in [6] analyzed the collision risk of the current flight separation standard based on ADS-C control in the cross ocean route flight, established the collision risk model of adjacent flights, and obtained the conclusion that the current flight separation standard can be further reduced by solving the collision risk of two adjacent aircraft, so as to improve the operation efficiency and reduce the flight cost. Although domestic and foreign scholars have conducted in-depth research on the collision risk of aircraft, there are still few research studies on the collision risk between UAV and transmission lines and transmission towers and surrounding buildings in the aspect of UAV power line inspection. Different from civil aircraft or other types such as general aviation photography, UAV power line patrol has a narrow operation range and complex surrounding environment and it is greatly affected by the terrain and airflow. Due to the particularity of operation nature, UAV needs to fly continuously around the transmission line and transmission tower.
In order to reduce the collision accident occurred during the UAV power inspection, by combining the probability distribution model of the UAV inspection and the influence of the meteorological factors of the power corridor on the collision hazard, the CUDA-based low-altitude hazard collision model of the UAV inspection is designed to effectively make up for the shortage of current UAV obstacle avoidance measures in the power inspection operation, improve the safety performance of the UAV, and provide a guarantee for the smooth implementation of the UAV inspection work.

CUDA Overview.
e basic framework of the CUDA collision model is Reich model. e basic principle of Reich model [7] could make a cuboid collision box for aircraft along its longitudinal axis, horizontal axis, and vertical axis. e length, width, and height of the cuboid refer to the length of the aircraft on this axis. After the collision box is enlarged, an adjacent layer is designed around aircraft A. Aircraft B is regarded as a particle. In terms of the positioning error in the actual operation process, when aircraft B enters the adjacent layer of aircraft A, it is considered that there is a collision risk in the direction of longitudinal axis, horizontal axis, and vertical axis between A and B, which is the lowest acceptable collision risk in aircraft operation. e length, width, and height of the adjacent layer are the longitudinal, lateral, and vertical separation standards of the collision box. With the continuous development and improvement of scholars in various countries [8], the Reich model has also been applied in various subdivision fields of aviation direction. In recent years [9][10][11][12][13], the Reich model was mainly applied in free flight collision risk research, short-range parallel runway approach and landing risk analysis, wake interval standard impact assessment, and so on.
CPU is good at flow control and logic processing, irregular data structure, unpredictable storage structure, single thread program, and branch intensive algorithm.
When parallel computing is implemented in the regular data structure and predictable storage mode, GPU has more advantages [14]. CUDA is a general parallel computing architecture developed by NVIDIA, which enables GPU to solve complex computing problems through multiple CUDAs, which includes the CUDA instruction set architecture (ISA) and parallel computing engine in GPU. In this paper, the CPU and GPU were combined in the heterogeneous computing mode. e CPU was used to complete the serial computing part, including data initialization and final integration. Furthermore, the GPU was used to complete the parallel computing part to complete the collision risk calculation of UAV in multiple possible locations.

Establishment of the Collision Risk Model for UAV Power
Line Patrol. Reich model is the main body of the collision risk model. is paper makes the following settings, and some variables are shown in Figure 1: (1) is model only considers the collision risk of one UAV in the power patrol environment and does not consider the multiple collision risks between UAVs or between multiple UAVs and the surrounding environment.
(x n , y n , z n )} represents the set of obstacles in the aircraft patrol operation environment. Each obstacle is approximately composed of several discrete spheres with the diameter and the set of the centers of the spheres. If there is no collision risk between these discrete points and the UAV, there is no collision risk between the obstacle and the UAV.
It is assumed that the UAV is flying at a uniform speed in a stable wind environment, as displayed in Figure 2.
Because the positioning accuracy of UAV stands for independent normal distribution on the coordinate axis, its density function is 2 Mathematical Problems in Engineering where μ(t) x,y,z is the position of UAV at time t, under the condition of static wind, When there is wind in the patrol operation environment, the components of steady wind speed on the three coordinate axes are W x , W y , and W z . e components of gust induced turbulence wind speed on the three coordinate axes are G x , G y , and G z , where G z marks the low-level wind shear in the vertical direction due to thunderstorm, front, terrain, and other environmental factors.
It is assumed that the turbulent wind speed follows the independent normal distributions N x [0, δ x ], N y [0, δ y ], and N z [0, δ z ] in each direction of the coordinate axis. It can be inferred that the actual instantaneous position of UAV at a certain moment is as follows: Without losing generality, due to the collision relationship between the UAV and building in the two-dimensional plane without turbulence, the following conclusions can be drawn.
As shown in Figure 2, the shadow part refers to the actual running path of the UAV critical layer. For a known sphere, if there is no intersection with the shadow part, it is determined that the sphere collides with the UAV. According to Figure 3, the angle of UAV's actual running direction: e course of UAV is e angle between the rectangular diagonal of UAV critical layer and UAV running direction is e width of the shadow area is e central line equation of the long side of the shadow area can be calculated:

Mathematical Problems in Engineering
After the equations are sorted out, we can obtain For the center point of any discrete sphere, the distance from the center line to the long side of the shadow area is To maintain the risk of collision between the UAV and building within the acceptable range, it is necessary to meet the requirements of In the vertical direction, because the vertical stable wind speed is 0, then the width of the shadow area is S z . In order to keep the collision risk between the UAV and building in an acceptable range, it is necessary to meet the following requirements: Due to the existence of turbulence, whether in the vertical or horizontal direction, Di s will have a certain error. According to the formula derived above, in the case of turbulence, it needs to meet the requirements to keep the collision risk between UAV and building within the acceptable range.
In the public air transportation of large aircraft, ICAO has made corresponding target risk level for longitudinal, lateral, and vertical safety separation. For example, ICAO has stipulated that the corresponding target risk level for longitudinal, lateral, and vertical safety separation conditions are 5 × 10 − 9 . erefore, an acceptable safety target risk level should be established in the UAV power line patrol operation. It is assumed that the turbulence in power line patrol operation follows normal distribution G x N(0, 1), G z N(0, 1), and G z N(0, 1). e target risk levels corresponding to longitudinal, lateral, and vertical safety intervals are R x , R y , and R z , and the corresponding risk level in at least one direction should not exceed 5 × 10 − 9 .
In order to achieve the corresponding risk level of no more than 5 × 10 − 9 , the probability of UAV appearing in the adjacent layers in each direction should be no less than 1 − 5 × 10 − 9 at least. erefore, the collision risk of UAV can be controlled by judging the position relationship between adjacent floors and buildings. In the standard normal distribution, the probability between −5.84717 and 5.84717 is 1 − 5 × 10 − 9 .
erefore, the position of the adjacent layer is

Case Simulation Verification
e process of solving the model is shown in Figure 4.

Calculation Conditions
(1) Initial position of the UAV (2) UAV dimensions (3) Steady wind speed (4) Turbulent wind speed (5) Velocity vector of the UAV e location of the building/obstacle is illustrated in Figure 5. To simplify the calculation, the obstacle is surrounded by 2379 discrete spheres. e position information of discrete points is shown in Table 1.
e CPU model used in this experiment is i7-8550u, with the main frequency being 1.80 GHz. NVIDIA CPU data processing CUDA data processing CPU data processing    GeForce MX 150 is used as the graphics card. ere are three SMs (streaming multiprocessors) in the card, and each SM can schedule up to 2048 threads. in which the dark part indicates the existence of collision risk.

Calculation
By recording the time spent in each run of the program, the calculation efficiency of computing collision risk using CPU is only compared with that using CPU + CUDA hybrid parallel computing, as shown in Table 2.

Conclusion
At present, the main application object of Reich model is civil aircraft, rarely involving general aviation. e application scenario is mainly large aircraft public air transportation, while UAV power line patrol has not been studied; e CUDA method is used to calculate the collision risk probability during UAV power patrol inspection, which can effectively reduce the processing time of UAV computing collision risk. In the actual aircraft patrol operation process, wind speed and direction and gust wind speed and direction significantly affect the flight safety of UAV. In this paper, the collision risk model was first proposed and the solution was provided. Also, an algorithm was proposed based on CUDA, because the wind speed and direction of gust are real time and unpredictable, which can calculate the risk of collision probability in real time. Especially in the complex operating environment, the operation efficiency is greatly improved compared with the collision risk calculated by conventional CPU, which enables UAV to avoid obstacles and collision in time.
When performing power inspection tasks, the drone wants to effectively avoid the risk of collision, not only from the algorithm calculation time consideration but also from the human-machine ring and other aspects of consideration. e future will continue to study a full range of low-altitude airspace drone power inspection with the collision avoidance methods.
Data Availability e data were provided by the machine patrol management center of Guangdong Power Grid Co., Ltd., and can be contacted at 13760638267@139.com.

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