Intelligent power analysis and harmonic detection method based on load voltage and current signals
By combining FFT and small sample neural networks, using phase-locked loops and generation and adversarial neural network technology, the problem of insufficient harmonic analysis accuracy and adaptability in the existing technology is solved, and high-precision and efficient harmonic detection effects are achieved.
Patent Information
- Application Number
- CN202510181241.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-19
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2045-02-19
AI Technical Summary
The prior art has problems in harmonic analysis with large data demand, long processing time and poor model adaptability, especially in complex electrical loads and variable environmental conditions, which are difficult to ensure high-precision detection results.
Combining fast Fourier transform (FFT) and small sample neural networks, load signals are collected through resistive-capacitance voltage division and resistive sampling, phase-locked loop technology is used to ensure the consistency of signal frequency and phase, and the neural network training is optimized by generating an adversarial neural network extension training set, and adaptive learning rate adjustment strategy is used to optimize neural network training.
It significantly improves the accuracy and adaptability of harmonic analysis, and can perform efficient power analysis and harmonic detection under small sample conditions, expanding the application scenarios of the analyzer.
Smart Images

Figure CN119916077A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of harmonic analysis, and in particular relates to an intelligent power analysis and harmonic detection method based on load voltage and current signals. Background Art
[0002] After decades of rapid development, power electronics technology has made rapid progress in modern industry and widely used consumer electronics, which has led to increasingly serious harmonic pollution in power systems. Harmonics will affect the normal operation efficiency of power equipment, increase the loss of power systems, and have the possibility of causing equipment failures. Therefore, accurate analysis and monitoring of harmonics are particularly important in the current environment. In the field of harmonic detection, power analyzers are widely used because they can accurately measure current, voltage, and power factor.
[0003] At present, domestic high-precision power analysis generally uses classic algorithms such as Fourier transform (FFT) to sample the input signal, convert the time domain signal into frequency domain representation, and extract relevant information of the harmonic components through spectrum analysis. However, although fast Fourier transform (FFT) is widely used in harmonic analysis, these methods have significant limitations in data demand, processing time and model adaptability, especially when facing complex electrical loads and changing environmental conditions, it is difficult to guarantee high-precision detection results. To address these problems, machine learning and deep learning technologies have gradually been applied to harmonic analysis. With its powerful data processing capabilities and nonlinear mapping characteristics, neural networks can effectively make up for the shortcomings of traditional algorithms, improve the accuracy and adaptability of harmonic analysis, and provide new solutions for high-precision power analysis.
[0004] In conventional neural network methods, a large number of training data samples are required to train the model. However, in practical applications, load harmonic sample data is extremely scarce, especially sample data for specific load parameters is even more difficult to obtain. Therefore, small sample learning gradually shows its application advantages in this scenario. Under the condition of scarce data samples, small sample neural network can use a small amount of training data for more accurate output. It has the characteristics of high efficiency, low cost, and strong feasibility, and provides a new intelligent solution for harmonic analysis.
[0005] The present invention is based on the analysis of the harmonic components of the input signal by fast Fourier transform (FFT), through the construction of a small sample neural network as the core method, the voltage and current in the load input signal are collected by using resistor-capacitor voltage division and resistor sampling, and the signal is adjusted to the appropriate input range of the ADC to achieve quantization by combining differential amplification and program-controlled gain amplification technology. At the same time, the frequency and phase of the output signal are ensured to be consistent with the input signal through the phase-locked loop technology, thereby further improving the analysis accuracy. The method can accurately analyze the harmonic characteristics of different types of loads (such as resistors, inductors, capacitors, etc.) under different process parameter conditions, and train the neural network model for the data set under small sample conditions. On the basis of existing data, a generation adversarial neural network is used to generate a variety of power analysis value samples to expand the training set, so as to train the neural network, monitor the loss function during the training process, so that the change of the learning rate is determined according to the loss function, and the efficiency and stability of the model training are improved. Summary of the invention
[0006] In view of the above problems existing in the prior art, the present invention proposes an intelligent power analysis and harmonic detection method based on load voltage and current signals, which has a reasonable design, solves the shortcomings of the prior art and has good effects.
[0007] An intelligent power analysis and harmonic detection method based on load voltage and current signals comprises the following steps:
[0008] Step 1: Collect the voltage signal and current signal of the load to be measured through the sensor;
[0009] Step 2: Process the collected signal, adjust it to the appropriate input range of the ADC, and use the ADC to convert the analog signal into a digital signal;
[0010] Step 3: Use a phase-locked loop circuit to perform frequency following processing on the digital signal, so that the output signal of the phase-locked loop circuit is consistent with the input signal in frequency and phase;
[0011] Step 4: Construct a BP neural network model and adopt an adaptive learning rate adjustment strategy to optimize the network training process;
[0012] Step 5: After FFT processing, the output signal of step 3 is input into the trained BP neural network model for power analysis and harmonic detection.
[0013] Furthermore, in step 1, the voltage and current signals of the load are collected using the resistor-capacitor voltage division method and the resistor sampling method respectively; in the resistor-capacitor voltage division method, the attenuation coefficient of the resistor-capacitor voltage division network is approximately equal to the ratio of the voltage division resistors R1 and R2 at low frequencies; at high frequencies, the resistor-capacitor parallel connection method is used to offset the influence of the parasitic capacitance of the resistor itself and the parasitic capacitance generated by the PCB layout; R1C1=R2C2 is made to eliminate the influence of the frequency on the voltage division, and C1 and C2 are frequency compensation capacitors.
[0014] Furthermore, in step 3, a phase-locked loop circuit is used to perform frequency tracking on the collected signal. The input signal, output signal and phase comparator are first initialized. The phase difference between the reference signal and the output signal of the voltage-controlled oscillator VCO is compared by the phase comparator. The error signal is smoothed out by a low-pass filter. The frequency of the voltage-controlled oscillator VCO is adjusted, and then the output signal and the reference signal are compared again. In this process, the phase-locked loop continuously adjusts the frequency and phase of the output signal to be consistent with the input signal, thereby achieving accurate tracking of the frequency of the input signal.
[0015] Furthermore, step 4 includes the following sub-steps:
[0016] Step 4.1: Build the dataset;
[0017] Step 4.2: Use a generative adversarial network to expand and enhance the data set to obtain a training set;
[0018] Step 4.3: Build a BP neural network model;
[0019] Step 4.4: Use the training set to train the BP neural network model, and use the loss function to back-propagate and update the model parameters according to the improved Adam algorithm.
[0020] Furthermore, in step 4.1, for different load types, by changing the electrical parameters of each load and the manufacturing process of the load, a variety of actual usage scenarios are simulated, the load types include resistance, capacitance and inductance, the electrical parameters include resistance value, capacitance value and inductance value, the manufacturing process includes material properties and geometric shape, and each load is respectively subjected to 1000 current and voltage acquisitions;
[0021] The collected data were processed by FFT to calculate 3000 sets of data, each set of which included 15 measured values, including voltage value, current value, active power value, power factor, current harmonic coefficient THD, and effective value of current fundamental wave and its 2nd to 10th harmonic components; in addition, 3000 sets of actual data were manually calculated under the same conditions, each set of which included 15 data values, including voltage value, current value, active power value, power factor, current harmonic coefficient THD, and effective value of current fundamental wave and its 2nd to 10th harmonic components, as target values;
[0022] The measured values and target values are standardized so that the mean of each feature is 0 and the standard deviation is 1, and then reshaped into a two-dimensional matrix to construct a data set.
[0023] Furthermore, in step 4.3, the BP neural network model includes an input layer, l hidden layers and an output layer, each hidden layer includes multiple neurons, the activation function of the neuron is the Relu function, the activation function of the output layer adopts the Softmax activation function, and the loss function adopts the mean square error loss function, and the input of the input layer is equal to the activation value, that is:
[0024] z (1) =a (1) =x (1) ;
[0025] z (i+1) =w (i) a (i) +b (i) ;
[0026] a (i+1) =f(z (i+1) );
[0027] Among them, x (1) is the input layer’s input, a (1) is the output of the input layer, z (1) is the linear combination of the input layer, that is, the weighted sum of the inputs of each neuron; (i+1) is the linear combination of the i+1th hidden layer, w (i) is the weight matrix of the i-th hidden layer, a (i) is the output of the i-th hidden layer, i.e., the activation value, b (i) is the bias term of the i-th hidden layer, f(z (i+1) ) is the activation function of the i+1th layer, i=1,…,l-1.
[0028] Furthermore, in step 4.4, the model parameter update expression is:
[0029]
[0030] In the formula, θt+1 is the model parameter for the next time step, θ t is the model parameter of the current time step, α is the learning rate; ε is the minimum value to prevent division by zero, which is 10 -8 ; is the first-order moment estimate of the corrected time step t, is the second-order moment estimate of the corrected time step t;
[0031] Design a segmented learning rate method. Before the loss function reaches the set threshold, it means that the distance from the objective function is far away. At this time, the maximum learning rate α is maintained. max , after the loss function reaches the set threshold, it means that it is close to the optimal solution, and the learning rate is exponentially decayed by the loss function. The expression is:
[0032]
[0033] In the formula, loss is the current loss error, loss set is the segment loss error threshold set, loss min is the minimum value of the current loss function.
[0034] Beneficial technical effects brought by the present invention:
[0035] The present invention combines neural networks with fast Fourier transform (FFT) for the first time to achieve compensation for circuit power harmonic analysis errors, significantly improving the accuracy of harmonic analysis. In particular, in view of the characteristics of small sample neural networks, the present invention innovatively adopts an adaptive learning rate adjustment strategy to optimize the network training process and avoid the limitations of traditional methods that rely on large amounts of data. Through this innovation, not only the accuracy of the power analyzer in load input signal harmonic detection is improved, but also the adaptability and practicality of the model under complex and changeable load conditions are enhanced, greatly expanding its application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 It is a schematic diagram of an ideal resistor-capacitor voltage division model in the present invention;
[0037] Figure 2 This is a schematic diagram of the BP neural network model in the present invention;
[0038] Figure 3 It is a flow chart of parameter update of the improved ADAM algorithm in the present invention;
[0039] Figure 4 The improved ADAM algorithm in the present invention optimizes the BP neural network flow chart; DETAILED DESCRIPTION
[0040] The specific implementation of the present invention is further described below in conjunction with specific embodiments:
[0041] An intelligent power analysis and harmonic detection method based on load voltage and current signals comprises the following steps:
[0042] Step 1: Collect the voltage signal and current signal of the load to be measured through the sensor;
[0043] Step 2: Process the collected signal, adjust it to the appropriate input range of the ADC, and use the ADC to convert the analog signal into a digital signal;
[0044] Step 3: Use a phase-locked loop circuit to perform frequency following processing on the digital signal, so that the output signal of the phase-locked loop circuit is consistent with the input signal in frequency and phase;
[0045] Step 4: Build a BP neural network model and train it;
[0046] Step 5: After FFT processing, the output signal of step 3 is input into the trained BP neural network model for power analysis and harmonic detection.
[0047] Specifically, in step 1, the voltage and current signals of the load are collected using the resistance-capacitance voltage division method and the resistance sampling method respectively; Figure 1 As shown in the figure, in the RC voltage divider method, the attenuation coefficient of the RC voltage divider network is approximately equal to the ratio of the voltage divider resistors R1 and R2 at low frequencies; at high frequencies, the RC parallel connection is used to offset the influence of the parasitic capacitance of the resistor itself and the parasitic capacitance generated by the PCB layout. According to the transfer function of the RC voltage divider model:
[0048]
[0049] Make R1C1=R2C2 to eliminate the effect of frequency on voltage division. C1 and C2 are frequency compensation capacitors.
[0050] In step 3, a phase-locked loop circuit is used to track the frequency of the collected signal. The input signal, output signal and phase comparator are initialized first. The phase difference between the reference signal and the output signal of the voltage-controlled oscillator VCO is compared through the phase comparator. The error signal is smoothed out using a low-pass filter. The frequency of the voltage-controlled oscillator VCO is adjusted, and then the output signal and the reference signal are compared again. In this process, the phase-locked loop continuously adjusts the frequency and phase of the output signal to keep consistent with the input signal, thereby achieving accurate tracking of the input signal frequency.
[0051] Step 4 includes the following sub-steps:
[0052] Step 4.1: Build the dataset;
[0053] For different types of loads, by changing the electrical parameters of each load and the manufacturing process of the load, a variety of actual use scenarios are simulated. The load types include resistance, capacitance and inductance. The electrical parameters include resistance value, capacitance value and inductance value. The manufacturing process includes material properties and geometric shape. To simulate a variety of actual use scenarios, each load is respectively collected 1000 times of current and voltage;
[0054] The collected data were processed by FFT to calculate 3000 sets of data, each set of which included 15 measured values, including voltage value, current value, active power value, power factor, current harmonic coefficient THD, and effective value of current fundamental wave and its 2nd to 10th harmonic components; in addition, 3000 sets of actual data were manually calculated under the same conditions, each set of which included 15 data values, including voltage value, current value, active power value, power factor, current harmonic coefficient THD, and effective value of current fundamental wave and its 2nd to 10th harmonic components, as target values;
[0055] The measured values and target values are standardized so that the mean of each feature is 0 and the standard deviation is 1, and then reshaped into a two-dimensional matrix to construct a data set.
[0056] Step 4.2: Use a generative adversarial network to expand and enhance the data set to obtain a training set;
[0057] The minimum multiplication loss function is used to train the generative adversarial network GAN. A z (random noise vector) is input into the generator, so that it outputs 15 continuous values with a size of 15, and then inputs it into the discriminator. The discriminator adopts a fully connected network structure. After the 15 continuous values enter the input layer, they are processed by the hidden layer and a probability value is output in the output layer to indicate whether the sample can be used as real data.
[0058] Step 4.3: Build a BP neural network model;
[0059] like Figure 2 As shown in the figure, the BP neural network model includes an input layer, l hidden layers and an output layer. Each hidden layer includes multiple neurons. The activation function of the neuron is the Relu function. The activation function of the output layer uses the Softmax activation function. The loss function uses the mean square error loss function. The input of the input layer is equal to the activation value, that is:
[0060] z (1) =a (1) =x (1) ;
[0061] z (i+1) =w (i) a (i) +b (i) ;
[0062] a (i+1) =f(z (i+1) );
[0063] Among them, x (1) is the input layer’s input, a (1) is the output of the input layer, z (1) is the linear combination of the input layer, that is, the weighted sum of the inputs of each neuron; (i+1) is the linear combination of the i+1th hidden layer, w (i) is the weight matrix of the i-th hidden layer, a (i) is the output of the i-th hidden layer, i.e., the activation value, b (i) is the bias term of the i-th hidden layer, f(z (i+1) ) is the activation function of the i+1th layer, i=1,…,l-1.
[0064] The Relu function expression is:
[0065] f(x)=max(0,x);
[0066] When the input x is a positive number, the Relu output is x;
[0067] When the input x is negative, the Relu output is 0.
[0068] The Softmax activation function expression is:
[0069]
[0070] Where: z i is the original score of the ith category (the linear output of the neural network, i.e., the original output without the activation function); e zi It is z i The result of performing an exponential operation; It is the sum of the exponential operation results of all categories, which is used to normalize so that the sum of the probabilities of all outputs is 1;
[0071] The mean square error loss function expression is:
[0072]
[0073] Where: is the model's response to input x i The predicted value, y i is the actual target value (label), and N is the number of samples in the dataset.
[0074] Step 4.4: Use the training set to train the BP neural network model. According to the Adam algorithm, use the loss function to back propagate and update the model parameters, such as Figure 3 and Figure 4 shown.
[0075] First, calculate the gradient g t , the expression is:
[0076]
[0077] Among them, θ t-1 is the model parameter corresponding to time step t-1, is the model parameter gradient, f t is the optimization objective function at time step t;
[0078] The first-order momentum is calculated for each parameter, including weights and biases, and the expression is:
[0079] m t =β1m t-1 +(1-β1)g t ;
[0080] The second-order momentum is calculated for each parameter using the expression:
[0081] v t =β2v t-1 +(1-β2)(g t ) 2 ;
[0082] In the formula, m t is the first-order moment estimate at time step t, v t is the second-order moment estimate of time step t, β1 is the first-order momentum decay rate, which is taken as 0.9; β2 is the second-order momentum decay rate, which is taken as 0.999;
[0083] The deviation correction expression is:
[0084]
[0085] In the formula, is the first-order moment estimate of the corrected time step t, is the power of the decay factor β1 at time step t, is the second-order moment estimate of the corrected time step t, is the power of the decay factor β2 in t steps;
[0086] The final model parameter update expression is:
[0087]
[0088] In the formula, θ t+1 is the model parameter for the next time step, θ t is the model parameter of the current time step, α is the learning rate; ε is the minimum value to prevent division by zero, which is 10 -8;
[0089] During the neural network training process, a fixed learning rate may cause the optimization to stay at a local optimal point and be unable to escape. If the learning rate is too small, the weight update is insufficient and it is easy to fall into the local optimal solution; if the learning rate is too large, it will not be able to stably converge to the optimal solution.
[0090] To solve the above problems, a segmented learning rate method is designed. Before the loss function reaches the set threshold, it means that the distance from the target function is far away. At this time, the maximum learning rate α is maintained. max , enjoy the high-speed search efficiency of the ADAM algorithm; after the loss function reaches the set threshold, it means that it is close to the optimal solution, and the learning rate is exponentially decayed to avoid oscillation or skipping the optimal point, which is conducive to the late convergence of the model. When the error reaches the expected value, the predicted value of the neural network is output. The expression is:
[0091]
[0092] In the formula, loss is the current loss error, loss set is the segment loss error threshold set, loss min is the minimum value of the current loss function.
[0093] When the loss function value reaches loss set When the learning rate needs to be fine-tuned, loss set Smaller, making Smaller, It shows exponential growth, the learning rate gradually decreases, and the optimization accuracy of the model is improved.
[0094] The maximum learning rate is set to 0.001, and the segment loss function threshold loss set is 0.2.
[0095] If the loss function value is less than or equal to the expected loss function value, that is, loss≤loss 期望 , the training ends.
[0096] The test results of some embodiments are shown in Tables 1 to 3. It can be seen that after the neural network compensation processing, the error value of the measurement data is further reduced, which effectively improves the accuracy of the measurement.
[0097] Table 1 Voltage comparison test results
[0098]
[0099] Table 2 Current comparison test results
[0100]
[0101] Table 3 Partial test results of current total harmonic coefficient (THD)
[0102]
[0103] Of course, the above description is not a limitation of the present invention, and the present invention is not limited to the above examples. Changes, modifications, additions or substitutions made by technicians in this technical field within the essential scope of the present invention should also fall within the protection scope of the present invention.
Claims
1. An intelligent power analysis and harmonic detection method based on load voltage and current signals, characterized in that: The following steps are involved: Step 1: Collect the voltage signal and current signal of the load to be measured through the sensor; Step 2: Process the collected signal, adjust it to the appropriate input range of the ADC, and use the ADC to convert the analog signal into a digital signal; Step 3: Use a phase-locked loop circuit to perform frequency following processing on the digital signal, so that the output signal of the phase-locked loop circuit is consistent with the input signal in frequency and phase; Step 4: Construct a BP neural network model and adopt an adaptive learning rate adjustment strategy to optimize the network training process; Step 5: After FFT processing, the output signal of step 3 is input into the trained BP neural network model for power analysis and harmonic detection.
2. The intelligent power analysis and harmonic detection method based on load voltage and current signals according to claim 1 is characterized in that: In the step 1, the voltage and current signals of the load are collected by using the resistor-capacitor voltage division method and the resistor sampling method respectively; in the resistor-capacitor voltage division method, the attenuation coefficient of the resistor-capacitor voltage division network is approximately equal to the ratio of the voltage division resistors R1 and R2 at low frequencies; at high frequencies, the resistor-capacitor parallel connection method is used to offset the influence of the parasitic capacitance of the resistor itself and the parasitic capacitance generated by the PCB layout; R1C1=R2C2 is made to eliminate the influence of the frequency on the voltage division, and C1 and C2 are frequency compensation capacitors.
3. The intelligent power analysis and harmonic detection method based on load voltage and current signals according to claim 2 is characterized in that: In step 3, a phase-locked loop circuit is used to track the frequency of the collected signal. The input signal, output signal and phase comparator are first initialized. The phase difference between the reference signal and the output signal of the voltage-controlled oscillator VCO is compared by the phase comparator. The error signal is smoothed out by a low-pass filter. The frequency of the voltage-controlled oscillator VCO is adjusted, and then the output signal and the reference signal are compared again. In this process, the phase-locked loop continuously adjusts the frequency and phase of the output signal to keep consistent with the input signal, thereby achieving accurate tracking of the input signal frequency.
4. The intelligent power analysis and harmonic detection method based on load voltage and current signals according to claim 3 is characterized in that: The step 4 includes the following sub-steps: Step 4.1: Build the dataset; Step 4.2: Use a generative adversarial network to expand and enhance the data set to obtain a training set; Step 4.3: Build a BP neural network model; Step 4.4: Use the training set to train the BP neural network model, and use the loss function to back-propagate and update the model parameters according to the improved Adam algorithm.
5. The intelligent power analysis and harmonic detection method based on load voltage and current signals according to claim 4 is characterized in that: In step 4.1, for different load types, by changing the electrical parameters of each load and the manufacturing process of the load, a variety of actual usage scenarios are simulated. The load types include resistance, capacitance and inductance. The electrical parameters include resistance value, capacitance value and inductance value. The manufacturing process includes material properties and geometric shape. Each load is respectively subjected to 1000 current and voltage acquisitions. The collected data were processed by FFT to calculate 3000 sets of data, each set of which included 15 measured values, including voltage value, current value, active power value, power factor, current harmonic coefficient THD, and effective value of current fundamental wave and its 2nd to 10th harmonic components; in addition, 3000 sets of actual data were manually calculated under the same conditions, each set of which included 15 data values, including voltage value, current value, active power value, power factor, current harmonic coefficient THD, and effective value of current fundamental wave and its 2nd to 10th harmonic components, as target values; The measured values and target values are standardized so that the mean of each feature is 0 and the standard deviation is 1, and then reshaped into a two-dimensional matrix to construct a data set.
6. The intelligent power analysis and harmonic detection method based on load voltage and current signals according to claim 5 is characterized in that: In step 4.3, the BP neural network model includes an input layer, l hidden layers and an output layer, each hidden layer includes multiple neurons, the activation function of the neurons is the Relu function, the activation function of the output layer uses the Softmax activation function, and the loss function uses the mean square error loss function. The input of the input layer is equal to the activation value, that is: z (1) =a (1) =x (1) ; z (i+1) =w (i) a (i) +b (i) ; a (i+1) =f(z (i+1) ); Among them, x (1) is the input layer’s input, a (1) is the output of the input layer, z (1) is the linear combination of the input layer, that is, the weighted sum of the inputs of each neuron; (i+1) is the linear combination of the i+1th hidden layer, w (i) is the weight matrix of the i-th hidden layer, a (i) is the output of the i-th hidden layer, i.e., the activation value, b (i) is the bias term of the i-th hidden layer, f(z (i+1) ) is the activation function of the i+1th layer, i=1,…,l-1.
7. The intelligent power analysis and harmonic detection method based on load voltage and current signals according to claim 6 is characterized in that: In step 4.4, the model parameter update expression is: In the formula, θ t+1 is the model parameter for the next time step, θ t is the model parameter of the current time step, α is the learning rate; ε is the minimum value to prevent division by zero, which is 10 -8 ; is the first-order moment estimate of the corrected time step t, is the second-order moment estimate of the corrected time step t; Design a segmented learning rate method. Before the loss function reaches the set threshold, it means that the distance from the objective function is far away. At this time, the maximum learning rate α is maintained. max , after the loss function reaches the set threshold, it means that it is close to the optimal solution, and the learning rate is exponentially decayed by the loss function. The expression is: In the formula, loss is the current loss error, loss set is the segment loss error threshold set, loss min is the minimum value of the current loss function.
Citation Information
Patent Citations
Phase-locked loop based downhole tool signal clock recovery method
CN104202041A
Neural network-based power grid impedance online identification method
CN112946363A