Single-Phase Microgrid With Seamless Transition Capabilities Between Modes of Operation

Microgrids are an effective way to increase the penetration of distributed generation into the grid. They are capable of operating either in grid-connected or in islanded mode, thereby increasing the supply reliability for the end user. This paper focuses on achieving seamless transitions from islanded to grid-connected and vice versa for a single phase microgrid made up from voltage controlled voltage source inverters (VC-VSIs) and current controlled voltage source inverters (CC-VSIs) working together in both modes of operation. The primary control structures for the VC-VSIs and CC-VSIs is considered together with the secondary control loops that are used to synchronize the microgrid as a single unit to the grid. Simulation results are given that show the seamless transitions between the two modes without any disconnection times for the CC-VSIs and VC-VSIs connected to the microgrid.


I. INTRODUCTION
T HE recent shift in paradigm towards the decentralization of electricity generation has effectively increased the penetration of distributed generation (DG). Microgrids are becoming an important concept to integrate DG and distributed energy storage systems [1]. Different types of DG can be connected to the microgrid. Inverters connected to renewable energy sources (RES) such as photovoltaics and micro-wind turbines typically consist of current controlled voltage source inverters (CC-VSIs) such that the maximum power can be transferred to the local grid at any time. On the other hand, batteries and other energy storage technologies typically consist of voltage controlled voltage source inverters (VC-VSIs) and employ the droop control technique so as to regulate the voltage and frequency of the microgrid. One of the main limitations of CC-VSIs is that these can disconnect from the main grid unnecessarily due to distant faults. Hence the power available from the natural resource is lost.
Consider that the microgrid initially operates in gridconnected mode during which both VC-VSIs and CC-VSIs supply power to the local loads, while the difference in generation is either exported or imported from the grid. The microgrid should seamlessly disconnect from the grid and operate autonomously forming an island in the event of faults in the utility grid. The disconnection times corresponding to abnormal voltages and frequencies are specified in IEC 61727 A. Micallef [2] and IEEE 1547 [3]. Two distinct categories can be distinguished in literature which aim to achieve seamless transitions between these two modes of operation. The first category employs primary control loops implemented in the inverters which make use of complex inverter topologies or control algorithms to achieve the transitions between the modes of operation [4]- [6]. The second category uses a hierarchical architecture for the microgrid [1], [7]- [13].
Gao and Iravani in [4] introduce a voltage-controlled voltage source inverter (VC-VSI) that can operate in both gridconnected and islanded mode. Voltage and frequency restoration loops are implemented in the primary control loops of the inverter which lead to stability problems when multiple inverters are connected in parallel since there is no coordination between the inverters. Another approach is presented in [5] which uses a complex synchro-inverter with microgrid stabilizer that is capable of operating in both modes of operation. The model used to determine the non-linear control of the microgrid stabilizer is dependent on the physical parameters of the inverter resulting in a complex design process which could be impractical for real applications. A voltage-based droop (VBD) control that is capable of operating in islanded mode and in grid-connected mode was considered in [6]. The authors propose an additional synchronization procedure in the VBD control strategy which is required for the transition to grid-connected operation. The main drawbacks of the proposed resistive microgrid architectures are: the real power demand cannot be shared equally among the inverters due to the inverse droops; there are no real and reactive power references in gridconnected operation; the import and export of power from the microgid cannot be regulated by this approach. The approach considered by Balaguer et al. in [14] considers two distinct controllers for islanded and grid connected operation. This makes achieving a seamless transition more complex due to the changeover coordination required between the controller modes. In addition there is no coordination between multiple inverters since all the restoration and synchronization functions for the transitions are implemented in the inverters.
Inverters that use primary control loops may not match the synchronization criteria for grid-connected transition operation when more DGs' are connected to the microgrid [15]. This occurs since the frequency and voltage of the microgrid are determined by multiple inverters through the use of droop control and the local loads [15]. Therefore, the second category uses a hierarchical architecture for the microgrid to achieve the transitions between the modes of operation with some coordination. Guerrero et al. in [1], [7], [8] propose the use This document downloaded from www.microgrids.et.aau.dk is the preprint version of the final paper: A. Micallef, M. Apap, C. Spiteri-Staines, J. M. Guerrero, "Single-phase microgrid with seamless transition capabilities between modes of operation," IEEE Trans. Smart Grid, 2015.
2 of a hierarchical architecture for the reliable operation of the microgrid. The primary control loops use the traditional droop control algorithms that are capable of operating in both modes of operation. A grid synchronization method based on the frequency restoration and voltage restoration mechanism of the P -ω and Q -V droop control loops enables the transition for islanded to grid-connected operation. Other similar hierarchical architectures and grid synchronization methods have been presented by several authors in [9]- [12], [16]. Lee et al. in [17] consider using the Q -V proposed in other literature instead of the conventional droop control. Abusara et al. in [16] include a additional dc link controller loop to handle the battery charging and discharging while in grid-connected mode in addition the the hierarchical control architecture. In [12] the hierarchical architecture is implemented differently from the other works in this section. Instead of having a separate MGCC, the microsource closest to the PCC coordinates the operation of the microgrid and acts as a central controller.
The single phase microgrid proposed in this paper is suitable for the case where a group of neighboring households, in a residential area, are connected together to form a microgrid. Each household has local energy generation and any energy source can be used with the microgrid inverters. The transitions between the two possible modes of operation, namely from islanded to grid-connected and vice versa, for this single phase microgrid are considered. The presented approach enables the microgrid to be interfaced to the mains grid without disconnecting the DGs' or the loads. The system does not consider the use of a backup generator and if the energy sources are renewable, one of the VC-VSI should also ideally be an energy storage system due to the intermittency of the RES. In such cases, an additional loop integrated into the primary control loops of the inverters monitoring the SOC for the energy storage, MPPT for the PV and micro-wind turbines etc.. such as those proposed by the authors in [18] should be added to the control loops described in this paper.
In this paper, the primary control loops for grid-connected and islanded operation were simplified and integrated into one single controller. Approaches that are available in literature, such as those in [4], [5] and [6], make use of more complex inverter topologies or control algorithms. In addition, the hierarchical approaches such as [7], [8] and [11] only consider the transitions of individual inverters which is a simplistic scenario and is impractical for real applications. The topology proposed in this paper aims to achieve a seamless transition for the microgrid as a whole unit rather than considering each unit separately. Hence multiple inverters connected to the microgrid were considered and by considering the whole microgrid as a complete unit adds to the overall complexity of the transitions. The algorithm used to synchronize the microgrid point of common coupling (PCC) voltage with the grid voltage is described in this paper. The work presented in this paper also considers the operation of multiple inverters with different functionality, grid forming inverters operating as VC-VSI and CC-VSI grid-tied inverters that supply their maximum power output to the load. The integration of CC-VSIs into the microgrids enables fault ride through capabilities for these inverters which can continue to generate power into the microgrid even during islanded operation. This occurs since the VC-VSIs will continue to supply a reference for the CC-VSI, as will be shown by the work presented in this paper. This method of integrating VC-VSIs with CC-VSIs is seen to offer better reliability for the local supply of the household user connected to the residential microgrid [22].
In addition the presented work also optimizes the power quality issues during islanded operation due to a reactive power sharing loop. Secondary control loops were used to minimize the reactive power flows between the inverters and achieve reactive power sharing between the inverters in islanded mode while also providing voltage and frequency restoration [19]- [21]. As with other case studies considered in literature, the performance of the proposed architecture is guaranteed for the case study considered in this paper. The authors believe that in this respect the solution being proposed in this paper provides a basic structure that may be extended to other microgrids with some minor modifications. The paper is organized as follows. In Section II, a description of the microgrid setup considered is given while in Section III, the primary control structures for the VC-VSIs and CC-VSIs is described. Section IV contains a description of the secondary control loops and the proposed grid synchronization technique. A summary of the simulation results is given in Section V, showing the suitability of the proposed method to achieve seamless transitions between the two modes of operation even in the case of different sources connected to the microgrid.

II. HIERARCHICAL MICROGRID ARCHITECTURE
Microgrids have a hierarchical control system consisting of primary, secondary and tertiary control layers [1], [8], [21], [23]. The primary control layer consists of the control algorithms implemented in the VC-VSIs connected to the microgrid. These control loops enable operation in islanded

Inverter
Inverter Output Filter Power Parameters Rating The secondary control layer consists of management and optimization algorithms implemented in the microgrid central controller (MGCC) that only serve to optimize the operation of the microgrid. A low bandwidth bidirectional communications link connects the MGCC with the inverters and the static switch (SS). The tertiary control layer considers the interaction between multiple microgrids at the MGCC level and the regulation of power flows across the grid. The tertiary layer was not considered at this stage.
The block diagram of the simulated microgrid architecture is shown in Fig. 1. The microgrid consists of two 2kVA VC-VSIs and a 2kVA CC-VSI connected to local loads. The inverters are interfaced to the point of common coupling (PCC) via LCL filters at their respective output however the grid side inductances were replaced by 1:1 isolation transformers. The parameters for the three inverters connected to the microgrid are given in Table I where L 1 is the inverter side inductance, C is the filter capacitance, R 1 is the inverter side choke resistance and R is the damping resistance, L 2 is the transformer leakage inductance, L M is the transformer magnetizing inductance and R 2 is the transformer resistance. Due to the short distances involved in the considered application, the impedance of the transmission lines connecting the inverters to the PCC becomes negligible when compared to the large impedance provided by the transformers connected at the output of the respective inverters. Two identical local non-linear loads, each consisting of a single phase rectifier with smoothing capacitor, were also connected to the microgrid at the PCC as shown in Fig. 1. The parameters for the non-linear loads are given in Table II. Switches S1 to S3 connected at the output of the inverters, allow the inverters to synchronize to the voltage at their respective PCC prior to their connection. Synchronization is required so as to reduce the turn-on transients which could compromise the stability of the microgrid. Switches S4 and  S5 at the input of the loads, enable load shedding when the generation is less than the demand from the loads. The state of the SS defines the mode of operation of the VC-VSIs that are connected to the microgrid. The SS monitors the voltage and frequency of the microgrid PCC voltage V PCC and the grid voltage V grid as shown in Fig. 3. Islanding detection techniques must be implemented in the SS to detect any faults or disturbances and disconnect the microgrid from the grid according to international standards. The transition must also be detected by the VC-VSIs connected to the microgrid. Table  III shows the disconnection times corresponding to abnormal voltages and frequencies that are specified in IEC 61727 [2] and IEEE 1547 [3].

A. Primary Control Loops
In this paper, the control loops for both islanded and grid-connected operation were implemented in a single VC-VSI controller that makes use of local voltage and current measurements. In addition to the operation of the secondary control loops, the transition in modes of operation of the microgrid can now occur seamlessly since there is no need to change the primary controllers. In both modes of operation the inverters regulate the output real power by using P -θ droops to supply real power and Q -E droops to supply the reactive power. The droop control functions that enable the inverter to operate in both modes of operation can be mathematically

Reactive Power Sharing and Voltage Restoration Frequency Restoration
Communication Link expressed by: where θ * = ω * /s is the phase angle of the output voltage and ω = ω * − G(s)(P − P * ) it the traditional droop control equation; G p (s) = G(s) s = sm d + m s = m d + m s and G q (s) = sn d + n + n i s are the real and reactive power droop controllers where m and n are the P -ω and Q -E droop gains. P * and Q * define the real and reactive power output by the inverters in grid-connected mode. These must set to zero in islanded operation since the local loads determine the output power of the inverters. In addition, n i must be set to zero during islanded operation otherwise this term would force a reactive power output from the inverters. If the reactive power demand from the local loads is lower than the reactive power injected by the inverters, the voltage at the PCC increases with time until the protection circuitry trips the inverters. The simulation results given in this paper consider that the VC-VSIs have an equal power rating as defined in Table I. Hence the droop gains of both inverters must be equal to ensure that the power is shared equally between the inverters. The following gains were used for the droop controllers of both VC-VSIs: m = 0.03rad/W.s , m d = 0.002rad/W.s 2 , n = 0.06V/VAr, n i = 0.12V.s/VAr and n d = 0.005V/VAr.s, where m and n are the P -ω and Q -E droop gains designed for islanded operation.
The inner control loops that were considered for both the VC-VSIs and CC-VSI consists of a voltage loop and an inner current loop. The transfer functions of the voltage and current Proportional-Resonant (PR) controllers incorporating selective harmonic control can be given by [21], [24]: where K pV and K pI are the proportional gains, k iVh and k iIh are the harmonic resonant gains, ω cVh and ω cIh determine the harmonic resonant bandwidth and ω h is the resonant frequency where ω h = hω. The term h=1 in (3) and (4) represents the fundamental frequency ω of the controller that is determined by the droop control algorithm. The closed loop transfer function (CLTF) of the inner loops can be expressed by [21], [24]: where Z L (s) = sL 1 + R 1 and Z C (s) = (sCR + 1)/sC. The bode plot of the voltage CLTF V C (s) V ref (s) for the inner loops is shown in Fig. 2. The inner loops exhibit a 3db bandwidth of 460Hz for a switching frequency of 8kHz while the selective harmonic control introduces bandpass characteristics at the desired harmonic frequencies. The PR controller gains that were designed are: K pV = 0.1, K pI = 2, k iV = 0.4ω h , k iI = 0.4ω h , ω cVh = 0.002ω h and ω cIh = 0.002ω h .
III. SECONDARY CONTROL STRUCTURE The stability of the microgrid can be compromised if the inverters adjust their output voltages and frequencies in an 5 attempt to restore the microgrid without any feedback from the other inverters in the microgrid. In this paper, secondary control loops were implemented in the MGCC to achieve voltage and frequency restoration of the microgrid. In addition, reactive power sharing between the VC-VSIs was also implemented to improve the power quality of the islanded microgrid. Secondary control is not required for real power sharing since the frequency is constant throughout the microgrid [8] and hence the real power is accurately shared by the VC-VSIs due to P -ω droops. Further details on the design of the reactive power sharing loop, voltage and frequency restoration loops were given by the authors in [19]- [21].
The communication bandwidth chosen for the microgrid is a compromise between the amount of data that is transferred along the network infrastructure and the transient response that is required from the secondary control loops. A high data bandwidth would imply a fast transient response for the secondary control loops while on the other hand providing a high rate of data transferred along the network. Since the restoration of the voltage and frequency of the microgrid are non critical, low bandwidth communications can be used to achieve the required functionality described in this paper with bandwidths as low as 1Hz. (The actual data rate and the secondary control latency would depend on the chosen communication protocol.) Since the simulation time varies exponentially with the choice of the communications bandwidth for the secondary control loops, due to the complexity of the modeled setup, the simulations considered a communications bandwidth of 1kHz.

A. Reactive Power Sharing
The VC-VSIs transmit the magnitude of their respective reactive power output (Q 1 and Q 2 ) to the MGCC as shown in Fig. 3. The MGCC determines the reactive power demand for each of the VC-VSIs connected to the microgrid, depending on the Q-E droop gains of the respective inverters, so as to achieve per unit reactive power sharing. The MGCC then regulates the reactive power of the VC-VSIs via proportional-integral (PI) controllers as follows: where Q total is the reactive power supplied by the VC-VSIs in the microgrid and for microgrids with two inverters with equal droop gains n T = n 1 + n 2 2 . ∆E Q is then broadcast to all the inverters in the microgrid and the inverters determine their respective reactive power demand (Q * 1 and Q * 2 ) by dividing with their Q − E droop gain. The reactive power of the inverters is then regulated via PI controllers.

B. Voltage Restoration Loop
The voltage restoration loop was cascaded with the reactive power compensation loop as shown in Fig. 3. The SS monitors the microgrid PCC voltage V PCC and transmits the magnitude to the MGCC. The MGCC then regulates the microgrid voltage via a PI controller. The equation for the amplitude restoration compensator can be expressed by: (7) where k pE and k iE are the gains of the voltage restoration PI controller, E * MG is the desired microgrid voltage and E MG is the measured microgrid voltage.

C. Frequency Restoration Loop
The frequency restoration algorithm was also implemented in the hierarchical structure. The SS monitors the microgrid frequency via a PLL and provides the MGCC with the magnitude of the frequency at the PCC via a low bandwidth communications link. The MGCC then regulates the frequency of the microgrid via a PI controller. The frequency restoration compensator can be expressed by: (8) where k pF and k iF are the gains of the frequency restoration PI controller, ω * MG is the desired microgrid voltage and ω MG is the measured microgrid voltage.

D. Synchronization of Microgrid PCC Voltage with the Grid Voltage
The microgrid PCC voltage must be synchronized with the grid prior to enabling the SS and commencing gridconnected operation. The amplitude of the microgrid PCC is restored by using the voltage restoration loop [21] in which the reference voltage E * MG is equal to the measured grid voltage amplitude |V grid |. The frequency restoration loop [21] was modified to include an additional synchronization block (grid synch) as shown in Fig. 3 with the aim to synchronize the microgrid voltage with the grid. The SS monitors the voltage and frequency conditions for both sides of its output contactor. A second-order generalized integrator with quadrature signal generation (SOGI-QSG) [7], [25]- [28] was used to generate the quadrature component of the PCC voltage. The SOGI also serves to attenuate the voltage harmonics present at the PCC due to the local nonlinear load. A phase-locked loop (PLL) was used to determine the magnitude (E PCC ) and frequency (ω PCC ) of the PCC voltage.
The grid synchronization algorithm reduces the phase angle between the grid voltage V grid and the PCC voltage V PCC by measuring the frequency deviation ω synch as shown in Fig. 4. When this additional frequency deviation ω synch is added to the microgrid frequency ω MG , the frequency restoration loop   Fig. 5. Real power output of the inverters. The real power output of the VC-VSIs are P 1 and P 2 respectively while that of the CC-VSI is P 3 . The CC-VSI was connected to the microgrid at t = 8s while non-linear load 2 was connected to the microgrid at t = 14s. is forced to restore the frequency while reducing the phase error between V PCC and V grid .
Assume for simplicity that V PCC and the V grid are purely sinusoidal so as to analyze the operation of the grid synchronization algorithm as shown in Fig.4. Assume also that the frequency is constant throughout the whole microgrid and that V PCC = |V| sin(ωt − φ), qV PCC = |V| cos(ωt − φ) is orthogonal to V PCC as determined from the SOGI-QSG and V grid = |V| sin(ωt). The output of the multiplier, , can be shown to be equal to: Therefore, signal consists of a DC component and a component at twice the grid frequency. After low pass filtering to remove the high frequencies and normalizing: For small values of φ, the phase difference between the two voltages is φ = n . A PD controller was then used to regulate the grid synchronization factor ω synch .

IV. SIMULATION RESULTS
The simulation setup shown in Fig. 1 was implemented in Simulink/Plecs environment. The reference voltage and  frequency of the microgrid are 220V RMS and 50Hz respectively. The sampling frequency of the voltage and current measurements and the frequency of the control algorithms and the gate drive signals is 8kHz. Since the frequency ω of the microgrid voltage, varies due to the droop control, the PR controller resonant frequencies were designed to adapt to the varying droop frequency. The following results were given to show the effectiveness of the proposed transition methods.

A. Islanded Operation
For a black start, the two VC-VSIs are sequentially connected in parallel to form the microgrid. Switch S4 is also turned on and the VC-VSIs supply the local non-linear load 1 as shown in Fig. 1. It is assumed that the inverters can handle the local load that is connected to the microgrid.
The CC-VSI is then connected to the microgrid at t = 8s and the corresponding effect on the real and reactive power outputs of the VC-VSIs is shown in Fig. 5 and Fig. 6 respectively. The set-points for the CC-VSI were P * = 500W and Q * = 0VAr where the power factor was set to zero so as to inject the maximum possible power into the microgrid. The real power output of the VC-VSIs is reduced due to the additional power being injected into the microgrid by the CC-VSI while the reactive power was not effected at steady state. Then switch S5 is also turned on at t = 14s and the inverters connected to the microgrid now supply both non-linear loads. The output of the CC-VSI is unaffected by the change in load while the VC-VSIs share equally the additional real power demand since 19 27 29 25 Time (  the frequency is constant throughout the microgrid, which can be deduced from Fig. 5 since the plots for P 1 and P 2 overlap. The reactive power of the load cannot be shared equally by the VC-VSIs due to mismatches in the output filters of the inverters [19]- [21].

B. Islanded to Grid-Connected Transition
The secondary controller gains that were designed are: k pF = 0.1, k iF = 1, k pE = 8, k iE = 10, k pQS = 0.01 and k iQS = 0.15. The frequency and voltage of the microgrid at steady state, for all inverters and loads connected to the microgrid, are equal to f = 48.18Hz and E = 193.0V as illustrated in Fig. 7 and Fig. 8 respectively. The steady state frequency and voltage of the microgrid in islanded operation are inherent to the droop control. These frequency and voltage deviations arise such that the inverters can share the real and reactive power demand from the local loads in a decentralized manner. The magnitudes of these deviations depend on the choice of the droop gains and the loads that are connected to the microgrid. Once the three-inverter microgrid reached steady state, the secondary control loops were turned on at t = 19s. When the restoration loops are enabled, the frequency of the microgrid is restored to 50Hz within 6s as shown in Fig. 7. The microgrid voltage is restored after 8s due to the voltage restoration loop as shown in Fig. 8. Fig. 9 and 10 show the effects on the real power and reactive power output of the inverters due to the secondary control loops. Due to the reactive power compensation loop, 19 27 29 25 Time ( the VC-VSIs were seen to share the reactive power demand at 626VAr, while without compensation the inverters were supplying 420VAr and 457VAr respectively. The increase that can be observed in the total real and reactive power output can be explained as follows. The secondary algorithms cause voltage variations at the output of the inverters to adjust the reactive power output of the respective inverters. Since the voltage at the PCC increases from 193V to 220V rms, this means that the voltage across the non-linear loads has also increased. The power drawn by the non-linear loads depends on the input voltage and hence this corresponds with a change in the power demand by the non-linear loads. The change in output P and Q of the inverters when the secondary control loops are enabled can also be described as follows. Assuming that the inverter output impedances are predominantly inductive, the real power output of each inverter can be approximated by: where P is the real power output by the inverter, |V inv | is the amplitude of the inverter output voltage, |V pcc | is the amplitude of the voltage at the PCC and δ is the angle between the two voltage vectors. Therefore, the real power delivered by the inverter is proportional to |V inv | and to |V pcc |. |V inv | and |V pcc | increase due to the effect of the secondary loops to achieve reactive power sharing and restoration of the microgrid PCC voltage. Therefore, the real power output of the inverters must also increase proportionally. A similar argument also holds for the reactive power output. Assuming that the inverter outputs are predominantly inductive, the reactive power output of each inverter can be approximated by: where Q is the reactive power output by the inverter. The reactive power delivered by the inverter is proportional to |V inv | and to |V inv | − |V pcc |. Due to the increase in |V inv | and |V pcc |, there must be a corresponding increase in reactive power output from the inverters. After the voltage and frequency deviations are restored, the microgrid voltage V PCC can be synchronized to the grid voltage once this becomes available. In practice, the microgrid can be re-connected to the grid after a minimum of 3 minutes from when the grid has been restored [2]. To consider a realistic scenario, voltage harmonics were also considered for the grid voltage since in practice the voltage total harmonic distortion (VTHD) is never zero due to the loads present on the grid. The VTHD levels considered for the 3 rd up to the 9 th harmonic were of 2%, -1%, 0.5% and -0.25% respectively. The grid synchronization algorithm was enabled at t = 29s and the operation of the frequency restoration loop with the aim to synchronize V PCC with V Grid is shown in Fig. 7. The effect on the microgrid voltage phase angle with respect to the grid voltage is shown in Fig. 11. The SS was closed at t = 36s and the microgrid becomes grid-connected as shown in shown in Fig. 11c. The grid-synchronization algorithm and the secondary control loops are then disabled.   Fig. 11. Synchronization of the microgrid PCC voltage V PCC to the grid voltage V grid . a) The voltage waveforms prior to enabling the synchronization algorithm. b) The voltage waveforms when the synchronization algorithm reaches steady state. c) Seamless change-over to grid-connected operation.

C. Grid-Connected Operation
For simplicity, it was assumed that the MGCC notifies the inverters to start the transition to grid-connected operation. The VC-VSIs employ 120ms to detect the presence of the grid and change their mode of operation from islanded into grid-connected from when the SS is closed at t = 36s. No transients were observed on the voltage at the PCC when the SS was enabled thereby indicating the effectiveness of the synchronization algorithm. Grid-connected droop control for the VC-VSIs was then enabled such that the inverters output the desired real and reactive powers. On the other hand, the mode of operation of the CC-VSI is not effected by the connection of the microgrid to the grid and the same operating conditions for islanded operation are maintained.
The set-points for the grid-connected VC-VSIs were P * 1 = 1100W and Q * 1 = 0VAr for VC-VSI 1 while those for VC-VSI 2 were P * 2 = 1200W and Q * 2 = 0VAr. The VC-VSIs start from their islanded power output to supply the desired real power as shown in Fig. 12 and Fig. 13. The VC-VSIs are seen to supply the desired reactive power without effecting the output of the CC-VSI which remains constant at 500W and 0VAr. Hence, the mode of operation of the microgrid was seamlessly changed from islanded into grid-connected.

D. Grid-Connected to Islanded Transition
A voltage dip was simulated at t = 47s, that reduces the grid voltage from 100% to 85% as shown in Fig. 14a. Under these conditions, the SS should disconnect the microgrid from the grid after 2s as defined in the standards summarized in Table  III. At t = 49s, the SS detects that a fault has developed on the grid and the SS opens thereby isolating the microgrid.
The PID controllers of the VC-VSI continue their operation and cause instability of the microgrid voltage as shown in Fig. 14a  implemented in the VC-VSIs, the VC-VSIs detect the formation of the island and change their operation into islanded mode. The CC-VSI is unaffected by the transition into islanded operation and outputs a constant power of 500W and 0VAr into the microgrid while the VC-VSIs share the remaining real and the reactive power demanded from the loads. The VC-VSIs supply an average real power output of 573W. Similarly, the inverters resume the reactive power sharing of the local nonlinear load with each inverter supplying an average reactive power output of 626VAr. Hence, the mode of operation of the microgrid was seamlessly changed from grid-connected into islanded. After the islanded microgrid has been set up, the secondary control loops can be re-enabled to maintain the desired voltage and frequency levels that would allow the microgrid to be re-connected to the grid once the conditions are re-satisfied.

V. CONCLUSION
This paper considers the islanded and grid-connected operation of the both VC-VSIs and CC-VSIs connected to a microgrid. A hierarchical architecture consisting of primary and secondary control loops was implemented to achieve seamless transitions from islanded to grid-connected operation and vice versa. The primary control loops that were proposed are capable of operating in both islanded and grid-connected modes of operation. The secondary control loops, implemented in the MGCC, were used to condition the voltage at the PCC of the microgrid such that the SS can connect the microgrid to the grid. In addition, reactive power sharing was ensured by introducing an additional compensation loop that reduced the reactive currents flowing between the inverters in islanded operation. Simulation results were given to show the effectiveness of the proposed transition method when the microgrid is in islanded mode, the transition from islanded to grid connected mode, grid-connected operation and the transition from grid-connected to islanded mode. The simulation results consider a case scenario where a voltage dip, as per standards IEC 61727 and IEEE 1547, causes the transition from grid-connected to islanded mode. The main limitations of the proposed primary control loops is that since a single VC-VSI was used, current limiting must be introduced into the inverter to limit the current during faults in grid-connected operation.