### 2.1 PQ controlled inverter

In PQ control, the inverter is used to deliver the required real and reactive power according to their set-points. The controller consists of current and power control loops. The inner current loop can rapidly respond to disturbances including input voltage fluctuation, converter dead time and inductance parameter variation. Therefore, the performance of the system is significantly improved [12]. A phase-locked loop (PLL) is used to synchronize the inverter to the microgrid. The RES provides constant real power and reactive power to the grid by PQ control. The operation of PQ control based on DQ reference frame which defines the components of the d-axis and q-axis AC currents.

In Fig. 2, the *d*-axis of the reference frame is in-phase with the grid voltage and thus, the d-axis current is responsible for controlling the real power (P) and the *q*-axis current controls the reactive power (Q) of the inverter. The controller consists two loops, i.e. an outer power control loop and an inner current control loop. The main objective of PQ control in the grid-connected inverter is to ensure the inverters to produce the real and reactive power according to their references. Under the *dq* coordinate system, the inverter output real and reactive power can be described as shown in Fig. 3.

The real and reactive power are decoupled in the power controller block and the current controller adopts the proportional integral (PI) control. The inverter active and reactive power are controlled by tracking the current references.

$$ {P}_{ref}={V}_{gq}{i}_{gq}+{V}_{gd}{i}_{gd} $$

(1)

$$ {Q}_{ref}={V}_{gq}{i}_{gd}-{V}_{gd}{i}_{gq} $$

(2)

$$ {i}_{dref}=\frac{P_{ref}}{V_{gd}},{i}_{qref}=-\frac{Q_{ref}}{V_{gd}} $$

(3)

Similarly, the inverter current is coupled in terms of *d-* and *q*-axis components as *i*_{
gd
} and *i*_{
gq
} are affected not only by *V*_{
gd
} and *V*_{
gq
}, but also by the coupled voltages. To independently control *i*_{
gd
} and *i*_{
gq
}, the coupled values need to be canceled. The current control loop uses conventional PI controller and its output is given to the inverter as demanded voltage for switching. The output of the current controller is:

$$ {V}_{dref}=\left({k}_{dp}+\frac{k_{dI}}{s}\right)\left({i}_{dref}-{i}_{gd}\right)-\omega {Li}_{gq}+{V}_{gd} $$

(4)

$$ {V}_{qref}=\left({k}_{qp}+\frac{k_{qI}}{s}\right)\left({i}_{qref}-{i}_{gq}\right)+\omega {Li}_{gd}+{V}_{gq} $$

(5)

When the microgrid is in grid-connected mode, the inverter is in current control mode so the references of the frequency and voltage are both measured by the PLL which also provides the orientation of the synchronous rotating coordinate system.

### 2.2 Droop controlled inverter

Droop control is a well-known method for controlling microgrid in islanded mode. The distributed generation unit is connected to a common bus with the transmission line impedance of *Z* = *R* + *jX*as shown in Fig. 4, where the apparent power delivered to the AC bus from the DG is:

$$ {S}_{inv}={P}_{inv}+{jQ}_{inv}={V}_{inv}{I}_{inv}^{\ast } $$

(6)

In (6), *P* and *Q* are the delivered active and reactive power, and *I*^{*}_{
inv
} is the current flowing through the line from the DG to the AC bus, which is represented as:

$$ {I}_{inv}^{\ast }=\frac{E\angle \phi -\mathrm{V}\angle 0}{Z} $$

(7)

$$ {S}_{inv}=V\left(\frac{E-V}{Z}\right)\cong \frac{EV}{Z}-\frac{V^2}{Z} $$

(8)

where *E* is the inverter voltage and *V* is the common AC bus voltage. *ϕ* is the phase angle of the inverter side voltage. \( \theta ={\mathit{\tan}}^{-1}\left(\frac{X}{R}\right) \) is the line impedance angle and *Z* is the magnitude of the line impedance.

The active power and reactive power are defined as:

$$ P=\frac{EV}{Z}\cos \left(\theta -\phi \right)-\frac{V^2}{Z}\cos \theta $$

(9)

$$ Q=\frac{EV}{Z}\sin \left(\theta -\phi \right)-\frac{V^2}{Z}\sin \theta $$

(10)

As seen, the output power depends on the line impedance. For inductive line with *θ* = 90^{∘}and *Z*≅*X*, the inverter output power is.

$$ P=\frac{EV}{X}\sin \phi $$

(11)

$$ Q=\frac{V}{X}\left(E\cos \phi -V\right) $$

(12)

If *X > > R*, *R* can be neglected, and if the power angle *ϕ* is small, sin*ϕ* ≅ *ϕ* and cos*ϕ* = 1. Thus (11) and (12) become:

$$ \phi \cong \frac{XP}{EV} $$

(13)

$$ E-V\cong \frac{XQ}{E} $$

(14)

Equations (13) and (14) show that the power angle is dependent on real power and the voltage difference depends on reactive power. Thus, the angle can be controlled by regulating the real power while the inverter voltage is controlled by the reactive power.

The real power and power angle regulate the frequency. By adjusting P and Q independently, the voltage amplitude and frequency of the microgrid are regulated. The frequency of the DG drops when the real power of the load increases and the DG voltage amplitude is reduced when the reactive power of the load increases [13]. The frequency and the amplitude of the inverter output voltage reference can be expressed as below.

$$ \omega ={\omega}^{\ast }-m\left({P}_{cal}-{P}^{\ast}\right) $$

(15)

$$ E={E}^{\ast }-n\left({Q}_{cal}-{Q}^{\ast}\right) $$

(16)

Equations (15) and (16) determine the frequency and voltage droop regulation relationship through real and reactive power in droop controller. The frequency is determined by droop gain *m* and the deviation between the calculated real power (*P*_{
cal
}) and the set-point *P*.* Similarly, the voltage magnitude is determined by the droop gain *n* and the difference between the calculated reactive power (*Q*_{
cal
}) and the set-point *Q**. Thus, (15) shows that load change will cause the frequency to deviate and similarly, (16) shows that the voltage amplitude is reduced when the reactive power of the load increases. Equations (15) and (16) are graphically depicted in Fig. 5.

The real power control loop is closely linked with frequency control and voltage angle. To improve the frequency control accuracy, the frequency restoration scheme (FRS) is applied to restore the frequency to its nominal value *ω*^{∗}. To realize this scheme Δ*ω* is added in (15) as:

$$ \omega ={\omega}^{\ast }+\Delta \omega -m\left({P}_{cal}-{P}^{\ast}\right) $$

(17)

For steady-state operation, Δ*ω* = *m*(*P*_{
cal
} − *P*^{∗}) and thus, Δ*ω* is reformed as:

$$ \frac{d}{dt}\left(\Delta \omega \right)=K\cdot \Delta \omega $$

(18)

where Δ*ω* is the frequency error and the constant *K* controls the overall system frequency restoration.

The frequency restoration scheme is based on Laplace transform of (17) and (18). As it is shown in Fig. 6, the frequency restoration block is added in the droop control diagram. The constant *K* shows the difference of the vertical moving of the D*G*. For reducing this variation in the DG, the constant *K* should be reduced though this does not eliminate the error completely. The FRS will start after smoothing the dynamic response [14].

The reactive power control loop is linked to voltage amplitude and the reactive power-sharing is realized with the Q-E droop control and is affected by voltage drop and load condition. Thus, (16) becomes

$$ E=\Delta E-n\left({Q}_{cal}-{Q}^{\ast}\right) $$

(19)

The voltage amplitude drop is obtained by:

$$ \Delta E={E}^{\ast }-{V}_{Pcc} $$

(20)

Equations (19) and (20) represent the relation between the DG reactive power output and the voltage magnitude difference. The varying range is limited and small for *V*_{
PCC
} and thus it assumes the value of *K* to be a constant slope. Reactive power provided by the DG which is equal to the load side reactive power so Δ*E* is reformed as

$$ \Delta E=K\left({E}^{\ast }-{V}_{Pcc}\right) $$

(21)

The voltage drop occurs at the connecting point because the generated reactive power of DG_{1} is higher than that of DG_{2}. Figure 6 shows the control diagram of the enhanced droop control. The output voltage is fed to the inverter through the synchronous reference frame. The output power of the DG is measured and filtered through the low pass filter [15]. The filtered power is given to the droop controller to create voltage magnitude *E* and the frequency *ω*. The reference voltage *V*_{
ref
} *= sinθ* is produced in the synchronous reference frame by *ω* and *E*. Finally, *V*_{
ref
} is applied to the PWM modulator to generate the PWM signal for the inverter.

In the droop control strategy, the change in load is managed by the distributed generators in a prearranged way and decentralized control of parallel inverters is designed based on the use of the system frequency as a communication link within the microgrid. This method has two problems, i.e. power coupling and slop selection. However, power coupling can be avoided through some improve strategies such as virtual power frame transformation or virtual output impedance, though the swapping between the power-sharing and voltage, amplitude, and frequency deviation depends on the selection of the droop coefficient *m* and *n*.