AC filtering method based on quasi-proportional resonance algorithm
By applying quasi-proportional resonance algorithm and bilinear transformation in AC signal filtering, the problems of phase offset and amplitude attenuation in AC signal filtering are solved, and the high-fidelity filtering effect is achieved and the implementation cost is reduced.
Patent Information
- Application Number
- CN202411682090.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-03-14
AI Technical Summary
The prior art cannot effectively solve the problems of phase offset and amplitude attenuation during AC signal filtering, especially in applications where signal phase is required.
The AC filtering method based on the quasi-proportional resonance algorithm is adopted to establish the continuous transfer function of the quasi-proportional resonance filter and convert it into a discrete transfer function using bilinear transformation to obtain the differential equation for filtering.
Average AC signal filtering without phase shift and amplitude attenuation is realized, which significantly improves signal fidelity, and the algorithm is easy to implement digitally, reducing hardware costs.
Smart Images

Figure CN119622227A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of signal processing, and in particular to an AC filtering method based on a quasi-proportional resonance algorithm. Background Art
[0002] In the control of power electronic equipment, it is usually necessary to filter the collected AC signals. For example, when applying a software phase-locked loop, it is necessary to collect the line voltage signal of the power grid and convert it into a phase voltage signal to obtain the frequency and phase information of the power grid. However, the AC signal actually collected usually contains multiple interference signals such as DC components, higher harmonics of the fundamental signal, and high-frequency switching noise. These noise signals will affect the performance of the phase-locked loop, causing system control distortion, and in severe cases, may cause the system to fail to work properly.
[0003] At present, there are two main technical solutions for filtering AC signals. The first is to add a hardware filtering circuit to the acquisition circuit, and the acquired signal is first processed by the filtering circuit and then input into the software for processing. Although this solution can effectively filter out noise signals, it has two disadvantages: one is that it increases the hardware cost; the other is that the filtering circuit will cause signal phase shift. In applications that require high signal phase information, software is required to perform nonlinear compensation, which increases the complexity of software processing.
[0004] The second type is to use software filtering solutions. Existing software filtering solutions mainly include low-pass filtering and band-pass filtering. Low-pass filtering cannot filter out the DC component in the AC signal, and will also cause signal phase shift. When filtering out noise signals, band-pass filtering will produce obvious nonlinear phase deviation and varying degrees of amplitude attenuation. In order to ensure the filtering effect, the amplitude correction and phase compensation of the filtered signal are required, which not only increases the complexity of the filtering algorithm, but also consumes additional limited computing resources.
[0005] It can be seen that the existing technology cannot solve the phase shift problem in the AC signal filtering process. Especially in applications where accurate signal phase is required, how to achieve AC signal filtering without phase shift and amplitude attenuation while ensuring that the filtering algorithm is easy to implement digitally is a technical problem that needs to be solved urgently. Summary of the invention
[0006] The purpose of the present invention is to provide an AC filtering method based on a quasi-proportional resonance algorithm, which applies the quasi-proportional resonance algorithm to AC signal filtering and realizes digitization through bilinear transformation, thereby realizing an AC signal filtering without phase shift and amplitude attenuation, while ensuring that the filtering algorithm is easy to realize digitally.
[0007] To achieve the above object, the present invention is implemented through the following technical solutions:
[0008] An AC filtering method based on a quasi-proportional resonance algorithm comprises the following steps:
[0009] S1: Obtain the AC signal to be processed;
[0010] S2: Establish the continuous transfer function of the quasi-proportional resonant filter:
[0011]
[0012] Among them, w c is the cut-off frequency used to adjust the filter bandwidth, w0 is the resonant frequency, that is, the frequency of the extracted AC signal, k p is the proportional coefficient used to adjust the dynamic response speed of the filtering system, k r The resonance coefficient can be adjusted to achieve zero steady-state error in tracking the AC signal, and s is a complex frequency operator;
[0013] S3: Convert the continuous transfer function into a discrete transfer function using a bilinear transformation:
[0014] The bilinear transformation of s is expressed as:
[0015]
[0016] Substituting the above equation into the continuous transfer function described in S2, we get the discrete transfer function:
[0017]
[0018] Among them, T s is the calculation step time, z is the complex variable of the discrete system, and w0 is the resonant frequency;
[0019] S4: According to the discrete transfer function described in S3, the difference equation is obtained:
[0020] b0y[n]+b1y[n-1]+b2y[n-2]=a0x[n]+a1x[n-1]+a2x[n-2]
[0021] Where x[n] is the input signal, y[n] is the output signal, a0, a1, a2 are coefficients related to the x[n] input signal, and b0, b1, b2 are coefficients related to the y[n] input signal;
[0022] S5: Filter the AC signal using the differential equation.
[0023] Further: the step S1 specifically includes:
[0024] S11: Collecting AC signals through a sampling circuit to obtain a sampled voltage value;
[0025] S12: Calculate the digital value of the AC signal according to the sampled voltage value, the sampled voltage reference value and the number of bits of the sampling analog-to-digital converter.
[0026] Furthermore: in step S12, the calculation formula of the digital quantity of the AC signal is:
[0027]
[0028] Among them, V AD is the digital value of the AC signal, V sample is the sampling voltage value, V ref is the sampling voltage reference value, and n is the number of bits of the sampling analog-to-digital converter.
[0029] Further: in step S4, the coefficients of the differential equation satisfy:
[0030]
[0031] Further: in the step S5, the coefficient b0 of the differential equation is normalized to obtain:
[0032] ″″′
[0033] y[n]+b1y[n-1]+b2y[n-2]=a0x[n]+a1x[n-1]+a2x[n-2]
[0034] ″″′
[0035] Among them, b1, b2, a0, a1, and a2 are normalized coefficients.
[0036] Furthermore: the value of the resonant frequency w0 is the same as the frequency of the AC signal to be extracted.
[0037] Further: the step S5 specifically includes:
[0038] S51: taking the AC signal as an input signal;
[0039] S52: Calculate the difference between the input signal and the output signal;
[0040] S53: Using the difference as an input of a quasi-proportional resonant filter for filtering.
[0041] Further: by adjusting the proportionality coefficient k p , resonance coefficient k r , cut-off frequency w c At least one parameter in is used to adjust the filtering effect.
[0042] Furthermore: by increasing the resonance coefficient k r, improving the filter's selectivity to signals at the resonant frequency.
[0043] Compared with the prior art, the present invention has the following beneficial effects:
[0044] The present invention adopts a quasi-proportional resonance algorithm combined with a bilinear transformation scheme to successfully solve the phase offset and amplitude attenuation problems in AC signal filtering. On the one hand, through the transfer function design of the quasi-proportional resonance algorithm, the accurate extraction of the AC signal of a specific frequency is achieved, ensuring that the effective signal after filtering has no amplitude attenuation and no phase offset, and significantly improving the fidelity of the signal. On the other hand, the bilinear transformation is used to convert the continuous transfer function into a discrete transfer function, and a complete set of differential equations is derived, so that the filtering algorithm is easy to implement in a digital system without the need for additional hardware circuit support, thereby reducing the implementation cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 is a flow chart of an AC filtering method based on a quasi-proportional resonance algorithm in an embodiment;
[0046] Figure 2 This is a simulation result diagram of a 50Hz AC signal under random noise interference by the filtering method of the present invention;
[0047] Figure 3 The figure is a simulation result diagram of a 50Hz AC signal under high-order frequency noise interference by the filtering method of the present invention;
[0048] Figure 4 The figure is a simulation result diagram of a 50Hz AC signal under the interference of high-frequency device noise by the filtering method of the present invention;
[0049] Figure 5 The figure is a simulation result diagram of a 50Hz AC signal under the interference of a superimposed DC component by the filtering method of the present invention;
[0050] Figure 6 The figure is a simulation result diagram of a 50Hz AC signal under mixed noise interference by the filtering method of the present invention;
[0051] Figure 7 The figure is a simulation result diagram of a 100 Hz AC signal under mixed noise interference by the filtering method of the present invention;
[0052] Figure 8 This is a diagram showing the filtering effect of the present invention when applied to actual AC voltage sampling. DETAILED DESCRIPTION
[0053] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0054] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0055] In a specific embodiment of the present invention, an AC filtering method based on a quasi-proportional resonance algorithm comprises the following steps:
[0056] S1: Obtain the AC signal to be processed;
[0057] In some other embodiments, the specific steps of S1 are as follows: an AC signal is collected by a sampling circuit to obtain a sampled voltage value V sample ;The sampling voltage reference value is V ref , the number of bits of the sampling analog-to-digital converter is n, according to the formula
[0058]
[0059] Calculate the digital value V of the AC signal AD .
[0060] S2: Establish the continuous transfer function of the quasi-proportional resonant filter:
[0061]
[0062] Among them, w c is the cut-off frequency used to adjust the filter bandwidth, w0 is the resonant frequency, that is, the frequency of the extracted AC signal, k p is the proportional coefficient used to adjust the dynamic response speed of the filtering system, k r The resonance coefficient can be adjusted to achieve zero steady-state error in tracking the AC signal, and s is a complex frequency operator;
[0063] Then, in order to implement the filter in a digital system, the continuous transfer function needs to be discretized.
[0064] S3: Convert the continuous transfer function into a discrete transfer function using a bilinear transformation:
[0065] The bilinear transformation of s is expressed as:
[0066]
[0067] Substituting the above equation into the continuous transfer function described in S2, we get the discrete transfer function:
[0068]
[0069] Among them, T s is the calculation step time, z is the complex variable of the discrete system, and w0 is the resonant frequency;
[0070] S4: According to the discrete transfer function described in S3, the difference equation is obtained:
[0071] b0y[n]+b1y[n-1]+b2y[n-2]=a0x[n]+a1x[n-1]+a2x[n-2]
[0072] Where x[n] is the input signal, y[n] is the output signal, a0, a1, a2 are coefficients related to the x[n] input signal, b0, b1,
[0073] b2 is the coefficient associated with the y[n] input signal;
[0074] Specifically, the coefficients of the difference equation satisfy:
[0075]
[0076] In practical applications, the coefficient b0 of the difference equation is usually normalized to obtain:
[0077] ″″′
[0078] y[n]+b1y[n-1]+b2y[n-2]=a0x[n]+a1x[n-1]+a2x[n-2]
[0079] ″″′
[0080] Among them, b1, b2, a0, a1, and a2 are normalized coefficients.
[0081] S5: Filter the AC signal using the differential equation.
[0082] Specifically, during the filtering process, the AC signal to be processed is used as the input signal, the difference between the input signal and the output signal is calculated, and the difference is used as the input of the quasi-proportional resonant filter for filtering. p, resonance coefficient k r , cut-off frequency w c In particular, by increasing the resonance coefficient k r , improving the filter's selectivity to signals at the resonant frequency.
[0083] To further illustrate the advantages of this method, the present invention also provides two sets of simulation experimental data for illustration:
[0084] The Simulink toolbox of Matlab software is used to build a simulation model of the filtering algorithm of the present invention, and the input signal port and the output signal port are reserved to compare the signals before and after filtering.
[0085] In order to highlight that the filtering method of the present invention can effectively extract AC signals of a specific frequency, the first group of simulation experiments used an AC signal with a base frequency of 50Hz, and superimposed different noise signals for filtering comparison. The superimposed noise signals included sampling random noise, high-order harmonic noise, high-frequency switching noise, DC component noise, etc. The simulation results show that the filtering algorithm proposed in the present invention can effectively filter out the above noise signals and accurately extract 50Hz AC signals without filtering phase shift. The specific test parameters and results are as follows:
[0086] In the first set of simulation verifications, the simulation step size was 1μs, the effective signal frequency was 50Hz, the amplitude was 311, the unbiased sine wave signal, the proportional coefficient of the filtering algorithm was 0.05, the resonance coefficient was 20, the cutoff frequency was 0.02, the resonance frequency was 50, and the noise signal was superimposed five times. In each set of simulation results, the red signal is the ideal signal, the black signal is the ideal signal superimposed on the noise signal, that is, the input signal of the filtering algorithm, and the blue signal is the output signal of the filtering algorithm. The first superposition of a uniformly distributed random signal, the maximum and minimum values of the random signal are + / -200, the frequency is 1MHz, and the simulation results are as follows Figure 2 As shown; the second time, three sine wave noises of different frequencies are superimposed. The first sine wave noise frequency is 150Hz, no bias, and the amplitude is 50. The second sine wave noise frequency is 300Hz, no bias, and the amplitude is 50. The third sine wave noise frequency is 550Hz, no bias, and the amplitude is 50. The simulation results are as follows Figure 3 As shown; the third time the high-frequency switching device signal noise is superimposed, the noise is presented in the form of a square wave, with an amplitude of 200, a frequency of 10kHz, and a duty cycle of 50%. A certain correction is made to the amplitude of the filtered signal. The simulation results are as follows Figure 4 As shown; the fourth time the DC component is superimposed, the sinusoidal signal is offset by +100, and the simulation results are as follows Figure 5 As shown; the fifth time, the above noise signals are superimposed simultaneously, and the simulation results are as follows Figure 6 As shown;
[0087] Based on the simulation results, it can be seen that no matter what kind of noise is superimposed, the filtering algorithm of the present invention can effectively filter out the noise signal, so that the filtered signal is basically consistent with the ideal signal and has no phase shift deviation.
[0088] In order to illustrate the universality and extensibility of the filtering algorithm of the present invention, in the second group of simulation tests, an AC signal with a base frequency of 100 Hz was used, and random noise, high-order harmonic noise, DC component noise, high-frequency switching device noise, etc. were superimposed. The simulation results show that the filtering algorithm of the present invention can also effectively extract 100 Hz AC signals without filtering phase shift. The specific test parameters and results are as follows:
[0089] In the second set of simulation verification, a comparative analysis of noise superposition was conducted. The simulation step size was 1μs, the effective signal frequency was 100Hz, the amplitude was 311, the unbiased sine wave signal, the proportional coefficient of the filtering algorithm was 0.05, the resonance coefficient was 20, the cutoff frequency was 0.02, the resonance frequency was 100, and multiple noise signals were superimposed at the same time. The simulation results are as follows: Figure 7 As shown, the red signal is the ideal signal, the black signal is the ideal signal superimposed with the noise signal, that is, the input signal of the filtering algorithm, and the blue signal is the output signal of the filtering algorithm. The simulation results show that the filtering algorithm can effectively filter out the noise and extract the 100Hz AC signal, which verifies the versatility of the filtering algorithm proposed in the present invention and can effectively extract AC signals of different frequencies.
[0090] In addition, the present invention also provides a practical application case to further illustrate the advantages of the present invention.
[0091] like Figure 8 As shown in the figure, the blue line is the original collected AC voltage, and the red line is the AC voltage after filtering. After the filtering algorithm is used, the noise signal is suppressed, the signal-to-noise ratio of the control signal is improved, and a smoother AC voltage signal is obtained without obvious phase shift.
[0092] The above embodiments are only for illustrating the technical concept and features of the present invention, and their purpose is to enable people familiar with the technology to understand the content of the present invention and implement it accordingly, and they cannot be used to limit the protection scope of the present invention. Any equivalent transformation or modification made according to the spirit of the present invention should be included in the protection scope of the present invention.
Claims
1. An AC filtering method based on a quasi-proportional resonance algorithm, characterized in that: The following steps are involved: S1: Obtain the AC signal to be processed; S2: Establish the continuous transfer function of the quasi-proportional resonant filter: Among them, w c is the cut-off frequency used to adjust the filter bandwidth, w0 is the resonant frequency, that is, the frequency of the extracted AC signal, k p is the proportional coefficient used to adjust the dynamic response speed of the filtering system, k r The resonance coefficient can be adjusted to achieve zero steady-state error in tracking the AC signal, and s is a complex frequency operator; S3: Convert the continuous transfer function into a discrete transfer function using a bilinear transformation: The bilinear transformation of s is expressed as: Substituting the above equation into the continuous transfer function described in S2, we get the discrete transfer function: Among them, T s is the calculation step time, z is the complex variable of the discrete system, and w0 is the resonant frequency; S4: According to the discrete transfer function described in S3, the difference equation is obtained: b0y[n]+b1y[n-1]+b2y[n-2]=a0x[n]+a1x[n-1]+a2x[n-2] Where x[n] is the input signal, y[n] is the output signal, a0, a1, a2 are coefficients related to the x[n] input signal, and b0, b1, b2 are coefficients related to the y[n] input signal; S5: Filter the AC signal using the differential equation.
2. The AC filtering method based on quasi-proportional resonance algorithm according to claim 1 is characterized in that: The step S1 specifically includes: S11: Collecting AC signals through a sampling circuit to obtain a sampled voltage value; S12: Calculate the digital value of the AC signal according to the sampled voltage value, the sampled voltage reference value and the number of bits of the sampling analog-to-digital converter.
3. The AC filtering method based on quasi-proportional resonance algorithm according to claim 2 is characterized in that: In step S12, the calculation formula of the digital quantity of the AC signal is: Among them, V AD is the digital value of the AC signal, V sample is the sampling voltage value, V ref is the sampling voltage reference value, and n is the number of bits of the sampling analog-to-digital converter.
4. The AC filtering method based on quasi-proportional resonance algorithm according to claim 1 is characterized in that: In step S4, the coefficients of the differential equation satisfy:
5. The AC filtering method based on quasi-proportional resonance algorithm according to claim 4 is characterized in that: In step S5, the coefficient b0 of the differential equation is normalized to obtain: ″″′ y[b]+b1y[n-1]+b2y[n-2]=a0x[n]+a1x[b-1]+a2x[n-2] ″″′ Among them, b1, b2, a0, a1, and a2 are normalized coefficients.
6. The AC filtering method based on quasi-proportional resonance algorithm according to claim 1, characterized in that: The value of the resonant frequency w0 is the same as the frequency of the AC signal to be extracted.
7. The AC filtering method based on quasi-proportional resonance algorithm according to claim 1 is characterized in that: The step S5 specifically includes: S51: taking the AC signal as an input signal; S52: Calculate the difference between the input signal and the output signal; S53: Using the difference as an input of a quasi-proportional resonant filter for filtering.
8. An AC filtering method based on a quasi-proportional resonance algorithm according to any one of claims 1 to 7, characterized in that: By adjusting the proportionality factor k p , resonance coefficient k r , cut-off frequency w c At least one parameter in is used to adjust the filtering effect.
9. The AC filtering method based on quasi-proportional resonance algorithm according to claim 8, characterized in that: By increasing the resonance coefficient k r , improving the filter's selectivity to signals at the resonant frequency.