PV inverter is controlled by the power electronic switch control, which can be used to participate in the power generation and the compensation management of reactive power optimization and harmonious wave. Conventional reactive current and harmonic current detection algorithm of ip-iq method in unbalanced three-phase voltage detection effect is not ideal, based on core idea of the instantaneous reactive power theory this paper proposed an improved ip-iq algorithm, which can overcome the problem of this test is not accurate. By a specific algorithm implementation design and experimental verification, can realize three-phase voltage unbalance is reactive power detection of reactive power and harmonic components, and then the implementation of the compensation, to realize adjustment of the power of the PV grid connected system, the active participation of distribution network power control optimization, affirmed the validity of the improved algorithm, provide a reference for practical engineering application.