## 3 Optimization Problem Formulations
### Preparation-Mode Operation Formulation  
The optimal MG operation in the preparation mode is formulated as nested MILP problems with chance constraints. It is a combination of normal-mode and emergency-mode problems. Further, the on-event problem under the emergency-mode operation condition is nested in the pre-scheduling problem under the normal-mode operation condition. In other words, with the decision-making of the pre-scheduling problem, normal- and emergency-mode operations are determined together under the preparation-mode problem. The cost function of the preparation mode, which is a sum of the normal-mode and emergency-mode operating cost, is expressed as Equation (38).  
\[min\ [f^{NM}(X^{NM})+f^{EM}(X^{EM})] \tag{38}\]  
The objective function of the preparation mode is subject to constraints Equations (2)-(20), Equations (22)-(37), and Equations (39)-(47).  
\[P_{g,sto_{1}-1}^{NM}-RD_{G}^{max}\leq P_{g,ts_{1}}^{STO_{1}},\forall_{g}, \forall_{I},ts_{1}=sto_{1}. \tag{39}\]\[P_{g,I_{1}}^{STO_{l}}\leq P_{g,I_{0}-1}^{NM}+RUL_{G}^{max},\forall_{g},\forall_{l},ts_{l}=sto_{l}. \tag{40}\]  
\[\sum_{t=0}^{TO_{g}-1}u_{g,I+t}^{STO_{l}}\geq T_{g}(u_{g,I_{0}}^{STO_{l}}-u_{g,I_{ 0}-1}^{NM}),\forall_{g},\forall_{l},ts_{l}=sto_{l}. \tag{41}\]  
\[To(u_{l}^{NM}-u_{t-1}^{NM})\leq\sum_{t=0}^{T_{0}-(j+1)}u_{ts_{l}+t}^{STO_{l}}+ \sum_{k=1}^{j}u_{t+j-k}^{NM},\forall_{g},\forall_{l}. \tag{42}\]  
\[T_{g}-\sum_{ts=0}^{T_{g}-1}u_{g,I_{1}+ts}^{STO_{l}}\geq T_{S}(u_{g,I_{0}-1}^{ NM}-u_{g,I_{S}I_{l}}^{STO_{l}}),\forall_{g},\forall_{l},ts_{l}=sto_{l}. \tag{43}\]  
\[T_{g}-\sum_{t=0}^{T_{0}-(j+1)}u_{g,I_{1}+t}^{STO_{l}}+\sum_{k=1}^{j}u_{t+j-k}^ {NM}\leq T_{S}(u_{t}^{NM}-u_{t-1}^{NM}),\forall_{g},\forall_{l}. \tag{44}\]  
\[y_{g,I_{1}}^{STO_{l}}=max\ \{(u_{g,I_{1}}^{STO}-u_{g,I_{0}-1}^{NM}),0\}, \forall_{g},\forall_{l},ts_{l}=sto_{l}. \tag{45}\]  
\[z_{g,I_{1}}^{STO_{l}}=max\ \{(u_{g,I_{0}-1}^{NM}-u_{g,I_{1}}^{STO_{l}}),0\}, \forall_{g},\forall_{l},ts_{l}=sto_{l}. \tag{46}\]  
\[SoC_{ts_{l}}^{STO_{l}}=SoC_{sto_{l}-1}^{NM}+\frac{\eta\cdot P_{ts_{l}}^{ch,STO _{l}}-P_{ts_{l}}^{ch,STO_{l}}}{Bat_{c}}\cdot\Delta t,\forall_{l},ts_{l}=sto_{l}. \tag{47}\]  
In the preparation-mode operation problem, some decision variables of the emergency mode are affected by the decision variables of normal-mode problems before the \(STO\). Thus, the preparation-mode operation problem needs to include constraints for considering the relationship between the normal- and emergency-mode operation problems. The decision variables in the emergency-mode operation affected by the decision variables in the normal mode operation are SoC dynamics, on/off state, and output of generators. Equations (39)-(47) indicate the relationship of decision variables between the emergency normal mode operation.  
Equations (39) and (40) represent the ramp capability's limit relationship between the normal- and emergency-mode variables about the generation output. Equations (41) and (44) indicate the minimum startup/shutdown time relationships between the normal- and emergency-mode variables in the generators' on/off state. In constraints (42) and (44), \(j=1\):\(To-1\), \(t=STO-j\), \(ts_{l}=sto_{l}\). Equations (45) and (46) represent the startup and shutdown binary variables' relationship between the normal and emergency modes, respectively. Equation (47) indicates the SoC relationship between the normal and emergency modes.