Optimal Incorporation of Photovoltaic Energy and Battery Energy Storage Systems in Distribution Networks Considering Uncertainties of Demand and Generation

: In this paper, the Archimedes optimization algorithm (AOA) is applied as a recent metaheuristic optimization algorithm to reduce energy losses and capture the size of incorporating a battery energy storage system (BESS) and photovoltaics (PV) within a distribution system. AOA is designed with revelation from Archimedes’ principle, an impressive physics law. AOA mimics the attitude of buoyant force applied upward on an object, partially or entirely dipped in liquid, which is relative to the weight of the dislodged liquid. Furthermore, the developed algorithm is evolved for sizing several PVs and BESSs considering the changing demand over time and the probability generation. The studied IEEE 69-bus distribution network system has different types of the load, such as residential, industrial, and commercial loads. The simulation results indicate the robustness of the proposed algorithm for computing the best size of multiple PVs and BESSs with a signiﬁcant reduction in the power system losses. Additionally, the AOA algorithm has an efﬁcient balancing between the exploration and exploitation phases to avoid the local solutions and go to the best global solutions, compared with other studied algorithms.


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][2][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][7][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

•
A new application of the Archimedes optimization algorithm for minimizing the energy losses and capture the size of incorporating battery energy storage system and photovoltaics in a distribution system. • The developed algorithm is evolved for sizing several PVs and BESSs considering the changing demand over time and the probability generation.

•
Validating the developed algorithm using IEEE 69-bus distribution network system which has different types of the load, such as residential, industrial, and commercial loads.

•
The simulation results indicate the robustness of the proposed algorithm for computing the best size of multiple PVs and BESSs, with a significant reduction in the power system losses.
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.

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.
Appl. Sci. 2021, 11, x FOR PEER REVIEW 3 of 30 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: • A new application of the Archimedes optimization algorithm for minimizing the energy losses and capture the size of incorporating battery energy storage system and photovoltaics in a distribution system. • The developed algorithm is evolved for sizing several PVs and BESSs considering the changing demand over time and the probability generation.

•
Validating the developed algorithm using IEEE 69-bus distribution network system which has different types of the load, such as residential, industrial, and commercial loads.

•
The simulation results indicate the robustness of the proposed algorithm for computing the best size of multiple PVs and BESSs, with a significant reduction in the power system losses.
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.

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. Forward/backward sweep algorithm is utilized to obtain the system load flows. The reactive and real power flows are calculated by Equation (2) and Equation (1), respectively [32]. 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 K = P (K + 1) + P L,(K + 1) + R K,(K + 1) (P (K + 1) + P L,(K + 1) ) 2 + (Q (K + 1) + Q L,(K + 1) ) 2 V (K + 1)
where, P loss (t) before (PV + BES) and P loss (h) after (PV + 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][34][35][36]:

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.
where NB and m are the overall number of branches and buses, respectively. Q loss (nb) and P loss (nb) are the reactive and real system loss at branch (j), respectively. G are the overall number of PV with BESS. Q rf and P rf represents the reactive and active power drawn from substation in RDS, respectively.

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

Voltage Limits
The operating bus voltage should be between high (V up ) and low (V lo ) voltage limits as shown in Equation (9).
where, V j represent the voltage at bus j.
P PV,low ≤ P PV ≤ P PV,high (12) where, P PV,high and P PV,low are the maximum and minimum power generation limits of PV.

Sizing Limits of Battery
where, E BESS,L and E BESS,H are the low and high magnitudes of battery energy stored.

Line Constraints
The current should be lower than the maximum current (I max,b ) through the branch (b) [37].

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]: where Q k and P k represent the reactive and real power at bus k; Q ok and P ok are the reactive and real load at bus k. V k represents the voltage at bus k, and N q and N p represent the reactive and real load voltage indices that are demonstrated in

PV Modelling
The solar radiation probabilistic nature can be designated according to the probability density function (PDF) of Beta as follows [36,41]: where f b (s) refers to the s distribution function of Beta and s refers to the arbitrary variable of solar radiation in kilowatt per meter square; α and β refer to the parameters of f b (s) which are computed exploiting the standard deviation (σ) and mean deviation (µ) as shown in (18). The value of standard deviation and mean deviation are presented in [42].
The PV module output power output depends on the solar radiation and surrounding temperature as well as the PV module characteristics itself. The maximum output power related to solar radiation s, P o (s), can be expressed as [19]: where, T cy = T A + s( N OT − 20 0.8 ) (23) where, N refers to the module's number; T cy and T A refer to the cell temperature and ambient temperature (C 0 ), respectively; Ki and Kv refer to the coefficient of current temperature (A/C 0 ) and coefficient of voltage temperature (V/C 0 ), respectively; FF refers to fill factor; NOT refers to rated working temperature of cell per C 0 ; I sc and refer to short circuit current (A) and open circuit voltage (V), respectively; VMPP and IMPP refer to voltage at maximum power point and current at maximum power point, respectively; P o (s) refers to the PV module maximum output power at solar radiation (s). The prospective output power at solar radiation (s) is computed according to Equation (10). Therefore, the overall prospective output during the identified interval time t, P t (t = 1 h in this study) can be expressed as follows:

BESS Modelling
BESS is supposed to be linked to an alternating current (AC) system through bidirectional DC/AC converters [43]. In this paper, BESS works at unity power factor to discharge or charge active power. In another meaning, the BESS can work as a generator throughout the period of discharging and a load throughout the period of charging. The energy variation of BESS at bus k in time interval t is evaluated as the following [44]: E BESSk (t) = E BESSk (t − 1) − η c P ch BESSk (t)∆t, for P BESSk (t) ≤ 0 (26) η BES = η Ch × η Dch (27) where E BESSk refers to the overall energy stored inside the BESS; P disch BESSk and P ch BESSk refer to the BESS discharged and charged power, respectively; η d and η c refer to the BESS efficiency in case of discharging and charging, respectively; ∆t indicates the duration of time interval t.

Sizing BES and PV
BESS is installed at the same location of PV in RDS. Therefore, the optimal sizing of BESS with PV are presented in [42]. Therefore, the charging and discharging energies of batteries at time (t) are calculated by Equations (28) and (29). (29) (E (PV + BES),j ) is a combination energy of BESS and PV at bus (j) which is determined by Equation (30). PV energy is determined by Equation (31).
where E DC BESS,j is the discharging energy of BESS to the distribution system (DS). E DS PV,j is the injection power energy from PV to DS and E C BESS,j the charging energy which is drawing from PV to BESS.
Round-trip efficiency can be determined by the ratio of discharging energy to the charging energy as shown below: Consequently, PV energy is updated to Equation (33) as follows: The high value of PV output during the day is evaluated by Equation (36).
where, E o PV and P o PV are the energy and maximum output of PV during the day, respectively. BESS sizing is determined by Equation (37).

Frame Design
In general, the recommended Archimedes optimization algorithm describes what occurs when objects that have different volumes and weights are dipped into a liquid. The following subsections indicate how the AOA was based on the phenomena elucidated in Archimedes' principle. Then, we explain how this law of physics is applied along with an algorithm of optimization [45].

Principle of Archimedes
The Archimedes principle declares that when dipping an object partially or completely into a liquid, the liquid goes flat out at an upward force on this object equivalent to liquid's weight dislodged by this object. Figure 5 describes that when an object is dipped into a liquid, it will be exposed to an upward force, named buoyant force, equivalent to the weight of the liquid dislodged by this object [46].
Where, and are the energy and maximum output of PV during the day, respectively.

Frame Design
In general, the recommended Archimedes optimization algorithm describes what occurs when objects that have different volumes and weights are dipped into a liquid. The following subsections indicate how the AOA was based on the phenomena elucidated in Archimedes' principle. Then, we explain how this law of physics is applied along with an algorithm of optimization [45].

Principle of Archimedes
The Archimedes principle declares that when dipping an object partially or completely into a liquid, the liquid goes flat out at an upward force on this object equivalent to liquid's weight dislodged by this object. Figure 5 describes that when an object is dipped into a liquid, it will be exposed to an upward force, named buoyant force, equivalent to the weight of the liquid dislodged by this object [46].  Figure 6 indicates when some objects dipped into the same liquid and every one attempts to achieve the state of equilibrium. The speed at which each immersed object reaches to the state of equilibrium varies due to its different density and volume. Any object will be in the state of equilibrium when the buoyant force Fb is equivalent to the weight (Wo) of this object:   Figure 6 indicates when some objects dipped into the same liquid and every one attempts to achieve the state of equilibrium. The speed at which each immersed object reaches to the state of equilibrium varies due to its different density and volume. Any object will be in the state of equilibrium when the buoyant force F b is equivalent to the weight (W o ) of this object:

Theory
where ρ b and ρ o are the density of the liquid and the dipped object, respectively, v b and v o are the volume of the liquid and the dipped object, respectively, and a o and a b are the gravity or acceleration of the liquid and the dipped object, respectively. This previous equation can be reorganized as the following: 3.1.2. Theory Figure 6 indicates when some objects dipped into the same liquid and every one attempts to achieve the state of equilibrium. The speed at which each immersed object reaches to the state of equilibrium varies due to its different density and volume. Any object will be in the state of equilibrium when the buoyant force Fb is equivalent to the weight (Wo) of this object: Figure 6. Some objects dipped in the same liquid [45]. Figure 6. Some objects dipped in the same liquid [45].
In the case of presence of another force acting on the object, such as colliding with another adjacent object (r), then the state of equilibrium will be:

Archimedes Optimization Algorithm
AOA is an algorithm that depends on a population. In this algorithm, the individuals of the population are the dipped objects. Resembling other metaheuristic algorithms that depend on population, AOA likewise initiates search procedure with preliminary population of objects, called candidate solutions, with arbitrary densities, accelerations, and volumes. At this phase, every object is likewise started with its arbitrary situation in liquid. Afterward, assessing the fitness of preliminary population, AOA works in repetitions until the end limit is achieved. After each repetition, AOA modernizes the volume and density for each object. The object's acceleration is modernized based on the state of collision with any other nearby object. Modernizing, density, acceleration and volume define the object's new location. In the following sub-section, the mathematical expression steps for AOA are explained.
Steps of AOA Algorithm The mathematical construction for the algorithm of AOA is presented in this subsection. Theoretically, AOA is deemed as a universal algorithm where it involves both exploitation and exploration procedures. The pseudocode of the AOA is indicated in Algorithm 1; it includes the preliminary population of objects, population assessment, and modernizing parameters. Mathematically, the stages of the suggested AOA are indicated as follows: 1 Preparation Set the locations of overall objects using (44): where O i refers to the ith object from the population that have N (search agents) objects. ub i and lb i are the higher and lower limits of the search scope, respectively. Dim represents the dimension variables. Set the initial value of density (den) and volume (vo) for every ith object according to Equations (45) and (46).
where rand refers to a random number within [0,1]. Finally, set the initial value of ith object acceleration (acc) using (47): In this step, assess preliminary population and nominate the object that has the best fitness value. Specify, the best location (x best ), the best density (den best ), the best volume (v best )), and the best acceleration (acc best ). 2 Modernize volumes and densities The volume and the density for every object i at the repetition (t + 1) is modernized according to (48) and (49): where vol bset is the volume correlated to the best object that has been obtained so far, and rand is a random number that is distributed uniformly.
Assess preliminary population and nominate one of them that has best fitness significance. Set repetition counter t = 1 While t ≤ t max do For every object I do Modernize volume and density for every object according to (49) Modernize the factors of transfer and decreasing of density TF and d according to (50) and (51), respectively.
If TF ≤ 0.5 then Exploration stage Modernize the object acceleration according to (52) and normalize this acceleration according to (54) Modernize the object location according to (55) else Exploitation stage Modernize the object acceleration according to (53) and normalize this acceleration according to (54) Modernize direction flag F according to (57) Modernize the object location according to (56) end if end for Assess every object and nominate one of them that has best fitness significance. Set t = t + 1 End while return object that has best fitness significance end Procedure 3 In the AOA algorithm, the population objects (search agents) are searching for the best promising area in all of the search space by the exploration phase and then searching for the best location (best object) in this promising area by the exploitation phase. TF is a factor that is changing with iteration to transfer the algorithm from the exploration phase to the exploitation phase through the simulation time, and can be evaluated as follows: where the TF factor rises progressively with increasing time till up to 1; t max and t are the maximum repetitions number and repetition number, respectively. Likewise, density decreasing factor d also supports the proposed AOA on universal to local inspection. It reduces with increasing time according to (51): where d t + 1 reduces with increasing time that provides the capability to converge in the previously specified promising zone. To guarantee a balance between the exploration and the exploitation in the proposed AOA, this variable must be handled appropriately. The text continues here. 4 Exploration step (colliding among objects happens). If TF ≤ 0.5, colliding among objects happens, an arbitrary material (mr) must be nominated and the acceleration of for repetition t + 1 according to (52) must be modernized: where acc i , den i , and vol i are the acceleration, the density, and the volume of the object I, whereas acc mr , vol mr and den mr are the acceleration, the volume, and the density of arbitrary material. It is significant to indicate that TF ≤ 0.5 guarantees exploration through one third of repetitions. Using a value other than 0.5 will affect the behavior of changing from exploration to exploitation steps.

5
Exploitation step (no colliding among objects). If TF > 0.5, there is no colliding among objects, modernize the acceleration of the object for repetition (t + 1) according to (53): where acc best refers to the best object acceleration. 6 Normalize the object acceleration. Normalize the object acceleration to compute the percentage of variation according to (54): where l and u represent the scope of normalization and put it at 0.1 and 0.9, respectively. The acc t + 1 i − norm calculates the percentage of the period that every agent will alteration. The value of acceleration will be great when the object is away from the global optimum, which means that the object will be in the exploration stage; other than that, it will be in the exploitation stage. This clarifies how the inspection modifies from the exploration stage to the exploitation stage. In an ordinary case, the factor of acceleration initiates with high value and reduces with increasing time. This aids search agents to move away from local solutions and at the same time transfer towards the global best solution. However, it is significant to state that there may still a small number of search agents that require extra time to stay in the exploration stage than in the normal case. Therefore, the proposed AOA attains the equilibrium between the exploration stage and the exploitation stage. 7 Modernize location If TF ≤ 0.5 (exploration stage), the ith object's location for following repetition t + 1 according to (55) where C 1 referes to a constant that equals 2. Other than that, when TF > 0.5(exploitation stage), the objects modernize their locations according to (56).
where C 2 referes to a constant that equals 6. T rises with increasing time and it is proportional to transfer factor and it is determined according to T = C 3 × TF. Additionally, it rises with increasing time through the scope [C 3 × 0.3, 1] and it possesses a particular percentage from the best location, at first. It begins with small percentage which causes a huge difference between the best location and the present location; consequently, the random walk step-size will be big. As the search continues, this percentage will rise progressively to reduce the difference between the best location and the present location. This results in an appropriate equilibrium between the exploration and the exploitation. F is the flag to vary the motion direction according to (57): where P = 2 × rand − C 4 .
8 Assessment Assess every object exploiting function f and recollect the best solution found yet. Designate x best , vol best , den best , and acc best .

Simulation Results and Dissections
The IEEE 69-bus radial distribution system (RDS) includes 69 buses with a reactive load of 2694.6 kVAr and an active load of 3801.5 kW as shown in Figure 7 [47]. The results are obtained under base values of 12.66 kV and 10 MVA. The used parameters and the system constraints are given in Table 1. This paper studies the optimal allocation of PV alone or with BES in residential, industrial, and commercial system loads.

Residential Load
In this case, the overall reactive and real load demand during 24 h are 34.43 MVAr and 48.57 MW, respectively. Without integration PV and BES in RDS, the total reactive and real loss during 24 h are 0.85 MVAr and 1.87 MW, respectively. Installing one PV alone in RDS at bus 61 reduces the system loss to 1.39 MW. Additionally, installing two PV alone in RDS at buses 61 and 17 reduces the system loss to 1.35 MW. The total energies of one and two PV alone in RDS during the day are illustrated in Figures 8 and 9. Table 2 illustrates the locations and sizes of PV, the total energy of PV, and the injection energy from PV to the grid. Therefore, installing three PV alone reduces the system loss to 1.34 MW at buses 61, 18, and 11. From Figure 10, the total energy of three PV alone is 15.64 MWh.
From Table 3, simultaneous integration of PV and BES gives better results than integration of PV alone in RDS. Installing one BESS and PV in RDS decreases the system loss to 0.71 MW at bus 61. The energies of PV and BESS during the day by incorporating one PV with BESS in RDS are illustrated in Figures 11 and 12. Installing two and three PV with BES in RDS decrease the system loss to 0.61 MW and 0.59 MW, respectively. The energies of PV and BESS during the day by incorporating two PV with BESS in RDS are illustrated in Figures 13 and 14. Additionally, energies of PV and BESS during the day by incorporating three PV with BESS in RDS are illustrated in Figures 15 and 16. Table 3 illustrates the locations and sizes of PV and BESS, the total energy of PV, the injection energy from PV to the grid, the charging energy from PV to BESS, and the discharging energy from BESS to the grid.

Simulation Results and Dissections
The IEEE 69-bus radial distribution system (RDS) includes 69 buses with a reactive load of 2694.6 kVAr and an active load of 3801.5 kW as shown in Figure 7 [47]. The results are obtained under base values of 12.66 kV and 10 MVA. The used parameters and the system constraints are given in Table 1. This paper studies the optimal allocation of PV alone or with BES in residential, industrial, and commercial system loads.    Table 2 illustrates the locations and sizes of PV, the total energy of PV, and the injection energy from PV to the grid. Therefore, installing three PV alone reduces the system loss to 1.34 MW at buses 61, 18, and 11. From Figure 10, the total energy of three PV alone is 15.64 MWh.
From Table 3, simultaneous integration of PV and BES gives better results than integration of PV alone in RDS. Installing one BESS and PV in RDS decreases the system loss to 0.71 MW at bus 61. The energies of PV and BESS during the day by incorporating one PV with BESS in RDS are illustrated in Figures 11 and 12. Installing two and three PV with BES in RDS decrease the system loss to 0.61 MW and 0.59 MW, respectively. The energies of PV and BESS during the day by incorporating two PV with BESS in RDS are illustrated in Figures 13 and 14. Additionally, energies of PV and BESS during the day by incorporating three PV with BESS in RDS are illustrated in Figures 15 and 16. Table 3 illustrates the locations and sizes of PV and BESS, the total energy of PV, the injection energy from PV to the grid, the charging energy from PV to BESS, and the discharging energy from BESS to the grid.  . PV output during the day by installing two PV alone in residential system load. Figure 10. PV output during the day by installing three PV alone in residential system load. Figure 11. PV output during the day by installing one PV with BES in residential system load. Figure 9. PV output during the day by installing two PV alone in residential system load. Table 2. The obtained results with and without installing PV alone in residential system loads.  Figure 9. PV output during the day by installing two PV alone in residential system load. Figure 10. PV output during the day by installing three PV alone in residential system load. Figure 10. PV output during the day by installing three PV alone in residential system load.  Figure 9. PV output during the day by installing two PV alone in residential system load. Figure 10. PV output during the day by installing three PV alone in residential system load. Figure 11. PV output during the day by installing one PV with BES in residential system load. Figure 11. PV output during the day by installing one PV with BES in residential system load.

Item Position (Size (kW)) PV Energy (kWh) Total PV Energy (kWh) P loss (kW)
Appl. Sci. 2021, 11, x FOR PEER REVIEW 17 of 30 Figure 12. BES output during the day by installing one PV with BES in residential system load. Figure 12. BES output during the day by installing one PV with BES in residential system load. Figure 12. BES output during the day by installing one PV with BES in residential system load. Figure 13. PV output during the day by installing two PV with BES in residential system load Figure 14. BES output during the day by installing two PV with BES in residential system load. Figure 13. PV output during the day by installing two PV with BES in residential system load. Figure 12. BES output during the day by installing one PV with BES in residential system load. Figure 13. PV output during the day by installing two PV with BES in residential system load Figure 14. BES output during the day by installing two PV with BES in residential system load. Figure 14. BES output during the day by installing two PV with BES in residential system load.
Appl. Sci. 2021, 11, x FOR PEER REVIEW 18 of 30 Figure 15. PV output during the day by installing three PV with BES in residential system load. Figure 15. PV output during the day by installing three PV with BES in residential system load. Figure 15. PV output during the day by installing three PV with BES in residential system load. Figure 16. BES output during the day by installing three PV with BES in residential system load.

Industrial Load
In this case, the overall reactive and real load demand during 24 h are 35.64 MVAr and 50.29 MW, respectively. Without integrating PV and BES in RDS, the total active and reactive power loss during 24 h are 1.89 MW and 0.86 MVAr, respectively. The total system losses are decreased to 1.55 MW, 1.52 MW, and 1.52 MW by integrating one, two, and three PV alone in RDS, respectively. Table 4 presents the locations and sizes of PV, the total energy of PV, the injection energy from PV to the grid and the system power loss. From Figures 17 and 18, the total energies of one and two PV alone during the day are 9.56 MWh and 11.80 MWh, respectively. Additionally, the total energy of three PV alone during the day is 13.35 MWh as shown in Figure 19.
The optimal allocation of one PV with BES in RDS at bus 61 decreases the system loss to 0.72 MW. The total energies of PV and BESS during the day by incorporating one PV with BESS are presented in Figures 20 and 21. The system losses are decreased to 0.62 MW and 0.60 MW by integrating two and three PV with BES in RDS, respectively. Figures 22 and 23 illustrate the energies of PV and BESS during the day by installing two PV with BESS in RDS. Additionally, Figures 24 and 25 illustrate the energies of PV and BESS during the day by installing three PV with BESS in RDS. The total injection energies from PV to BESS and to the grid are presented in Table 5. Additionally, the charging and discharging energies of BESS are presented in Table 5 and Figure 25.

Industrial Load
In this case, the overall reactive and real load demand during 24 h are 35.64 MVAr and 50.29 MW, respectively. Without integrating PV and BES in RDS, the total active and reactive power loss during 24 h are 1.89 MW and 0.86 MVAr, respectively. The total system losses are decreased to 1.55 MW, 1.52 MW, and 1.52 MW by integrating one, two, and three PV alone in RDS, respectively. Table 4 presents the locations and sizes of PV, the total energy of PV, the injection energy from PV to the grid and the system power loss. From Figures 17 and 18, the total energies of one and two PV alone during the day are 9.56 MWh and 11.80 MWh, respectively. Additionally, the total energy of three PV alone during the day is 13.35 MWh as shown in Figure 19. Table 4. The obtained results with and without installing PV alone in industrial system loads.

Item
Position (Size (kW)) PV Energy (kWh) Total PV Energy (kWh) P loss (kW)  Figure 17. PV output during the day by installing one PV alone in industrial system load. Figure 17. PV output during the day by installing one PV alone in industrial system load. Figure 17. PV output during the day by installing one PV alone in industrial system load. Figure 18. PV output during the day by installing two PV alone in industrial system load. Figure 19. PV output during the day by installing three PV alone in industrial system load. Figure 18. PV output during the day by installing two PV alone in industrial system load. Figure 17. PV output during the day by installing one PV alone in industrial system load. Figure 18. PV output during the day by installing two PV alone in industrial system load. Figure 19. PV output during the day by installing three PV alone in industrial system load. Figure 19. PV output during the day by installing three PV alone in industrial system load.
The optimal allocation of one PV with BES in RDS at bus 61 decreases the system loss to 0.72 MW. The total energies of PV and BESS during the day by incorporating one PV with BESS are presented in Figures 20 and 21. The system losses are decreased to 0.62 MW and 0.60 MW by integrating two and three PV with BES in RDS, respectively. Figures 22 and 23 illustrate the energies of PV and BESS during the day by installing two PV with BESS in RDS. Additionally, Figures 24 and 25 illustrate the energies of PV and BESS during the day by installing three PV with BESS in RDS. The total injection energies from PV to BESS and to the grid are presented in Table 5. Additionally, the charging and discharging energies of BESS are presented in Table 5 and Figure 25                  . BES output during the day by installing three PV with BES in industrial system load. Figure 25. BES output during the day by installing three PV with BES in industrial system load.

Commercial Load
In this case, the overall reactive and real load demand during 24 h are 37.82 MVAr and 53.35 MW, respectively. Without integrating BESS and PV in RDS, the overall reactive and real loss during 24 h are 0.99 MVAr and 2.17 MW, respectively. The system power loss is reduced to 1.12 MW with installing one PV alone at bus 61. The optimal placement and sizing of two PV alone at buses 61 and 17 decreases the system loss to 1.04 MW as shown in Table 6. Additionally, the optimal sizing of three PV alone at buses 61, 18, and 11 with total energy of 22.81 MWh decreases the system loss to 1.02 MW. From Figures 26 and 27, the total energies of one and two PV and three PV alone during the day are presented in Figure 26, Figure 27, and Figure 28, respectively.

Commercial Load
In this case, the overall reactive and real load demand during 24 h are 37.82 MVAr and 53.35 MW, respectively. Without integrating BESS and PV in RDS, the overall reactive and real loss during 24 h are 0.99 MVAr and 2.17 MW, respectively. The system power loss is reduced to 1.12 MW with installing one PV alone at bus 61. The optimal placement and sizing of two PV alone at buses 61 and 17 decreases the system loss to 1.04 MW as shown in Table6. Additionally, the optimal sizing of three PV alone at buses 61, 18, and 11 with total energy of 22.81 MWh decreases the system loss to 1.02 MW. From Figures 26 and 27, the total energies of one and two PV and three PV alone during the day are presented in Figure 26, Figure 27, and Figure 28, respectively.
Installing one, two, and three PV with BES decreases the system losses to 0.83 MW, 0.71 MW, and 0.69 MW, respectively, as shown in Table 7. The total energy of PV and the charging and discharging energies of BES by integrating one PV with BES in RDS are illustrated in Figures 29 and 30. Figures 31 and 32 show the energies of two PV and the charging and discharging energies of BESS during the day, respectively. By incorporating three PV with BESS, the injection energies from PV to BESS and the grid during the day are shown in Figure 33, and the charging and discharging energies of BESS are shown in Figure 34. The results proved which the presented algorithm is an efficient to obtain the best global results when compared with modified HGSO algorithm and HGSO algorithm. This comparative study is illustrated in Table 8.      Installing one, two, and three PV with BES decreases the system losses to 0.83 MW, 0.71 MW, and 0.69 MW, respectively, as shown in Table 7. The total energy of PV and the charging and discharging energies of BES by integrating one PV with BES in RDS are illustrated in Figures 29 and 30. Figures 31 and 32 show the energies of two PV and the charging and discharging energies of BESS during the day, respectively. By incorporating three PV with BESS, the injection energies from PV to BESS and the grid during the day are shown in Figure 33, and the charging and discharging energies of BESS are shown in Figure 34. The results proved which the presented algorithm is an efficient to obtain the best global results when compared with modified HGSO algorithm and HGSO algorithm. This comparative study is illustrated in Table 8.  Figure 27. PV output during the day by installing two PV alone in commercial system load.                   Table 3. The obtained results with and without installing PV with BES in residential system loads.  Table 4. The obtained results with and without installing PV alone in industrial system loads.

Ploss (kW) Total PV Energy
(kWh) PV Energy (kWh) Position (size (kW)) Item Figure 34. BES output during the day by installing three PV with BES in commercial system load.

Conclusions
In this paper, an application for a recent optimization algorithm called the Archimedes optimization algorithm (AOA) has been proposed for reducing energy losses and to capture the size of incorporating battery energy storage system (BESS) and photovoltaic (PV) energy system in RDS. In this paper, all non-dispatchable PV energy systems have been transformed into a dispatchable energy resource with BESS integration with PV. AOA has been evolved for sizing several PV and BESS considering the changing demand over time and the probability generation. The proposed algorithm has been applied on the IEEE 69-bus distribution network with various daily demand configurations such as residential, industrial, and commercial loads demand. The obtained results demonstrate that the model can boost high penetration of the PV energy system accompanied with effective usage of BESS energy resources, which shows the strength of the presented algorithm for evaluating the best sizing of numerous PV and BESS with a significant reduction in energy losses. In addition, the AOA gives better results compared with other well-known optimization algorithms.

Conflicts of Interest:
The authors declare no conflict of interest.