## 4 Bi-Level Dispatch and Control Architecture
### Inner-Level Operation Strategy
\begin{array}{l}\underset{s.t.}{\text{min}}F_{in,nor}(\textbf{P}_{DER})\\ \textbf{G}_{in,nor}(\textbf{P}_{DER})\leq 0\end{array}  \tag{7}\]  
In the emergency mode, the emergency response agent will displace the optimal dispatch agent, and the GVPP starts to provide power support for the power system. As for the control objectives, the accommodation of RESs and the smooth of net output power can be neglected. Moreover, the load shedding agent can be actuated. Thus, the objective functions of the emergency operation mode can be expressed as,  
\[\mathbf{F}_{in,em}(\mathbf{P}_{SDER})=\left[ \begin{array}{cc}f_{in,em,1}(\mathbf{P}_{SDER}),&f_{in,em,2}(\mathbf{P}_{SDER})\\ =\left[\begin{array}{cc}R_{C,in},&D_{S,in}\\ \end{array}\right]\end{array} \right] \tag{8}\]  
where \(\mathbf{F}_{in,em}\) is the objective functions of the emergency operation mode and \(\mathbf{F}_{in,em}\in\mathbf{R}^{2\times 1}\); \(f_{in,em,1}\) and \(f_{in,em,2}\) are corresponding objective functions; \(\mathbf{P}_{SDER}\) is the decision variables and,  
\[\mathbf{P}_{SDER}=\left[ \begin{array}{cc}\mathbf{P}_{T},&\mathbf{P}_{R},&\mathbf{P}_{E},&\bm {P}_{D},&\mathbf{P}_{L}\\ \end{array} \right] \tag{9}\]  
where \(\mathbf{P}_{L}\) is the commands for load shedding and \(\mathbf{P}_{L}\in\mathbf{R}^{N_{l}\times N_{l}}\); \(N_{l}\) is the number of deployed load shedding devices. Additionally, in the emergency mode, the constraints of power reserve can be neglected. The equality and inequality constraints can be represented as,  
\[\mathbf{H}_{in,em}(\mathbf{P}_{SDER})=0 \tag{10}\]  
\[\mathbf{G}_{in,em}(\mathbf{P}_{SDER})\geq 0 \tag{11}\]  
where \(\mathbf{G}_{in,em}\) and \(\mathbf{H}_{in,em}\) are the functions of equality and inequality constraints, respectively, and,  
\[\mathbf{H}_{in,em}=\left[ \begin{array}{cc}\mathbf{H}_{in,em,PS},&\mathbf{H}_{in,em,T},& \mathbf{H}_{in,em,R},&\mathbf{H}_{in,em,E},&\mathbf{H}_{in,em,D},&\mathbf{H}_{in,em,L}\\ \end{array} \right] \tag{12}\]  
\[\mathbf{G}_{in,em}=\left[ \begin{array}{cc}\mathbf{G}_{in,em,PS},&\mathbf{G}_{in,em,T},& \mathbf{G}_{in,em,R},&\mathbf{G}_{in,em,E},&\mathbf{G}_{in,em,D},&\mathbf{G}_{in,em,L}\\ \end{array} \right] \tag{13}\]  
where \(\mathbf{H}_{in,em,PS},\mathbf{H}_{in,em,T},\mathbf{H}_{in,em,R},\mathbf{H}_{in,em,E},\mathbf{H}_{ in,em,D}\), and \(\mathbf{H}_{in,em,L}\) are the equality constraints of power flow and stability, traditional generators, RESs, ESSs, controllable loads, and load shedding, respectively; \(\mathbf{G}_{in,em,P,S}\), \(\mathbf{G}_{in,em,T}\), \(\mathbf{G}_{in,em,R}\), \(\mathbf{G}_{in,em,E}\), \(\mathbf{G}_{in,em,D}\), and \(\mathbf{G}_{in,em,L}\) are the inequality constraints of power flow and stability, traditional generators, RESs, ESSs, controllable loads, and controllable loads, and load shedding, respectively. Therefore, the optimization model for the inner-level GVPP operation in the emergency mode can be expressed as,  
\[ \begin{array}{c}\text{min}\mathbf{F}_{in,em}(\mathbf{P}_{SDER})\\ \text{s.f.}\left\{\begin{array}{cc}\mathbf{H}_{in,em}(\mathbf{P}_{SDER})=0\\ \mathbf{G}_{in,em}(\mathbf{P}_{SDER})\leq 0\end{array}\right.\end{array}  \tag{14}\]