*7.2. Design Constraint*

In an arbitrary situation, the requirements or needs that must be considered are referred to as constraints. The power balance between the consumption and generation aspect is the most important constraint [108]. In distribution networks, electricity is imported or exported to the major grid, although this is often limited [109], to BESS-based operations [31]. The following are the most important limitations in maximizing the BESS size.

#### 7.2.1. BESS Operation Constraint

The most common operational constraints when sizing BESS optimization techniques are charge or discharge or SOC constraints. In addition, battery degradation rate and life span needs to be regarded. The literature published by [110–113] reported otherwise, that the optimization of the BESS must consider the SOC. This constraint was taken into [114–118] consideration by maximizing BESS power loss, capacity, method, power balance, and battery lifecycle. In [32], the impact of BESS operation constraints is analyzed based on microgrid application and stated as follows

$$P\_i^{\min} \mathcal{X}\_{ib} \subseteq P\_{ib}^R \subseteq P\_i^{\max} \mathcal{X}\_{ib} \tag{18}$$

$$
\alpha\_i^{\min} P\_{ib}^R \preceq^\* \mathcal{C}\_{ib}^R \preceq^\* \alpha\_i^{\max} P\_{ib}^R \tag{19}
$$

*PR ib* , *<sup>C</sup><sup>R</sup> ib* denote power and energy rating BESS. The maximum and lowest BESS power ratings of *Pmin <sup>i</sup>* , *<sup>P</sup>max <sup>i</sup>* are represented by Equation (18). To determine the current investment status of BES technology, the binary variable *x* is used. Equation (19) utilized the power capacity to compute the maximum discharge time and measure the BESS capacity, where *αmax <sup>i</sup>* , *<sup>α</sup>min <sup>i</sup>* indicates the highest and lowest possible energy to power rating ratios for the BES.

$$0 \le P\_{ibdhs}^{clch} \le P\_{ib}^R \mathfrak{u}\_{ibdhs} \tag{20}$$

$$-P\_{ib}^{R}(1 - \mu\_{ib\text{dls}}) \le P\_{ib\text{dls}}^{c\text{h}} \le 0 \tag{21}$$

The charging or discharge power of BESS *Pch ibdhs*, *<sup>P</sup>dch ibdhs* is limited depicted in Equations (20) and (21), where *i*, *b*, *d*, *h*, and *s* denote the distributed energy resources, bus, day, hour, and scenarios indices, respectively. *uibdhs* is BES operating state. BESS power turns negative and positive while charging and discharging, respectively. The current state of the BESS operation is determined by the value of the binary variable *u*. BESS can only flow when it is equal to one, and charges when it is equivalent to zero. The magnitude of the discharge has a direct bearing on the BESS life cycle, which varies from the diverse technologies. The BESS cycle refers to a complete one that includes both charging and discharging of the battery.

$$\xi\_{\text{iibdls}} = \left(\mu\_{\text{iibdls}} - \mu\_{\text{iibd}(h-1)s}\right)\mu\_{\text{iibdls}}\tag{22}$$

$$\sum\_{d} \sum\_{h} pr\_s \xi\_{i \text{bdlus}} \le \frac{1}{T} \sum\_{m \in N} K\_{im} \mathcal{W}\_{i \text{b}m} \tag{23}$$

Equation (22) is used to determine the BESS cycle, where *ξibdhs* is BESS cycle indicator. Every time the charging process begins, the value is bound to be one, otherwise, it is zero. During the planned time horizon, the total BES cycle need not exceed the specified lifespan regarding the determined maximum DOD and the life project stated in Equation (23), where *Kim* is BESS lifecycle, and *Wibm* represents a binary variable that reflects the value of the BESS maximum DOD.

$$\sum\_{m \in \mathcal{N}} \mathcal{W}\_{ibm} \stackrel{\prec}{\leq} \ x\_{ib} \tag{24}$$

$$\mathbf{C}\_{\text{ibdds}} = \mathbf{C}\_{\text{ibd}(h-1)s} - \frac{P\_{\text{ibdds}}^{\text{cl}}T}{\eta\_i} - P\_{\text{ibdds}}^{\text{cl}}T \tag{25}$$

$$(1 - \sum\_{m \in \mathcal{N}} \Upsilon\_{\text{ibnu}} \mathcal{W}\_{\text{ibnu}}) \mathcal{C}\_{\text{ib}}^{R} \leq \| \mathcal{C}\_{\text{ibdls}} \| \leq \mathcal{C}\_{\text{ib}}^{R} \tag{26}$$

Equation (24), assures that for each BESS deployed, only one maximum depth of discharge value is evaluated. According to Equation (25), the energy stored at each time interval is equal to the preceding period minus the discarded or charged energy, where *Cibdhs* is stored energy BESS during each interval. Meanwhile in Equation (26), BESS cannot be discharged with less energy than the minimum value specified by the maximum depth. This is not indicated by the discharge, nor can it be charged with more energy than its rated capacity allows during the process. Where Y*ibm* is maximum DOD BESS.

#### 7.2.2. Battery Degradation of BESS Constraint

Battery degradation in BESS is important to consider. Cardoso et al. [27], stated that the total annual electricity cost savings from PV and BESS can be reduced by 5–12% by solely considering the battery degradation constraint limitations. Furthermore, some literature [35] stated that a battery degradation model is based on cycling and aging conditions. Afterwards, it is used in the BESS operation constraint to support its optimization by lowering the planning cost of energy storage.

$$\gamma^{\text{Idl}} \left( \text{SoC}\_{\text{j},k} \right) = A\_{\text{j}}^{\text{Idl}} \text{SoC}\_{\text{j},k}^2 + B\_{\text{j}}^{\text{Idl}} \text{SoC}\_{\text{j},k} + \text{C}\_{\text{j}}^{\text{idl}} \tag{27}$$

$$\gamma^{\mathbb{C}yc} \left( DoD\_{j,k,n} \right) = A\_j^{\mathbb{C}yc} DoD\_{j,k,n}^2 + B\_j^{\mathbb{C}yc} DoD\_{j,k,n} \tag{28}$$

Equations (27) and (28) are capacity fade rates during idling and cycling conditions resulting from historical data on battery characteristics and adjusted to the least squares fitting method [35]. Where *j*, *k*, *n* are the battery technology, transmission grid nodes, and charge/discharge cycles indices, respectively. *γIdl*, *γCyc* is the capacity fade rate during the idling condition, and *AIdl <sup>b</sup>* , *<sup>B</sup>Idl <sup>b</sup>* , *<sup>C</sup>Idl <sup>b</sup>* , *<sup>A</sup>Cyc <sup>b</sup>* , *<sup>B</sup>Cyc <sup>b</sup>* is a quadratic, linear, and constant of the degradation functions during idling and cycling.

$$0 \le E\_{s,j,k,t}^{BESS} \le \mathbb{E}\_{j,k}^{BESS} \left[ 1 - \left( \gamma^{\text{Idl}} \left( \text{SoC}\_{j,k} \right) + \sum\_{n} y\_n \gamma^{\text{Cyc}} \left( \text{DoD}\_{j,k,n} \right) \right) Y(s) \right] \tag{29}$$

BESS charging is limited to the energy rating of those batteries which continues to fade due to the life horizon, depicted in the Equation (20), where *EBESS <sup>b</sup>*,*i*,*y*,*d*,*<sup>t</sup>* is the BESS continuity energy, and *EBESS <sup>b</sup>*,*<sup>i</sup>* represents the installed BESS Energy. The value can be 0.5 for half cycles and 1.0 for full ones *yn*. *Y* represents years for the number of the scenario *s*.

$$Term\_{j,k} = 1 - \left(\gamma^{Idl} \left(\text{SoC}\_{j,k}\right) + \sum\_{n} y\_n \gamma^{\text{Cyc}} \left(DoD\_{j,k,n}\right)\right) T\_j^{Lt} \tag{30}$$

$$EoL\_j \le rem\_{j,k} \le 1\tag{31}$$

Equation (30), *remj*,*<sup>k</sup>* is a formulation of the remaining BESS capacity at the end of battery service life due to idling degradation and cycling. *TLt <sup>j</sup>* represents service lifetime period BESS of a manufacturer. The selected operating strategy is dependent on the remaining BESS capacity. *remj*.*<sup>k</sup>* ensures that the remaining capacity is not less than the EOL threshold, moreover a constraint is applied in Equation (31).

#### 7.2.3. Power and Energy Balance Constraint

When it comes to BESS size, the power, and energy balance between demand and generation is crucial. In the following literatures [112,116,118–122], the energy and power balance are constraints in the process of optimizing the size of the BESS. Based on [32], the power and energy balance constraints are expressed as follows

$$\sum\_{\mathbf{y}\in[G,\mathcal{W}]} \mu\_{\text{i}\text{b}} P\_{\text{i}\text{dhs}} + \sum\_{\mathbf{d}\in\mathcal{B}} \left( P\_{\text{i}\text{ddss}}^{\text{ch}} + P\_{\text{i}\text{ddss}}^{\text{ch}\text{h}} \right) + \sum\_{\mathbf{i}\in I} \psi\_{\text{i}\text{b}} f\_{\text{i}\text{dhs}} + P\_{\text{d}\text{lbs}}^{\text{M}} + LS\_{\text{hdls}} = D\_{\text{bdl}} \tag{32}$$

The balance of power and energy constraints are stated in Equation (32). This guarantees the amount of power provided by the distributed energy resources (DER) installed on that bus, plus or minus the amount of electricity going into or emanating from it, is equal to the quantity of power locally needed on that bus. If there is not enough generation to maintain BESS balance, the load is reduced, and the strength tends to be positive while the system is discharging and negative while it is charging. However, if the power is flowing from the utility grid into the microgrid, then it has a positive value, otherwise, it is negative. Where *i*, *b*, *d*, *h*, and *s* are the distributed energy resources, bus, day, hour, and scenarios indices, respectively. *μib* is a generation-bus incidence matrix element, *Pidhs* is DER output power, *Pch ibdhs*, *<sup>P</sup>dch ibdhs* depicts BESS charging and discharging power, *ψib* represents a line-bus matrix element (one if line *l* is connected to bus *b*, 0 if otherwise), *fidhs* denotes distribution line power flow, *P<sup>M</sup> dhs* is electricity moved to and from the utility grid, *LSbdh* is the load shedding cost, and *Dbdh* is total load demand.

$$-P^{M,max}z\_{dhs} \stackrel{\sim}{\leq} P^{M}\_{ds} \stackrel{\sim}{\leq} P^{M,max}z\_{dhs} \tag{33}$$

$$0 \le L S\_{\text{bdh}} \le \left( D\_{\text{bdh}} - C D\_{\text{bdh}} \right) \tag{34}$$

$$-f\_l^{\max} \le f\_{\text{idhs}} \le f\_l^{\max} \tag{35}$$

Equation (33) is the limitation of a microgrid network of power transfer to the grid. Furthermore, Equation (34) is the limit for load reduction, where *PM*,*max* denotes the maximum power capacity of the microgrid to the utility grid, *zdhs* is microgrid/utility grid status, *Dbdh*, *CDbdh* represents the sum of all load demands as well as the critical load demand. Equation (35) is the amount of power that flows through a distribution network microgrid due to channel capacity constraints, where *f max <sup>l</sup>* is the maximum power capacity of distribution line.

#### *7.3. Optimization Strategy and Algorithm*

Size, capacity, cost, and lifetime are all aspects of the BESS that need to be improved. Existing research on BESS sizing-related problems is categorized according to grid scenario, goals that need to be achieved, the strategy applied, test bus, and various advantages and limitations to optimize the different algorithms. These include genetic algorithms (GA), particle swarm optimization (PSO), dynamic programming (DP), taboo search, fuzzy PSO, and bat algorithm. Simulation and modeling technologies such as PSLF, MATLAB, CPLEX, OpenDSS, GAMS, Gurobi, PowerFactory, and DIgSILENT are extensively used to improve BESS sizes. MATLAB is also a viable choice. Moreover, several research use a test bus from the IEEE study case to evaluate the system's performance instead of the current test systems [44]. The following are some of the most often used algorithms for predicting BESS size.

#### 7.3.1. Probabilistic

Since several parameters tend to be improved, the probabilistic technique is regarded as one of the simplest ways of measuring BESS. The fundamental constraint of such a method is the number of parameters that need to be examined. Based on preliminary research, the probabilistic method was discovered to be the most useful approach for calculating the uncertainty parameter of the optimization process to obtain the best BESS measure [123–129]. Its key benefit is the need for a small amount of data to conclude. As a result, probabilistic approaches are excellent in circumstances where information is scarce.
