Lightning positioning method, device and equipment based on multi-core multi-process accelerated parallelism and storage medium
By employing a multi-core, multi-process approach that utilizes a two-stage multi-process pool and shared memory collaboration, the computational bottleneck and low hardware resource utilization of lightning location systems under large-scale networking conditions are resolved. This approach enables efficient and real-time lightning location, making it suitable for power protection and meteorological monitoring.
Patent Information
- Application Number
- CN202511690755.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-18
- Publication Date
- 2026-02-27
AI Technical Summary
Existing lightning positioning systems suffer from computational bottlenecks, low hardware resource utilization, and low parallel collaboration efficiency in large-scale networking and high-sampling scenarios, making it difficult to meet the requirements for real-time response and high precision.
A two-stage multi-process pool and shared memory collaborative approach is adopted to accelerate parallel processing of lightning localization through multi-core and multi-process, including data preprocessing, peak detection, shared memory allocation, multi-process task allocation, parallel computing, 3D localization calculation and result fusion, and the localization results are optimized by combining least squares method and weighted centroid method.
It improves the stability and accuracy of lightning location, shortens the output delay of location results, meets the real-time response requirements of scenarios such as power protection and meteorological monitoring, and reduces operation and maintenance and data calibration costs.
Smart Images

Figure CN121579192A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of lightning monitoring and parallel computing, and in particular to a lightning positioning method, device and equipment based on multi-core multi-process acceleration parallel and a storage medium. BACKGROUND
[0002] As a common disastrous weather, lightning has threatened the stability of power systems, aviation safety, meteorological warning and social production, and the demand for the accuracy and real-time performance of lightning positioning has been significantly improved. Currently, the mainstream lightning positioning relies on multi-station networking systems, which are based on the time of arrival (TOA) method. By measuring the time difference of lightning signals arriving at different stations, the position is inversely calculated combined with the electromagnetic wave speed, which is widely used in power protection, meteorological monitoring and other fields.
[0003] However, the existing system has obvious limitations in large-scale networking and high sampling scenarios: first, the TOA time difference calculation and equation solving are mostly processed in a serial architecture, which is prone to bottlenecks when facing massive data, and the positioning delay is difficult to meet the real-time response requirements; second, the hardware scheduling is not adapted to the multi-core architecture, which cannot tap the potential of multi-core, waste resources and easily cause uneven load, reducing the TOA solving efficiency; third, the expansion of stations and the improvement of sampling accuracy lead to a sharp increase in TOA data, and the existing parallel scheme lacks fine task splitting and thread synchronization, resulting in insufficient system stability and adaptability. SUMMARY
[0004] The first object of the present application is to provide a lightning positioning method based on multi-core multi-process acceleration parallel, which realizes efficient parallel processing of large-scale station data through a two-stage multi-process pool and shared memory cooperation, and completes lightning positioning by combining the time of arrival (TOA) method, focusing on solving the problems of low utilization of multi-core hardware resources and low efficiency of parallel cooperation, and being suitable for scenes with high real-time requirements such as power protection, meteorological monitoring, etc. The present application also provides a lightning positioning device, equipment and storage medium based on multi-core multi-process acceleration parallel.
[0005] Technical solution: The lightning positioning method based on multi-core multi-process acceleration parallel provided by the present application comprises the following steps: S1, sequentially performing point circulation to read the original waveform data of multiple lightning monitoring stations, and performing preprocessing on the data of each station; S2, performing peak detection and feature extraction on the processed data of each station; S3, shared memory allocation and data sharing; S4, multi-process task allocation and parallel computing; S5, three-dimensional positioning calculation and optimization; S6, result fusion and optimization; S7, finally, resource release and cleaning.
[0006] The preprocessing in S1 includes: Verifying whether the data length is as expected; Deciding whether to splice the data of the time periods before and after according to the data type identifier; Filtering the original data with a band-pass filter of a preset frequency range; Up-sampling the data to improve the time resolution; Calculating the first-order difference of the waveform to enhance the peak feature.
[0007] Further, S2 performs peak detection using a sliding window algorithm, specifically including: Calculating the maximum and minimum values of each time period in a preset time unit to determine the trigger threshold; Using a window of a preset number of sampling points to traverse the entire data sequence; Verifying whether the detected peak is a local extreme point; Recording the position information of all qualified peaks.
[0008] Further, S3 specifically includes: Creating a shared memory area and storing the data array therein; Encapsulating the peak matrix of the master site through the shared array; Encapsulating the waveform data of all sites as shared array objects respectively; Establishing a mapping relationship from virtual memory to physical memory.
[0009] Further, S4 specifically includes: Parallel processing of peak matching tasks of all sites through a process pool: creating a parameter list containing shared memory references, starting a preset number of processes and calling a calculation function through the process pool, and performing parallel calculation on the tasks in the parameter list to obtain a result list; In the inter-site peak matching and correlation analysis stage, the following operations are performed on the data of each site: calculating the expected time delay according to the inter-site distance; performing cross-correlation calculation using a window of a preset number of points to complete coarse matching and preliminarily determine the peak position; performing fine cross-correlation through a window of a preset number of points to achieve fine matching and accurately locate the peak; calculating the waveform correlation coefficient to exclude matching results with a correlation lower than a preset threshold.
[0010] Further, S5 three-dimensional positioning calculation and optimization uses the least squares method for three-dimensional spatial positioning, constructs an objective function to calculate the difference between the theoretical distance and the actual propagation distance, calculates the initial value through the weighted centroid method to improve the convergence speed, sets a preset maximum number of iterations and a tolerance, and finally returns the positioning result, the residual error, and the average residual error; In the S6 result fusion and optimization process, the positioning results calculated by all main stations are collected first. Then, the results are spatiotemporally clustered using preset time windows and spatial windows. The result with the smallest residual in each cluster is selected as the final positioning result, generating an output result containing time, latitude, longitude, and altitude information.
[0011] Furthermore, the S7 specifically includes: Call the release method to release all shared memory regions; Properly shut down the process pool to reclaim system resources; Make sure all open files are closed properly.
[0012] Correspondingly, a lightning location device based on multi-core, multi-process accelerated parallelism is also provided, including: The data acquisition and preprocessing module is used to acquire raw waveform data from multiple lightning monitoring stations and perform data integrity verification, digital filtering, upsampling and differential processing. The shared memory management module is responsible for creating and managing shared memory regions, encapsulating large data arrays into shared array objects, and providing an efficient multi-process data sharing mechanism. The peak detection module uses a sliding window algorithm to detect the peak value of lightning signals in the data of each station, and has the functions of noise level estimation, peak detection and verification. The parallel computing scheduling module creates and manages process resources through a process pool, dynamically allocating computing tasks to multiple CPU cores to achieve parallel computing. The correlation analysis module calculates the cross-correlation function between signals from different stations, completing peak alignment in two stages: coarse matching and fine matching. The 3D positioning calculation module, based on the least squares optimization algorithm, uses the time difference of arrival of multiple stations to perform 3D spatial positioning calculations. The results fusion and output module is responsible for clustering, optimizing, and selecting multiple calculation results to generate the final result.
[0013] Correspondingly, a lightning location device based on multi-core multi-process accelerated parallelism is also provided, including: one or more processors; Storage device for storing one or more programs or user data; When the one or more programs are executed by one or more processors, the one or more processors implement the lightning location method based on multi-core multi-process acceleration and parallelism as described above.
[0014] Correspondingly, a lightning location storage medium based on multi-core and multi-process accelerated parallelism is also disclosed, which stores a computer program that, when executed by a processor, implements the lightning location method based on multi-core and multi-process accelerated parallelism as described above.
[0015] Beneficial effects: Compared with the prior art, the significant advantages of this invention are: (1) Improved stability of lightning location process: The location task is evenly distributed to the multi-core core through a dual-stage process pool to avoid hardware idleness or single core overload, ensuring stable lightning event capture and continuous result output, and solving the problem of location disconnection under high load in traditional architecture. (2) Dual optimization of lightning positioning speed and accuracy: Shared memory enables efficient data interaction of multiple processes, and combined with two-stage parallel splitting, the processing efficiency is greatly improved. In terms of speed, it can quickly process large-scale site data and avoid missing key nodes of lightning movement; in terms of accuracy, it reduces the error of TOA time difference calculation and reduces the deviation of lightning position back-inference, meeting the high-precision requirements of power lightning protection, airport monitoring and other applications. (3) Enhanced real-time response to lightning events: It significantly reduces the time required for large-scale site data processing, shortens the delay in outputting positioning results, and can track the trajectory of thunderstorm clouds in real time and quickly update the location of lightning, thus providing time for emergency response in scenarios such as power line trip prediction and short-term weather warning. (4) Good hardware adaptability in multiple scenarios: It can be adapted to mainstream multi-core hardware and can be deployed in different scenarios (such as substation servers and meteorological cloud nodes) without modifying the core logic. At the same time, it ensures that the positioning results of the same lightning event are small in different hardware environments, reducing the operation and maintenance and data calibration costs of cross-regional monitoring networks. Attached Figure Description
[0016] Figure 1 This is a flowchart illustrating the method and shared memory usage of the present invention. Figure 2 This is a diagram illustrating the multi-process parallel structure of the method of the present invention; Figure 3 This is a block diagram of the device of the present invention; Figure 4 This is a comparison chart of algorithm running times; Figure 5 This is a comparison chart showing the running time of each step before and after algorithm acceleration. Detailed Implementation
[0017] Example 1: As Figure 1 As shown, a lightning location method based on multi-core, multi-process accelerated parallelism includes the following steps: The process proceeds sequentially through time points. First, data processing is performed by reading raw waveform data from multiple lightning monitoring stations and executing a series of pipelined processing operations on the data from each station: verifying whether the data length meets expectations; determining whether to splice data from preceding and following time periods based on the data type identifier; filtering the raw data using a bandpass filter with a preset frequency range; upsampling the data to improve time resolution; and calculating the first-order difference of the waveform to enhance peak characteristics.
[0018] Then, peak detection and feature extraction are performed. The sliding window algorithm is used to perform peak detection on the processed data of each station: the maximum and minimum values of each time period are calculated in a preset time unit to determine the trigger threshold; the entire data sequence is traversed using a window of a preset number of sampling points; it is verified whether the detected peak is a local extreme point; and the position information of all qualified peaks is recorded.
[0019] Subsequently, shared memory allocation and data sharing are performed. A shared memory area is created and a large data array is stored therein: the peak matrix of the master station is encapsulated into a shared array; the waveform data of all stations are encapsulated into shared array objects respectively; and a mapping relationship between virtual memory and physical memory is established.
[0020] As shown in Figure 2 , multi-process task allocation and parallel computing are performed. All station peak matching tasks are processed in parallel through a process pool: a parameter list containing a shared memory reference is created, a preset number of processes are started, and a calculation function is called through a process pool to perform parallel computing on the tasks in the parameter list to obtain a result list. In the inter-station peak matching and correlation analysis stage, the following operations are performed on the data of each station: the expected time delay is calculated according to the distance between stations; cross-correlation calculation is performed using a window of a preset number of points to complete coarse matching and preliminarily determine the peak position; fine cross-correlation is performed through a window of a preset number of points to achieve fine matching and accurately locate the peak; and the waveform correlation coefficient is calculated to exclude matching results with a correlation lower than a preset threshold. In the three-dimensional positioning calculation and optimization stage, the least squares method is used for three-dimensional spatial positioning, a target function is constructed to calculate the difference between the theoretical distance and the actual propagation distance, the initial value is calculated through the weighted centroid method to improve the convergence speed, the preset maximum number of iterations and the tolerance are set, and finally the positioning result, residual error and average residual error are returned. In the result fusion and optimization selection process, the positioning results calculated by all master stations are collected first, then a preset time window and a spatial window are used to perform time and space clustering on the results, the result with the smallest residual error is selected from each cluster as the final positioning result, and an output result containing time, latitude, longitude and height information is generated. Finally, resource release and cleaning are performed. After all calculations are completed, system resources are released: a release method is called to release all shared memory areas; the process pool is properly closed to recover system resources; and it is ensured that all open files are properly closed.
[0021] This method is designed around a two-stage 8-process pool parallel and shared memory data interaction, and realizes lightning positioning based on the TOA positioning principle. This method is based on multi-core processor hardware resources, and realizes the parallelization of the TOA positioning process through process scheduling and task splitting. The core steps include: (1) Multi-core multi-process environment initialization: After the main program starts, first detect the number of processor cores and memory capacity, configure a two-stage 8-process pool (site-level 8-process pool, peak-level 8-process pool), the process pool size is fixed to 8, which adapts to the hardware characteristics of mainstream multi-core processors (8 cores and above); At the same time, create a shared memory partition, divided into "site data area (store basic data of each site)", "parallel interaction area (store real-time interaction data between processes)", "result cache area (store temporary positioning results)", realize direct reading and writing of multiple processes through memory mapping file, avoid time-consuming loss of traditional data transmission; Load global parameters (including TOA positioning basic parameters, process synchronization threshold), provide a unified benchmark for parallel processing.
[0022] (2) Time point cycle and single site data preprocessing: Enter the time point cycle, the main program reads the site list of the current time unit, and performs basic data preprocessing (including data loading, interference elimination, signal feature extraction) for each site. Extract the core parameters (signal arrival time) required for TOA positioning, and write the preprocessing results of all sites to the shared memory "site data area" uniformly, providing data support for subsequent parallel processing.
[0023] (3) Master station loop and site-level 8-process pool parallel: The main program enters the master station selection loop, and selects one site with good signal quality as the master station each time; Then start the site-level 8-process pool, and evenly distribute the remaining slaves to the 8 processes according to the number, each process reads the data of the master station and the assigned slave from the shared memory "site data area", and executes the "master-slave station signal matching" task in parallel; After all processes complete the matching, write the results to the shared memory "parallel interaction area" in real time, and the main program constructs a "site difference matrix" based on these results as input for peak-level parallel.
[0024] (4) Peak-level 8-process pool parallel and TOA positioning: The main program starts the peak-level 8-process pool, and groups the data in the "site difference matrix" according to characteristics, and evenly distributes them to the 8 processes; Each process reads the assigned group data from the shared memory, executes the "positioning calculation" task in parallel based on the TOA principle, and obtains the lightning position corresponding to each group of data; All processes write the calculation results to the shared memory "result cache area", and the main program synchronously completes the inter-process data verification to ensure the consistency of the calculation results.
[0025] (5) Result merging and loop control: The main program judges whether the current master station is processed, if there are more master stations, it returns to the "master station selection" step, and repeats the "site-level parallel → peak-level parallel" process; After all master stations are processed, the main program collects all temporary results from the shared memory "result cache area", performs repeated result merging and outlier elimination, and outputs the final positioning results of the current time unit; Determine whether there are more time units, if there are, return to the time point cycle, otherwise the main program ends.
[0026] (6) Process pool and shared memory coordination mechanism: The scheduling of the two-stage 8-process pool adopts the "dynamic start-stop + idle recovery" strategy - the station-level process pool automatically releases resources after completing the task, and the peak-level process pool directly calls the idle core when starting to avoid resource occupation; The three partitions of the shared memory realize process synchronization through "read-write lock": only one process is allowed to write at the same time, and multiple processes can read simultaneously, ensuring data security and interaction efficiency; Processes do not need to transfer data through the main program, but interact directly through shared memory, greatly reducing the coordination time.
[0027] Compared with the traditional serial processing TOA lightning positioning method, this method parallelizes time-consuming tasks such as TOA time difference calculation and equation solving through fine multi-core coordination and process scheduling, breaking through the bottleneck of large-scale data processing, and can flexibly adapt to different sizes of site networking scenarios, while avoiding efficiency loss caused by TOA data competition between processes.
[0028] Embodiment 2: This patent realizes a two-stage parallel TOA processing logic, and the core modules include: (1) Multi-core multi-process scheduling module: responsible for the creation, task distribution, process start-stop and resource recovery of the two-stage 8-process pool (station level, peak level), ensuring that the 8 processes evenly occupy different cores of the multi-core processor, avoiding core overload or idling; built-in process synchronization mechanism (read-write lock, semaphore) to coordinate the access of multiple processes to shared memory; (2) Shared memory management module: realizes the partition creation, capacity allocation, data read-write control of shared memory, and provides a direct data interaction channel for multiple processes; supports dynamic expansion of memory space, and adapts to different sizes of site data; (3) Basic processing module: responsible for single-site data preprocessing and TOA positioning basic calculation, and outputs the results to shared memory to provide data support for parallel modules. (4) Result integration module: collects temporary positioning results of multiple processes, performs merging and abnormality rejection, and outputs the final positioning result.
[0029] To realize the multi-core multi-process accelerated parallel lightning positioning method in embodiment 1, this embodiment provides a multi-core multi-process accelerated parallel lightning positioning device, as shown in Figure 3 , which includes: A data acquisition and preprocessing module is configured to acquire raw waveform data from multiple lightning monitoring sites and perform data integrity verification, digital filtering, upsampling, and difference processing. A shared memory management module is responsible for creating and managing shared memory areas, encapsulating large data arrays as shared array objects, and providing an efficient multi-process data sharing mechanism. A peak detection module uses a sliding window algorithm to detect lightning signal peaks in each site data, with noise level estimation, peak detection, and verification functions. A parallel computing scheduling module creates and manages process resources through a process pool, dynamically allocates computing tasks to multiple CPU cores, and realizes parallel computing. A correlation analysis module calculates the cross-correlation function between signals of different stations, and completes coarse matching and fine matching of peak alignment. A three-dimensional positioning calculation module uses the time difference of arrival of multiple stations to perform three-dimensional spatial positioning calculation based on a least squares optimization algorithm. A result fusion and output module is responsible for clustering, optimizing selection and generating the final result of multiple calculation results.
[0030] Embodiment 3: The embodiment provides a lightning positioning device based on multi-core multi-process accelerated parallelism, comprising one or more multi-core processors. A storage device for storing one or more programs, user data, a communication interface and an operating system. The multi-core processor supports parallel computing, the storage device is used to store computer programs and lightning monitoring data, the communication interface is used to communicate data with distributed lightning monitoring stations, and the operating system supports programming environment and multi-process management. When the one or more programs are executed by one or more processors, the one or more processors implement the lightning positioning method based on multi-core multi-process accelerated parallelism in embodiment 1.
[0031] Embodiment 4: The embodiment provides a lightning positioning storage medium based on multi-core multi-process accelerated parallelism, which stores a computer program, the computer program includes data preprocessing program code, shared memory management program code, multi-process parallel computing program code, three-dimensional positioning algorithm program code and result fusion and output program code. The program is executed by the processor to realize the lightning positioning method based on multi-core multi-process accelerated parallelism.
[0032] To verify the effect of the application, relevant experiments are carried out. The experimental results show that the lightning positioning method based on multi-core multi-process accelerated parallelism can effectively improve the computing efficiency and processing capacity of lightning positioning, has significant performance improvement compared with the traditional method, and can meet the demand of real-time lightning monitoring.
[0033] As shown in Figure 4 , the time consumption of the algorithm before acceleration is 67.8s, and the time consumption after acceleration using multi-core multi-process is only 17.5s.
[0034] As shown in Figure 5 , the algorithm is divided into reading list, data processing, peak detection, reading data, peak matching and positioning calculation, result merging main links, the time consumption of the links after acceleration is greatly reduced, especially the peak matching and positioning calculation part using multi-process parallelism.
Claims
1. A lightning location method based on multi-core, multi-process accelerated parallelism, characterized in that, Includes the following steps: S1. Perform point loop in sequence, read the raw waveform data of multiple lightning monitoring stations, and perform preprocessing on the data of each station; S2. Perform peak detection and feature extraction on the processed data of each site; S3, Shared memory allocation and data sharing; S4, Multi-process task allocation and parallel computing; S5. Three-dimensional positioning calculation and optimization; S6. Results fusion and optimization; S7. Finally, release and clean up the resources.
2. The lightning location method based on multi-core, multi-process accelerated parallelism according to claim 1, characterized in that: Preprocessing in S1 includes: Verify that the data length meets expectations; Whether to concatenate data from preceding and following time periods depends on the data type identifier; The original data is filtered using a bandpass filter with a preset frequency range; Upsampling of the data improves temporal resolution; The first-order difference of the waveform is calculated to enhance the peak characteristics.
3. The lightning location method based on multi-core, multi-process accelerated parallelism according to claim 1, characterized in that, S2 employs a sliding window algorithm for peak detection, specifically including: Calculate the maximum and minimum values for each time period using a preset time unit to determine the trigger threshold; Traverse the entire data sequence using a window with a preset number of sampling points; Verify whether the detected peak value is a local extremum point; Record the location information of all qualified peak values.
4. The lightning location method based on multi-core, multi-process accelerated parallelism according to claim 1, characterized in that, S3 specifically includes: Create a shared memory region and store the data array in it; The peak value matrix of the main site is encapsulated using a shared array; The waveform data from all stations are encapsulated into shared array objects. Establish a mapping relationship between virtual memory and physical memory.
5. The lightning location method based on multi-core, multi-process accelerated parallelism according to claim 1, characterized in that, S4 specifically includes: Peak matching tasks for all sites are processed in parallel using a process pool: a parameter list containing shared memory references is created, a preset number of processes are started, and the calculation function is called through the process pool to perform parallel calculations on the tasks in the parameter list to obtain a list of results. During the peak matching and correlation analysis phase between stations, the following operations are performed on the data of each station: the expected time delay is calculated based on the distance between stations; cross-correlation calculation is performed using a window with a preset number of points to complete coarse matching and initially determine the peak position; fine cross-correlation is performed using a window with a preset number of points to achieve fine matching and accurately locate the peak; the waveform correlation coefficient is calculated, and matching results with correlation below a preset threshold are excluded.
6. The lightning location method based on multi-core, multi-process accelerated parallelism according to claim 1, characterized in that, The S5 3D positioning calculation and optimization uses the least squares method for 3D spatial positioning, constructs an objective function to calculate the difference between the theoretical distance and the actual propagation distance, calculates the initial value through the weighted centroid method to improve the convergence speed, sets the preset maximum number of iterations and tolerance, and finally returns the positioning result, residual and average residual. In the S6 result fusion and optimization process, the positioning results calculated by all main stations are collected first. Then, the results are spatiotemporally clustered using preset time windows and spatial windows. The result with the smallest residual in each cluster is selected as the final positioning result, generating an output result containing time, latitude, longitude, and altitude information.
7. The lightning location method based on multi-core, multi-process accelerated parallelism according to claim 1, characterized in that, S7 specifically includes: Call the release method to release all shared memory regions; Properly shut down the process pool to reclaim system resources; Make sure all open files are closed properly.
8. A lightning location device based on multi-core, multi-process accelerated parallel processing, characterized in that, include: The data acquisition and preprocessing module is used to acquire raw waveform data from multiple lightning monitoring stations and perform data integrity verification, digital filtering, upsampling and differential processing. The shared memory management module is responsible for creating and managing shared memory regions, encapsulating large data arrays into shared array objects, and providing an efficient multi-process data sharing mechanism. The peak detection module uses a sliding window algorithm to detect the peak value of lightning signals in the data of each station, and has the functions of noise level estimation, peak detection and verification. The parallel computing scheduling module creates and manages process resources through a process pool, dynamically allocating computing tasks to multiple CPU cores to achieve parallel computing. The correlation analysis module calculates the cross-correlation function between signals from different stations, completing peak alignment in two stages: coarse matching and fine matching. The 3D positioning calculation module, based on the least squares optimization algorithm, uses the time difference of arrival of multiple stations to perform 3D spatial positioning calculations. The results fusion and output module is responsible for clustering, optimizing, and selecting multiple calculation results to generate the final result.
9. A lightning location device based on multi-core, multi-process accelerated parallel processing, characterized in that, include: One or more processors; Storage device for storing one or more programs or user data; When the one or more programs are executed by one or more processors, the one or more processors implement the lightning location method based on multi-core multi-process accelerated parallelism as described in any one of claims 1 to 7.
10. A lightning positioning storage medium based on multi-core, multi-process accelerated parallelism, characterized in that, It stores a computer program that, when executed by a processor, implements the lightning location method based on multi-core, multi-process accelerated parallelism as described in any one of claims 1 to 7.