*7.1. Objective Function BESS*

Since BESS plays an important role, its sizing is essential to ensure the normal functioning of distribution networks. An accurate and realistic model improves the operating systems from an economic and safety standpoint [104]. BESS optimum sizing is centered on finding its optimal capacity and the ability to minimize distribution network operating costs while meeting performance goals. Its investment cost is an essential component in calculating the distribution network operating expense. Moreover, this is affected by the investment payback period. As a result, BESS life is significant, and the number of cycles it can complete as well as the SOC at which it runs, are the two most important parameters used to determine the longevity of the battery. To assess the expenses linked to BESS, the anticipated lifespan was used [105]. In [106], the lifetime was determined by predictive models. The main objective of the study is to reduce costs, integrate RES, analyze its effects, and obtain benefits for the network.

#### 7.1.1. Objective Function BESS to Reduce Total Cost Storage Expansion Planning

In the literature [32] the objective function was considered to reduce the total cost of storage expansion planning on the microgrid. It is defined as follows

$$\begin{aligned} Min \sum\_{i \in G} \sum\_{d} \sum\_{h} F\_i \left( P\_{idh(\cdot)}, I\_{idh(\cdot)} \right) &+ \sum\_{d} \sum\_{h} \rho\_{dh} P\_{dh(\cdot)}^{M} \\ &+ \sum\_{s} pr\_s \sum\_{b \in K} \sum\_{d} \sum\_{h} LS\_{bdhs} v \\ &+ \sum\_{i \in B} \sum\_{b \in K} \left( P\_{ib}^{R} \left( C P\_i^{a} + C M\_i \right) + \mathcal{C}\_{ib}^{R} \left( \mathcal{C} E\_i^{a} + \mathcal{C} I\_i^{a} \right) \right) \end{aligned} \tag{10}$$

The first two-term Equation (10) indicates the operating cost of the microgrid when connected to the grid. Where *b*, *d*, *h*, *i*, *l*, *s* and *B* are the bus, day, hour, distributed energy resources, lines, scenarios, and battery technologies indices, respectively. *Fi* represents the microgrid local DG units cost function, *Pidh*() is DG output power, *Iidh*() depicts the commitment state of dispatchable units, *ρdh* is electricity market price (\$/kWh), and *P<sup>M</sup> dh*() illustrates the power transferred to and from the utility grid. The third term accounts for the costs of dissatisfying the requirements of the MG demand. Due to insignificant changes in the demand for microgrids, the output of generators distributed at the price of electricity during the planning period need to consider the historical data of one year. Where *prs* is the probability of islanding scenarios, *LSbdhs* depicts load curtailment, and *v* represents the value of lost load (\$/kWh). Incidentally, the value of lost load (VOLL) measures the economic losses associated with underserved energy. It depicts the willingness of customers to pay for reliable electrical services. This number is not dependent on the time or length of the outage rather, it is determined by the kind of consumer and location. The last term reflects the costs of BESS. Where *C<sup>R</sup> ib*, *<sup>P</sup><sup>R</sup> ib* is BESS rated energy and power, *CE<sup>a</sup> <sup>i</sup>* , *CP<sup>a</sup> <sup>i</sup>* depicts annualized energy or power investment cost of BESS, *C I<sup>a</sup> <sup>i</sup>* is the cost of BESS installation on an annualized basis and *CMi* represents the annual operating and maintenance cost of BESS.

In addition, there is also a BESS objective function to be applied in storage expansion planning on the grid. Based on the literature [35], it is stated as follows

$$\min \sum\_{s \in S} \pi\_s \sum\_{t \in T} \left[ \sum\_{s \in I} A\_i^G P\_{s,i,t}^G - B\_i^G P\_{s,i,t}^G + \sum\_{km \in Br} \left( F\_{s,km,i}^2 \frac{R\_{km}}{V\_{km}^2} \mathbb{C}\_{API} \right) \right] \Delta t + \sum\_{k \in K} \sum\_{j \in J} \frac{\mathbb{E}\_{j,k}^{ES} \mathbb{C}\_j^E + \overline{P}\_{j,k}^{ES} \mathbb{C}\_j^F}{365 \ T\_j^{\text{LI}}} \tag{11}$$

Equation (11) shows the objective function that considers the exchange between investment costs and BESS operations. Due to this, BESS can demonstrate energy timeshift applications, which, in turn, contributes to the reduction in the day-to-day running expenses of the network. This is accomplished through a series of hypothetical situations that reflects the whole life span of BESS. The first group indicates the total operating cost of DG, where *S* represent the set of future network operation scenarios, *T* is the time intervals, *π<sup>s</sup>* depicts the probability value of the scenario *s*, *I* represent the generation units, *A<sup>G</sup> <sup>i</sup>* , *<sup>B</sup><sup>G</sup> <sup>i</sup>* illustrates a generation cost function, and *Ps*,*i*, it is the scheduled power output of a thermal unit. The second term shows active power losses on the network, *Fkm*, *Rkm*, *Vkm* depicting thermal limit, resistance, and the voltage level of the line. *Br* is an index of branches connecting pairs of nodes *km*, while *CAPL* represent energy price for active power losses. The last term illustrates the investment cost of BESS, where *K* represent of index of transmission grid nodes, *<sup>J</sup>* is the set of energy storage technologies, *PES <sup>j</sup>*,*<sup>k</sup>* , *<sup>E</sup>ES <sup>j</sup>*,*<sup>k</sup>* represents the rated power and energy capacity of BESS, *C<sup>E</sup> <sup>j</sup>* , *<sup>C</sup><sup>P</sup> <sup>j</sup>* depicts the investment costs of battery technology, and *TLt <sup>j</sup>* is the service lifetime battery.

#### 7.1.2. Objective Function BESS of Life Cycle Cost Energy System

This energy system objective Life Cycle Cost (LCC) is used to minimize the total planning costs calculated only from BESS [91]. It is defined by some literature as follows:

$$\text{Min LCC} = \mathbb{C}\_{batt} + \mathbb{C}\_{O-M} \tag{12}$$

$$\mathbb{C}\_{O-M} = \frac{\sum\_{y=1}^{Y} (1+r)^{Y-y} [\Sigma\_{t=1}^{8760} (\mathbb{C}\_{out,y}(t) + \mathbb{C}\_{fit,y}(t) + \xi \mathbb{C}\_{batt}]}{\left(1+r\right)^{Y}} \tag{13}$$

$$
\mathbb{C}\_{batt} = \mathbb{C}ap\_{but} \,\mu\_{batt} \tag{14}
$$

$$\mathcal{L}\_{out,y}(t) = \left(P\_y^{\mathbb{S}-b}(t) + P\_y^{\mathbb{S}-l}(t)\right) \Delta t \,\mathcal{D}\_{buy} \tag{15}$$

$$\mathcal{C}\_{fit,y}(t) = \left(P\_y^{b-g}(t) + P\_y^{pv-g}(t)\right) \text{At } \mathcal{O}\_{sell} \tag{16}$$

Equation (12) is an LCC consisting of the initial investment cost of BESS (*Cbatt*), including the cost of operation and maintenance BESS (*CO*−*M*). Furthermore, Equation (13) is used to obtain the operation and maintenance costs where *y* and *t* is the index year, and time interval respectively, *Cout*.*y*(*t*) depicts electricity bills, and *Cfit*.*y*(*t*) is the benefit from selling electricity to the grid. Equation (14) represents the initial investment cost of BESS, where *Capbat* depicts the capacity of the battery, and *μbatt* is the unit capacity price. Additionally, Equation (15) is used to calculate the electricity bills where *Pg*−*<sup>b</sup> <sup>y</sup>* (*t*) represents the power flow from grid to BESS (kW), *Pg*−*<sup>l</sup> <sup>y</sup>* (*t*) is the power flow grid to the line, and ∅*buy* depicts electricity price. Equation (16) is the profit realized from selling electricity to the grid, where *Pb*−*<sup>g</sup> <sup>y</sup>* (*t*) represents power flow battery to the grid, *<sup>P</sup>pv*−*<sup>g</sup> <sup>y</sup>* (*t*) illustrates the power flow PV to the grid, and ∅*sell* is feed-in tariff.

#### 7.1.3. Objective Function BESS for Battery Degradation Cost

According to the literature [107], the optimal scheduling of BESS is supposed to minimize the degradation costs, which are the proposed objective function. The intended degradation charge model accounts for the nonlinearities of battery life. As a result, the ideal SOC profile is the same regardless of the degradation cost model if the pricing pattern is either too flat or there are excessive disparities between the maximum and minimum prices. The objective function is stated in the following equation:

$$\text{Min } \sum\_{t} \left( \left( \lambda\_t P\_{grid,t} \right) + \mathbb{C}\_E \left( \text{SoC}\_t^{\text{aux}} \right) - \mathbb{C}\_E \left( \text{SoC}\_{t-1} \right) \right) \tag{17}$$

Equation (17), is the optimal cost scheduling of BESS. It consists of power grid expense and degradation cost function for optimal scheduling, where *t* represents index of time interval, *λ<sup>t</sup>* is electricity price, *Pgrid*,*<sup>t</sup>* represents the power from the grid, *CE* denotes degradation cost for scheduling, *SoCaux <sup>t</sup>* , *SoC* is auxiliary and actual SOC BESS.
