The invention relates to a novel
software phaselock technique applicable to micro-grid master-slave control. In a master-slave control structure of a micro-grid, a micro-grid master control
inverter tracks the phase of a
power grid while in grid-connected operation; and when in isolated island operation, the micro-grid master control
inverter needs to maintain the
system frequency to be unchanged; to ensure that the phase and the frequency of a
voltage do not change suddenly during the micro-grid
mode switching process, the invention provides the novel
software phaselock technique; when the connected grid is changed to the isolated island mode, the phase of the
power grid is locked; and an output phase after the grid is disconnected transits from the
power grid phase to the micro-grid phase gradually, and no
phase jump happens; when the isolated island mode is changed to the connected grid, a
phase difference of the power grid and the micro-grid is firstly calculated, and subsequently the PI modulation is carried out on the
phase difference; the output is used as a frequency compensating
signal to be overlapped with the frequency under the isolated island mode and to be used as frequency reference of an output
voltage of the micro-grid main control
inverter; and by changing the frequency, the phase of the micro-grid main control inverter is enabled to approach to the phase of the power grid slowly; and when the
phase difference of the micro-grid main control inverter and the power grid is less than a set value (theta0), the
grid connection operation is carried out.