# Optimal Sizing of Battery Energy Storage System for Implicit Flexibility in Multi-Energy Microgrids
## 2 Methodology
### Bess  
The employed BESS model relies on four LUTs built from experimental data. Specifically, two LUTs derived from performance maps describe how AC-side power varies with the state of charge (SOC) and DC-side power--one for charging and one for discharging. Two additional capability LUTs capture how the maximum charging and discharging power changes across different SOC intervals. While a finer discretization improves the accuracy of BESS operation modeling, it also increases the computational load. A simplified version of the performance LUTs used in this study and the employed capability LUTs are provided in Figure 2 for illustrative purposes. The performance LUTs implemented in this study use a 5% SOC discretization, with 299 data points for charging and 219 for discharging. The capability LUT is defined over just four SOC intervals, reflecting the fact that maximum charging power is limited only when SOC > 95% and that maximum discharging power is constrained only when SOC < 5%. The equations below describe the implementation of the fast piecewise linear modeling approach. In this formulation, the AC-side and DC-side charge/discharge power variables are modeled as linear combinations of support points from the previously introduced LUTs, as shown in Equations (14)-(17). These constraints ensure that the same set of weighting coefficients \(y_{k,t}^{\textit{dkn}_{\textit{LUT}}}\) and \(y_{k,t}^{\textit{dls}_{\textit{LUT}}}\), treated as time-dependent decision variables in the optimization, is applied to both the AC and DC side variables, effectively selecting a specific charging or discharging operating point of the BESS. Equations (18) and (19) enforce that the sum  
\[p_{t}^{BESS_{\text{sho}DC}}=\sum_{k=1}^{K_{\text{shuLUT}}}\left(p_{k}^{\text{ chuDC}_{\text{LUT}}}\times y_{k,t}^{\text{chuLUT}}\right), \tag{14}\]  
\[p_{t}^{BESS_{\text{sho}AC}}=\sum_{k=1}^{K_{\text{shuLUT}}}\left(p_{k}^{\text{ chuAC}_{\text{LUT}}}\times y_{k,t}^{\text{chuLUT}}\right), \tag{15}\]  
\[p_{t}^{BESS_{\text{sho}DC}}=\sum_{k=1}^{K_{\text{shuLUT}}}\left(p_{k}^{\text{ disDC}_{\text{LUT}}}\times y_{k,t}^{\text{disLUT}}\right), \tag{16}\]  
\[p_{t}^{BESS_{\text{sho}AC}}=\sum_{k=1}^{K_{\text{shuLUT}}}\left(p_{k}^{\text{ disAC}_{\text{LUT}}}\times y_{k,t}^{\text{disLUT}}\right), \tag{17}\]  
\[\sum_{k=1}^{K_{\text{shuLUT}}}\left(y_{k,t}^{\text{chuLUT}}\right)=y_{t}^{BESS _{\text{shcharging}}}, \tag{18}\]  
\[\sum_{k=1}^{K_{\text{shuLUT}}}\left(y_{k,t}^{\text{disLUT}}\right)=y_{t}^{BESS _{\text{shcharging}}}, \tag{19}\]  
\[y_{t}^{BESS_{\text{shcharging}}}+y_{t}^{BESS_{\text{shcharging}}}+y_{t}^{BESS _{\text{shelfare}}}=1. \tag{20}\]  
The charging and discharging power flows of the BESS are linked to its SOC through the following constraints. The same sets of coefficients used to represent the BESS operating point as a convex combination of the LUT support points \(y_{k,t}^{chuLUT}\) and \(y_{k,t}^{disLUT}\) are also used to compute the SOC at each time step, as shown in Equation (21). The variable \(soc_{t}^{BESS_{\text{shoE}}}\) is introduced to represent the SOC during idle periods and is constrained to zero whenever the binary variable \(y_{t}^{BESS_{\text{shoE}}}\) is zero. To ensure temporal consistency, Equation (22) enforces the SOC update by linking the SOC at the current time step to the SOC from the previous time step and the current DC power flow. In this formulation, \(\Delta t\) denotes the time step duration in hours, while \(P^{BESS_{\text{shom}}}\) and \(E^{BESS_{\text{shom}}}\) represent the nominal installed power and energy capacity of the BESS, respectively. Additionally, constraints are imposed to ensure that the SOC at the end of the day equals that at the beginning of the day, and that the SOC remains within predefined lower and upper bounds at all times.