*4.1. Algorithm Design without Considering Constraints*

For the considered hybrid microgrid, the nodes can be layered on DC and AC sub-grids. The leadership layer nodes include the feedback elements, which are used to update the self-data. The tracking layer nodes do not contain feedback elements, which receive leadership information to realize the data update.

For the hybrid model, the update algorithm of the leadership layer node is formulated as

$$\begin{cases} \lambda\_i(t+1) = \sum\_{j \in N\_i} d\_{ij} \lambda\_i(t) + \varepsilon \Delta P(t) \\ \quad P\_i(t+1) = \frac{\lambda\_i(t+1) - \delta\_i}{2\delta\_i} \\ \Delta P(t+1) = \sum\_{s \in S\_{DM}} P\_{DM,s}(t) - \sum\_{i \in S\_{TG}} P\_{TG,i}(t) - \sum\_{j \in S\_{WT}} P\_{WT,j}(t) \\ \quad - \sum\_{k \in S\_{SL}} P\_{SL,k}(t) - \sum\_{r \in S\_{RS}} P\_{BS,r}(t) \end{cases} \tag{25}$$

The update algorithm for the tracking layer node is

$$\begin{cases} \lambda\_i(t+1) = \sum\_{j \in N\_i} d\_{ij} \lambda\_i(t) \\ \bar{P}\_i(t+1) = \frac{\lambda\_i(t+1) - \delta\_i}{2\delta\_i} \\ \Delta P(t+1) = \sum\_{s \in S\_{DM}} P\_{DM,s}(t) - \sum\_{i \in S\_{TG}} P\_{TG,i}(t) - \sum\_{j \in S\_{WT}} P\_{WT,j}(t) \\ \qquad - \sum\_{k \in S\_{SL}} P\_{SL,k}(t) - \sum\_{r \in S\_{RS}} P\_{BS,r}(t) \end{cases} \tag{26}$$

where *dij* is the node correlation coefficient, which is *dij* <sup>=</sup> 2/-*Ni* + *Nj* + δ , *Ni* and *Nj* are the number of nodes that directly connected to the node *i* and *j* respectively, and δ is a small positive number.

Combining Equations (25) and (26), a two-layer consensus algorithm is presented

$$\begin{cases} \lambda(t+1) = D\lambda(t) + E\Delta P(t) \\ \mathcal{P}(t+1) = \tilde{A}\lambda(t+1) + \mathcal{B} \\ \Delta P(t+1) = \sum\_{s \in S\_{\text{DM}}} P\_{\text{DM},s}(t) - \sum \tilde{P}(t+1) \end{cases} \tag{27}$$

where

$$\begin{array}{lcl}\lambda(t+1) = \left[\lambda\_{\text{TG},1}(t+1), \dots, \lambda\_{\text{WT,1}}(t+1), \dots, \lambda\_{\text{SL,1}}(t+1), \dots, \lambda\_{\text{SS,1}}(t+1), \dots, \lambda\_{\text{BS,1}}(t+1), \dots\right]^T\\\tilde{P}(t+1) = \left[P\_{\text{TG},1}(t+1), \dots, P\_{\text{WT,1}}(t+1), \dots, P\_{\text{SL,1}}(t+1), \dots, P\_{\text{BS,1}}(t+1), \dots\right]^T\\\tilde{A} = \text{diag}\left[\left\langle \frac{1}{2^{\text{T}T\_{1}}}, \dots, \left\langle \frac{1}{2^{\text{T}T\_{1}}}, \dots, \left[\frac{1}{2^{\text{S}T\_{1}}}\right], \dots, \left[\frac{1}{2^{\text{S}T\_{1}}}, \dots, \frac{1}{2^{\text{S}T\_{1}}}\right]^T\right\rangle\right]^T\\\tilde{B} = \left[-\frac{b\_{\text{TG},1}}{2\mu\_{\text{TG},1}}, \dots, -\frac{b\_{\text{WT,1}}}{2\mu\_{\text{WT,1}}}, \dots, -\frac{b\_{\text{SL,1}}}{2\mu\_{\text{SL,1}}}, \dots, -\frac{b\_{\text{SL,1}}}{2\mu\_{\text{SS,1}}}, \dots,\right]^T\\\tilde{D} = \left[\frac{1}{2} - \sum\_{j=1}^{n} d\_{1j} + \dots \quad d\_{1i} & \dots \quad d\_{1n} & \dots \\ \dots & \dots & \dots & \dots & \dots\\ d\_{i1} & \dots \quad 1 - \sum\_{j=1}^{n} d\_{ij} & \dots & d\_{in} \\ \vdots & \dots & \dots &$$

*E* is defined as a column vector, scalar 0 and feedback coefficient ε are taken as the elements. When the node is set as the leader node, the corresponding value is chosen as ε, otherwise, the value is chosen as 0.

For the DC sub-grid, the leadership layer node update strategy can be expressed as

$$\begin{cases} \begin{aligned} \lambda\_{\mathrm{DC},i}(t+1) &= \sum\_{j \in \mathcal{N}\_{i}} d\_{ij} \lambda\_{\mathrm{DC},i}(t) + \varepsilon \Delta P\_{\mathrm{DC}}(t) \\ \mathcal{P}\_{\mathrm{DC},i}(t+1) &= \frac{\lambda\_{\mathrm{DC},i}(t+1) - \delta\_{\mathrm{DC},j}}{2 \mu\_{\mathrm{DC},i}} \\ \Delta P\_{\mathrm{DC}}(t+1) &= \sum\_{s \in \mathrm{SQCD}} P\_{\mathrm{DCDM},s}(t) - \sum\_{k \in \mathcal{S}\_{\mathrm{SL}}} P\_{\mathrm{SL},k}(t) \\ &\quad - \sum\_{r \in \mathrm{S}\_{\mathrm{RS}}} P\_{\mathrm{BS},r}(t) - P\_{\mathrm{AC}-\mathrm{DC}}(t) \end{aligned} \tag{28}$$

The update algorithm for the tracking layer node is

$$\begin{cases} \begin{aligned} \lambda\_{DC,i}(t+1) &= \sum\_{j \in N\_i} d\_{ij} \lambda\_{DC,i}(t) \\ \tilde{P}\_{DC,i}(t+1) &= \frac{\lambda\_{DC,i}(t+1) - \delta\_{DC,i}}{2\mathcal{U}\_{DC,i}} \\ \Delta P\_{DC}(t+1) &= \sum\_{s \in S\_{DCDM}} P\_{DCDM,s}(t) - \sum\_{k \in S\_{SL}} P\_{SL,k}(t) \\ &- \sum\_{r \in S\_{RS}} P\_{BS,r}(t) - P\_{AC-DC}(t) \end{aligned} \tag{29}$$

For the AC sub-grid, the leadership layer node update strategy can be expressed as

$$\begin{cases} \lambda\_{AC,i}(t+1) = \sum\_{j \in N\_i} d\_{ij} \lambda\_{AC,i}(t) + \varepsilon \Delta P\_{AC}(t) \\\ P\_{AC,i}(t+1) = \frac{\lambda\_{A \cap \mathcal{I}}(t+1) - \delta\_{AC,i}}{2 \delta\_{AC,i}} \\\ \Delta P\_{AC}(t+1) = \sum\_{s \in S\_{ACDM}} P\_{ACDM,s}(t) - \sum\_{i \in S\_{TG}} P\_{TG,i}(t) \\\ \quad - \sum\_{j \in S\_{WT}} P\_{WT,j}(t) + P\_{AC-DC}(t) \end{cases} \tag{30}$$

The update algorithm for the tracking layer node is

$$\begin{cases} \lambda\_{AC,i}(t+1) = \sum\_{j \in N\_i} d\_{ij} \lambda\_{AC,i}(t) \\ \mathcal{P}\_{AC,i}(t+1) = \frac{\lambda\_{AC,i}(t+1) - \delta\_{AC,i}}{2d\_{AC,i}} \\ \Delta P\_{AC}(t+1) = \sum\_{s \in S\_{ACDM}} P\_{ACDM,s}(t) - \sum\_{i \in S\_{TG}} P\_{TG,i}(t) \\ \quad - \sum\_{j \in S\_{WT}} P\_{WT,j}(t) + P\_{AC-DC}(t) \end{cases} \tag{31}$$

Equations (25) and (26), (28) and (29), and (30) and (31) are the proposed algorithms that can be applied to the AC/DC hybrid microgrid, the DC sub-grid, and the AC sub-grid, respectively. Therefore, the proposed two-layer consensus control method is able to effectively solve the ED issue. Next, we will comprehensively consider the influence of various constraints, and modify the proposed algorithms.
