A method, device and apparatus for estimating phase difference of non-ideal sinusoidal voltage signal

By constructing a phase difference estimation model and using neural networks for signal correction and optimization, the problems of low accuracy and large error in phase difference estimation of non-ideal sinusoidal voltage signals are solved, and high-precision phase difference measurement is achieved.

CN119829926BActive Publication Date: 2025-09-30NAT UNIV OF DEFENSE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411994405.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-09-30
Estimated Expiration
2044-12-31

AI Technical Summary

Technical Problem

Existing technologies for estimating the phase difference of non-ideal sinusoidal voltage signals have the disadvantages of low accuracy, sensitivity to signal distortion, limited resolution, and are affected by noise and nonlinear distortion, resulting in large measurement errors.

Method used

A phase difference estimation model is constructed, including a preprocessing model, a signal correction model and a three-layer nested optimization model. Signal correction and optimization are performed through a neural network model, which automatically learns the signal distortion law and optimizes the signal correction model in a closed loop to improve measurement accuracy.

Benefits of technology

It significantly improves the phase difference measurement accuracy, expands the applicable scenarios, reduces the dependence on manually tuned parameters, and improves the generalization ability and measurement accuracy of the signal correction model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829926B_ABST
    Figure CN119829926B_ABST
Patent Text Reader

Abstract

The present invention relates to a phase difference estimation method, system and device for a non-ideal sinusoidal voltage signal. The method comprises: constructing a phase difference estimation model. The non-ideal sinusoidal voltage signal is converted into an approximately ideal sinusoidal voltage signal through a preprocessing model, and the non-ideal sinusoidal voltage signal and the approximately ideal sinusoidal voltage signal are input as training sample sets into a signal correction model to extract phase features and obtain estimated phase features. The signal correction model is trained according to the estimated phase difference features, and the extracted features are corrected, and an ideal sinusoidal voltage signal is output. The ideal sinusoidal voltage signal is input into a three-layer nested optimization model for phase difference estimation to obtain a phase difference estimation value. The training parameters of the signal correction model are updated according to the phase difference estimation value, and the three-layer nested optimization model performs phase difference estimation based on the updated training parameters. The adoption of this method takes advantage of the dual advantages of data-driven and model optimization, and realizes high-precision intelligent phase difference estimation of non-ideal sinusoidal voltage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of power electronic control technology, and in particular to a method, device and equipment for estimating the phase difference of a non-ideal sinusoidal voltage signal. Background Art

[0002] In power devices, particularly in power electronics and electric drive, voltage and current signals often appear as non-ideal sine waves containing various harmonic components. Accurately estimating the phase difference between these signals is crucial for applications such as power factor correction, motor control, and grid stability analysis.

[0003] In the prior art, the most commonly used method for measuring phase difference is to directly use the inverse sine function for calculation. The specific approach is: first, the sinusoidal voltage signal to be measured is filtered and conditioned to obtain an approximately ideal sinusoidal waveform; then, the instantaneous phase angles of the two sinusoidal voltage signals are calculated separately, and the difference between them is the phase difference estimate. This method is simple in principle and has low computational complexity, but there are some defects in directly using the inverse sine function to solve the phase, such as sensitivity to signal distortion and limited resolution, which results in a certain error in the obtained phase. Due to factors such as noise and nonlinear distortion, the measured signal often has various distortions, making it difficult to meet the premise of an approximately ideal sinusoidal waveform, thereby affecting the accuracy of the phase difference estimation. Summary of the Invention

[0004] Based on this, it is necessary to provide a phase difference estimation method, device and equipment for non-ideal sinusoidal voltage signals that can improve the phase difference measurement accuracy in order to address the above technical problems.

[0005] A method for estimating a phase difference of a non-ideal sinusoidal voltage signal, the method comprising:

[0006] Construct a phase difference estimation model. The phase difference estimation model includes: a preprocessing model, a signal correction model, and a three-layer nested optimization model.

[0007] The non-ideal sinusoidal voltage signal is converted into an approximately ideal sinusoidal voltage signal through a preprocessing model. The non-ideal sinusoidal voltage signal and the approximately ideal sinusoidal voltage signal are input as training sample sets into the signal correction model to extract phase features and obtain estimated phase features.

[0008] The signal correction model is trained according to the estimated phase difference features and a pre-constructed loss function to obtain a trained signal correction model.

[0009] The ideal phase feature is obtained through the trained signal correction model. After correcting the ideal phase feature, the ideal sinusoidal voltage signal is obtained.

[0010] The ideal sinusoidal voltage signal is input into the three-layer nested optimization model to estimate the phase difference and obtain the phase difference estimation value.

[0011] The training parameters of the signal correction model are updated according to the phase difference estimation value, the three-layer nested optimization model is trained according to the updated training parameters to obtain a trained three-layer nested optimization model, and the phase difference is estimated by the trained three-layer nested optimization model.

[0012] A phase difference estimation device for a non-ideal sinusoidal voltage signal, the device comprising:

[0013] The model building module is used to build a phase difference estimation model. The phase difference estimation model includes: a preprocessing model, a signal correction model, and a three-layer nested optimization model.

[0014] The estimated phase feature extraction module is used to convert the non-ideal sinusoidal voltage signal into an approximately ideal sinusoidal voltage signal through a preprocessing model, and input the non-ideal sinusoidal voltage signal and the approximately ideal sinusoidal voltage signal as a training sample set into the signal correction model to extract the phase feature and obtain the estimated phase feature.

[0015] The signal correction model training module is used to train the signal correction model according to the estimated phase difference characteristics and the pre-built loss function to obtain a trained signal correction model.

[0016] The ideal sinusoidal voltage signal acquisition module is used to obtain the ideal phase feature through the trained signal correction model. After correcting the ideal phase feature, the ideal sinusoidal voltage signal is obtained.

[0017] The phase difference estimation value acquisition module is used to input the ideal sinusoidal voltage signal into the three-layer nested optimization model to perform phase difference estimation and obtain the phase difference estimation value.

[0018] The phase difference estimation module is used to update the training parameters of the signal correction model according to the phase difference estimation value, train the three-layer nested optimization model according to the updated training parameters to obtain the trained three-layer nested optimization model, and perform phase difference estimation through the trained three-layer nested optimization model.

[0019] A computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0020] Construct a phase difference estimation model. The phase difference estimation model includes: a preprocessing model, a signal correction model, and a three-layer nested optimization model.

[0021] The non-ideal sinusoidal voltage signal is converted into an approximately ideal sinusoidal voltage signal through a preprocessing model. The non-ideal sinusoidal voltage signal and the approximately ideal sinusoidal voltage signal are input as training sample sets into the signal correction model to extract phase features and obtain estimated phase features.

[0022] The signal correction model is trained according to the estimated phase difference features and a pre-constructed loss function to obtain a trained signal correction model.

[0023] The ideal phase feature is obtained through the trained signal correction model. After correcting the ideal phase feature, the ideal sinusoidal voltage signal is obtained.

[0024] The ideal sinusoidal voltage signal is input into the three-layer nested optimization model to estimate the phase difference and obtain the phase difference estimation value.

[0025] The training parameters of the signal correction model are updated according to the phase difference estimation value, the three-layer nested optimization model is trained according to the updated training parameters to obtain a trained three-layer nested optimization model, and the phase difference estimation is performed using the trained three-layer nested optimization model.

[0026] The phase difference estimation method, device, and apparatus described above for non-ideal sinusoidal voltage signals utilizes a phase difference estimation model that is applicable to non-ideal sinusoidal voltage signals of various distortion forms and exhibits strong generalization capabilities. The signal correction model automatically learns various distortion patterns from a large number of samples, eliminating the need for manually designed preprocessing models and significantly expanding its applicable scenarios. A three-layer nested optimization model collaboratively optimizes and analyzes the processing parameters of each model component, addressing the low accuracy of the direct inverse sine method. Simultaneously, closed-loop automatic fine-tuning of the signal correction model continuously optimizes performance, significantly improving phase difference measurement accuracy. Furthermore, the training parameters of the signal correction model are obtained through autonomous training, while the state variables of the three-layer nested optimization model are automatically determined through a game theory strategy, eliminating the need for manual parameter tuning and the need for subjective experience. This approach not only addresses existing issues with estimating the phase difference of filtered non-ideal sinusoidal AC voltage signals, which often result in phase errors due to sensitivity to signal distortion, limited resolution, and various distortions in the measured signal caused by factors such as noise and nonlinear distortion. It also effectively improves the accuracy of phase difference estimation. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 1 is a flow chart of a method for estimating a phase difference of a non-ideal sinusoidal voltage signal according to an embodiment;

[0028] Figure 2 is a structural block diagram of a phase difference estimation device for a non-ideal sinusoidal voltage signal in one embodiment;

[0029] Figure 3 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0030] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0031] In one embodiment, Figure 1 As shown, a method for estimating the phase difference of a non-ideal sinusoidal voltage signal is provided, comprising the following steps:

[0032] Step 102: construct a phase difference estimation model.

[0033] The phase difference estimation model includes: a preprocessing model, a signal correction model and a three-layer nested optimization model.

[0034] The signal correction model is a neural network model, which adopts a multi-layer perceptron, a convolutional neural network, a recurrent neural network or a combination thereof.

[0035] Step 104 : convert the non-ideal sinusoidal voltage signal into an approximately ideal sinusoidal voltage signal through a preprocessing model, and input the non-ideal sinusoidal voltage signal and the approximately ideal sinusoidal voltage signal into a signal correction model as a training sample set to extract phase features and obtain estimated phase features.

[0036] Specifically, the input non-ideal sinusoidal voltage signal is first preprocessed using a preprocessing model, including removing DC components, removing high-frequency noise, and performing data compensation. A high-pass filter is then used to remove the DC component of the non-ideal sinusoidal voltage signal, with the cutoff frequency of the high-pass filter set to the minimum value of the non-ideal sinusoidal voltage signal's frequency band.

[0037] Furthermore, a low-pass filter is used to remove high-frequency noise. The passband frequency range of the low-pass filter is determined by the frequency range of the non-ideal sinusoidal voltage signal. Missing points in the valid data segment are interpolated using linear or polynomial interpolation. Data distortion points are replaced with normal data using waveform similarity comparison. The threshold for identifying abnormalities is 3 to 6 times the standard deviation.

[0038] Furthermore, the passband frequency range of the bandpass filter is determined according to the frequency range of the non-ideal sinusoidal voltage signal; the bandpass filter is designed using the window function method, frequency sampling technology, maximum flatness characteristic method or elliptic function method, and the filter order is controlled below 20, and the reasonable order is determined through comparison.

[0039] Furthermore, the designed bandpass filter is used to filter the preprocessed non-ideal sinusoidal voltage signal to suppress the DC component and high-frequency noise, retain the fundamental component, and obtain an approximate signal close to the ideal sinusoidal waveform.

[0040] Furthermore, the input of the signal correction model training is the non-ideal sinusoidal voltage signal before filtering and the approximately ideal sinusoidal voltage signal after filtering, and the output of the training is the phase and amplitude characteristics (i.e., the estimated phase characteristics) of the ideal sinusoidal voltage signal corresponding to the approximately ideal sinusoidal voltage signal.

[0041] Step 106 : training the signal correction model according to the estimated phase difference feature and the pre-built loss function to obtain a trained signal correction model.

[0042] The pre-built loss function needs to comprehensively consider the errors in both phase and amplitude dimensions. For the phase dimension, the mean square error (MSE) loss can be used; for the amplitude dimension, the smooth L1 loss can be used to reduce the impact of outliers. The total loss is the weighted sum of the two.

[0043] Specifically, a signal correction model is used to predict the phase and amplitude characteristics of the ideal sinusoidal voltage signal based on the non-ideal signal before filtering and the approximately ideal sinusoidal voltage signal after filtering. The signal correction model adopts a gated recurrent unit or a long short-term memory network structure to capture the long-term dependencies in the input sequence.

[0044] Furthermore, mini-batch gradient descent can be used during training, with Adam or RMSProp as the optimizer. The batch size and learning rate should be adjusted based on the amount of data and model complexity. Typically, the batch size is set between 32 and 512, and the initial learning rate is between 0.001 and 0.01. A decay strategy can be used later. To prevent overfitting, regularization strategies such as L2 regularization, dropout, and data augmentation can be introduced during training.

[0045] Furthermore, the training set of samples must cover sufficient distortion conditions, including phase distortion and amplitude fluctuation. The labels are the corresponding phase and amplitude data of the ideal sinusoidal voltage signal. During training, the changes in training and validation losses must be monitored. Training can be terminated when the validation loss stops decreasing after multiple epochs to avoid overfitting. Generally, 100 to 500 epochs are sufficient.

[0046] Step 108 : Acquire the ideal phase feature through the trained signal correction model, and obtain the ideal sinusoidal voltage signal after correcting the ideal phase feature.

[0047] Specifically, after the above training, a signal correction model is obtained that can predict the phase and amplitude of the corresponding ideal sinusoidal voltage signal from the input non-ideal sinusoidal voltage signal. Because the prediction may contain slight phase distortion and amplitude offset, it is necessary to calibrate and optimize the phase and amplitude of the ideal sinusoidal voltage signal, as well as the parameters of the signal correction model.

[0048] Furthermore, an adaptive adjustment model is constructed, optimizing the phase offset and amplitude correction parameters to minimize the difference between the signal adjusted according to these parameters and the ideal sinusoidal voltage signal. This model includes the amplitude correction parameter, baseline correction amount, initial phase, and time-varying phase correction amount. The optimization objective is defined as minimizing the mean square error between the adaptive adjustment model and the known ideal sinusoidal voltage signal. Using the amplitude correction parameter, baseline correction amount, initial phase, and time-varying phase correction amount as optimization variables, an optimization algorithm is used to solve the problem. The optimal parameters obtained are substituted into the adaptive adjustment model to obtain the corrected ideal sinusoidal voltage signal.

[0049] ;

[0050] Among them, A is the amplitude correction parameter, B is the baseline correction amount, is the initial phase, is the time-varying phase correction.

[0051] Define the optimization objective as minimizing With the known ideal sinusoidal voltage signal The mean square error of:

[0052] .

[0053] A, B, and To optimize the variables, an optimization algorithm (such as L-BFGS) is used to solve the problem. Add smoothing constraints to prevent the phase correction from fluctuating too drastically. Smoothing can be done using a norm penalty term:

[0054] ;

[0055] Here, λ is the smoothing coefficient, and the larger the value, the better the smoothness.

[0056] Further, the optimal A, B, 、 Substitute into the adaptive adjustment model to obtain the corrected ideal sinusoidal voltage signal .

[0057] Step 110 : Input the ideal sinusoidal voltage signal into the three-layer nested optimization model to perform phase difference estimation to obtain a phase difference estimation value.

[0058] Specifically, the repaired ideal sinusoidal voltage signal The main purpose of normalization is to eliminate the influence of the amplitude dimension so that the subsequent phase difference estimation is only related to the phase. The normalization method uses maximum and minimum value normalization:

[0059] ;

[0060] in, represents the normalized sinusoidal voltage signal, and Respectively By this normalization, the signal The value range of is mapped to the interval [0, 1].

[0061] Furthermore, using the normalized ideal sinusoidal voltage signal The orthogonal characteristics of the phase difference estimation function are constructed , ideal sinusoidal voltage signal and are orthogonal, that is:

[0062] ;

[0063] ;

[0064] in, For the cycle, is the angular frequency, is the initial phase. Using this orthogonal property, we can construct a phase difference estimation function.

[0065] Furthermore, let the actual measurement signal be: , the reference signal is: , the phase difference between them is According to the above orthogonal properties, we have:

[0066] ;

[0067] ;

[0068] Divide the above formula by , and After normalization Substitution, we get:

[0069] ;

[0070] ;

[0071] This is the required phase difference estimation function ,in is the phase difference to be estimated, is the angular frequency known or to be optimized, is the neural network parameter vector. is the normalized ideal sinusoidal voltage signal.

[0072] Furthermore, a three-layer nested optimization model is established, including the outer multi-objective optimization, the middle max-min game model and the inner single-objective optimization, with the purpose of optimizing the phase difference. , angular frequency Sum signal correction model parameters , so that the phase difference estimate The deviation from the known expected phase difference is minimized, and the loss function of the signal correction model is also minimized.

[0073] The outer multi-objective optimization model is as follows:

[0074] ;

[0075] ;

[0076] ;

[0077] in, is the phase difference estimate and expected value The absolute deviation, is the signal correction model trained at the current parameters The loss function value under , the goal is to minimize these two objective functions simultaneously. The constraints include and The value range of and the phase difference estimation function The modulus constraint.

[0078] The middle layer is the max-min game model, which includes the upper max-min model and the lower min model.

[0079] Upper max-min model:

[0080] ;

[0081] ;

[0082] The goal is to minimize the worst-case absolute error of the phase difference estimate ,here is the decision variable, and is the opponent variable, with the same constraints as above.

[0083] Lower min model:

[0084] ;

[0085] ;

[0086] ;

[0087] here is the solution of the upper max-min model, the goal is to When smallest and , that is, to find the current Best match and , is the weight, and the constraints include Value range, phase difference estimation function modulus constraint, right The ordinary constraints on the derivatives of periodicity) and neural network loss function value constraints.

[0088] The inner layer is a single-objective optimization model:

[0089] ;

[0090] ;

[0091] This layer optimizes the signal correction model parameters , so that the loss function is minimized. The goal is the same as step S30, and the constraint is the upper limit of the loss function The optimization solution process of the three-layer nested structure is as follows: the outer optimization is given an initial , the middle level solves the optimal solution under this initial value The solution is substituted into the outer optimization and repeated until convergence to obtain the global optimum , the inner layer is for auxiliary optimization, Further optimize and output the results to the middle layer for use.

[0092] Step 112, updating the training parameters of the signal correction model according to the phase difference estimation value, training the three-layer nested optimization model according to the updated training parameters to obtain a trained three-layer nested optimization model, and performing phase difference estimation using the trained three-layer nested optimization model.

[0093] Specifically, get the optimal solution ,Will Output as phase difference estimate. The deviation from the known expected phase difference is used to update the neural network training data, loss function, and regularization parameters, and the three-layer nested optimization model is re-executed to form an optimization closed loop.

[0094] Furthermore, the global optimal value obtained in the previous iteration step Substitute it into the three-layer nested optimization model and perform multiple rounds of iterative solutions in the following way:

[0095] 1) Fixed , using inner optimization to solve the optimal :

[0096] ;

[0097] ;

[0098] 2) Substitute into the lower min model:

[0099] ;

[0100] ;

[0101] ;

[0102] get .in, Constraints for the lower min model The threshold in is used to limit right The derivative range of To limit the upper limit of the neural network loss function,

[0103] 3) Substitute into the upper max-min model:

[0104] ;

[0105] ;

[0106] Solve to get new ,and 、 Constitute a new optimal solution.

[0107] 4) Repeat steps 1), 2), and 3) until convergence to the global optimum. When the global optimal solution is obtained Then, it is output as the phase difference estimation value.

[0108] Further, according to The phase difference from the known expected Deviation , the signal correction model is updated in the following ways to form an optimization closed loop:

[0109] 1) Update the training dataset:

[0110] Based on the original training set, The value of the phase difference distortion degree is redesigned New training samples that are similar to the original ones are added to the training set. At the same time, some old ones that are not related to the original ones are removed. Training samples with large differences can improve the pertinence of the dataset.

[0111] 2) Update the loss function:

[0112] based on The value of , the weight of the phase error term in the loss function is adaptively adjusted. For example, when When it is large, the weight of the phase error term can be appropriately increased so that the signal correction model can focus more on optimizing the phase error in the next round of training.

[0113] 3) Update regularization strategy:

[0114] against For large values, the regularization strength can be appropriately increased (e.g., increasing the L2 regularization coefficient) to reduce model complexity and reduce the risk of overfitting. At the same time, regularization methods such as dropout can be used to improve model generalization capabilities.

[0115] After the above update, a new round of training of the signal correction model is performed again to obtain new model parameters .by As the new initial value, execute the three-layer nested optimization solution of step S80 again to obtain the new Solution and update Value. Repeat this process until This closed-loop update strategy continuously optimizes the signal correction model, gradually bringing its output closer to the ideal state, until the specified convergence threshold is met or the maximum number of iterations is reached. This improves the accuracy of the final phase difference estimate. By alternating between model self-adjustment and optimization, the estimation error is continuously reduced, ultimately achieving a highly accurate phase difference estimate.

[0116] The phase difference estimation model constructed in the aforementioned method for estimating the phase difference of non-ideal sinusoidal voltage signals is applicable to non-ideal sinusoidal voltage signals with various distortion forms and exhibits strong generalization capabilities. The signal correction model automatically learns various distortion patterns from a large number of samples, eliminating the need for manually designed preprocessing models and significantly expanding its applicable scenarios. A three-layer nested optimization model collaboratively optimizes and analyzes the processing parameters of each model component, addressing the low accuracy of the direct inverse sine method. Simultaneously, closed-loop automatic fine-tuning of the signal correction model continuously optimizes performance, significantly improving phase difference measurement accuracy. Furthermore, the training parameters of the signal correction model are obtained through autonomous training, and the state variables of the three-layer nested optimization model are automatically determined through a game theory strategy, eliminating the need for manual parameter tuning and subjective experience. This method not only addresses the existing issues of phase difference estimation after filtering non-ideal sinusoidal AC voltage signals, which often result in phase errors due to sensitivity to signal distortion, limited resolution, and various distortions in the measured signal caused by factors such as noise and nonlinear distortion. It also effectively improves the accuracy of phase difference estimation.

[0117] In one embodiment, a non-ideal sinusoidal voltage signal is obtained through a preprocessing model, the non-ideal sinusoidal voltage signal is subjected to signal cleaning, and then filtered through a bandpass filter to obtain an approximately ideal sinusoidal voltage signal.

[0118] It is worth mentioning that the bandpass filter can be designed using the following method:

[0119] 1) Window function method: Determine the ideal passband frequency response based on the required passband frequency range, then truncate it to a finite impulse response using a windowing function. Window functions can include rectangular, Hamming, and Blackman windows. The choice of window function affects passband ripple and stopband attenuation. The window length is inversely proportional to the main ceramic ripple and transition band slope, so a trade-off is typically required between main ceramic ripple and stopband attenuation.

[0120] 2) Frequency sampling technology: Design an ideal frequency response based on the required passband frequency range, then obtain the filter impulse response coefficients through inverse transformation. Frequency sampling techniques include direct sampling, linear normalization, and Chebyshev weighting. Chebyshev weighting can achieve good amplitude-frequency characteristics, but at the same order, the phase linearity is poor.

[0121] 3) The maximum flatness method is a design approach that finds the filter transfer function that achieves a maximum flat frequency response amplitude characteristic for a given passband frequency range and passband ripple requirements. The maximum flatness characteristic ensures that the amplitude-frequency response within the passband is essentially flat.

[0122] 4) The elliptic function method is based on the digital implementation of analog filters. It can design filters with very steep passband / bandstop characteristics and narrow transition bands, but it will have large ripple and phase nonlinearity.

[0123] The order of a bandpass filter is directly proportional to its frequency selectivity. A higher order results in a steeper transition band and improved stopband attenuation. However, excessively high order can also lead to computational overhead and noise transmission issues. It is generally recommended to keep the filter order below 20. The order can be selected based on actual needs and after simulation and comparison. After passing through the aforementioned bandpass filter, the high-frequency noise and DC components of the non-ideal sinusoidal voltage signal are effectively suppressed, while the fundamental component is retained, resulting in a near-ideal sinusoidal waveform.

[0124] In one embodiment, the three-layer nested optimization model includes: an outer multi-objective optimization model, a middle max-min game model, and an inner single-objective optimization model. After normalizing the ideal sinusoidal voltage signal, the orthogonal features are obtained:

[0125] ;

[0126] ;

[0127] in, is an ideal sinusoidal voltage signal, is the time period, is the angular frequency of the ideal sinusoidal voltage signal, is the initial phase of the ideal sinusoidal voltage signal. The phase difference estimation function is constructed based on the orthogonal characteristics:

[0128] ;

[0129] ;

[0130] ;

[0131] in, is the normalized sinusoidal voltage signal, is the corrected ideal sinusoidal voltage signal, and are ideal sinusoidal voltage signals The minimum and maximum values ​​of is the phase difference estimation function, is the phase of the approximately ideal sinusoidal voltage signal, is the phase difference parameter The minimum value range of is the phase difference parameter The maximum value range of is the angular frequency parameter The minimum value range of is the angular frequency parameter The maximum value range of

[0132] Minimize the ideal phase characteristics based on the phase difference estimation function and the outer multi-objective optimization model:

[0133] ;

[0134] ;

[0135] ;

[0136] in, is the estimated phase difference and expected value The absolute deviation, The signal correction model is at the current parameters The loss function value under , is the angular frequency of the ideal sinusoidal voltage signal, is the estimated phase difference, is the phase difference estimation function. The minimized ideal phase feature is used in a middle-level max-min game model to obtain the minimum phase difference estimate, the minimum angular frequency that matches the minimum phase difference estimate, and the correction parameters of the signal correction model. The correction parameters are then used in an inner-level single-objective optimization model to obtain the optimal correction parameters. The training parameters of the signal correction model are then updated based on the optimal correction parameters. The three-layer nested optimization model is then trained based on the updated training parameters to obtain a trained three-layer nested optimization model.

[0137] It is worth noting that the reason for using maximum and minimum value normalization is to keep the periodicity and phase characteristics of the signal unchanged while removing the amplitude information. Compared with other methods such as zero mean normalization, this normalization method is more suitable for periodic signal processing. Based on the orthogonal integration method, it is possible to avoid directly using trigonometric functions such as inverse sine to estimate the phase difference, thereby reducing the estimation error. Through this three-layer nested optimization model, the phase difference estimation value can be optimized simultaneously. , angular frequency and neural network parameters , so that the absolute deviation of the phase difference estimation and the signal correction model loss function are both optimized, thus obtaining the most accurate phase difference estimation. Among them, game optimization helps to deal with The coupling relationship between them, the inner auxiliary optimization improves During the iterative optimization process, intelligent optimization algorithms such as particle swarm and ant colony can be used, supplemented by some mathematical optimization methods (such as interior point method, alternating direction multiplier method, etc.) to improve optimization efficiency and robustness.

[0138] In one embodiment, the estimated phase characteristics include: a phase value to be optimized and an amplitude value to be optimized. The ideal phase characteristics include: an ideal phase value and an ideal amplitude value.

[0139] In one embodiment, a trained signal correction model obtains an ideal phase feature, and adaptive filtering compensation is used to correct the ideal phase feature to obtain an ideal sinusoidal voltage signal corresponding to the corrected ideal phase feature.

[0140] It is worth noting that the signal correction model can adopt a multi-layer perceptron (MLP), a convolutional neural network (CNN), a recurrent neural network (RNN) or a combination thereof. In this embodiment, an RNN or a CNN+RNN hybrid structure is adopted. The input includes two parts: a non-ideal sinusoidal voltage signal before filtering and an approximately ideal sinusoidal voltage signal after filtering. Because the non-ideal signal before filtering contains all distortion information such as phase and amplitude distortion, the approximately ideal signal after filtering is used as a training label to guide the signal correction model to learn the repair operation. The output is the phase and amplitude feature data of the ideal sinusoidal voltage signal corresponding to the approximately ideal sinusoidal voltage signal. The phase feature can be represented as a time series, and the amplitude feature can be set as an amplitude constant.

[0141] In one embodiment, adaptive filtering compensation is used to correct the ideal phase characteristic to obtain an ideal sinusoidal voltage signal corresponding to the corrected ideal phase characteristic:

[0142] ;

[0143] in, is the corrected ideal sinusoidal voltage signal, A is the ideal amplitude correction parameter, B is the baseline correction value, is the phase value to be optimized, is the time-varying phase correction.

[0144] It is worth noting that this correction method can effectively correct the amplitude distortion and phase distortion errors caused by the neural network prediction, obtaining a near-ideal sinusoidal waveform, laying the foundation for subsequent accurate estimation of the phase difference. In addition, existing filtering methods (such as Kalman filtering, adaptive filtering, etc.) can also be used to smooth the predicted signal, and then perform adaptive optimization compensation to improve efficiency. It can be seen that by optimizing the amplitude and phase correction parameters, fine adjustment of the neural network prediction results is achieved, and ideal sinusoidal waveform data is obtained, which provides a reliable basic signal source for subsequent minimization of phase difference estimation errors.

[0145] In one embodiment, a non-ideal sinusoidal voltage signal is obtained through a preprocessing model, and the DC component of the non-ideal sinusoidal voltage signal is removed using a high-pass filter to obtain a non-ideal sinusoidal voltage signal to be denoised. A low-pass filter is used to remove high-frequency noise from the non-ideal sinusoidal voltage signal to be denoised, and linear interpolation is used to interpolate missing points in the valid data segments of the non-ideal sinusoidal voltage signal to obtain a non-ideal sinusoidal voltage signal to be cleaned. Waveform similarity is used to replace the data distortion points of the non-ideal sinusoidal voltage signal to be cleaned with normal data to obtain a cleaned non-ideal sinusoidal voltage signal. A bandpass filter is used to suppress the DC component and high-frequency noise of the cleaned non-ideal sinusoidal voltage signal, while retaining the fundamental component of the cleaned non-ideal sinusoidal voltage signal, to obtain an approximately ideal sinusoidal voltage signal.

[0146] It's worth noting that a high-pass filter can be used to remove the DC component. The filter's cutoff frequency is typically the minimum value within the frequency band of the non-ideal sinusoidal voltage signal. For example, when the sinusoidal frequency range is 50 Hz to 100 Hz, the high-pass filter's cutoff frequency can be set to 45 Hz. A digital filter can be used for the high-pass filter, and filter design methods include window functions, frequency sampling, and maximum flatness. A low-pass filter can be used to remove high-frequency noise. The low-pass filter's passband frequency range is determined by the frequency range of the non-ideal sinusoidal voltage signal, and the amplitude within the passband is as flat as possible. When the sinusoidal frequency range is 50 Hz to 100 Hz, the low-pass filter's cutoff frequency can be set to 105 Hz. A digital filter can also be used, and the design method is the same as for the high-pass filter. Data compensation primarily addresses outliers such as missing and distorted points within valid data segments. Missing points in valid data segments can be interpolated using methods such as linear interpolation, polynomial interpolation, or wavelet transforms. Distorted data points can be replaced with normal data using methods such as waveform similarity comparison. The threshold setting is affected by factors such as the signal-to-noise ratio and the effective data length. Usually, the threshold can be set based on 3 to 6 times the standard deviation.

[0147] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. In addition, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0148] In one embodiment, Figure 2 As shown, a phase difference estimation device for a non-ideal sinusoidal voltage signal is provided, comprising: a model building module 202, an estimated phase feature extraction module 204, a signal correction model training module 206, an ideal sinusoidal voltage signal acquisition module 208, a phase difference estimation value acquisition module 210, and a phase difference estimation module 212, wherein:

[0149] The model building module 202 is used to build a phase difference estimation model. The phase difference estimation model includes: a preprocessing model, a signal correction model, and a three-layer nested optimization model.

[0150] The estimated phase feature extraction module 204 is used to convert the non-ideal sinusoidal voltage signal into an approximately ideal sinusoidal voltage signal through a preprocessing model, and input the non-ideal sinusoidal voltage signal and the approximately ideal sinusoidal voltage signal as a training sample set into the signal correction model to extract the phase feature and obtain the estimated phase feature.

[0151] The signal correction model training module 206 is used to train the signal correction model according to the estimated phase difference feature and the pre-built loss function to obtain a trained signal correction model.

[0152] The ideal sinusoidal voltage signal acquisition module 208 is used to acquire an ideal phase feature through a trained signal correction model, and obtain an ideal sinusoidal voltage signal after correcting the ideal phase feature.

[0153] The phase difference estimation value acquisition module 210 is used to input the ideal sinusoidal voltage signal into the three-layer nested optimization model to perform phase difference estimation and obtain a phase difference estimation value.

[0154] The phase difference estimation module 212 is used to update the training parameters of the signal correction model according to the phase difference estimation value, train the three-layer nested optimization model according to the updated training parameters to obtain the trained three-layer nested optimization model, and perform phase difference estimation using the trained three-layer nested optimization model.

[0155] For the specific limitations of the phase difference estimation device for non-ideal sinusoidal voltage signals, please refer to the limitations of the phase difference estimation method for non-ideal sinusoidal voltage signals above, which will not be repeated here. The various modules in the above-mentioned phase difference estimation device for non-ideal sinusoidal voltage signals can be implemented in whole or in part by software, hardware, and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0156] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 3As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected via a device bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating device and a computer program. The internal memory provides an environment for the operation of the operating device and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a method for estimating the phase difference of a non-ideal sinusoidal voltage signal is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a key, trackball or touchpad provided on the computer device housing, or an external keyboard, touchpad or mouse.

[0157] Those skilled in the art will understand that Figure 2-3 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present invention and does not constitute a limitation on the computer device to which the solution of the present invention is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0158] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0159] Construct a phase difference estimation model. The phase difference estimation model includes: a preprocessing model, a signal correction model, and a three-layer nested optimization model.

[0160] The non-ideal sinusoidal voltage signal is converted into an approximately ideal sinusoidal voltage signal through a preprocessing model. The non-ideal sinusoidal voltage signal and the approximately ideal sinusoidal voltage signal are input as training sample sets into the signal correction model to extract phase features and obtain estimated phase features.

[0161] The signal correction model is trained according to the estimated phase difference features and a pre-constructed loss function to obtain a trained signal correction model.

[0162] The ideal phase feature is obtained through the trained signal correction model. After correcting the ideal phase feature, the ideal sinusoidal voltage signal is obtained.

[0163] The ideal sinusoidal voltage signal is input into the three-layer nested optimization model to estimate the phase difference and obtain the phase difference estimation value.

[0164] The training parameters of the signal correction model are updated according to the phase difference estimation value, the three-layer nested optimization model is trained according to the updated training parameters to obtain a trained three-layer nested optimization model, and the phase difference is estimated by the trained three-layer nested optimization model.

[0165] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing the relevant hardware using a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the above-described method embodiments. Any reference to memory, storage, database, or other media used in the various embodiments provided herein may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct RAMbus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM).

[0166] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0167] The above-described embodiments merely illustrate several implementations of the present invention, and while their descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent. It should be noted that a person skilled in the art would be able to make numerous variations and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present invention. Therefore, the scope of protection of the patent for this invention shall be determined by the appended claims.

Claims

1. A method for estimating the phase difference of a non-ideal sinusoidal voltage signal, characterized in that: The method comprises: Constructing a phase difference estimation model; the phase difference estimation model includes: a preprocessing model, a signal correction model and a three-layer nested optimization model; Converting the non-ideal sinusoidal voltage signal into an approximately ideal sinusoidal voltage signal through the preprocessing model, inputting the non-ideal sinusoidal voltage signal and the approximately ideal sinusoidal voltage signal as a training sample set into the signal correction model to extract phase features and obtain estimated phase features; Training the signal correction model according to the estimated phase feature and a pre-constructed loss function to obtain a trained signal correction model; An ideal phase feature is obtained by using a trained signal correction model, and an ideal sinusoidal voltage signal is obtained after correcting the ideal phase feature; Inputting the ideal sinusoidal voltage signal into the three-layer nested optimization model to perform phase difference estimation to obtain a phase difference estimation value; the three-layer nested optimization model includes: an outer multi-objective optimization model, a middle max-min game model, and an inner single-objective optimization model; The training parameters of the signal correction model are updated according to the phase difference estimation value, the three-layer nested optimization model is trained according to the updated training parameters to obtain the trained three-layer nested optimization model, and the phase difference estimation is performed through the trained three-layer nested optimization model.

2. The method according to claim 1, characterized in that The non-ideal sinusoidal voltage signal is converted into an approximately ideal sinusoidal voltage signal by the preprocessing model, comprising: A non-ideal sinusoidal voltage signal is obtained through the preprocessing model, and after signal cleaning, the non-ideal sinusoidal voltage signal is filtered through a bandpass filter to obtain an approximately ideal sinusoidal voltage signal.

3. The method according to claim 1, characterized in that Inputting the ideal sinusoidal voltage signal into the three-layer nested optimization model to perform phase difference estimation to obtain a phase difference estimation value, updating the training parameters of the signal correction model according to the phase difference estimation value, and training the three-layer nested optimization model according to the updated training parameters to obtain the trained three-layer nested optimization model, including: After normalizing the ideal sinusoidal voltage signal, the orthogonal feature is obtained: in, is an ideal sinusoidal voltage signal, is the time period, is the angular frequency of the ideal sinusoidal voltage signal, is the initial phase of the ideal sinusoidal voltage signal, is the ideal amplitude correction parameter; Construct a phase difference estimation function based on the orthogonal features: in, is the normalized sinusoidal voltage signal, is the corrected ideal sinusoidal voltage signal, and are ideal sinusoidal voltage signals The minimum and maximum values ​​of is the phase of the approximately ideal sinusoidal voltage signal; Minimize the ideal phase characteristic according to the phase difference estimation function and the outer multi-objective optimization model: in, is the estimated phase difference and expected value The absolute deviation, The signal correction model is at the current parameters The loss function value under , is the angular frequency of the ideal sinusoidal voltage signal, is the estimated phase difference, is the phase difference estimation function, is the phase difference parameter The minimum value range of is the phase difference parameter The maximum value range of is the angular frequency parameter The minimum value range of is the angular frequency parameter The maximum value range of The minimized ideal phase feature is used to obtain a minimum phase difference estimate, a minimum angular frequency matched by the minimum phase difference estimate, and correction parameters of a signal correction model through a middle-level max-min game model; The correction parameters obtain the optimal correction parameters through the inner single-objective optimization model, the training parameters of the signal correction model are updated according to the optimal correction parameters, and the three-layer nested optimization model is trained according to the updated training parameters to obtain the trained three-layer nested optimization model.

4. The method according to any one of claims 1 to 3, characterized in that The estimated phase characteristics include: a phase value to be optimized and an amplitude value to be optimized; The ideal phase characteristics include: an ideal phase value and an ideal amplitude value.

5. The method according to claim 4, characterized in that The ideal phase feature is obtained by using the trained signal correction model. After correcting the ideal phase feature, an ideal sinusoidal voltage signal is obtained, including: The ideal phase feature is obtained through the trained signal correction model, and the ideal phase feature is corrected by adaptive filtering compensation to obtain an ideal sinusoidal voltage signal corresponding to the corrected ideal phase feature.

6. The method according to claim 5, characterized in that Adaptive filtering compensation is used to correct the ideal phase characteristic to obtain an ideal sinusoidal voltage signal corresponding to the corrected ideal phase characteristic, including: Adaptive filtering compensation is used to correct the ideal phase characteristic to obtain an ideal sinusoidal voltage signal corresponding to the corrected ideal phase characteristic: in, is the corrected ideal sinusoidal voltage signal, A is the ideal amplitude correction parameter, B is the baseline correction value, is the phase value to be optimized, is the time-varying phase correction.

7. The method according to claim 6, characterized in that The non-ideal sinusoidal voltage signal is obtained by the preprocessing model, the non-ideal sinusoidal voltage signal is subjected to signal cleaning, and then filtered by a bandpass filter to obtain an approximately ideal sinusoidal voltage signal, including: Acquire a non-ideal sinusoidal voltage signal through the preprocessing model, and remove a DC component of the non-ideal sinusoidal voltage signal using a high-pass filter to obtain a non-ideal sinusoidal voltage signal to be denoised; Using a low-pass filter to remove high-frequency noise from the non-ideal sinusoidal voltage signal to be denoised, and using linear interpolation to interpolate missing points in the valid data segment of the non-ideal sinusoidal voltage signal to be denoised, to obtain a non-ideal sinusoidal voltage signal to be cleaned; Using waveform similarity to replace the data distortion points of the non-ideal sinusoidal voltage signal to be cleaned with normal data to obtain the cleaned non-ideal sinusoidal voltage signal; The bandpass filter is used to suppress the DC component and high-frequency noise of the net processed non-ideal sinusoidal voltage signal, and retain the fundamental component of the net processed non-ideal sinusoidal voltage signal, so as to obtain an approximately ideal sinusoidal voltage signal.

8. A phase difference estimation device for a non-ideal sinusoidal voltage signal, characterized in that: The device comprises: A model building module is used to build a phase difference estimation model; the phase difference estimation model includes: a preprocessing model, a signal correction model and a three-layer nested optimization model; an estimated phase feature extraction module, configured to convert a non-ideal sinusoidal voltage signal into an approximately ideal sinusoidal voltage signal through the preprocessing model, and input the non-ideal sinusoidal voltage signal and the approximately ideal sinusoidal voltage signal as a training sample set into the signal correction model to extract phase features, thereby obtaining an estimated phase feature; A signal correction model training module is used to train the signal correction model according to the estimated phase feature and a pre-constructed loss function to obtain a trained signal correction model; An ideal sinusoidal voltage signal acquisition module is used to obtain an ideal phase feature through a trained signal correction model, and obtain an ideal sinusoidal voltage signal after correcting the ideal phase feature; a phase difference estimation value acquisition module, configured to input the ideal sinusoidal voltage signal into the three-layer nested optimization model to perform phase difference estimation and obtain a phase difference estimation value; the three-layer nested optimization model comprises: an outer multi-objective optimization model, a middle max-min game model, and an inner single-objective optimization model; A phase difference estimation module is used to update the training parameters of the signal correction model according to the phase difference estimation value, train the three-layer nested optimization model according to the updated training parameters to obtain the trained three-layer nested optimization model, and perform phase difference estimation through the trained three-layer nested optimization model.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.