## 3 Optimization Configuration Method of ESS
### Constraint Formulation  
It is essential to configure GFM-ESSs due to the uneven distribution of inertia resources in the renewable energy power system. The NFDC is used to describe the frequency response ability of certain generators and the inertia distribution characteristics of power system. The value of NFDC is subject to the following constraint, which is shown in Equation (19).  
\[NFDC_{\text{min}}<(NFDC_{i}^{\text{eq}}=\sum\limits_{i=1}^{N_{\text{C}}}\frac {Y_{\text{eq}}^{m,r}}{K_{ji}})<NFDC_{\text{max}} \tag{19}\]  
where the quantity of generators in the power system is represented by \(N_{G}\), and \(NFDC_{\text{min}}\) and \(NFDC_{\text{max}}\) are the extreme values of the system frequency change rate which can be determined according to relevant specifications for the stable operation of the power system.  
According to the inertia constraint in Equation (19), the configuration requirements of GFM-ESSs can be clarified. It is feasible to guarantee that the frequency variation of the power system will remain within the safe operation range.  
\[\sum K_{j}=K_{j}(\text{SG})+K_{j}(\text{ESS})>\sum Y_{\text{eq}}^{m,r}/NFDC_{ \text{max}} \tag{20}\]  
The feasible region of ESS is subjected to a variety of constraints as shown in Equations (21)-(25), including capacity constraints and charge-discharge constraints.  
\[\gamma_{\text{SOC}}E_{i,\text{ess}}^{\text{min}}\leq E_{i,\text{ess}}\leq(1- \gamma_{\text{SOC}})E_{i,\text{ess}}^{\text{max}} \tag{21}\]  
\[E_{i,\text{ess}}^{t}-E_{i,\text{ess}}^{t-1}=\eta^{\text{c}}P_{i,\text{ess}}^{ \text{ch}}\Delta t-\frac{P_{i,\text{ess}}^{\text{dis}}}{\eta^{\text{d}}}\Delta t \tag{22}\]  
\[0\leq P_{i,\text{ess}}^{\text{ch}}\leq u_{i,\text{ess}}^{\text{ch}}P_{i,\text{ ess}}^{\text{re}} \tag{23}\]  
\[0\leq P_{i,\text{ess}}^{\text{dis}}\leq u_{i,\text{ess}}^{\text{dis}}P_{i,\text{ ess}}^{\text{re}} \tag{24}\]  
\[u_{i,\text{ess}}^{\text{ch}}+u_{i,\text{ess}}^{\text{dis}}\leq 1 \tag{25}\]  
where \(\gamma_{\text{SOC}}\) is the maximum discharge rate of the ESS, \(E_{i,\text{ess}}^{\text{min}}\) and \(E_{i,\text{ess}}^{\text{max}}\) are maximum and minimum capacities of the ESS power output, \(P_{i,\text{ess}}^{\text{ch}}\) and \(P_{i,\text{ess}}^{\text{dis}}\) are the power for energy acquisition and energy discharge, \(\mu_{i,\text{ess}}^{\text{ch}}\) and \(\mu_{i,\text{ess}}^{\text{dis}}\) represent state variables that indicate the different operating states of the ESS, and \(\eta^{\text{c}}\) and \(\eta^{\text{d}}\) are the energy acquisition efficiency and discharge efficiency of ESS.  
Finally, the power balance constraints and power flow constraints are considered, which are shown in Equations (26) and (27). The designed power flow constraint method does not depend on the selection of initial values and can be directly used in the optimization model. Moreover, this model has the ability to represent the branch power flow simultaneously [26; 27].  
\[\sum_{i=1}^{N_{\text{SG}}}P_{\text{SG}}^{i}+\sum_{i=1}^{N_{\text{loss}}}\left( P_{i,\text{res}}^{\text{f}}-P_{i,\text{res}}^{\text{r}}\right)+\sum_{i=1}^{N_{ \text{seg}}}P_{i,\text{ess}}^{\text{dis}}=\sum_{i=1}^{N_{\text{Load}}}P_{i}^{ \text{Load}}+\sum_{i=1}^{N_{\text{seg}}}P_{i,\text{ess}}^{\text{ch}} \tag{26}\]  
\[P_{\text{trans}}^{\text{min}}\leq Q_{l}^{\text{SG}}P_{l}^{\text{SG}}+Q_{l}^{ \text{res}}\Big{(}P_{l,I}^{\text{res}}+P_{\text{ess}}^{\text{dis}}-P_{\text{ ess}}^{\text{ch}}\Big{)}<P_{\text{trans}}^{\text{max}} \tag{27}\]  
where \(N_{\text{Load}}\) represents the number of loads in the power system, and \(P_{i}^{\text{Load}}\) is the active power of load. The definitions of the remaining variables are the same as those in Equation (18).