In order to improve the ability of traditional dq harmonic detection method to respond to grid-side voltage distortion, a virtual flux-oriented harmonic detection method based on composite second-order generalized integrator is proposed. The method uses the virtual flux as an improvement of the Synchronous Reference Frame Phase-locked Loop , and replaces the conventional low-pass filter with the composite second-order generalized integrator, which eliminates the detection error of the traditional dq harmonic detection method that due to the harsh conditions of voltage asymmetry and distortion of the three-phase power grid, and the grid phase angle and frequency can be accurately locked. The simulation and experiment results show that the improved harmonic detection method is not affected by the imbalance and distortion of the power grid, the fundamental wave positive sequence current has no distortion,and it can accurately track changes of frequency. It proves that the virtual flux directional harmonic detection method based on composite second order generalized integrator proposed in this paper effectiveness.