*4.2. Algorithm Design with Considering Constraints*

When considering the active output of the generator, the update equation of the generator node can be expressed as

$$\begin{cases} P\_{\rm TG,i}(t) = P\_{\rm TG,i}^{\min}(t), & P\_{\rm TG,i}^{\min}(t) > P\_{\rm TG,i}(t) \\ P\_{\rm TG,i}(t) = \frac{\lambda\_{\rm TG,i}(t) - b\_{\rm TG,i}}{2\pi\_{\rm TG,i}}, P\_{\rm TG,i}^{\min}(t) \le P\_{\rm TG,i}(t) \le P\_{\rm TG,i}^{\max}(t) \\\ P\_{\rm TG,i}(t) = P\_{\rm TG,i}^{\max}(t), & P\_{\rm TG,i}(t) > P\_{\rm TG,i}^{\max}(t) \end{cases} \tag{32}$$

⎧ ⎪⎪⎪⎪⎪⎨ ⎪⎪⎪⎪⎪⎩

When considering the power output climbing constraint, the generator node needs to make the following adjustments

$$\begin{aligned} P\_{\rm TG,i}(t) &= \frac{\lambda\_{\rm TG,i}(t) - b\_{\rm TG,i}}{2\pi\_{\rm TG,i}} , -\Delta P\_{\rm TG,i}^d \leq P\_{\rm TG,i}(t) - P\_{\rm TG,i}(t-1) \leq \Delta P\_{\rm TG,i}^u \\\ P\_{\rm TG,i}(t) &= P\_{\rm TG,i}(t) , & -\Delta P\_{\rm TG,i}^d > P\_{\rm TG,i}(t) - P\_{\rm TG,i}(t-1) \\\ & & \text{or } P\_{\rm TG,i}(t) - P\_{\rm TG,i}(t-1) > \Delta P\_{\rm TG,i}^u \end{aligned} \tag{33}$$

When considering the operating constraints and SOC constraints of the energy storage unit, the output power update equation can be expressed as

$$\begin{cases} P\_{BS,i}(t) = \underline{P}\_{BS,i}, \underline{P}\_{BS,i} > P\_{BS,i}(t) \& \text{SOC}\_{BS,r}^{\text{min}} \le \text{SOC}\_{BS,r}(t) \le \text{SOC}\_{BS,r}^{\text{max}}\\ P\_{BS,i}(t) = \frac{\underline{A}\_{BS,i}(t) - \underline{b}\_{BS,i}}{\underline{2}a\_{BS,i}}, & \underline{P}\_{BS,i} \le P\_{BS,i}(t) \le \overline{P}\_{BS,i} \\\ P\_{BS,i}(t) = \overline{P}\_{BS,i}, P\_{BS,i}(t) > \overline{P}\_{BS,i} \& \text{SOC}\_{BS,r}^{\text{min}} \le \text{SOC}\_{BS,r}(t) \le \text{SOC}\_{BS,r}^{\text{max}}\\\ P\_{BS,i}(t) = 0, \text{SOC}\_{BS,r}^{\text{min}} > \text{SOC}\_{BS,r}(t) \cap \text{SOC}\_{BS,r}(t) > \text{SOC}\_{BS,r}^{\text{max}} \end{cases} \tag{34}$$

The update equation of the wind generator node with output constraint of wind power is

$$\begin{cases} P\_{WT,i}(t) = 0, & 0 > P\_{WT,i}(t) \\ P\_{WT,i}(t) = \frac{\lambda\_{WT,i}(t) - b\_{WT,i}}{2a\_{WT,i}}, & 0 \le P\_{WT,i}(t) \le P\_{WT,i}^{st}(t) \end{cases} \tag{35}$$
 
$$P\_{WT,i}(t) = P\_{WT,i}^{st}(t), \qquad P\_{WT,i}(t) > P\_{WT,i}^{st}(t)$$

The update equation of the PV node with output constraint of photovoltaic power is

$$\begin{cases} P\_{SL,i}(t) = 0, & 0 > P\_{SL,i}(t) \\ P\_{SL,i}(t) = \frac{\lambda\_{SL,i}(t) - b\_{SL,i}}{2a\_{SL,i}}, & 0 \le P\_{SL,i}(t) \le P\_{SL,i}^{st}(t) \end{cases} \tag{36}$$

$$P\_{SL,i}(t) = P\_{SL,i}^{st}(t), \qquad P\_{SL,i}(t) > P\_{SL,i}^{st}(t)$$

When considering the AC/DC connection line constraint, the update equation for the DC-side power deviation is

$$\begin{cases} \Delta P\_{\rm DC}(t) = P\_{\rm AC\\_DC'}^{\min} & P\_{\rm AC\\_DC}^{\min} > P\_{\rm AC\\_DC}(t) \\ \Delta P\_{\rm DC}(t) = \sum\_{\substack{\rho \in S\_{\rm DC\,DM} \\ r \in \text{S\_{\rm DC}} \\ r \in \text{S\_{\rm DC}}}} P\_{\rm DCM\rho,\ell}(t) - \sum\_{k \in \text{S}\_{\rm CL}} P\_{\rm SL\_k\ell}(t) \\ \Delta P\_{\rm DC}(t) = P\_{\rm AC\\_DC'}^{\max} & P\_{\rm AC\\_DC}(t) > P\_{\rm AC\\_DC}^{\max} \end{cases} \tag{37}$$

When considering the AC/DC connection line constraint, the update equation for the AC-side power deviation is

$$\begin{cases} \Delta P\_{AC}(t) = P\_{AC\\_DC'}^{\min} & P\_{AC\\_DC}^{\min} > P\_{AC\\_DC}(t) \\ \Delta P\_{AC}(t) = \sum\_{g \in S\_{AC\\_DC}} P\_{AC\\_D}(t) - \sum\_{i \in S\_{TG}} P\_{TG,i}(t) \\ \phantom{P} - \sum\_{j \in S\_{WT}} P\_{WT,j}(t) + P\_{AC\\_DC}(t), \qquad P\_{AC\\_DC}^{\min} \le P\_{AC\\_DC}(t) \le P\_{AC\\_DC}^{\max} \\ \Delta P\_{AC}(t) = P\_{AC\\_DC'}^{\max} & P\_{AC\\_DC}(t) > P\_{AC\\_DC}^{\max} \end{cases} \tag{38}$$

By combining Equations (32)–(38) with (27), for the hybrid microgrid, the two-layer consensus algorithm is developed with constraints, which can be used to effectively solve the hierarchical ED problems of the considered hybrid microgrid. It is worth pointing out that, in the hierarchical framework, the generator nodes of the leadership layer and the tracking layer are obtained. For the leadership layer nodes, they can share the feedback data to those adjacent nodes, and for the tracking nodes, they can receive data from the interconnected leader nodes; finally, the microgrid can achieve the consensus state.

For convenience of understanding, the flow chart of the proposed two-layer consensus algorithm is shown in Figure 2.

**Figure 2.** Flow chart of the dynamic economic dispatch (ED) strategy based on the two-layer consensus algorithm.

**Remark 1.** *It should be pointed out that for the considered hybrid microgrid, a fully distributed hierarchical algorithm based on combining Equations (32)–(38) with (27) is proposed for solving the ED problem, where the necessary constraints for distributed units are also considered, which could be helpful for ED of the considered microgrid. Compared with the existing consensus method-based approaches [39,40], the proposed hierarchical consensus algorithm has a better adaptability. In addition, in some cases where the ED issue has the hierarchical property, the results in References [39,40] would fail in solving this problem.*

**Remark 2.** *The main di*ff*erence between this paper and the existing results [39,40,42] is that the hierarchical control thought is utilized in this paper. By the use hierarchical processing, the whole control strategy is divided into two parts, that is, the leadership layer control and the tracking layer control. In our proposed hierarchical consensus strategy, the leadership layer is taken as the upper level, and correspondingly, the tracking layer is taken as the lower level, thus the proposed algorithm could be processed in a hierarchical way, which is in line with the published results. With more leader nodes existing simultaneously, the convergence speed could be faster, and the simulation curves are smoother and more satisfactory.*
