The Integrated Switching Control Strategy for Grid-Connected and Islanding Operation of Micro-Grid Inverters Based on a Virtual Synchronous Generator

: In allusion to the virtual synchronous generator (VSG)-based voltage source inverters in micro-grids, an integrated control method combining a quasi-synchronization algorithm and an islanding detection algorithm is proposed to improve the power supply reliability and quality, which can simultaneously meet the operational requirements of both grid-connected mode (GCM) and off-grid mode (OGM), and the smooth switching between them. The quasi-synchronization algorithm of the micro-grid inverter is designed to realize a ﬂexible grid connection. Moreover, for quickly detecting islanding phenomena, a novel islanding detection algorithm based on the VSG’s inherent characteristics is put forward. Finally, the validity and availability of the proposed models and control strategies are comprehensively veriﬁed by simulation results based on Matlab/Simulink.


Introduction
Micro-grids, integrating distributed power supply, energy storage devices, power electronic equipment and local loads, is a new way of supplying power [1]. The switching control between grid connected mode (GCM) and off-grid mode (OGM) will directly affect the security and stability of the micro-network. Therefore, higher requirements are imposed on the control of switching between different operating modes of micro-grids [2].
The switching modes include both active and passive switching from GCM to OGM, as well as the active switching from OGM to GCM. In this regard, some control strategies have been proposed. P-Q control in GCM and V-F control in OGM, respectively proposed in [3,4], have the advantages of flexible control of the inverter and convenient adjustment. However, these control methods ignore the inertia characteristics of the synchronous generator (SG). Thus, VSG technology, similar to the operating mechanism and external characteristics of the SG, is proposed in [5][6][7][8]. In order to realize the active switching from OGM to GCM, the voltage amplitude, frequency and phase angle of the micro-grid system are adjusted to achieve the quasi-synchronous grid-connected operation in [9]. Based on synchronous adjustment of the frequency, to ensure the same phase of the micro-grid system voltage and the grid voltage, the cross-calculation algorithm is proposed in [10,11]. The combination of traditional inverter synchronization method and VSG is proposed in [12,13], by introducing voltage, frequency, and phase angle regulators to achieve inverter pre-synchronization. In the quasi-synchronous grid-connected methods proposed above, the information of the grid voltage and the micro-grid voltage can be obtained through the phase-locked loop (PLL). However, since the grid voltage or the micro-grid voltage is asymmetric and distorted, the frequency fluctuates, and the voltage signals cannot be accurately detected by traditional PLL.
When unplanned islanding occurs, it is essential for the micro-grid to rapidly detect the unplanned islanding phenomenon. At present, islanding detection methods all aim at grid-connected inverters adopting direct current control strategy, and there are few studies on inverters based on droop control or VSG control. Based on the theoretical basis of islanded PV generation, the non-detected zones of two islanding detection algorithms are derived in [14], and by means of analyzing the relations between different islanding detection standards for distributed PV generation and corresponding non-detection zones the protective thresholds of frequency and voltage are obtained. The popular slip mode frequency shift (SMS) and auto phase shift active islanding detection methods are investigated and an improved SMS strategy is proposed in [15]. In the proposed method, an additional phase shift is introduced to help in stimulating the action of the islanding detection and the algorithm is simplified as well. A new active islanding detection method based on 2nd harmonic impedance measurement is studied in [16]. With this method, the inverter current reference is slightly modified by an injected signal which affecting the in-grid current in a negligible way. Based on voltage phase and frequency variation for distributed SGs, an islanding detection method, one of passive islanding detection methods, is proposed in [17]. This method, however, has disadvantages of large non-detection zones (NDZs) and slow detection speed. The introduction of the droop characteristic will increase the NDZ of the micro-grid inverter, which is pointed out in [18]. To solve this problem, according to the linear relationship between frequency and active power in droop control, an islanding detection method based on positive feedback of frequency is proposed in [19], which can reduce the time required for detection. However, this method only considers frequency offset caused by the change of active power, but does not consider voltage offset caused by the change of reactive power. Simultaneously, it is difficult to detect the islanding phenomenon when the power is balanced.
In summary, based on the voltage source micro-grid inverter with VSG, an integrated control method combining the quasi-synchronization algorithm and the novel islanding detection algorithm is proposed in this paper, which can simultaneously satisfy the requirement of both GCM and OGM of the micro-grid, and the smooth switching between them. Meanwhile, an improved PLL based on cascaded general-integrator (CGI) is proposed to obtain accurate voltage information. Thus, the performance of the islanding detection method proposed in [19] can be improved by adding the positive feedback of reactive voltage and power disturbance module to quickly detect the islanding phenomenon. When the micro-grid operates from GCM to OGM, the control signal obtained by the detection algorithm can be applied to switching process, so as to ensure reliable and stable operation of the system.

Structure and Control Strategy of Micro-Grid System
The voltage source micro-grid system based on VSG is mainly composed of static transfer switch (STS), micro-grid inverter based on VSG and electrical load. The main circuit structure of the voltage source inverter is a typical three-phase full-bridge inverter, as shown in Figure 1.
According to Refs. [5][6][7][8], the mathematical equations of the VSG control algorithm are as follows: where ∆ω = ω n − ω and ∆u = u n − u o . The instantaneous active power P e and reactive power Q e can be calculated from the output voltage u ok and the output current i ok , that is: where Δω = ωn − ω and Δu = un − uo.
The instantaneous active power Pe and reactive power Qe can be calculated from the output voltage uok and the output current iok, that is:

Smooth Switching Strategy of Micro-Grid Operation Modes
In order to realize the smooth switching between GCM and OGM in a micro-grid, an integrated switching control strategy of voltage-controlled type micro-grid inverter based on VSG technology is presented in Figure 2, and the control process in two cases is analyzed as follows: Case I: When the micro-grid system switches to GCM, the corresponding control flowchart is shown in Figure 2a. The islanding detection algorithm is embedded in the VSG algorithm, which detected the islanding phenomenon all the time. If the grid is stable, the micro-grid still operates in GCM, while if the grid faults, the islanding detection algorithm detects the islanding phenomenon, then the controller sends switching signals to switch the inverter into OGM. Simultaneously, the islanding detection algorithm is cut out from the integrated switching control algorithm. At this point, the situation turn to case II and the control flowchart of the micro-grid is shown in Figure 2b.

Smooth Switching Strategy of Micro-Grid Operation Modes
In order to realize the smooth switching between GCM and OGM in a micro-grid, an integrated switching control strategy of voltage-controlled type micro-grid inverter based on VSG technology is presented in Figure 2, and the control process in two cases is analyzed as follows: Case I: When the micro-grid system switches to GCM, the corresponding control flowchart is shown in Figure 2a. The islanding detection algorithm is embedded in the VSG algorithm, which detected the islanding phenomenon all the time. If the grid is stable, the micro-grid still operates in GCM, while if the grid faults, the islanding detection algorithm detects the islanding phenomenon, then the controller sends switching signals to switch the inverter into OGM. Simultaneously, the islanding detection algorithm is cut out from the integrated switching control algorithm. At this point, the situation turn to case II and the control flowchart of the micro-grid is shown in Figure 2b.
Case II: The control flowchart when the micro-grid system switches to GCM is shown in Figure 2b. In order to achieve the automatic grid-connected operation when the grid is recovered, the grid should be checked at a fixed frequency. If the grid has not been recovered, the micro-grid will continue to work in OGM. When the grid fault is recovered, the quasi-synchronization algorithm would be embedded into the VSG control algorithm. Then, the micro-grid can be smoothly connected to the large grid. After realizing safe and reliable grid-connected operation, the islanding detection algorithm is re-embedded into the control algorithm. At this point, the situation turns to case I and the control flowchart of the micro-grid is shown in Figure 2a.
Case II: The control flowchart when the micro-grid system switches to GCM is shown in Figure  2b. In order to achieve the automatic grid-connected operation when the grid is recovered, the grid should be checked at a fixed frequency. If the grid has not been recovered, the micro-grid will continue to work in OGM. When the grid fault is recovered, the quasi-synchronization algorithm would be embedded into the VSG control algorithm. Then, the micro-grid can be smoothly connected to the large grid. After realizing safe and reliable grid-connected operation, the islanding detection algorithm is re-embedded into the control algorithm. At this point, the situation turns to case I and the control flowchart of the micro-grid is shown in Figure 2a. In summary, the integrated switching control strategy in detail is shown in Figure 3. The quasisynchronization algorithm and islanding detection algorithm is described respectively in Sections 3.3 and 3.4.

PLL Based on Cascaded General-Integrator
A PLL based on cascaded general-integrator (CGI-PLL), using a third-order general-integrator (TOGI) to suppress the influence of the DC component of the voltage on the system, is designed in this paper, as shown in Figure 1. However, TOGI has no ideal filtering effect on the lower harmonics of the voltage (such as 5th and 7th harmonics). The reduced order resonant (ROR) regulator can quickly and accurately achieve positive and negative sequence separation and harmonic separation by suppressing the influence of low-order harmonics. Thus, ROR regulator is used to make up for the disadvantages of TOGI in this paper. In summary, the integrated switching control strategy in detail is shown in Figure 3. The quasi-synchronization algorithm and islanding detection algorithm is described respectively in Sections 3.3 and 3.4.

PLL Based on Cascaded General-Integrator
A PLL based on cascaded general-integrator (CGI-PLL), using a third-order general-integrator (TOGI) to suppress the influence of the DC component of the voltage on the system, is designed in this paper, as shown in Figure 1. However, TOGI has no ideal filtering effect on the lower harmonics of the voltage (such as 5th and 7th harmonics). The reduced order resonant (ROR) regulator can quickly and accurately achieve positive and negative sequence separation and harmonic separation by suppressing the influence of low-order harmonics. Thus, ROR regulator is used to make up for the disadvantages of TOGI in this paper.  The control block diagram of ROR regulator and TOGI can be seen in Figure 4. According to Refs. [20][21][22], the closed-loop transfer functions of ROR regulator and TOGI can be listed separately:  The control block diagram of ROR regulator and TOGI can be seen in Figure 4. According to Refs. [20][21][22], the closed-loop transfer functions of ROR regulator and TOGI can be listed separately:  The asymmetrical grid voltage with harmonic is transformed into αβ stationary coordinate system, that is: From (5), the ROR regulator has only one pole, s = jωsr, with frequency and polarity selectivity. Therefore, ROR can directly perform positive, negative and harmonic separation by setting the resonant frequency.
According to Ref. [23], the voltage containing the DC offset component is expressed as: The resonant frequency of TOGI is equal to the fundamental frequency of the voltage, ωst = ωo. Therefore, the TOGI output signals can be expressed as: From (6), H1(s) can be seen as a band-pass filter whose bandwidth is determined by kt, H2(s) can be seen as a low-pass filter, H3(s) can be seen as a notch filter with notch frequency ωst. Therefore, when the input voltage contains DC component, ut1(t) is a output voltage without DC component and with the same frequency as the AC component of the input voltage, ut2(t) is a output voltage with DC component and the same amplitude as the input voltage, but the phase of ut2(t) lag the input voltage by 90°, ut3(t) only contains DC component. Thus, TOGI can generate two-phase quadrature signal with the same frequency and same amplitude as the fundamental wave component of the input voltage.
The structure of CGI-PLL, as shown in Figure 5, is composed of ROR regulators, TOGIs, and SRF-PLL. For one thing, the ROR regulators decouple the voltage positive and negative sequence and remove the harmonics; for another, the TOGIs suppress the DC component and perform secondary separation and filtering; and then, the SRF-PLL realizes the phase angle and frequency tracking, where ωo of the TOGI and ROR regulators is obtained from the SRF-PLL. The performance of CGI-PLL in complex voltage conditions is shown in Figure 6.  The asymmetrical grid voltage with harmonic is transformed into αβ stationary coordinate system, that is: From (5), the ROR regulator has only one pole, s = jω sr , with frequency and polarity selectivity. Therefore, ROR can directly perform positive, negative and harmonic separation by setting the resonant frequency.
According to Ref. [23], the voltage containing the DC offset component is expressed as: The resonant frequency of TOGI is equal to the fundamental frequency of the voltage, ω st = ω o . Therefore, the TOGI output signals can be expressed as: From (6), H 1 (s) can be seen as a band-pass filter whose bandwidth is determined by k t , H 2 (s) can be seen as a low-pass filter, H 3 (s) can be seen as a notch filter with notch frequency ω st . Therefore, when the input voltage contains DC component, u t1 (t) is a output voltage without DC component and with the same frequency as the AC component of the input voltage, u t2 (t) is a output voltage with DC component and the same amplitude as the input voltage, but the phase of u t2 (t) lag the input voltage by 90 • , u t3 (t) only contains DC component. Thus, TOGI can generate two-phase quadrature signal with the same frequency and same amplitude as the fundamental wave component of the input voltage.
The structure of CGI-PLL, as shown in Figure 5, is composed of ROR regulators, TOGIs, and SRF-PLL. For one thing, the ROR regulators decouple the voltage positive and negative sequence and remove the harmonics; for another, the TOGIs suppress the DC component and perform secondary separation and filtering; and then, the SRF-PLL realizes the phase angle and frequency tracking, where ω o of the TOGI and ROR regulators is obtained from the SRF-PLL. The performance of CGI-PLL in complex voltage conditions is shown in Figure 6.

Active Switching Control from OGM to GCM
The micro-grid inverter based on VSG has two modules of power reference and droop control. During GCM, the inverter operates according to the given power Pset and Qset, while during OGM, the inverter operates according to the droop characteristics of P-f and Q-V. When the frequency or voltage of the system deviates too much from the reference value, the system can perform secondary adjustment of the frequency or voltage, which is secondary frequency regulation or secondary voltage regulation. Therefore, the micro-grid can actively adjust the voltage and frequency during OGM, which is exactly the theoretical basis for the micro-grid switching from OGM to GCM. The micro-grid inverter realizes secondary voltage and frequency regulation by controlling Pset and Qset in the droop characteristic curve, as shown in Figure 7.

Active Switching Control from OGM to GCM
The micro-grid inverter based on VSG has two modules of power reference and droop control. During GCM, the inverter operates according to the given power Pset and Qset, while during OGM, the inverter operates according to the droop characteristics of P-f and Q-V. When the frequency or voltage of the system deviates too much from the reference value, the system can perform secondary adjustment of the frequency or voltage, which is secondary frequency regulation or secondary voltage regulation. Therefore, the micro-grid can actively adjust the voltage and frequency during OGM, which is exactly the theoretical basis for the micro-grid switching from OGM to GCM. The micro-grid inverter realizes secondary voltage and frequency regulation by controlling Pset and Qset in the droop characteristic curve, as shown in Figure 7.

Active Switching Control from OGM to GCM
The micro-grid inverter based on VSG has two modules of power reference and droop control. During GCM, the inverter operates according to the given power P set and Q set , while during OGM, the inverter operates according to the droop characteristics of P-f and Q-V. When the frequency or voltage of the system deviates too much from the reference value, the system can perform secondary adjustment of the frequency or voltage, which is secondary frequency regulation or secondary voltage regulation. Therefore, the micro-grid can actively adjust the voltage and frequency during OGM, which is exactly the theoretical basis for the micro-grid switching from OGM to GCM. The micro-grid Taking secondary frequency regulation as an example, the P-f curve of the inverter is shifted from 1 to 1′ by adjusting the given active power from Pset to P'set. Suppose the system active load PL is constant, and the micro-grid system will run at point B whose frequency is ωe. According to Refs. [24,25], the new P-f curve 1′ is: where ∆Pset is: Similar to a prime mover, the given active power Pset should be limited [26], and the new Q-V curve can be obtained as: where ∆Qset is: The quasi-synchronization grid-connected algorithm is composed of a synchronous detection unit, a synchronous regulation unit and a closing unit, which is shown in Figure 8.  Taking secondary frequency regulation as an example, the P-f curve of the inverter is shifted from 1 to 1 by adjusting the given active power from P set to P set . Suppose the system active load P L is constant, and the micro-grid system will run at point B whose frequency is ω e . According to Refs. [24,25], the new P-f curve 1 is: where ∆P set is: Similar to a prime mover, the given active power P set should be limited [26], and the new Q-V curve can be obtained as: where ∆Q set is: The quasi-synchronization grid-connected algorithm is composed of a synchronous detection unit, a synchronous regulation unit and a closing unit, which is shown in Figure 8. Taking secondary frequency regulation as an example, the P-f curve of the inverter is shifted from 1 to 1′ by adjusting the given active power from Pset to P'set. Suppose the system active load PL is constant, and the micro-grid system will run at point B whose frequency is ωe. According to Refs. [24,25], the new P-f curve 1′ is: where ∆Pset is: Similar to a prime mover, the given active power Pset should be limited [26], and the new Q-V curve can be obtained as: where ∆Qset is: The quasi-synchronization grid-connected algorithm is composed of a synchronous detection unit, a synchronous regulation unit and a closing unit, which is shown in Figure 8.  In this paper, the allowable voltage difference is ε u = 5%u g and the allowable frequency difference is ε ω = 0.4%ω g . Otherwise, the synchronous adjustment unit will perform secondary voltage and frequency regulation by increasing (or decreasing) ∆Q set , ∆P set .
The phase angle difference, ∆θ, has the greatest impact on the inverter when connected to the grid. Therefore, a phase angle regulator is added to indirectly adjust the phase angle difference by directly adjusting the frequency of the micro-grid to realize ∆θ ≈ 0. When the frequency difference between the micro-grid system and the grid is less than εω, the phase angle regulator will run, that is: Considering the intrinsic actuation time of controller and circuit breaker, the switching signal should be sent in advance. The incremental angle is usually called leading angle, which can be expressed as (16): where ω d = ε ω .

Reactive Switching Control between OGM and GCM
In order to reduce the impact of unplanned switching processes on the micro-grid system, the micro-grid system must be able to effectively detect the occurrence of islanding phenomenon. According to IEEE Std.1547 [27], when unplanned islanding occurs, the islanding state needs to be detected by the control system within 2 s. The frequency thresholds are typically set at 49.3 Hz and 50.5 Hz, and the voltage thresholds are set at 193.6 V and 242 V.
The power flow at the point of common coupling (PCC) point in Figure 1 satisfies the Power Conservation principle, that is: The frequency and voltage deviation caused by the unmatched power can be described as follows: According to (18), it is obvious that there is a certain mathematical relationship between the change of frequency and voltage and the variation of active power and reactive power. Therefore, the islanding phenomenon can be detected through frequency or voltage amplitude changes. If the frequency of the system deviates from the normal frequency by more than 2 Hz or the voltage exceeds 20% of the rated voltage, the micro-grid operation should be switched to OGM immediately.
In order to solve the problem of large NDZ in the detection method, positive feedback of V-Q is added on the basis of [19] in this paper. When unplanned islanding occurs, the frequency and voltage of inverter will shift to a certain direction under the influence of droop characteristics and positive feedback. During OGM, the inverter sets the reference frequency and voltage to fixed values. The specific control schematic diagram is shown in Figure 9. According to Figure 8, the output voltage and frequency of the inverter can be expressed by (19) and (20): Based on (19) and (20), it can be seen that when ki > 1 (i = 1, 2), the positive feedback effect can be enhanced. However, it should be noted that, if ki is too large, islanding phenomenon would occur due to the large fluctuations, while if ki is too small, the offset value of voltage or frequency would exceed the detection thresholds for a long time. Therefore, the value of ki need be discussed in this paper.
Case I: When uo ≤ 0.88un or uo ≥ 1.1un, or fo ≤ 49.3 Hz or fo ≥ 50.5 Hz, the occurrence of islanding phenomenon can be detected directly. At this time, it is not necessary to add positive feedback, that is, ki = 1.
Case II: When the grid is disconnected, the inverter output power and the power required by the loads are completely matched or the degree of mismatch is small. At this time, the range of voltage amplitude is 0.88un ≤ uo ≤ 1.1un, or the range of frequency is 49.3 Hz ≤ fo ≤ 50.5 Hz. The voltage or frequency of the inverter does not change or change slightly. Therefore, the islanding phenomenon cannot be quickly and effectively detected. In this situation, positive feedback is required to accelerate the detection speed. To avoid false islanding, it can be considered that islanding phenomenon is highly likely to occur only when the voltage amplitude or frequency changes several times in the same direction. In this situation, it is necessary to add positive feedback to accelerate the detection speed and reduce NDZ.
In summary, the value of ki is chosen as: According to Figure 8, the output voltage and frequency of the inverter can be expressed by (19) and (20): Based on (19) and (20), it can be seen that when k i > 1 (i = 1, 2), the positive feedback effect can be enhanced. However, it should be noted that, if k i is too large, islanding phenomenon would occur due to the large fluctuations, while if k i is too small, the offset value of voltage or frequency would exceed the detection thresholds for a long time. Therefore, the value of k i need be discussed in this paper.
Case I: When u o ≤ 0.88u n or u o ≥ 1.1u n , or f o ≤ 49.3 Hz or f o ≥ 50.5 Hz, the occurrence of islanding phenomenon can be detected directly. At this time, it is not necessary to add positive feedback, that is, k i = 1.
Case II: When the grid is disconnected, the inverter output power and the power required by the loads are completely matched or the degree of mismatch is small. At this time, the range of voltage amplitude is 0.88u n ≤ u o ≤ 1.1u n , or the range of frequency is 49.3 Hz ≤ f o ≤ 50.5 Hz. The voltage or frequency of the inverter does not change or change slightly. Therefore, the islanding phenomenon cannot be quickly and effectively detected. In this situation, positive feedback is required to accelerate the detection speed. To avoid false islanding, it can be considered that islanding phenomenon is highly likely to occur only when the voltage amplitude or frequency changes several times in the same direction. In this situation, it is necessary to add positive feedback to accelerate the detection speed and reduce NDZ.
In summary, the value of k i is chosen as: If the amplitude or frequency change once in the same direction, N will automatically increase by one. If the amplitude or frequency of the previous two amplitudes changes in different directions, N is set to 0.
In order to further reduce the NDZ and accelerate the detection speed, power disturbance basing on of positive feedback is presented in this paper. As shown in Figure 8, P d , Q d represent positive and reactive power disturbances, respectively. Simultaneously, for the purpose of avoiding the impact of power disturbance on the normal operation of the inverter, whether to start the power disturbance is determined by judging the k i value. When k i > 1, active or reactive power disturbance should be added to the given power of the inverter according to the k 1 and k 2 values. With the aim of reducing the power disturbance value, the addition of positive or negative disturbance is determined based on the ∆u and ∆ω values. When ∆u and ∆ω is positive, negative power disturbance is added, otherwise positive power disturbance is added. The introduction of power disturbances essentially increases the difference of power, which can reduce the NDZ. The flowchart of the islanding detection is shown in Figure 10.   (21) If the amplitude or frequency change once in the same direction, N will automatically increase by one. If the amplitude or frequency of the previous two amplitudes changes in different directions, N is set to 0.
In order to further reduce the NDZ and accelerate the detection speed, power disturbance basing on of positive feedback is presented in this paper. As shown in Figure 8, Pd, Qd represent positive and reactive power disturbances, respectively. Simultaneously, for the purpose of avoiding the impact of power disturbance on the normal operation of the inverter, whether to start the power disturbance is determined by judging the ki value. When ki > 1, active or reactive power disturbance should be added to the given power of the inverter according to the k1 and k2 values. With the aim of reducing the power disturbance value, the addition of positive or negative disturbance is determined based on the ∆u and ∆ω values. When ∆u and ∆ω is positive, negative power disturbance is added, otherwise positive power disturbance is added. The introduction of power disturbances essentially increases the difference of power, which can reduce the NDZ. The flowchart of the islanding detection is shown in Figure 10.

Controller Behavior and Simulation Results
The simulation model of the micro-grid system based on VSG with integrated switching control strategy is established in Matlab/Simulink. The specific simulation parameters are listed in Table 1, and the comprehensive simulation results are given in the following.

Controller Behavior and Simulation Results
The simulation model of the micro-grid system based on VSG with integrated switching control strategy is established in Matlab/Simulink. The specific simulation parameters are listed in Table 1, and the comprehensive simulation results are given in the following.

Quasi-Synchronization Process from OGM to GCM
Aiming at verifying the proposed VSG control algorithm, a quasi-synchronization algorithm is adopted to realize the smooth switching from OGM to GCM and the stability maintainence of voltage and frequency as well.
In the micro-grid, P Load , Q Load are 8 kW and 6 kVar respectively, while the initial values of P set and Q set are 3 kW and 1 kVar respectively. The amplitude of voltage at the PCC is 211 V and the frequency is 49.5 Hz, and the grid is ideal. At 0.5 s, the controller sends a signal to incorporate the CGI-PLL and the quasi-synchronization algorithm into the VSG control algorithm. The value of P set gradually increases to 16 kW, and the value of Q set gradually increases to 6 kVar. The simulation results of quasi-synchronization process are shown in Figure 11.

Quasi-Synchronization Process from OGM to GCM
Aiming at verifying the proposed VSG control algorithm, a quasi-synchronization algorithm is adopted to realize the smooth switching from OGM to GCM and the stability maintainence of voltage and frequency as well.
In the micro-grid, PLoad, QLoad are 8 kW and 6 kVar respectively, while the initial values of Pset and Qset are 3 kW and 1 kVar respectively. The amplitude of voltage at the PCC is 211 V and the frequency is 49.5 Hz, and the grid is ideal. At 0.5 s, the controller sends a signal to incorporate the CGI-PLL and the quasi-synchronization algorithm into the VSG control algorithm. The value of Pset gradually increases to 16 kW, and the value of Qset gradually increases to 6 kVar. The simulation results of quasisynchronization process are shown in Figure 11.
As shown in Figure 11, under the effect of the quasi-synchronization algorithm, the micro-grid inverter controls the voltage amplitude and frequency according to active and reactive power commands after 0.5 s. Therefore, the micro-grid voltage is gradually synchronized with the grid voltage. At 2.06 s, the micro-grid voltage meets the grid-connection standards and the micro-grid operates on GCM, the synchronization process is completed. From the Figure 10d, there is no large current fluctuations at the grid-connected moment, and the grid-connected process is smooth. Then, the micro-grid system begins to supply power to the grid. After about 2.7 s, the micro-grid is stable. And the micro-grid not only supplies 8 kW and 6 kVar power to the load, but also supplies extra 8 kW power to the grid.

Switching Control from GCM to OGM
In order to verify that the proposed islanding detection algorithm can effectively detect the islanding phenomenon and smoothly switch from GCM to OGM, the simulation experiments on micro-grid model are as follows: Case I: PLoad, QLoad are 2 kW and 1 kVar, respectively, and Pset, Qset of the VSG control algorithm are As shown in Figure 11, under the effect of the quasi-synchronization algorithm, the micro-grid inverter controls the voltage amplitude and frequency according to active and reactive power commands after 0.5 s. Therefore, the micro-grid voltage is gradually synchronized with the grid voltage. At 2.06 s, the micro-grid voltage meets the grid-connection standards and the micro-grid operates on GCM, the synchronization process is completed. From the Figure 10d, there is no large current fluctuations at the grid-connected moment, and the grid-connected process is smooth. Then, the micro-grid system begins to supply power to the grid. After about 2.7 s, the micro-grid is stable. And the micro-grid not only supplies 8 kW and 6 kVar power to the load, but also supplies extra 8 kW power to the grid.

Switching Control from GCM to OGM
In order to verify that the proposed islanding detection algorithm can effectively detect the islanding phenomenon and smoothly switch from GCM to OGM, the simulation experiments on micro-grid model are as follows: Case I: P Load , Q Load are 2 kW and 1 kVar, respectively, and P set , Q set of the VSG control algorithm are 9 kW and 1 kVar, respectively. The micro-grid is connected to the grid at 1.3 s. After the connection, the islanding detection algorithm is embedded into integrated control strategy. At 3.0 s, 5 kW load is connected to the migro-grid system, and the grid is disconnected at 3.5 s. The simulation ends at 4.0 s, and the simulation results are shown in Figure 12.

Switching Control from GCM to OGM
In order to verify that the proposed islanding detection algorithm can effectively detect the islanding phenomenon and smoothly switch from GCM to OGM, the simulation experiments on micro-grid model are as follows: Case I: PLoad, QLoad are 2 kW and 1 kVar, respectively, and Pset, Qset of the VSG control algorithm are 9 kW and 1 kVar, respectively. The micro-grid is connected to the grid at 1.3 s. After the connection, the islanding detection algorithm is embedded into integrated control strategy. At 3.0 s, 5 kW load is connected to the migro-grid system, and the grid is disconnected at 3.5 s. The simulation ends at 4.0 s, and the simulation results are shown in Figure 12.  Case II: P Load , Q Load are 2 kW and 0 kVar, respectively, and P set , Q set are 9 kW and 0 kVar, respectively. With other simulation parameters unchanged, the load of 7 kW and 2 kVar is connected to the micro-grid system at 3.0 s to simulate the reactive power of the micro-grid unmatched with the load power. The simulation results are shown in Figure 13. Case II: PLoad, QLoad are 2 kW and 0 kVar, respectively, and Pset, Qset are 9 kW and 0 kVar, respectively. With other simulation parameters unchanged, the load of 7 kW and 2 kVar is connected to the micro-grid system at 3.0 s to simulate the reactive power of the micro-grid unmatched with the load power. The simulation results are shown in Figure 13. Case III: PLoad, QLoad are 2 kW and 1 kVar, respectively. Pset, Qset are 7 kW and 2 kVar, respectively. With other simulation parameters unchanged, the load of 5 kW and 1 kVar is connected to the microgrid system at 3.0 s, when the output power of the micro-grid completely matches with the load power. The simulation results are shown in Figure 14.  Case III: P Load , Q Load are 2 kW and 1 kVar, respectively. P set , Q set are 7 kW and 2 kVar, respectively. With other simulation parameters unchanged, the load of 5 kW and 1 kVar is connected to the micro-grid system at 3.0 s, when the output power of the micro-grid completely matches with the load power. The simulation results are shown in Figure 14. Case II: PLoad, QLoad are 2 kW and 0 kVar, respectively, and Pset, Qset are 9 kW and 0 kVar, respectively. With other simulation parameters unchanged, the load of 7 kW and 2 kVar is connected to the micro-grid system at 3.0 s to simulate the reactive power of the micro-grid unmatched with the load power. The simulation results are shown in Figure 13. Case III: PLoad, QLoad are 2 kW and 1 kVar, respectively. Pset, Qset are 7 kW and 2 kVar, respectively. With other simulation parameters unchanged, the load of 5 kW and 1 kVar is connected to the microgrid system at 3.0 s, when the output power of the micro-grid completely matches with the load power. The simulation results are shown in Figure 14.  Based on Figure 12, when the active power is unmatched, the frequency will rise (or fall) under the effect of P-f droop characteristics. When the frequency deviation exceeds normal level, the positive frequency feedback and active power disturbance starts, which makes the frequency of the output voltage exceeds normal range rapidly. Thus the islanding phenomenon is detected. The entire time of islanding detection lasts about 0.12 s. As shown in Figure 13, the frequency will fluctuate with the reactive power unmatched. And the fluctuation of frequency is smaller than that of voltage amplitude. Consequently, when the amplitude deviation exceeds normal level, the positive voltage feedback and reactive power disturbance starts, which makes the amplitude of the output voltage rapidly exceeds normal range. Thus the islanding phenomenon is detected. The entire time of islanding detection lasts about 0.22 s. According to Figure 14, the micro-grid is disconnected from the grid at 3.5 s. During 3.5 s to 3.7 s, the frequency changes slightly because the output power of the inverter is matched with the power of the loads. At 3.7 s, positive feedback and active power disturbance are added, which accelerates the change of frequency. The entire time of detection process lasts about 0.5 s. Once the islanding phenomenon is detected, the PCC quickly switches the micro-grid to operate at OGM. Moreover, the detection time is less than 2 s, which meets the standard of islanding detection.
Case IV: The micro-grid system is connected to the grid all time. At 3.0 s, the frequency and amplitude of the grid voltage drop 0.3 Hz and 10 V respectively, and the condition of false islanding is simulated. The disturbance time lasts 0.5 s. The other simulation parameters are the same as case I. The simulation results are shown in Figures 15 and 16.
From Figures 15 and 16, it can be found that when false islanding occurs, the amplitude and frequency of the voltage at the PCC fluctuates with the grid voltage. However, the positive feedback and power disturbance does not start, and the signal of islanding detection shows that islanding phenomenon do not occur. It can be concluded that false islanding can be effectively identified using novel islanding detection algorithm.
Case V: Taking case I as an example, the switching process of the micro-grid inverter between GCM and OGM is analyzed, and the simulation results are shown in Figure 17. Based on Figure 12, when the active power is unmatched, the frequency will rise (or fall) under the effect of P-f droop characteristics. When the frequency deviation exceeds normal level, the positive frequency feedback and active power disturbance starts, which makes the frequency of the output voltage exceeds normal range rapidly. Thus the islanding phenomenon is detected. The entire time of islanding detection lasts about 0.12 s. As shown in Figure 13, the frequency will fluctuate with the reactive power unmatched. And the fluctuation of frequency is smaller than that of voltage amplitude. Consequently, when the amplitude deviation exceeds normal level, the positive voltage feedback and reactive power disturbance starts, which makes the amplitude of the output voltage rapidly exceeds normal range. Thus the islanding phenomenon is detected. The entire time of islanding detection lasts about 0.22 s. According to Figure 14, the micro-grid is disconnected from the grid at 3.5 s. During 3.5 s to 3.7 s, the frequency changes slightly because the output power of the inverter is matched with the power of the loads. At 3.7 s, positive feedback and active power disturbance are added, which accelerates the change of frequency. The entire time of detection process lasts about 0.5 s. Once the islanding phenomenon is detected, the PCC quickly switches the micro-grid to operate at OGM. Moreover, the detection time is less than 2 s, which meets the standard of islanding detection.
Case IV: The micro-grid system is connected to the grid all time. At 3.0 s, the frequency and amplitude of the grid voltage drop 0.3 Hz and 10 V respectively, and the condition of false islanding is simulated. The disturbance time lasts 0.5 s. The other simulation parameters are the same as case I. The simulation results are shown in Figures 15 and 16.
From Figures 15 and 16, it can be found that when false islanding occurs, the amplitude and frequency of the voltage at the PCC fluctuates with the grid voltage. However, the positive feedback and power disturbance does not start, and the signal of islanding detection shows that islanding phenomenon do not occur. It can be concluded that false islanding can be effectively identified using novel islanding detection algorithm.
Case V: Taking case I as an example, the switching process of the micro-grid inverter between GCM and OGM is analyzed, and the simulation results are shown in Figure 17.     According to Figure 17, the micro-grid inverter based on VSG control can provide essential power supply for the load with no supply from the grid. When the micro-grid is connected to the grid, the switching process is smooth due to the proposed control algorithm. When some other loads are connected to the micro-grid system, there is no large voltage or current fluctuations. When unplanned islanding occurs, the islanding phenomenon can be detected immediately and the micro-grid operation can actively be switched to OGM. Therefore, under the effect of the integrated swithching control strategy proposed in this paper, the micro-grid system can operate reliably and stably.

Conclusions
In this paper, an integrated swithching control strategy based on the VSG algorithm was adopted for voltage-controlled type micro-grid inverter. The integrated switching control strategy combines the VSG algorithm with the CGI-PLL, a quasi-synchronization algorithm and a novel islanding detection algorithm, whereby the risk of switching failure can be effectively reduced and the transient response during the switching process can be strongly suppressed. Compared with traditional PLL technology, the CGI-PLL presented in this paper can accurately obtain the information of voltage when the voltage is asymmetric and distorted. The quasi-synchronization algorithm can suppress the impact current at grid-connected moment. The switching process from OGM to GCM for micro-grid system adopted quasi-synchronization algorithm is smoother than the micro-grid system without it. Compared with traditional islanding detection methods, the novel islanding detection method can detect islanding phenomenon effectively, reduce the non-detection zone and cut into the islanding operation. Theoretical analysis and simulation results verify the rationality and validity of this integrated switching control strategy.

Conflicts of Interest:
The authors declare no conflict of interest.

Q i
IGBT device (i = 1-6) L filter inductors C filter capacitors R L sum of equivalent resistances of the filter inductors, switching devices and circuits i Lk current of the filter inductor (k = a, b, c) i ok output current of the inverter (k = a, b, c) u ok output voltage of the inverter (k = a, b, c) R g equivalent resistance of the grid L g equivalent inductance of the grid u gk grid voltage (k = a, b, c) T set given torque T e electromagnetic torque P set given active power