Neural network intelligent power quality data interpolation method and device based on NPU acceleration
By introducing an NPU-accelerated neural network interpolation method into power quality monitoring equipment, the problems of CPU computational complexity and real-time performance were solved, enabling efficient and real-time power quality data analysis and improving system performance and resource utilization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-17
- Publication Date
- 2026-04-03
AI Technical Summary
Existing power quality data interpolation methods suffer from severe computational complexity and real-time issues on CPUs, leading to reduced CPU processing efficiency and failing to meet the requirements of modern power quality monitoring equipment for high performance, low power consumption, and deterministic response.
A neural network-based intelligent power quality data interpolation method based on NPU acceleration is adopted. The power quality data interpolation network model is trained by acquiring the power quality training dataset, and then the model is quantized and format converted before being deployed to the NPU. The NPU is used for parallel computing, and the results are output to the CPU.
It improves the overall performance of the system, reduces CPU resource consumption and computational bottlenecks, enhances the real-time performance and efficiency of power quality data analysis, and has broad application prospects.
Smart Images

Figure CN121785984A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a method and apparatus for interpolating intelligent power quality data based on an NPU-accelerated neural network. Background Technology
[0002] Existing power quality data interpolation methods generally employ spline interpolation, specifically cubic spline interpolation. This method requires constructing hundreds or thousands of linear equations, and each interval segment requires solving the polynomial coefficients of four spline interpolations. Calculating and storing the intermediate matrix coefficients consumes tens of MB of SRAM (Static Random Access Memory) resources and CPU processing time, which poses a significant obstacle on microcontrollers with limited data storage space and processing capabilities. This reduces the real-time performance and efficiency of the CPU in handling other tasks, presenting a severe challenge of computational complexity in practical engineering applications.
[0003] The calculation time for cubic spline interpolation is typically 10-50ms, and the task switching overhead is 1-2ms. If cubic spline interpolation calculations for power quality data are performed frequently, it will consume a lot of CPU running time, severely reducing CPU execution efficiency. Moreover, such latency is unacceptable for power quality events that require millisecond-level response, such as voltage dips and transient interruption detection.
[0004] Existing power quality data interpolation methods and systems often rely on serial computation when performing spline interpolation using traditional CPUs. This consumes significant hardware resources and involves complex numerical calculations, especially with multiple data points and large datasets, where the computational load increases exponentially with the amount of data. This is particularly problematic when processing large amounts of power quality data in real-time, placing a heavy burden on general-purpose MCUs and often making CPU processing speed a bottleneck. Summary of the Invention
[0005] This application provides a neural network intelligent power quality data interpolation method and apparatus based on NPU acceleration, which solves the real-time problem faced in traditional CPU computing and brings significant performance improvement by integrating NPU as a hardware accelerator.
[0006] To achieve the above objectives, this application adopts the following technical solution: Firstly, a neural network-based intelligent power quality data interpolation method accelerated by an NPU is provided, including: Obtain the power quality data interpolation network model trained using the power quality training dataset; The trained power quality data interpolation network model is quantized and format-converted, and then deployed to the neural network processing unit (NPU). The collected real-time power quality data is input into the NPU to perform power quality data interpolation calculation through the power quality data interpolation network model, and the power quality data interpolation result is obtained. The interpolation result of the power quality data is output to the central processing unit (CPU).
[0007] Secondly, a neural network-based intelligent power quality data interpolation device accelerated by an NPU is provided, comprising: The acquisition module is used to acquire the power quality data interpolation network model trained using the power quality training dataset; The deployment module is used to quantize and convert the trained power quality data interpolation network model, and then deploy it to the neural network processing unit (NPU). The calculation module is used to input the collected real-time power quality data into the NPU, so as to perform power quality data interpolation calculation through the power quality data interpolation network model and obtain the power quality data interpolation result. The output module is used to output the interpolation result of the power quality data to the central processing unit (CPU).
[0008] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, an NPU, and an analog-to-digital converter (ADC), characterized in that the memory stores a computer program, and when the processor executes the computer program, it cooperates with the NPU and the ADC to implement the neural network-accelerated intelligent power quality data interpolation method as described in any one of the first aspects above.
[0009] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the NPU-accelerated neural network intelligent power quality data interpolation method as described in any one of the first aspects above.
[0010] Fifthly, embodiments of this application provide a computer program product that, when run on an electronic device, causes the electronic device to execute the NPU-accelerated neural network intelligent power quality data interpolation method described in any of the first aspects above.
[0011] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here.
[0012] In this embodiment, a power quality data interpolation network model trained on a power quality training dataset is first obtained. Then, the trained model is quantized and format-converted before being deployed to a Neural Processing Unit (NPU). Real-time power quality data is then input into the NPU to perform interpolation calculations using the interpolation network model, yielding the interpolated results. Finally, the interpolated results are output to the Central Processing Unit (CPU). Thus, the heterogeneous collaboration between the NPU and CPU improves overall system performance. The CPU primarily handles system control, data acquisition, transmission, and high-level decision-making, while the NPU, equipped with the trained interpolation network model, quickly interpolates power quality data and outputs the results to the CPU, enabling the system to efficiently execute various tasks and effectively avoiding computational resource conflicts and performance bottlenecks.
[0013] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0014] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiments below. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings: Figure 1 This is a flowchart illustrating a neural network-based intelligent power quality data interpolation method based on NPU acceleration provided in an embodiment of this application. Figure 2 This is a flowchart of the architecture of a one-dimensional convolutional neural network provided in an embodiment of this application; Figure 3 This is a structural block diagram of the NPU-accelerated neural network intelligent power quality data interpolation device provided in the embodiments of this application; Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0015] The embodiments of the technical solutions of this application will now be described in detail with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solutions of this application, and are therefore merely examples and should not be used to limit the scope of protection of this application. When the following description relates to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. Various changes, modifications, and equivalents of the methods, apparatus, and / or systems described herein will become apparent upon understanding this disclosure. For example, the order of operations described herein is merely illustrative and is not limited to those orders set forth herein, but can be changed as will become apparent upon understanding this disclosure, except for operations that must be performed in a specific order. Furthermore, for clarity and conciseness, descriptions of features known in the art may be omitted.
[0016] The embodiments described in the following examples of this disclosure are not representative of all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0017] It should be noted that existing power quality data interpolation methods and systems often rely on serial computation when performing spline interpolation on traditional CPUs. This consumes significant hardware resources and involves complex numerical calculations, especially with multiple data points and large datasets, where the computational load increases exponentially with the data volume. This is particularly problematic when processing large amounts of power quality data in real-time on general-purpose MCUs, where CPU processing speed often becomes a bottleneck. To address the real-time performance issues faced by traditional CPUs, integrating an NPU as a hardware accelerator can significantly improve performance. NPUs are primarily optimized for deep learning and large-scale matrix operations, enabling efficient parallel computation. Their advantages are particularly pronounced when dealing with tasks involving real-time processing of large amounts of power quality data.
[0018] Traditional CPU-based spline interpolation methods have inherent limitations in terms of computational complexity, real-time performance, and system resource consumption, failing to meet the requirements of modern power quality monitoring equipment for high performance, low power consumption, and deterministic response. This invention addresses the real-time issues faced by traditional CPU-based computation through a neural network-accelerated intelligent power quality data interpolation method based on an NPU (Neural Processing Unit). Integrating an NPU as a hardware accelerator significantly improves performance and greatly reduces CPU and resource consumption.
[0019] It should be noted that the execution subject of the NPU-accelerated neural network intelligent power quality data interpolation method in this embodiment can be an NPU-accelerated neural network intelligent power quality data interpolation device, hereinafter referred to as "device". This device can be configured in any type of electronic device, and this application embodiment does not limit it.
[0020] See Figure 1 This is a flowchart illustrating the NPU-accelerated neural network intelligent power quality data interpolation method provided in the first embodiment of this application. Figure 1 As shown, the NPU-accelerated neural network-based intelligent power quality data interpolation method may include the following steps: Step 101: Obtain the power quality data interpolation network model trained using the power quality training dataset.
[0021] Power quality waveform data refers to waveform signal data collected from actual electricity meter application scenarios, reflecting the power characteristics of the power system. It corely includes four key characteristics: fundamental wave (a 50Hz / 60Hz sine wave during normal power system operation), harmonics (sine waves with frequencies that are integer multiples of the fundamental wave, such as the 3rd and 5th harmonics), voltage sags (a short-lived voltage drop, typically lasting 0.5-30 cycles), and noise (random interference signals superimposed on the normal waveform). This data forms the foundational raw data for constructing the training dataset. As the prototype input sample for the power quality data interpolation network model, its multiple characteristics ensure that the trained model can adapt to the complex power quality scenarios in actual power systems, avoiding the problem of insufficient generalization ability caused by the model only being able to handle single-characteristic data.
[0022] The power quality training dataset can refer to a dataset composed of "input data - output data" pairs, used to train a power quality data interpolation network model. The input data is the original power quality waveform data, and the output data is the interpolation result obtained after processing the original data with cubic spline interpolation. The two must be correlated one-to-one.
[0023] Among them, the power quality data interpolation network model refers to a neural network model that is trained offline and has the ability to interpolate power quality data. It adopts a one-dimensional convolutional neural network structure and includes an input module, encoder, feature layer, decoder and output module.
[0024] Optionally, power quality waveform data containing fundamental, harmonic, sag, and noise characteristics are first collected. Then, cubic spline interpolation is used to interpolate the power quality waveform data according to a preset interpolation step size to obtain output data. Finally, the power quality waveform data and the output data are combined to form a power quality training dataset.
[0025] The preset interpolation step size can refer to the number of original data intervals between two adjacent interpolation points when using the cubic spline interpolation algorithm to process power quality waveform data. For example, when the interpolation step size is 5, it means that a new interpolation point is inserted every 5 original data points.
[0026] Specifically, the power quality waveform data comes from actual electricity meter application scenarios, including waveform data collected under different operating conditions (such as peak electricity consumption and equipment start-up and shutdown). For example, the data volume is not less than a preset threshold (such as 2,000 data points), and the number of sampling points for each data point is not less than a preset number (such as 6,000). Specifically, the step size for cubic spline interpolation can be determined based on the correspondence between the original data volume and the target interpolation data volume. Let the original data volume be N, and the interpolated data volume be M, then the interpolation step size h can be expressed as: h = (N-1) / (M-1) The core logic of this formula is: the total number of intervals in the original data sequence is (N-1) (e.g., 6144 data points correspond to 6143 intervals), and after interpolation, it needs to be evenly distributed into (M-1) intervals. The step size h is the ratio of the intervals of the original data to the intervals of a single interpolation interval.
[0027] For example, when the original data volume N=6144 and the target interpolation data volume M=2048, substituting into the formula yields: h = (6144-1) / (2048-1)≈3 This means that interpolation calculations are performed approximately every three original data points, ultimately generating 2048 uniformly distributed interpolated data points, which meets the data volume requirements of FFT spectral analysis. This method ensures that the interpolated data is uniformly distributed within the original data sequence, balancing interpolation accuracy with the target data volume requirement.
[0028] Specifically, a large amount of power quality waveform data is collected in actual electricity meter applications. The obtained data should include fundamental wave, harmonics, sag, noise, etc., to obtain power quality waveform data with various characteristics. Spline interpolation is used to obtain output data. The input and output data form a power quality training dataset.
[0029] For example, a large amount of power quality waveform data can be collected to obtain 3000 power quality waveform data points containing various characteristics such as fundamental frequency, harmonics, sag, and noise. Each data point contains 6144 data points. Then, cubic spline interpolation with a step size of 3 is used to obtain output data, which contains 2048 data points. The output data is used as the label for training the neural network. The input and output data form the power quality training dataset, which contains 3000 data points. The total number of input data points is 3000 * 6144 = 18,432,000 data points, which is not limited here.
[0030] Optionally, the power quality data interpolation network model adopts a one-dimensional convolutional network structure, which includes an input module, an encoder, a feature layer, a decoder, and an output module. The encoder contains at least three convolutional layers and pooling layers for feature extraction; The decoder contains at least three upsampling layers and convolutional layers for target waveform reconstruction; The feature layer forms a high-level feature representation of a predetermined dimension; The convolutional neural network uses LeakyReLU as the activation function, which is particularly suitable for processing negative fluctuations and harmonic components that may appear in power quality data. The mean squared error loss function is used for training and optimization. The LeakyReLU activation function satisfies the following: when the input value x≥0, the output value is equal to x; when x<0, the output value is equal to αx, where α ranges from 0.01 to 0.3, and is set to 0.01 in this invention.
[0031] It should be noted that the power quality data interpolation network model adopts a one-dimensional convolutional network structure, which can include several parts: an input module, an encoder, a feature layer, a decoder, and an output module. Each part contains a different number of convolutional layers and pooling layers, and each convolutional layer contains a different number of channels. The encoder extracts features through convolutional and pooling layers, the decoder reconstructs the target waveform through upsampling and convolution operations, and the feature layer forms a 256-dimensional high-level feature representation. The encoder contains at least three convolutional and pooling layers, and the decoder contains at least three upsampling and convolutional layers. The input and output layers have the same dimensions as the input and output data. For the input data... and convolution kernel The convolution operation can be represented as:
[0032] in, This represents the convolution operation. It is a bias term. is the output of the convolutional layer, and W is the weight matrix of the convolutional kernel.
[0033] The above formulas illustrate the basic way CNNs process data. When the amount of collected data is insufficient for the model's input layer requirements, preprocessing is performed to meet the input requirements. Typical data preprocessing includes padding and normalization, using zero padding to the target length.
[0034] The activation function is used to introduce non-linearity and enhance the expressive power of the model. The activation function used in this network model is LeakyReLU.
[0035] in This is the input value, where α is the negative slope coefficient (usually a small positive number between 0.01 and 0.3); when When the input is equal to the input (same as ReLU), the output is equal to the input itself. Compared to the traditional ReLU activation function, LeakyReLU maintains a small gradient in the negative range, effectively mitigating the problem of neuron death, and is suitable for handling negative fluctuations and harmonic components that may appear in power quality data.
[0036] The loss function used is the mean squared error loss function:
[0037] in, It's a real label. It is the value predicted by the model. It refers to the number of samples.
[0038] Specifically, after setting the network model parameters, the power quality dataset is divided into two groups: a training set (80%) and a validation set (20%). The network training parameters are then set, and training begins. Multiple training iterations are performed, the loss function is monitored, and training is completed. For example, the power quality dataset can be divided into two groups: a training set with 2400 data entries and a validation set with 600 data entries. The network training parameters are set as follows: batch size 32, learning rate 0.001, total training epochs 50. Training begins, multiple training iterations are performed, the loss function is monitored, and training is completed.
[0039] Figure 2 This is a flowchart of the architecture of a one-dimensional convolutional neural network (CNN), used for model building in scenarios such as power quality data interpolation. The functions of each module are as follows: Input layer: Receives raw power quality waveform data (including fundamental, harmonic, and other characteristics); The encoder consists of convolutional layers (extracting data features, such as waveform frequency and amplitude changes), pooling layers (compressing feature dimensions and retaining key information), and fully connected layers (integrating features); Feature layer: Stores high-level feature representations of the encoder output (such as 256-dimensional feature vectors).
[0040] Decoder: Consists of deconvolutional layers (to restore feature dimensions) and upsampling layers (to enlarge feature size); Output layer: Outputs the interpolated results of power quality data, matching the dimensions of the input data.
[0041] Step 102: Quantize and convert the trained power quality data interpolation network model, and then deploy it to the neural network processing unit (NPU).
[0042] Specifically, the trained power quality data interpolation network model is quantized, exported to a format supported by the NPU, and deployed on the NPU to complete the deployment of the power quality data interpolation neural network model.
[0043] Model quantization refers to the process of adjusting the accuracy of the trained power quality data interpolation network model. By converting parameters such as weights and biases in the model from high precision (such as 32-bit floating point) to low precision (such as 8-bit integer and 16-bit fixed point), the model storage volume and computational complexity are reduced while ensuring that the loss of model interpolation accuracy is controllable (such as the error rate increase does not exceed 1%). It should be noted that most NPUs are more efficient at processing low-precision data (e.g., 8-bit integer calculation is 4-8 times faster than 32-bit floating-point calculation), and the storage volume of the quantized model can be reduced by more than 70% (e.g., the volume of a 32-bit model is reduced to 1 / 4 of its original size after quantization to 8 bits), solving the problem that high-precision models cannot be deployed on resource-constrained NPUs.
[0044] Model format conversion refers to the process of converting the quantized power quality data interpolation network model from a general training format (such as Python's .h5 format or PyTorch's .pth format) to a dedicated format supported by NPU hardware (such as Huawei Ascend NPU's .om format or Horizon Robotics NPU's .bin format). During the conversion process, it is necessary to adapt to the NPU's instruction set, storage architecture, and computing unit logic to ensure that the model can be correctly parsed and executed by the NPU for inference.
[0045] The Neural Processing Unit (NPU) is a hardware acceleration unit specifically designed for processing neural network computation tasks. By integrating a large number of parallel computing cores (such as multiply-accumulate units), dedicated instruction sets (such as neural network convolution instructions), and high-speed storage interfaces, it is optimized for core neural network tasks such as matrix operations, feature extraction, and inference computation. Compared with the CPU, it can complete computations with lower power consumption and higher speed.
[0046] Step 103: Input the collected real-time power quality data into the NPU to perform power quality data interpolation calculation through the power quality data interpolation network model and obtain the power quality data interpolation result.
[0047] Specifically, after the network model is deployed, online interpolation calculation of power quality data can be performed. The CPU transmits the data collected by the ADC to the NPU, starts the neural network model already deployed in the NPU to perform real-time interpolation calculation, and outputs the power quality data interpolation result to the CPU for subsequent operations after the model completes inference.
[0048] Specifically, power quality monitoring equipment (such as smart meters and ADCs) can collect power system waveform data in real time at a frequency of 50Hz / 60Hz to obtain real-time power quality data including fundamental amplitude, harmonic components, voltage sag, and noise. Then, the collected data is zero-padding and normalized to ensure the data format matches the input requirements of the NPU deployment model. The preprocessed real-time power quality data is then transmitted to the NPU's input buffer. The NPU then loads the deployed power quality data interpolation network model and reads the real-time data from the input buffer. Leveraging the NPU's parallel computing cores, including its multiply-accumulate units and dedicated convolution instructions, matrix operations and convolution are executed rapidly without consuming CPU resources. Inference time is controlled within 2-5ms, meeting millisecond-level response requirements. After NPU inference is complete, waveform data matching the dimensions of the input data is generated. This result fills in missing points in the original data, increases sampling density, and maintains controllable accuracy loss. Step 104: Output the power quality data interpolation results to the central processing unit (CPU).
[0049] Specifically, the interpolation results can be transmitted to a designated storage area of the CPU through the communication interface between the NPU and the CPU (such as through interrupt signal triggering), so that the CPU can perform tasks such as FFT spectrum analysis and fault diagnosis. Optionally, the CPU and NPU interact through a preset communication interface; the NPU triggers the CPU to extract the interpolation results through an interrupt signal, and the NPU independently occupies dedicated storage resources during the inference process, without occupying the CPU's SRAM resources.
[0050] Optionally, during the NPU's power quality data interpolation inference process, the CPU executes non-interpolation-related tasks in parallel. These non-interpolation-related tasks include real-time power quality data acquisition and control, ADC module parameter configuration, and storage management of historical interpolation results.
[0051] Optionally, the CPU can be used to call the Fast Fourier Transform algorithm to perform spectrum analysis on the interpolation results of power quality data, so as to obtain the fundamental frequency, harmonic content and amplitude information of real-time power quality data.
[0052] It should be noted that the CPU transmits the real-time power quality data (including fundamental and harmonic characteristics) acquired by the ADC to the NPU, launching the deployed neural network model. The NPU independently performs interpolation inference, quickly completing data interpolation through a parallel computing core, without consuming CPU or CPU SRAM resources. The NPU triggers the CPU via a preset communication interface (such as an interrupt signal) to transmit the interpolation results to a designated storage area on the CPU for subsequent processing. While the NPU is performing inference, the CPU does not need to wait and can process non-interpolation tasks in parallel (such as real-time data acquisition and control, ADC parameter configuration, and historical result storage), improving system resource utilization. The NPU uses dedicated storage resources independently during inference, avoiding contention for SRAM with the CPU and ensuring that their operations do not interfere with each other. After completing inference, the NPU actively notifies the CPU to retrieve the results via an interrupt signal, avoiding CPU polling and reducing latency. After the CPU obtains the interpolation results, it calls the FFT algorithm to perform spectrum analysis, which can obtain key power quality parameters such as fundamental frequency, harmonic content, and amplitude, providing data support for fault diagnosis.
[0053] In this embodiment, a power quality data interpolation network model trained on a power quality training dataset is first obtained. Then, the trained model is quantized and format-converted before being deployed to a Neural Processing Unit (NPU). Real-time power quality data is then input into the NPU to perform interpolation calculations using the interpolation network model, yielding the interpolated results. Finally, the interpolated results are output to the Central Processing Unit (CPU). Thus, the heterogeneous collaboration between the NPU and CPU improves overall system performance. The CPU primarily handles system control, data acquisition, transmission, and high-level decision-making, while the NPU, equipped with the trained interpolation network model, quickly interpolates power quality data and outputs the results to the CPU, enabling the system to efficiently execute various tasks and effectively avoiding computational resource conflicts and performance bottlenecks. Using CNN neural network training for power quality data interpolation and deploying the network on an NPU for acceleration, through parallel computing and a dedicated neural network instruction set, not only can computational efficiency be improved and CPU processing time reduced, but CPU resources can also be effectively released. This ensures that the entire system can remain efficient and stable during multi-task execution, improves the real-time performance of power quality data analysis, and has broad application prospects.
[0054] Corresponding to the NPU-accelerated neural network intelligent power quality data interpolation method described in the above embodiments, Figure 3 This is a structural block diagram of the neural network-based intelligent power quality data interpolation device based on NPU acceleration provided in the embodiments of this application.
[0055] Reference Figure 3 The NPU-accelerated neural network intelligent power quality data interpolation device 200 includes: The acquisition module 210 is used to acquire the power quality data interpolation network model trained through the power quality training dataset; The deployment module 220 is used to quantize and convert the trained power quality data interpolation network model, and then deploy it to the neural network processing unit (NPU). The calculation module 230 is used to input the collected real-time power quality data into the NPU, so as to perform power quality data interpolation calculation through the power quality data interpolation network model and obtain the power quality data interpolation result. Output module 240 is used to output the power quality data interpolation result to the central processing unit (CPU).
[0056] Optionally, the CPU and the NPU interact through a preset communication interface; the NPU triggers the CPU to extract interpolation results through an interrupt signal, and the NPU independently occupies dedicated storage resources during inference, without occupying the CPU's SRAM resources.
[0057] Optionally, during the process of the NPU performing power quality data interpolation inference, the CPU executes non-interpolation-related tasks in parallel, including real-time power quality data acquisition and control, ADC module parameter configuration, and storage management of historical interpolation results.
[0058] Optionally, the acquisition module 210 is further configured to: Collect power quality waveform data including fundamental frequency, harmonics, sag, and noise characteristics; Cubic spline interpolation is used to interpolate the power quality waveform data according to a preset interpolation step size to obtain the output data. The power quality waveform data and the output data are combined to form the power quality training dataset.
[0059] Optionally, the power quality data interpolation network model adopts a one-dimensional convolutional network structure, which includes an input module, an encoder, a feature layer, a decoder, and an output module. The encoder contains at least three convolutional layers and pooling layers for feature extraction; The decoder contains at least three upsampling layers and convolutional layers for target waveform reconstruction; The feature layer forms a high-level feature representation of a preset dimension; The convolutional neural network uses LeakyReLU as the activation function and is trained and optimized using the mean squared error loss function. The LeakyReLU activation function satisfies the following conditions: when the input value x≥0, the output value is equal to x; when x<0, the output value is equal to αx, where α ranges from 0.01 to 0.3.
[0060] Optionally, the output module 240 is also used for: Based on the CPU, the Fast Fourier Transform algorithm is invoked to perform spectral analysis on the interpolation results of the power quality data, thereby obtaining the fundamental frequency, harmonic content, and amplitude information of the real-time power quality data.
[0061] In this embodiment, a power quality data interpolation network model trained on a power quality training dataset is first obtained. Then, the trained model is quantized and format-converted before being deployed to a Neural Processing Unit (NPU). Real-time power quality data is then input into the NPU to perform interpolation calculations using the interpolation network model, yielding the interpolated results. Finally, the interpolated results are output to the Central Processing Unit (CPU). Thus, the heterogeneous collaboration between the NPU and CPU improves overall system performance. The CPU primarily handles system control, data acquisition, transmission, and high-level decision-making, while the NPU, equipped with the trained interpolation network model, quickly interpolates power quality data and outputs the results to the CPU, enabling the system to efficiently execute various tasks and effectively avoiding computational resource conflicts and performance bottlenecks.
[0062] in addition, Figure 3 The NPU-accelerated neural network intelligent power quality data interpolation device shown can be a software unit, hardware unit, or a combination of software and hardware built into existing electronic devices. It can also be integrated into the electronic device as an independent component or exist as an independent electronic device.
[0063] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0064] In this embodiment, the electronic devices used for the CPU and NPU are as follows: Figure 4 As shown. In practical applications, the NPU power quality data interpolation calculation time in this invention is T_NPU≈2-5ms, while the traditional spline interpolation calculation time is T_CPUinterpolation≈15-50ms, representing a performance improvement of 5-25 times. The NPU's energy efficiency ratio is far higher than that of the CPU, reducing overall system power consumption by 30-60%, and it does not occupy CPU or other resources. It also boasts high accuracy, good real-time performance, and excellent energy efficiency. This invention can process heavy loads in real time on a general-purpose MCU, reducing CPU and resource consumption, improving the real-time performance and efficiency of power quality data analysis, and increasing interpolation accuracy. Figure 4 As shown, the device consists of memory (ROM and RAM), CPU, NPU, etc. The C code program used is stored in the program memory. ROM is used to store programs, tables, and constants that must always be retained; in a microcontroller, it is called program memory. RAM (divided into SRAM and DRAM) is usually used to store data (constants or variables) or calculation results required during program execution; in a microcontroller, it is called data memory. NPU stands for Neural Processing Unit, used to deploy the trained power quality data interpolation neural network model. In this embodiment, SRAM is used for RAM.
[0065] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the steps in the above-described method embodiments.
[0066] This application provides a computer program product that, when run on an electronic device, enables the electronic device to implement the steps described in the various method embodiments above.
[0067] If the integrated unit is implemented as a software functional unit and used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a device / electronic device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks.
[0068] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0069] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0070] In the embodiments provided in this application, it should be understood that the disclosed devices / electronic devices and methods can be implemented in other ways. For example, the device / electronic device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings or direct couplings or communication connections may be through some interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0071] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0072] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings are intended to cover non-exclusive inclusion.
[0073] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly defined.
[0074] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0075] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.
[0076] In the description of the embodiments of this application, the term "multiple" refers to two or more (including two), similarly, "multiple sets" refers to two or more (including two sets), and "multiple pieces" refers to two or more (including two pieces).
[0077] In the description of the embodiments of this application, the technical terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," "counterclockwise," "axial," "radial," and "circumferential" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing the embodiments of this application and simplifying the description, and are not intended to indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the embodiments of this application.
[0078] In the description of the embodiments of this application, unless otherwise expressly specified and limited, technical terms such as "installation," "connection," "joining," and "fixing" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. For those skilled in the art, the specific meaning of the above terms in the embodiments of this application can be understood according to the specific circumstances.
[0079] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A neural network-based intelligent power quality data interpolation method based on NPU acceleration, characterized in that, Includes the following steps: Obtain the power quality data interpolation network model trained using the power quality training dataset; The trained power quality data interpolation network model is quantized and format-converted, and then deployed to the neural network processing unit (NPU). The collected real-time power quality data is input into the NPU to perform power quality data interpolation calculation through the power quality data interpolation network model, and the power quality data interpolation result is obtained. The interpolation result of the power quality data is output to the central processing unit (CPU).
2. The method according to claim 1, characterized in that, in, The CPU and the NPU interact through a preset communication interface; the NPU triggers the CPU to extract interpolation results through an interrupt signal, and the NPU independently occupies dedicated storage resources during inference, without occupying the CPU's SRAM resources.
3. The method according to claim 1, characterized in that, in, During the NPU's power quality data interpolation inference process, the CPU executes non-interpolation-related tasks in parallel. These non-interpolation-related tasks include real-time power quality data acquisition and control, ADC module parameter configuration, and storage management of historical interpolation results.
4. The method according to claim 1, characterized in that, Before obtaining the power quality data interpolation network model trained using the power quality training dataset, the method further includes: Collect power quality waveform data including fundamental frequency, harmonics, sag, and noise characteristics; Cubic spline interpolation is used to interpolate the power quality waveform data according to a preset interpolation step size to obtain the output data. The power quality waveform data and the output data are combined to form the power quality training dataset.
5. The method according to claim 1, characterized in that, The power quality data interpolation network model adopts a one-dimensional convolutional network structure, which includes an input module, an encoder, a feature layer, a decoder, and an output module. The encoder contains at least three convolutional layers and pooling layers for feature extraction; The decoder contains at least three upsampling layers and convolutional layers for target waveform reconstruction; The feature layer forms a high-level feature representation of a preset dimension; The convolutional neural network uses LeakyReLU as the activation function and is trained and optimized using the mean squared error loss function. The LeakyReLU activation function satisfies the following conditions: when the input value x≥0, the output value is equal to x; when x<0, the output value is equal to αx, where α ranges from 0.01 to 0.
3.
6. The method according to claim 1, characterized in that, After outputting the power quality data interpolation result to the central processing unit (CPU), the method further includes: Based on the CPU, the Fast Fourier Transform algorithm is invoked to perform spectral analysis on the interpolation results of the power quality data, thereby obtaining the fundamental frequency, harmonic content, and amplitude information of the real-time power quality data.
7. A neural network-based intelligent power quality data interpolation device accelerated by an NPU, characterized in that, include: The acquisition module is used to acquire the power quality data interpolation network model trained using the power quality training dataset; The deployment module is used to quantize and convert the trained power quality data interpolation network model, and then deploy it to the neural network processing unit (NPU). The calculation module is used to input the collected real-time power quality data into the NPU, so as to perform power quality data interpolation calculation through the power quality data interpolation network model and obtain the power quality data interpolation result. The output module is used to output the interpolation result of the power quality data to the central processing unit (CPU).
8. The apparatus according to claim 7, characterized in that, The CPU and the NPU interact through a preset communication interface; the NPU triggers the CPU to extract interpolation results through an interrupt signal, and the NPU independently occupies dedicated storage resources during inference, without occupying the CPU's SRAM resources.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the NPU-accelerated neural network intelligent power quality data interpolation method as described in any one of claims 1-6.
10. An electronic device comprising a memory, a processor, an NPU, and an analog-to-digital converter (ADC), characterized in that, The memory stores a computer program, and when the processor executes the computer program, it works with the NPU and the ADC to implement the steps of the NPU-accelerated neural network intelligent power quality data interpolation method as described in any one of claims 1-6.