*3.2. Secondary Control*

The secondary control provides for generating the updated local values of references *VCrefi*1 and *VCrefi*2 for the two actions of the primary control. The diagram of the secondary control for *i*th DCES, drawn in Figure 6, underlines the two updating paths and the usage of two controls, one in the

ĥ

updating path of the CL DC-bus voltage, and the other one in that of the battery SOC. The operation of the secondary control relies on the average consensus algorithms.

**Figure 6.** The proposed secondary control of the DCES.

Returning to the diagram of Figure 6, the voltage control updates the average voltage *VCi* of *i*th CL DC bus, by processing the local voltage measurement *VCi* and the neighbors' average voltage *VCj* [26] through a consensus algorithm. It is expressed by

$$\overline{V}\_{\rm Ci} = V\_{\rm Ci} - \int \sum\_{j=1}^{n} a\_{ij} (\overline{V}\_{\rm Ci} - \overline{V}\_{\rm Cj}) \mathrm{d}t \tag{13}$$

After comparison of *VCi* to the global voltage reference *VCref* of the CL DC-bus voltage of the microgrid, the error term is processed by a PI controller, as formulated in (8), to generate a correction term δ1*i* for the voltage reference *VCerfi*1 of the TPC control of *i*th DCES.

$$\delta\_{\rm Ii} = k\_{\rm Plli} (V\_{\rm Cref} - \overline{V}\_{\rm Ci}) + k\_{\rm Illi} \int (V\_{\rm Cref} - \overline{V}\_{\rm Ci}) \mathrm{d}t \tag{14}$$

where the *kPUi* and *kIUi* are the proportional and integral coefficients of the voltage control. In agreemen<sup>t</sup> with (14), the correction term δ1*i* is higher when the average voltage *VCi* greatly deviates from reference *VCref*. As shown by (15), this fact enforces reference *VCrefi*1 of the TPC control so as to realize the consensus of *VCi* and *VCref*, which means that the average CL DC-bus voltage are regulated very close to the rated value [20].

$$V\_{Crefi1} = V\_{Cref} + \delta\_{i1} \tag{15}$$

To realize the consensus of the SOC of the batteries in a multiple DCES, the SOC control of Figure 6 compels batteries with a high SOC to discharge faster and those with low SOC to charge faster. For this purpose, the following local state variable *Si* is defined for the SOC of the battery of *i*th DCES [19]:

$$S\_i = \frac{P\_{bi}}{C\_i F\_{SOCi}} = \frac{V\_{bi} i\_{bi}}{C\_i F\_{SOCi}} \tag{16}$$

where *Pbi* indicates the power flow at the battery terminals (marked as negative during charging and positive during discharging), *SOCi* is the SOC of the battery of *i*th DCES, and *FSOCi* is a function of *SOCi* defined as

$$F\_{\rm SOCi} = \begin{cases} \rm SOC\_i - \rm SOC\_{L\nu} & P\_{\rm lii} > 0 \\ \rm SOC\_H - \rm SOC\_{i\nu} & P\_{\rm lii} < 0 \end{cases} \tag{17}$$

where *SOCL* and *SOCH* are respectively the lower and upper limits of *SOCi*, which are selected as 0.2 and 0.8 in this paper.

By help of a consensus algorithm, the updated value of *Si* is processed by a PI controller, as formulated in (18), to generate a correction term δ2*i* for the voltage reference *VCerfi*2 of the BBC control of *i*th DCES.

$$\delta\_{2i} = k\_{\rm Pos} \sum\_{j=1}^{N} a\_{ij} (S\_j - S\_i) + k\_{\rm ISI} \int \sum\_{j=1}^{N} a\_{ij} (S\_j - S\_i) \, \mathrm{d}t \tag{18}$$

where the *kPSi* and *kISi* indicate the proportional and integral coe fficient of the SOC control.

Similar to the update of the voltage reference *VCerfi*1, a correction term δ2*i* becomes higher when *Si* greatly deviates from the neighboring *Sj*. As shown by (19), this fact enforces reference *VCrefi*2 of the BBC control and, together with it, the charging or discharging process of the batteries so as to realize the consensus of *SOCi* and *SOCj*.

$$V\_{Cref2} = V\_{Crrf} + \delta\_{i2} \tag{19}$$

The structure of the distributed cooperative system arranged for the control of multiple DCESs is illustrated by the block diagram in Figure 7. The diagram highlights that the system has two control levels, including the primary control and secondary control. Compared to the existing distributed cooperative control [27], the voltage references of the TPC and BBC controls that are located in the primary control level, are generated respectively by the voltage and SOC controls that are located in the secondary control level. It means that the TPC and BBC can be controlled independently, which contributes to a reduced battery usage and releases the burden of the battery.

**Figure 7.** Structure of the proposed distributed cooperative control.
