**1. Introduction**

Recently, the penetration of PV systems into the electric grid has been increased in most countries to take advantage of the environment as well as the economic benefits. PV energy systems do not emit polluting gases such as traditional energy sources, and the owners of PV energy systems obtain incentives from utilities by selling the output energy from their PV units at a high price [1–3]. PV output is variable during the day as it depends on the variable natural source [4,5]. The designing, optimization, and planning of PV has been presented in [6–8]. The allocation of the PV energy system near the loads in the distribution system leads to improvement in voltage profile and to a decrease the emission, cost, and system losses as in [9,10]. The optimal planning of PV in a realistic case has been presented in [11]. In [12,13], an analytical method has been applied to decrease the system loss by incorporating PV in distribution networks. In [14], the optimal allocation of electric vehicles with a combination of PV and battery storage to reduce the total system cost is presented. Additionally, the optimal planning of PV with electric vehicles in distribution networks to decrease the system loss is presented in [15]. Incorporating PV in the distribution system to decrease the system loss and to improve the bus system voltage is introduced in [16,17]. Nevertheless, the high penetration of the PV energy system with the variation

**Citation:** Abdel-Mawgoud, H.; Kamel, S.; Tostado-Véliz, M.; Elattar, E.E.; Hussein, M.M. Optimal Incorporation of Photovoltaic Energy and Battery Energy Storage Systems in Distribution Networks Considering Uncertainties of Demand and Generation. *Appl. Sci.* **2021**, *11*, 8231. https://doi.org/10.3390/ app11178231

Academic Editor: Fabio La Foresta

Received: 1 July 2021 Accepted: 1 September 2021 Published: 5 September 2021

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

in demand exposes the distribution systems to various problems, such as fluctuations of power, voltage rise, extraordinary energy losses, and a low stability of voltage [1,18,19]. Therefore, load curtailment and integration of energy storage systems has been exploited to decrease power fluctuations and overcome any system constraint violations [1].

Nowadays, the integration of DG into distribution systems considering the energy losses has enticed attention. Research on the allocation of renewable DG (e.g., solar, wind and biomass) has been proposed to reduce energy loss, considering the variations of power generation and load demand [11,14,15]. According to the presence load type characteristics, optimum DG power factor dispatch for every load level would be an integral part for reducing energy losses. Nevertheless, most of the current research assumed that the DG systems work at predefined power factors.

In contrast to generation systems that depend on conventional generation techniques such as gas turbines and reciprocating engines, PV energy resources are non-dispatchable and intermittent, depending on temperature and radiation. The BESS technologies create a chance to transform the PV energy resources from non-dispatchable systems to dispatchable systems with similar conventional resources [20,21]. Throughout the past two decades, a hybrid system of BESS and PV has been considered for the applications of stand-alone systems [22–24]. Recently, the hybrid system of PV and BESS has been exploited as one of the furthermost worthwhile solutions in grid-connected applications to increase the penetration of the PV energy system in distribution systems. Such hybrid design helps alleviate the influences of intermittency in the PV energy systems, and offers many benefits for the owners of PV system, customers, and utilities. Many researchers have devoted their efforts to this interesting topic [18–20,25–31]. A hybrid PV-BESS has been evolved for applications of load demand-side to improve the efficiency of the electrical system [25,26]. In [27], authors have proposed an optimal BESS charging and discharging schedule in a PV grid-connected system for shaving of peak demand. Authors in [28] have presented a methodology to calculate the BESS size for shaving of peak load and power balance used in case of connecting PV energy system with the grid. In [29], authors have presented a methodology to compute the BESS size for raising the penetration of the PV energy system in case of residential system load with the objectives of voltage regulation and decreasing in maximum output power and yearly cost. A discharging and charging strategy for the BESS has been suggested to alleviate abrupt changes in the output power of the PV energy system and boost the evening peak load in the case of a residential load system [30]. The authors in [18] have proposed a conception of voltage regulation voltages in the distribution systems with high penetration of PV energy system by adjusting the output power of BESS at customer-side. BESS has been controlled and sized to diminish the fluctuation in the PV output power [20,31]. In [19], the authors have evolved the BESS's best discharging and charging schedule on an hourly basis to alleviate the discontinuity of PV output by reducing the energy loss.

Generally, the previous review indicates that significant research has been published on the size and discharging and discharging schedules of the BESS exploited in the case of connecting the PV energy system with the grid. Nevertheless, most of the research introduced has supposed that the optimal power factor dispatch for every hybrid PV-BESS throughout all of the time intervals is ignored as well and the size of PV units exploited in hybrid PV-BESS is prespecified. Based on the characteristics of the loads served, every PV-BESS hybrid that can provide reactive and active power with the optimum power factor may positively reduce energy losses in distribution systems.

This paper shows a conception of involving a hybrid PV and BESS in residential, industrial, and commercial distribution systems, taking into account the system energy loss. Where the PV energy system is deemed as a non-dispatchable energy source as its power output cannot be controlled, BESS is considered as a dispatchable energy source as its power output can be controlled. In this paper, AOA is applied to reduce the energy losses and capture the size of incorporating a PV energy system and BESS in a distribution network. However, the paper contributions can be summarized as follows:


The remainder of this paper is constructed as following: the load, BESS, and PV modeling are introduced in Section 2. Also the problem formulation of BESS with PV is introduced in Section 2. The methodology of the proposed Archimedes optimization algorithm (AOA) has been presented in Section 3. The cases study on a 69-bus industrial, commercial, and residential distribution have been presented and discussed in Section 4. Section 5 offers the conclusions of the paper.

### **2. Problem Formulation**

The two buses of the main feeder in the distribution network with a combination of PV and BES can be represented in Figure 1.

**Figure 1.** Two buses of radial distribution network.

Forward/backward sweep algorithm is utilized to obtain the system load flows. The reactive and real power flows are calculated by Equations (1) and (2), respectively [32].

$$P\_{\mathbf{K}} = P\_{(\mathbf{K}\star\mathbf{1})} + P\_{\mathbf{L},(\mathbf{K}\star\mathbf{1})} + R\_{\mathbf{K},(\mathbf{K}\star\mathbf{1})} \left( \frac{\left(P\_{(\mathbf{K}\star\mathbf{1})} + P\_{\mathbf{L},(\mathbf{K}\star\mathbf{1})}\right)^2 + \left(Q\_{(\mathbf{K}\star\mathbf{1})} + Q\_{\mathbf{L},(\mathbf{K}\star\mathbf{1})}\right)^2}{\left|V\_{(\mathbf{K}\star\mathbf{1})}\right|^2} \right) \tag{1}$$

$$Q\_K = Q\_{(K\star 1)} + Q\_{L,(K\star 1)} + X\_{K,(K\star 1)} \left( \frac{\left(P\_{(K\star 1)} + P\_{L,(K\star 1)}\right)^2 + \left(Q\_{(K\star 1)} + Q\_{L,(K\star 1)}\right)^2}{\left|V\_{(K\star 1)}\right|^2} \right) \tag{2}$$

where, *P***(***<sup>K</sup>* **+ 1)** and *Q***(***<sup>K</sup>* **+ 1)** represent the real and reactive power flow from bus (*K*) to the next bus system, respectively. The reactive and real load flows between (*K*) and (*K* **+ 1**) buses are *QK* and *PK*, respectively. the reactance and resistance between (*K*) and (*K* **+ 1**) buses are *XK***,(***<sup>K</sup>* **+ 1)** and *RK***,(***<sup>K</sup>* **+ 1)**, respectively. The reactive and real load at bus (*K* **+ 1**) are *QL***,(***<sup>K</sup>* **+ 1)** and *PL***,(***<sup>K</sup>* **+ 1)**, respectively.

The voltage magnitude of system buses is evaluated by Equation (3).

$$\left(V\_{\text{(K}\star 1)}\right)^2 = V\_K^2 - 2\left(P\_K R\_{\text{K}, \text{(K}\star 1)} + Q\_K X\_{\text{K}, \text{(K}\star 1)}\right) + \left(R\_{\text{K}, \text{(K}\star 1)}\right)^2 + X\_{\text{K}, \text{(K}\star 1)}\left(\frac{P\_K^2 + Q\_K^2}{V\_K^2}\right) \tag{3}$$

where *V***(***K***+1)** and *V(K)* are the system voltage at buses (*K* **+ 1**) and (**K**), respectively. Installation of PV and BESS in RDS changes the load flows through the system branches. Therefore, Equations (1) and (2) are modified to Equations (4) and (5), respectively.

$$P\_{\rm K} = P\_{\rm (K \star 1)} + P\_{\rm L, (K \star 1)} + R\_{\rm K, (K \star 1)} \left( \frac{\left(P\_{\rm (K \star 1)} + P\_{\rm L, (K \star 1)}\right)^2 + \left(Q\_{\rm K \star 1} + Q\_{\rm L, (K \star 1)}\right)^2}{\left|V\_{\rm (K \star 1)}\right|^2} \right) - P\_{\rm (PV \star RHS), (K \star 1)} \tag{4}$$

$$Q\_K = Q\_{(K\star 1)} + Q\_{L,(K\star 1)} + X\_{K,(K\star 1)} \left( \frac{\left(P\_{(K\star 1)} + P\_{L,(K\star 1)}\right)^2 + \left(Q\_{(K\star 1)} + Q\_{L,(K\star 1)}\right)^2}{\left|V\_{(K\star 1)}\right|^2} \right) - Q\_{(PV\star 2)\text{ESS}\_1, (K\star 1)}\tag{5}$$

where, *Q***(***PV* **<sup>+</sup>** *BES***),(***<sup>K</sup>* **+ 1)** and *P***(***PV* **<sup>+</sup>** *BES***),(***<sup>K</sup>* **+ 1)** are the injection reactive and real power from BESS and PV units at bus (*K* **+ 1**), respectively.

The ratio of system losses with incorporating BESS and PV to the system losses without incorporating BESS and PV in RDS is formulated as single objective function as shown in Equation (6).

$$F\_o = \sum (\frac{\sum\_{h=1}^{24} P\_{loss}(h)^{after} \text{ (PV + BESS)} \,\Delta(h)}{\sum\_{h=1}^{24} P\_{loss}(h)^{before} \text{ (PV + BESS)} \,\Delta(h)}), \quad h = 1, 2, 3, 4, \dots, \dots \dots 24 \text{ h} \tag{6}$$

where, *Ploss***(***t***)** *before* **(***PV* **<sup>+</sup>** *BES***)** and *Ploss***(***h***)** *after* **(***PV* **<sup>+</sup>** *BESS***)** are the system losses before and after incorporating BESS and PV in distribution system at time (*h*).

The inequality and equality constraints are formulated as shown next [33–36]:

### *2.1. Equality Constraints*

These constraints include power flow balance equations. Therefore, the power generation from substation and PV with BESS should be equal to the system loss and system load demand as shown next.

$$P\_{rf} + \sum\_{\mathbf{g}=\mathbf{1}}^{G} P\_{PV\*+BES} \text{ (g)} = \sum\_{j=\mathbf{1}}^{m} P\_{L,j} + \sum\_{\mathbf{nb}=\mathbf{1}}^{\text{NB}} P\_{loss} \text{(nb)} \tag{7}$$

$$Q\_{rf} + \sum\_{g=1}^{G} Q\_{PV+BES}(\mathbf{g}) = \sum\_{j=1}^{m} Q\_{L,j} + \sum\_{nb=1}^{NB} Q\_{loss}(nb) \tag{8}$$

where *NB* and m are the overall number of branches and buses, respectively. *Qloss***(***nb***)** and *Ploss***(***nb***)** are the reactive and real system loss at branch **(***j***)**, respectively. *G* are the overall number of PV with BESS. *Qrf* and *Prf* represents the reactive and active power drawn from substation in RDS, respectively.

### *2.2. Inequality Constraints*

These constraints include system operating constraints such as system voltage limits, PV generation with BESS limits and branch current limits as follows:

### 2.2.1. Voltage Limits

The operating bus voltage should be between high (*Vup*) and low (*Vlo*) voltage limits as shown in Equation (9).

$$\mathbf{V}\_{lo} \le \mathbf{V}\_{\hat{f}} \le \mathbf{V}\_{up} \tag{9}$$

where, *Vj* represent the voltage at bus *j*.

2.2.2. Sizing Limits of (PV + BESS)

$$\sum\_{\mathbf{g}=\mathbf{1}}^{G} P\_{PV+\text{BES}}(\mathbf{g}) \le \left(\sum\_{j=\mathbf{1}}^{m} P\_{L,j} + \sum\_{nb=\mathbf{1}}^{\text{NB}} P\_{loss}(nb)\right) \tag{10}$$

$$\sum\_{m=1}^{G} Q\_{PV-\text{BES}}(m) \le \left(\sum\_{j=1}^{m} Q\_{L,j} + \sum\_{nb=1}^{\text{NB}} Q\_{loss}(nb)\right) \tag{11}$$

$$P\_{PV,low} \le P\_{PV} \le P\_{PV,high} \tag{12}$$

where, *PPV***,***high* and *PPV***,***low* are the maximum and minimum power generation limits of PV.

2.2.3. Sizing Limits of Battery

$$E\_{BESS,L} \le E\_{BESS,j}(\text{h}) \le E\_{BESS,H} \tag{13}$$

where, *EBESS***,***<sup>L</sup>* and *EBESS***,***<sup>H</sup>* are the low and high magnitudes of battery energy stored.

### 2.2.4. Line Constraints

The current should be lower than the maximum current (*Imax***,***b*) through the branch (b) [37].

$$I\_b \le I\_{\max, b} \text{ b = 1, 2, 3 \dots, Nb} \tag{14}$$

*2.3. Modeling and Sizing of PV and BES*

### 2.3.1. Load Modelling

The distribution network system studied in this paper have has various daily load demand configurations, such as residential load as shown if in Figure 2, industrial load as shown in Figure 3, and commercial load as indicated in Figure 4 [38,39]. All previous load demand patterns are based on the voltage and time with reactive and actual load voltage indexes. Time-varying load demands are modelled from Equations (15) and (16), as shown below [40]:

$$P\_{\rm w}(\mathbf{t}) = P\_{\rm ow}(\mathbf{t}) \times V\_{\rm w}^{N\_p} \tag{15}$$

$$Q\_w(t) = Q\_{ow}(t) \times V\_w \, ^{N\_q} \tag{16}$$

where *Qk* and *Pk* represent the reactive and real power at bus *k*; *Qok* and *Pok* are the reactive and real load at bus *k*. *Vk* represents the voltage at bus *k*, and *Nq* and *Np* represent the reactive and real load voltage indices that are demonstrated in Table 1 [40].

**Figure 2.** Normalized daily residential load demand curve.

**Figure 3.** Normalized daily industrial load demand curve.

**Figure 4.** Normalized daily commercial load demand curve.

**Table 1.** The used parameters.

