*3.1. ES-2 Control Scheme*

Primary control, also named local voltage and frequency control, provides for the independent voltage and frequency control of each ES, which belong to the outer loops. After that, the inner loops exert upon two control actions, namely the decoupled control and filter capacitor voltage control, which can be seen by the scheme in Figure 4.

**Figure 4.** Current loops of primary control for ES-2.

In this subsection, a new type of decoupled power control is proposed for the ES. Compared to the existing power control of the ES [10], new functions are added. Specifically, a decoupling network as well as an inner current loop are added, which give the ES higher dynamic responses.

When the PCC voltage phasor *vs* is selected as the reference phasor, the voltage and current at the PCC can be expressed as:

$$v\_s(t) = \sqrt{2}V\_s \cos(\omega t) \tag{2}$$

$$i\_{\mathbb{G}}(t) = \sqrt[f]{2} l\_{\mathbb{G}} \cos(\omega t + \mathcal{Q}) \tag{3}$$

The active power (*P*) and reactive power (*Q*) at the PCC are:

$$P = \text{Re}(V\_{\text{s}}I\_{\text{G}}{}^{\ast}) = \text{Re}\{ \left| \upsilon\_{\text{sd}} + j\upsilon\_{\text{sq}} \right\rangle \cdot \left| i\_{\text{Gd}} + j i\_{\text{Gq}} \right\rangle \} = \upsilon\_{\text{Sd}}i\_{\text{Gd}} + \upsilon\_{\text{Sq}}i\_{\text{Gq}} = \upsilon\_{\text{Sd}}i\_{\text{Gd}} = V\_{\text{s}}I\_{\text{G}}\cos\mathcal{D} \tag{4}$$

$$Q = \operatorname{Im}(V\_s I\_G{}^\*) = \operatorname{Im}(\left\{\upsilon\_{\rm sd} + j\upsilon\_{\rm sq}\right\} \left\{i\_{\rm Gd} + j i\_{\rm Gd}\right\}) = \upsilon\_{\rm Sd} i\_{\rm Gd} - \upsilon\_{\rm Sq} i\_{\rm Gq} = -\upsilon\_{\rm Sd} i\_{\rm Gd} = V\_s I\_G \sin \Omega \tag{5}$$

where *iGq* and *iGq* represent the active and reactive components of the current *iG*, and the last equalities hold in quasi-stationary conditions. Equations (4) and (5) show that, under the working hypothesis of a well stabilized PCC voltage, the decoupled power control is achieved by separately controlling the two current components. The relevant control scheme is drawn in Figure 4, where *K* and *K*0 are the decoupling compensation term and the feedforward coefficient of the grid voltage, respectively, and the current loops are closed by means of Proportional Integral (PI) regulators.

The effectiveness of the scheme in Figure 4 confides in the accurate control of the ES output voltage rather than of the VSI output voltage. This goal is obtained by including in the scheme an auxiliary control loop, aimed at forcing the ES output voltage to accurately track the *vES* reference signals delivered by the decoupled control stage. The auxiliary control loop, designated with 'Filter capacitor voltage loop' in Figure 4, is explicated in Figure 5; it contains a delay block of 1.5*Ts* to account for the calculation and sampling delays in the processing of the control signals. The loop controller *GPR*(*s*) is a proportional resonant (PR) regulator with the following expression:

$$G\_{PR}(s) = K\_p + \frac{2K\_r\omega\_c s}{s^2 + 2a\nu\_c s + a\nu\_0^2} \tag{6}$$

where, *Kp* and *Kr* are the proportional and resonant parameters of the PR regulator. The PR regulator has the incomparable advantage of tracking closely a sinusoidally-shaped signal during its transients; furthermore, the amplitude gain of the PR regulator at resonant frequency can be set large enough to give the control loop an almost zero static error as well as a good anti-interference capability. Other quantities in Figure 5 are the VSI gain *KPWM* and the block *G*2(*s*), whose transfer function is:

$$\begin{array}{rcl} G\_2(\mathbf{s}) &=& \frac{(R\_1 + sL\_1)(R\_2 + R\_3) + R\_2R\_3}{sCf((R\_1 + sL\_1)(R\_2 + R\_3) + R\_2R\_3) + R\_1 + sL\_1 + R\_2} \\ &=& \frac{Z\_0}{sCfZ\_0 + 1} \end{array} \tag{7}$$

**Figure 5.** ES output voltage control.

Since the response of the auxiliary control loop exhibits a weakly damped behavior, an active damping is introduced in its basic scheme by means of a complementary function that increases the damping of the ES output voltage and, with it, the stability of the control. Such a function can be obtained by feeding back -into the forward path of the *vES* control- a signal representative of either the capacitor current or voltage or the inductance voltage, after an appropriate filtering. Irrespectively of the selected signal, its transduction has the inconvenience of necessitating one more sensor in the ES control hardware. However, the benefits obtained with the active damping function rewards for the additional hardware. In this paper, the feedback of the capacitor current is adopted as drawn in Figure 5, where sensing of the current is modeled by the time rate of the capacitor voltage.

#### *3.2. The Proposed Hierarchical Control for Multiple ES-2*

The current references in Figure 4 are delivered by PI regulators that close the control loops built up around the corresponding PCC voltage components. When multiple ESs are distributed along a microgrid as exemplified in Figure 1, it is no longer appropriate to use the same value (e.g., 220 V) for the voltage reference of each ES-tied node because the voltage drop inherent in the transmission line prevents the actual PCC voltage to match the reference. The consequence is that the integral term of the PI regulators of the voltage loops is subjected to the windup phenomenon. Let the accumulated voltage error be positive at a given node; the corresponding ES is forced to inject a useless active and reactive power into the SL, thus compromising its regulating action and affecting the safe operation of the other ESs. Therefore, different reference voltages must be set for ESs at different nodes, according to the droop characteristics of Figure 6.

**Figure 6.** Droop characteristics for different node voltages.

The proposed hierarchical control determines the current components by help of a secondary control that embeds the frequency and voltage loops shown in Figure 7 within the dashed line. Both loops rely on the droop control technique. When the microgrid is running under the islanded situation, the active power flowing in the microgrid is mainly generated by the connected RESs. When an active power shortage occurs, the frequency of the microgrid declines to some extent. The tied ES compensates for the power shortage by the injection of the active power, thus improving the frequency stability of the microgrid. The stabilizing frequency action exerted by the ES allows setting of the frequency reference at the power system frequency (50Hz).

**Figure 7.** Proposed hierarchical control for ES-2.

In turn, the PCC voltage is subjected to a gradual downward trend, from which it has to recover. This task is supported by the voltage control loop. Since the reactive line power *Q* measured at PCC is directly correlated with the voltage drop of the microgrid line, the feedback value of the voltage loop is determined by multiplying *Q* by the droop coefficient, expressed as:

$$a = \frac{1}{Q\_{\max} \frac{2R\_3}{V^2\_S}}\\a = \frac{1}{Q\_{\max} \frac{2R\_3}{V^2\_S}}\\a = \frac{1}{Q\_{\max} \frac{2R\_3}{V^2\_S}}\\a = \frac{1}{Q\_{\max} \frac{2R\_3}{V^2\_S}}\tag{8}$$

and by summing it to the PCC voltage. The difference between the reference voltage for the nodes and the feedback voltage is then processed by a PI regulator to give the reference of the reactive current component.
