Active Power Filter (APF) is in parallel connection with the power grid, and through real-time detection of harmonics in the power grid with the external mutual inductor and calculation and analysis of reverse-phase compensating current caused by the inverter, dynamic filtering of harmonics from the gird or dynamic reactive compensation will be achieved. APF can run separately, or several APFs can be connected in parallel manner to achieve greater compensation capacity. It is suitable for harmonics control in various situations.