A harmonic detection control method for active power filters

By establishing a bidirectional collaborative mechanism between sliding window Fourier analysis and phase-locked loop (PLL) in the active power filter, the problem of PLL being affected by grid voltage distortion is solved, achieving high-precision harmonic detection and compensation, and meeting the grid current quality requirements of the IEEE 519 standard.

CN122136861APending Publication Date: 2026-06-02STATE GRID SHANGHAI MUNICIPAL ELECTRIC POWER CO
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
STATE GRID SHANGHAI MUNICIPAL ELECTRIC POWER CO
Filing Date
2026-02-12
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

Existing active power filter harmonic detection technology relies on phase-locked loops, which are susceptible to grid voltage distortion, leading to phase drift and harmonic detection errors, and thus failing to meet the total harmonic distortion rate requirements of the IEEE 519 standard.

Method used

A bidirectional collaborative mechanism between sliding window Fourier analysis and phase-locked loop (PLL) is constructed. By correcting the phase error of the PLL through feedback, a bidirectional collaborative closed-loop control based on the fundamental current phase is established to cut off error propagation and improve detection accuracy.

Benefits of technology

It effectively reduces phase error of phase-locked loop, improves the accuracy of harmonic detection and compensation effect, and reduces the total harmonic distortion rate of grid current to below the IEEE 519 standard.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122136861A_ABST
    Figure CN122136861A_ABST
Patent Text Reader

Abstract

This invention discloses a harmonic detection and control method for an active power filter, comprising: establishing an active power filter system and performing mathematical modeling, the active power filter system including a main circuit, a harmonic detection unit, a phase tracking unit, and a compensation control unit; deriving the voltage and current equations of the main circuit in a two-phase rotating coordinate system based on Kirchhoff's laws, and clarifying the interference paths of grid harmonics on the harmonic detection unit and the phase tracking unit; establishing a harmonic detection unit based on sliding window Fourier analysis and a phase tracking unit based on a phase-locked loop; and establishing a bidirectional collaborative mechanism between the harmonic detection unit and the phase tracking unit; and achieving harmonic compensation through the compensation control unit based on the harmonic information detected by the harmonic detection unit; the bidirectional collaborative mechanism includes: substituting the fundamental voltage phase output by the phase-locked loop into the Fourier coefficient calculation formula, and feeding back the fundamental current phase output by the harmonic detection unit to the phase-locked loop.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power quality management technology for power systems, and in particular to a harmonic detection and control method for active power filters. Background Technology

[0002] With the widespread application of power electronic equipment (such as frequency converters and rectifiers), the proportion of nonlinear loads in the power grid has surged, leading to excessive harmonic current content and a total harmonic distortion (THD) exceeding 5%, which severely affects power supply quality. Active power filters (APFs), as core devices for harmonic mitigation, rely on the accuracy of harmonic detection for their compensation effectiveness. Currently, the mainstream sliding window Fourier analysis (SWFA) harmonic detection technology requires a phase-locked loop (PLL) to provide the fundamental phase of the grid voltage as a calculation reference in order to accurately extract harmonic components.

[0003] However, existing technologies have certain drawbacks. For example, when the grid voltage is distorted (e.g., total harmonic distortion (THD) = 10%), the phase-locked loop (PLL) is susceptible to harmonic interference, causing phase drift of the output fundamental frequency (with an error of 5°~8°). Furthermore, sliding window Fourier analysis calculates harmonics based on an incorrect phase reference, which can lead to misjudgment of harmonic frequencies and phase misalignment. This results in a misalignment between the compensation current and the actual harmonics, ultimately preventing the total harmonic distortion of the grid current from being reduced to below the IEEE 519 standard (≤5%).

[0004] Existing improvement schemes mostly optimize the sliding window Fourier analysis (e.g., increasing the sliding window length) or the phase-locked loop (e.g., adding a low-pass filter) separately, but they do not resolve the fundamental contradiction of unidirectional dependence. That is, the sliding window Fourier analysis requires a phase reference provided by the phase-locked loop, but cannot assist the phase-locked loop in anti-interference. Furthermore, when the phase-locked loop is affected by harmonic interference, the error will propagate to the sliding window Fourier analysis, forming an error chain. Therefore, to at least solve one of the above problems, a harmonic detection and control method for active power filters is urgently needed. Summary of the Invention

[0005] The purpose of this invention is to provide a harmonic detection and control method for active power filters. By constructing a bidirectional collaborative mechanism, the sliding window Fourier analysis and phase-locked loop are mutually calibrated to cut off error propagation.

[0006] To achieve the above objectives, the present invention is implemented through the following technical solution: This invention provides a harmonic detection and control method for an active power filter, comprising: An active power filter system is established and mathematically modeled. The active power filter system includes a main circuit, a harmonic detection unit, a phase tracking unit, and a compensation control unit. The voltage and current equations of the main circuit in a two-phase rotating coordinate system are derived based on Kirchhoff's laws, and the interference path of the grid harmonics of the main circuit to the harmonic detection unit and the phase tracking unit is clarified. A harmonic detection unit based on sliding window Fourier analysis and a phase tracking unit based on a phase-locked loop are established; and a bidirectional collaborative mechanism between the harmonic detection unit and the phase tracking unit is established; based on the harmonic information detected by the harmonic detection unit, harmonic compensation is achieved through the compensation control unit; wherein, the bidirectional collaborative mechanism includes: substituting the fundamental voltage phase output by the phase-locked loop into the calculation formula of the Fourier coefficients, and feeding back the fundamental current phase output by the harmonic detection unit to the phase-locked loop.

[0007] Optionally, establishing the harmonic detection unit based on sliding window Fourier analysis includes: A current transformer is installed on the load side to collect the load current. The load current is divided into sliding windows of fixed length, and a discrete Fourier transform is performed on each window to extract the fundamental current component and each characteristic harmonic current component. The phase information of the fundamental current component is used as the phase of the fundamental current.

[0008] Optionally, the length of the sliding window is set to 1 / 4 of the fundamental period of the power grid, and the fundamental current component and the 5th to 19th characteristic harmonic current components are calculated by discrete Fourier transform.

[0009] Optionally, establishing the phase tracking unit based on a phase-locked loop includes: Voltage transformers are installed on the grid side to collect grid voltage, and the fundamental voltage phase of the grid is tracked by a phase-locked loop. The fundamental current phase extracted by the harmonic detection unit is introduced as a feedback correction term. When the phase error of the phase-locked loop exceeds a preset threshold, the fundamental current phase is superimposed on the phase tracking equation of the phase-locked loop through proportional-integral adjustment to correct the phase drift caused by grid harmonic interference. The phase tracking equation is as follows: in, The corrected fundamental voltage phase. The fundamental current phase. The phase of the fundamental voltage obtained by phase-locked loop tracking. , These are the proportional-integral correction factors. This is the rated angular frequency of the power grid.

[0010] Optionally, the Fourier coefficients are calculated using the following formula: Fundamental current amplitude: Harmonic current amplitude: Where N is the number of sliding windows, and h is the harmonic order. The sampling period is The fundamental angular frequency, For load current, This represents the phase of the fundamental voltage.

[0011] Optionally, the main circuit includes a power grid, a nonlinear load, and a converter.

[0012] Optionally, the harmonic compensation based on the harmonic information detected by the harmonic detection unit and implemented through the compensation control unit includes: inputting the accurate harmonic information detected by the harmonic detection unit into the compensation control unit to generate a command current with the same amplitude and opposite phase as the harmonic; The voltage outer loop uses proportional-integral control to stabilize the DC-side voltage of the active power filter, while the current inner loop tracks the command current. A drive signal is generated by space voltage vector pulse width modulation to control the switching of the IGBT (Insulated Gate Bipolar Transistor) of the converter.

[0013] Optionally, the step of using proportional-integral control in the voltage outer loop to stabilize the DC-side voltage of the active power filter includes: when the DC-side voltage deviates from a preset value, supplementing the DC-side energy by adjusting the fundamental active component of the command current on the d-axis; The step of tracking the command current in the inner current loop includes: tracking the difference between the command current and the actual compensation current in the inner current loop to ensure that the phase deviation between the output compensation current and the harmonic current detected by the harmonic detection unit is ≤1°.

[0014] Optionally, the active power filter is a three-phase three-wire parallel active power filter.

[0015] Optionally, the harmonic detection and control method for active power filters further includes: building a simulation model to simulate grid voltage distortion scenarios, in order to verify the improvement of the phase-locked loop phase error, the detection accuracy of the harmonic detection unit, and the compensation effect of the active power filter by the bidirectional collaborative mechanism.

[0016] This invention has at least the following technical effects: By constructing a two-way collaborative closed-loop mechanism of phase-locked loop and sliding window Fourier analysis, the traditional one-way dependency mode can be broken, which is conducive to cutting off error propagation and improving detection accuracy. Attached Figure Description

[0017] Figure 1 This is a schematic flowchart of a harmonic detection and control method for an active power filter provided in an embodiment of the present invention. Figure 2 This is a logic diagram of an active power filter system provided in an embodiment of the present invention. Detailed Implementation

[0018] The following detailed description, in conjunction with the accompanying drawings and specific embodiments, provides a further detailed explanation of the harmonic detection and control method for active power filters proposed in this invention. The advantages and features of this invention will become clearer from the following description. It should be noted that the drawings are in a very simplified form and use non-precise proportions, intended only to facilitate and clearly illustrate the embodiments of this invention. Please refer to the drawings to make the objectives, features, and advantages of this invention more apparent and understandable. It should be understood that the structures, proportions, sizes, etc., depicted in the accompanying drawings are only for illustrative purposes to aid those skilled in the art and are not intended to limit the implementation conditions of this invention. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in proportions, or adjustments to the size, without affecting the effects and objectives achieved by this invention, should still fall within the scope of the technical content disclosed in this invention.

[0019] like Figure 1 As shown, to address the problems of phase error, inaccurate detection, and compensation failure caused by the one-way dependence of existing sliding window Fourier analysis-phase-locked loop methods, this embodiment provides a harmonic detection and control method for active power filters, including the following steps: Step S1: Establish an active power filter system and perform mathematical modeling; Step S2: Establish a harmonic detection unit based on sliding window Fourier analysis; Step S3: Establish a phase tracking unit based on a phase-locked loop; Step S4: Establish a two-way collaborative mechanism between the harmonic detection unit (sliding window Fourier analysis) and the phase tracking unit (phase-locked loop); Step S5: Based on the harmonic information detected by the harmonic detection unit, harmonic compensation is achieved through the compensation control unit; and Step S6: Build a simulation model to simulate the power grid voltage distortion scenario, in order to verify the improvement of the two-way collaborative mechanism on the phase-locked loop phase error, the detection accuracy of the harmonic detection unit, and the compensation effect of the active power filter.

[0020] First, in step S1, the active power filter is, for example, a three-phase three-wire parallel active power filter. (See reference...) Figure 2An active power filter system may include a main circuit, a harmonic detection unit, a phase tracking unit, and a compensation control unit. The main circuit includes the power grid, a nonlinear load, and a converter for the active power filter. The DC-side voltage Udc of the main circuit is, for example, 700V, the filter inductance L is, for example, 2mH, and the DC-side capacitance C is, for example, 2000μF. Parameter matching can be determined based on circuit transient analysis. The voltage and current equations of the main circuit in a two-phase rotating coordinate system (dq rotating coordinate system) can be derived based on Kirchhoff's laws, and the interference paths of the power grid harmonics on the harmonic detection unit (sliding window Fourier analysis) and the phase tracking unit (phase-locked loop) can be identified.

[0021] Specifically, neglecting resistive losses, the voltage and current equations of the main circuit of the active power filter system in a two-phase rotating coordinate system are as follows: in, , They are respectively d , q Dynamic voltage drop of shaft inductor, This represents the dynamic current of the DC-side capacitor. id , iq These are the compensation currents for the active power filters. d , q Axial components; usd , usq These are the mains voltages. d , q Axial components; Sd , Sq These are the switching functions; Udc This is the DC-side voltage of the active power filter, for example, it can be set to 700V; w The angular frequency of the power grid. t For time, L This is a filter inductor.

[0022] The above equations show that power grid harmonics will pass through usd , usq It affects the phase detection of the phase-locked loop, and thus affects the harmonic extraction accuracy of the sliding window Fourier analysis through phase reference offset.

[0023] Furthermore, in step S2, to establish a harmonic detection unit based on sliding window Fourier analysis, a current transformer can be installed on the load side to collect the load current. The load current is divided into a sliding window of fixed length, and a discrete Fourier transform is performed on each window to extract the fundamental current component and the characteristic harmonic current components, such as the 5th, 7th, and 11th harmonics. The phase information of the fundamental current component is used as the fundamental current phase, which can be used as a reference signal for phase-locked loop correction.

[0024] Specifically, the length of the sliding window can be set to 1 / 4 of the fundamental period of the power grid. For example, for a 50Hz power grid, the length of the sliding window can be set to 5ms. The fundamental current component and the characteristic harmonic current components of the 5th to 19th orders are calculated using discrete Fourier transform. This embodiment uses an incremental calculation method that combines the elimination of old window data with the superposition of new window data, which helps to reduce the amount of real-time calculation and ensures that the fundamental current phase extraction delay is ≤1ms.

[0025] For example, the load current can be... Divided into a sliding window of length N, the phase of the pure fundamental current The calculation formula (unaffected by harmonic interference) is as follows: in, The sampling period is, for example, 100 μs. w0 This is the fundamental angular frequency, for example, 314 rad / s.

[0026] Further, in step S3, to establish a phase tracking unit based on a phase-locked loop (PLL), a voltage transformer can be installed on the grid side to collect the grid voltage, and the fundamental voltage phase of the grid can be tracked through the PLL. The fundamental current phase extracted by the harmonic detection unit is introduced as a feedback correction term. When the phase error of the PLL exceeds a preset threshold, the fundamental current phase is superimposed on the phase tracking equation of the PLL through proportional-integral (PI) adjustment to correct the phase drift caused by grid harmonic interference. The preset threshold is, for example, 5°.

[0027] Specifically, the phase tracking equation obtained through proportional-integral adjustment is as follows: in, The corrected fundamental voltage phase. The phase of the fundamental current, through It can provide feedback to cancel out harmonic interference on the phase-locked loop. The phase of the fundamental voltage obtained by phase-locked loop tracking. , These are the proportional-integral correction factors, for example, 0.5 and 10 respectively. ω is the rated angular frequency of the power grid. t is time. Based on stability analysis using control theory, it can be proven that the model can reduce the phase error of the phase-locked loop from 5° to within 1°.

[0028] Furthermore, in step S4, the establishment of a bidirectional collaborative mechanism includes reverse correction and forward optimization, that is, substituting the fundamental voltage phase output by the phase-locked loop into the calculation formula of the Fourier coefficients, and feeding back the fundamental current phase output by the harmonic detection unit to the phase-locked loop.

[0029] Specifically, due to the extraction of sliding window Fourier analysis It possesses pure fundamental wave characteristics (THD≤1%) and is unaffected by power grid harmonics. Therefore, the phase error of the phase-locked loop can be defined. .

[0030] in, The grid voltage signal is acquired by a voltage transformer installed on the grid side, and the signal is obtained by phase tracking using a standard phase-locked loop (PLL). When the value exceeds a preset threshold, the proportional-integral correction stage is triggered. Based on Lyapunov stability theory, it can be proven that this correction mechanism can... The circuit converges rapidly to within 1°, effectively offsetting harmonic interference to the phase-locked loop (PLL). This invention, by constructing a bidirectional collaborative closed-loop mechanism combining the PLL and sliding-window Fourier analysis, breaks the traditional unidirectional dependency mode, cuts off error propagation, and improves detection accuracy.

[0031] Furthermore, the modified phase-locked loop can output a stable phase. It can stabilize the phase Substitute the values ​​into the formula for calculating the Fourier coefficients in sliding window Fourier analysis. Specifically, the formula for calculating the Fourier coefficients is as follows: Fundamental current amplitude: Harmonic current amplitude: Where h is the harmonic order and N is the length of the sliding window. The sampling period is The fundamental angular frequency, For load current, For the fundamental voltage phase, it can be understood that this is used in calculations when corrections are required. The corrected fundamental voltage phase Traditional sliding window Fourier analysis suffers from phase reference drift, affecting the harmonic current amplitude. The calculation error exceeds 30%, and this invention can be passed. Precisely locating the harmonic phase can... The calculation error is reduced to below 22.5%, ensuring the amplitude and phase accuracy of harmonic detection.

[0032] Further, in step S5, the precise harmonic information detected by the harmonic detection unit can be input into the compensation control unit. This precise harmonic information includes amplitude and phase, so that the compensation control unit can generate a command current with the same amplitude but opposite phase as the harmonics. Proportional-integral control can be used in the outer voltage loop to stabilize the DC-side voltage of the active power filter. The command current is tracked in the inner current loop, and a drive signal is generated using space vector pulse width modulation (SVPWM) to control the IGBT switching of the converter, thereby achieving harmonic compensation.

[0033] Based on the compensation principle of equal amplitude and opposite phase, the command compensation current is... Theoretically, this can completely cancel out the harmonic components of the power grid. Among them, These represent the harmonic amplitude and phase detected by sliding window Fourier analysis, respectively, where h is the harmonic order. The fundamental angular frequency, t For time.

[0034] In some embodiments, stabilizing the DC-side voltage of an active power filter using proportional-integral (PI) control in the outer voltage loop includes: when the DC-side voltage deviates from a preset value, supplementing the DC-side energy by adjusting the fundamental active component of the command current on the d-axis. The preset value for the DC-side voltage is, for example, 700V. The transfer function of the outer voltage loop PPI control is shown below: in, This is the proportional correction factor for the voltage loop. is the integral correction coefficient for the voltage loop, and s is the Laplace operator.

[0035] By adjusting the d-axis fundamental active current component This allows the power grid to supplement active power to the DC side of the active power filter. The DC side energy balance equation is shown below: Based on the above formula, this control method can enable... Udc It remains stable within the range of 700V±5%.

[0036] In some embodiments, tracking the command current in the current inner loop includes: generating the difference between the command current and the actual compensation current through proportional-integral adjustment. Sd and Sq This ensures that the phase deviation between the output compensation current and the harmonic current detected by the harmonic detection unit is ≤1°. The steady-state error of this tracking mechanism is ≤1%, which ensures that the phase deviation between the output compensation current and the command current of the active power filter is ≤1°.

[0037] Furthermore, generating the drive signal through space voltage vector pulse width modulation includes using a switching function. Sd and Sq The command voltage is converted into a three-phase stationary coordinate system, and based on the space voltage vector theory, the IGBT drive signal that meets the control requirements of the active power filter converter can be generated through sector judgment and vector synthesis to cancel grid harmonics and achieve precise compensation current output.

[0038] Finally, in step S6, a grid voltage distortion scenario can be simulated to verify the performance of the bidirectional collaborative mechanism.

[0039] Specifically, regarding the anti-interference performance of phase-locked loops (PLLs), when the grid voltage THD = 10%, the phase error of traditional PLLs... This invention uses sliding window Fourier analysis for inverse correction, based on error propagation theory, to obtain... The error was reduced by 84.6%.

[0040] Regarding the detection accuracy of sliding window Fourier analysis, combined with Fourier transform error analysis, the detection error of the 5th harmonic of traditional sliding window Fourier analysis is 32%, and that of the 7th harmonic is 28%. After introducing a phase-locked loop to stabilize the phase, the detection error of the 5th harmonic is reduced to 24%, and that of the 7th harmonic is reduced to 21%, both by 25%.

[0041] Regarding the compensation effect of active power filters, based on the superposition theorem, the grid current after compensation by the active power filter is derived. ,in , To compensate for the downstream grid current, For load current, This is the actual compensation current output by the APF. As a reference current, under ideal conditions, The amplitude of the current should be equal to that of the harmonic current to be canceled, but the phase should be opposite, so that the two currents can cancel each other out after being superimposed. Theoretically, this can make the THD of the grid current ≤ 3%, which complies with the IEEE 519-2014 standard.

[0042] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0043] It should be noted that the apparatus and methods disclosed in the embodiments herein can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings show the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments herein. In this regard, each block in a flowchart or block diagram may represent a module, program, or part of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system to perform the specified function or action, or can be implemented using a combination of dedicated hardware and computer instructions.

[0044] In addition, the functional modules in the various embodiments of this article can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0045] Although the present invention has been described in detail through the preferred embodiments above, it should be understood that the above description should not be considered as a limitation of the present invention. Various modifications and substitutions to the present invention will be apparent to those skilled in the art after reading the above description. Therefore, the scope of protection of the present invention should be defined by the appended claims.

Claims

1. A harmonic detection and control method for an active power filter, characterized in that, include: An active power filter system is established and mathematically modeled. The active power filter system includes a main circuit, a harmonic detection unit, a phase tracking unit, and a compensation control unit. The voltage and current equations of the main circuit in a two-phase rotating coordinate system are derived based on Kirchhoff's laws, and the interference path of the grid harmonics of the main circuit to the harmonic detection unit and the phase tracking unit is clarified. A harmonic detection unit based on sliding window Fourier analysis and a phase tracking unit based on a phase-locked loop are established; and a bidirectional collaborative mechanism between the harmonic detection unit and the phase tracking unit is established; based on the harmonic information detected by the harmonic detection unit, harmonic compensation is achieved through the compensation control unit; wherein, the bidirectional collaborative mechanism includes: substituting the fundamental voltage phase output by the phase-locked loop into the calculation formula of the Fourier coefficients, and feeding back the fundamental current phase output by the harmonic detection unit to the phase-locked loop.

2. The harmonic detection and control method for active power filters according to claim 1, characterized in that, The harmonic detection unit based on sliding window Fourier analysis includes: A current transformer is installed on the load side to collect the load current. The load current is divided into sliding windows of fixed length, and a discrete Fourier transform is performed on each window to extract the fundamental current component and each characteristic harmonic current component. The phase information of the fundamental current component is used as the phase of the fundamental current.

3. The harmonic detection and control method for active power filters according to claim 2, characterized in that, The length of the sliding window is set to 1 / 4 of the fundamental period of the power grid, and the fundamental current component and the 5th to 19th characteristic harmonic current components are calculated by discrete Fourier transform.

4. The harmonic detection and control method for active power filters according to claim 2, characterized in that, Establishing the phase tracking unit based on a phase-locked loop includes: Voltage transformers are installed on the grid side to collect grid voltage, and the fundamental voltage phase of the grid is tracked by a phase-locked loop. The fundamental current phase extracted by the harmonic detection unit is introduced as a feedback correction term. When the phase error of the phase-locked loop exceeds a preset threshold, the fundamental current phase is superimposed on the phase tracking equation of the phase-locked loop through proportional-integral adjustment to correct the phase drift caused by grid harmonic interference. The phase tracking equation is as follows: in, The corrected fundamental voltage phase. The fundamental current phase. The phase of the fundamental voltage obtained by phase-locked loop tracking. , These are the proportional-integral correction factors. This is the rated angular frequency of the power grid.

5. The harmonic detection and control method for active power filters according to claim 4, characterized in that, The formula for calculating the Fourier coefficients is as follows: Fundamental current amplitude: Harmonic current amplitude: in, For harmonic order, The length of the sliding window. The sampling period is The fundamental angular frequency, For load current, This represents the phase of the fundamental voltage.

6. The harmonic detection and control method for an active power filter according to claim 1, characterized in that, The main circuit includes a power grid, a nonlinear load, and a converter.

7. The harmonic detection and control method for an active power filter according to claim 6, characterized in that, The harmonic compensation based on the harmonic information detected by the harmonic detection unit and implemented through the compensation control unit includes: inputting the accurate harmonic information detected by the harmonic detection unit into the compensation control unit to generate a command current with the same amplitude and opposite phase as the harmonic; The voltage outer loop uses proportional-integral control to stabilize the DC-side voltage of the active power filter, while the current inner loop tracks the command current. A drive signal is generated by space voltage vector pulse width modulation to control the IGBT switching of the converter.

8. The harmonic detection and control method for an active power filter according to claim 7, characterized in that, The method of using proportional-integral control in the voltage outer loop to stabilize the DC-side voltage of the active power filter includes: when the DC-side voltage deviates from the preset value, supplementing the DC-side energy by adjusting the fundamental active component of the command current on the d-axis; The step of tracking the command current in the inner current loop includes: tracking the difference between the command current and the actual compensation current in the inner current loop to ensure that the phase deviation between the output compensation current and the harmonic current detected by the harmonic detection unit is ≤1°.

9. The harmonic detection and control method for an active power filter according to claim 1, characterized in that, The active power filter is a three-phase, three-wire, parallel active power filter.

10. The harmonic detection and control method for an active power filter according to claim 1, characterized in that, Also includes: A simulation model was built to simulate a power grid voltage distortion scenario in order to verify the improvement of the bidirectional collaborative mechanism on the phase-locked loop phase error, the detection accuracy of the harmonic detection unit, and the compensation effect of the active power filter.