## 3 Optimization Problem Formulations  
### Normal Mode Operation Formulation  
Equation (1) expresses the objective function of the normal mode operation. In Equation (1), \(X^{NM}\) represents the set of decision variables related to the normal-mode operation problem. The first and second terms indicate the cost of operating the controllable generating unit and the cost of power exchange with the main grid, respectively. The last term represents the sum of the load shedding costs for classes A and B. \[ \begin{split} f^{NM}(X^{NM})&=\sum_{g=1}^{G}\sum_{t =1}^{T}(C_{g}^{gen}\cdot P_{g,t}^{NM}+C_{g}^{SU}\cdot y_{g,t}^{NM}+C_{g}^{SD} \cdot z_{g,t}^{NM})\\ &\quad+\sum_{t=1}^{T}(PR_{t}^{Buy}\cdot P_{t}^{Buy.NM}-PR_{t}^{ Selt}\cdot P_{t}^{Sell.NM})\\ &\quad+\sum_{t=1}^{T}(C^{ISA}\cdot P_{t}^{ISA.NM}+C^{LSB}\cdot P _{t}^{LSB.NM}).\end{split}  \tag{1}\]  
Equations (2)-(20) represent constraints related to the normal-mode operation. The power balance of the system is represented by Equation (2), and Equations (3) and (4) represent the load shedding. \[ \begin{split}&\sum_{g=1}^{G}P_{g,t}^{NM}+P_{t}^{WT}+P_{t}^{PV}+ \eta\cdot P_{t}^{dch.NM}-P_{t}^{ch.NM}\\ &+P_{t}^{Buy.NM}-P_{t}^{Sell.NM}\geq P_{t}^{IA.NM}+P_{t}^{IB.NM},\forall_{t}.\end{split}  \tag{2}\]  
\[ \begin{split}& P_{t}^{LSA.NM}=P_{t}^{LA}-P_{t}^{IA.NM},\forall_{t}. \end{split}  \tag{3}\]  
\[ \begin{split}& P_{t}^{LSB.NM}=P_{t}^{LB}-P_{t}^{IB.NM},\forall_{t}. \end{split}  \tag{4}\]  
Further, Equation (5) represents the output limit of the generating units. Equation (6) indicates the ramp capability limit of the generating units. Equations (7) and (8) represent the minimum start-up time and minimum stop time of the generating units, respectively. Equations (9) and (10) represent the binary variables that indicate the start-up and shutdown behavior of the generator, respectively. \[ \begin{split} u_{g,t}^{NM}\cdot P_{g}^{min}&\leq P_{g, t}^{NM}\leq u_{g,t}^{NM}\cdot P_{g}^{max},\forall_{g,t}.\end{split}  \tag{5}\]  
\[ \begin{split}& P_{g,t-1}^{NM}-RD_{G}^{max}\leq P_{g,t}^{NM}\leq P _{g,t-1}^{NM}+RU_{G}^{max},\forall_{g,t}.\end{split}  \tag{6}\]\[\sum_{t=0}^{TO_{g}-1}u_{g,t+t}^{NM}\geq TO_{g}(u_{g,t}^{NM}-u_{g,t-1}^{NM}),\forall_ {g,t}. \tag{7}\]  
\[TS_{g}-\sum_{k=0}^{TS_{g}-1}u_{g,t+t}^{NM}\geq TS_{g}(u_{g,t-1}^{NM}-u_{g,t}^{ NM}),\forall_{g,t}. \tag{8}\]  
\[y_{g,t}^{NM}=\max\ \{(u_{g,t}^{NM}-u_{g,t-1}^{NM}),0\},\forall_{g,t}. \tag{9}\]  
\[z_{g,t}^{NM}=\max\ \{(u_{g,t-1}^{NM}-u_{g,t}^{NM}),0\},\forall_{g,t}. \tag{10}\]  
Equations (11)-(18) are associated with the battery operations. The battery dynamics are modeled through a linear model as shown in Equation (11). The maximum charging and discharging power are restricted by the capacity of the power conversion system (PCS), as shown in Equations (12) and (13), respectively. Further, Equations (14) and (15) constrain the maximum allowable charging/discharging power according to the SoC level, \(SoC_{t}^{NM}\). Equations (16) and (17) are introduced to prevent the battery from being charged and discharged frequently, respectively, which extends the battery lifespan. Thus, once charging begins, it must last for at least TCM hours, and once discharging starts, it must not be terminated within TDM hours. Equation (18) indicates that charging and discharging must not occur simultaneously within the ESS.