## 4 Bi-Level Dispatch and Control Architecture
### Outer-Level Operation Strategy  
In the outer level of the architecture, the GVPPs and other controllable resources are coordinated for the economic and stable operation. Similar to the inner-level operation strategy, the outer-level strategy can be divided into the normal and emergency modes. In the normal mode, the operation cost \(C_{G,out}\) and the amount of RES curtailment \(R_{C,out}\) are taken as optimization objectives, which can be expressed as,  
\[ \begin{array}{c}\mathbf{F}_{out,nor}(\mathbf{P}_{CER})=\left[\begin{array}{cc}f_{ out,nor,1}(\mathbf{P}_{CER}),&f_{out,nor,2}(\mathbf{P}_{CER})\\ =\left[\begin{array}{cc}C_{G,out},&R_{C,out}\\ \end{array}\right]\end{array}\right]\end{array}  \tag{15}\]  
where \(\mathbf{F}_{out,nor}\) is the objective functions of the normal mode and \(\mathbf{F}_{out,nor}\in\mathbf{R}^{2\times 1}\); \(f_{out,nor,1}\) and \(f_{out,nor,2}\) are corresponding objective functions; \(\mathbf{P}_{CER}\) are the decision variables and,  
\[\mathbf{P}_{CER}=\left[ \begin{array}{cc}\mathbf{P}_{GVPP},&\mathbf{P}_{CER}\\ \end{array} \right] \tag{16}\]where \(\mathbf{P}_{GVPP}\) and \(\mathbf{P}_{OER}\) are the commands for GVPPs and other controllable resources, respectively, and \(\mathbf{P}_{GVPP}\in\mathbf{R}^{N_{G}\times N_{t}}\) and \(\mathbf{P}_{D}\in\mathbf{R}^{N_{o}\times N_{t}}\); \(N_{o}\) is the number of other controllable resources. Additionally, some equality and inequality constraints should be satisfied, which can be represented as,  
\[\mathbf{H}_{out,nor}(\mathbf{P}_{CER})=0 \tag{17}\]  
\[\mathbf{G}_{out,nor}(\mathbf{P}_{CER})\leq 0 \tag{18}\]  
where \(\mathbf{H}_{out,nor}\) and \(\mathbf{G}_{out,nor}\) are the functions of equality and inequality constraints, respectively, and,  
\[\mathbf{H}_{out,nor}=\left[ \begin{array}{cccc}\mathbf{H}_{out,nor,PS},&\mathbf{H}_{out, nor,RE},&\mathbf{H}_{out,nor,G},&\mathbf{H}_{out,nor,O}\end{array} \right] \tag{19}\]  
\[\mathbf{G}_{out,nor}=\left[ \begin{array}{cccc}\mathbf{G}_{out,nor,PS},&\mathbf{G}_{out, nor,RE},&\mathbf{G}_{out,nor,G},&\mathbf{G}_{out,nor,O}\end{array} \right] \tag{20}\]  
where \(\mathbf{H}_{out,nor,PS}\), \(\mathbf{H}_{out,nor,RE}\), \(\mathbf{H}_{out,nor,G}\), and \(\mathbf{H}_{in,nor,O}\) are the equality constraints of power flow and stability, power reserve, GVPPs and other controllable resources, respectively; \(\mathbf{G}_{out,nor,PS}\), \(\mathbf{G}_{out,nor,RE}\), \(\mathbf{G}_{out,nor,G}\), and \(\mathbf{G}_{out,nor,O}\) are the inequality constraints of power flow and stability, power reserve, GVPPs, and other controllable resources, respectively. Therefore, the optimization model for the outer-level operation in the normal mode can be expressed as,  
\[\underset{s.f.\left\{ \begin{array}{c}\min\mathbf{F}_{out,nor}(\mathbf{P}_{CER})\\ \mathbf{H}_{out,nor}(\mathbf{P}_{CER})=0\\ \mathbf{G}_{out,nor}(\mathbf{P}_{CER})\leq 0\end{array} \right.} \tag{21}\]  
In the emergency mode, GVPPs start to provide power support, and so the commands for GVPPs should be adjusted to handle the active power deficits. The frequency deviation of the center of inertia (COI) \(\Delta f_{COI}\) is used for the adjustment. Furthermore, the additional power for GVPP clusters can be calculated as,  
\[\Delta P_{em,G}(n_{e})=k_{p}\Delta f_{COI}(n_{e})+k_{d}\cdot\frac{\mathrm{d} \Delta f_{COI}(n_{e})}{\mathrm{d}t_{e}} \tag{22}\]  
where \(\Delta P_{em,G}\) is the \(n_{e}\)th additional power for GVPPs; \(k_{p}\) and \(k_{d}\) are the proportion and differential coefficients, respectively; \(t_{e}\) is the control interval. Then, the additional power for each GVPP is optimized and the control cost \(C_{G,out}\) is taken as the objective, which can be represented as,  
\[f_{out,em}(\Delta P_{GER}(n_{e}))=C_{G,out} \tag{23}\]  
where \(f_{out,em}\) is the objective function; \(\Delta P_{GER}(n_{e})\) is the \(n_{e}\)th additional power for GVPPs, and \(\Delta P_{GER}(n_{e})\in\mathbf{R}^{N_{G}}\).