## 2 A Two-Stage Robust Optimization Model
### Mathematical Model of Microgrid System
#### 2.1.2 Energy Storage Device  
The energy storage device in this article selects the battery as the research object and assumes that it is only in a charging or discharging state during operation [27]. The state of charge model of the battery is as follows:  
\[\begin{array}{ll}SOC_{t}=&SOC_{t-1}+\left[\frac{x_{\text{bat,t}}\cdot P^{ \text{ch}}_{\text{bat,t}}\cdot\eta_{\text{ch}}}{E_{\text{EN}}}\right.\\ &-\left.\frac{(1-x_{\text{bat,t}})}{E_{\text{EN}}\cdot\eta_{\text{ dis}}}\right]\Delta t\times 100\%\end{array} \tag{5}\]  
where \(SOC_{t}\) and \(SOC_{t-1}\) represent the state of charge of the battery during time periods \(t\) and \((t-1)\), respectively; \(P^{\text{ch}}_{\text{bat,t}}\) and \(P^{\text{dis}}_{\text{bat,t}}\) represent the charging and discharging power of the battery during time period \(t\). \(\eta_{\text{ch}}\) and \(\eta_{\text{dis}}\) are, respectively, the charging and discharging efficiency of energy storage devices. \(E_{\text{EN}}\) rated battery capacity. \(x_{\text{bat,t}}\) is a 0-1 integer variable, and \(x_{\text{bat,t}}\)\(=1\) represents that the battery is in a charged state during time period t.  
The depth of discharge during each charge and discharge cycle of a battery is a key factor affecting its service life. Ignoring this factor will inevitably lead to optimistic optimization results. The relationship between battery discharge depth and equipment life is shown in the Formula (6). Firstly, the cyclic discharge depth is determined by a rainflow counting method, and then its cyclic life can be fitted by power function. However, this formula has a high degree of nonlinearity and is difficult to solve in the model.  
\[N_{\text{life}}=N_{0}(D^{\text{cyc}}_{\text{d}od})^{-k_{p}} \tag{6}\]  
where \(N_{\text{life}}\) is the number of cycles when the battery reaches its upper limit of life. \(D^{\text{cyc}}_{\text{d}od}\) is the discharge depth of the battery. \(N_{0}\) is the number of cycles required for the battery to reach its maximum lifespan when operating at 100% discharge depth. The \(k_{p}\) fitting coefficients of the power function are \(k_{p}\) and \(N_{0}\), and both are the factory parameters of each battery.  
To solve the above problems, this article simplifies them into a lifetime model based on the equivalent full cycle number of discharge depth. Firstly, the number of charge and discharge cycles at different discharge depths is converted to the equivalent full cycle number at 100% discharge depth, and it is assumed that the battery undergoes charge and discharge cycles at time \(t\), with a cycle discharge depth equal to the discharge depth of the battery at time \(t-1\). The expressions for the equivalent full cycle number and daily equivalent cycle number of a single battery are as follows [28]:  
\[D_{\text{dod,t-1}}=1-SOC_{t-1} \tag{7}\]  
\[D^{\text{cyc}}_{\text{dod,t}}=D_{\text{dod,t-1}}\cdot x_{\text{soc,t}} \tag{8}\]\[\chi_{\text{bat},t}=\max\{\chi_{\text{soc},t}-\chi_{\text{soc},t-1},0\} \tag{9}\]  
\[n_{\text{eq},t}={(D_{\text{dod},t}^{\text{cyc}})}^{kp} \tag{10}\]  
\[N_{\text{eq}}=\sum_{t=1}^{T}n_{\text{eq},t} \tag{11}\]  
where \(D_{\text{dod},t-1}\) is the discharge depth during the \(t-1\) period. \(D_{\text{dod},t-1}^{\text{cyc}}\) is the depth of cyclic discharge for time period \(t\). When \(\chi_{\text{SOC},t}\) is a 0-1 integer variable with a value of 1, this indicates the occurrence of a charge discharge cycle during time period \(t\). \(\chi_{\text{bat},t}\) is a 0-1 integer variable is used as the number of cycles for the battery. When its value is 1, this indicates that the battery has undergone one charge discharge cycle--that is, the battery has transitioned from a discharged state to a charged state. \(n_{\text{eq},t}\) is the equivalent number of full cycles of the battery during time period \(t\), and \(N_{\text{eq}}\) is the daily equivalent full cycle count of the battery.