**1. Introduction**

Nowadays, renewable energy sources (RESs) have been widely connected to distribution networks according to the advantage of electricity generation from RESs, which is clean energy, to respond to the high increasing demand in electrical power. However, RESs also consist of a major drawback, which is a fluctuation of power generation, due to the uncertainty of natural sources that cannot be controlled, causing an imbalance between the supply and demand of electrical power. As a result, electrical power flows in a reverse way and power loss occurs in distribution networks [1–4], especially the connection of privately-owned RESs to the distribution network systems of distribution network operators (DNO). Owners of RES companies usually sell electrical energy to the distribution networks based on electricity generation depending on the natural sources at that time. In particular, photovoltaics (PVs) can generate electricity only during the daytime, which is an example of the above-mentioned problem.

The important factors for a distribution network is the reliability of the power system and that the power quality meets the standards. Therefore, energy storage systems (ESSs) have an important role and have been used in distribution networks with the connected RESs to overcome the drawbacks of RES. Additionally, the ESS can balance the electrical power supply and demands [5], improve voltage deviation [6,7], reduce power loss [8–11], reduce peak demand by storing electrical energy during an off-peak time and supplying electric power during peak time [12,13], and use for many objectives including voltage deviation improvement, power loss reduction, and peak demand reduction [14–16].

The optimal location and sizing of an ESS installation can improve the power system's efficiency and reliability [17]. I. Naidji et al. proposed the optimal sizing of an ESS installation that considered the minimum cost at the weakest position by considering the contingency sensitivity index (CSI) [18]. M. Nick et al. introduced the minimum investment cost of an ESS together with the optimal siting and sizing of an ESS to reduce the expenses incurred in the power system by using second-order cone programming (SOCP) [19]. The installation of a battery energy storage system (BESS) cannot only improve the power system efficiency, but also increase the flexibility of dealing with the management (purchase and sell) of electric power for the maximum profit of an electricity supplier [20]. The installation of a BESS, together with the connection of RESs to manage power systems, can support the increasing electricity consumption [21–24]. In addition to the installation of the ESS in the optimal siting and sizing, the appropriate schedule control of an ESS plays an important role in improving the efficiency of power systems and is also able to increase the profits from the sale of electricity for the electricity seller [25–27].

N. Jayasekara et al. proposed an appropriate method to find the optimal siting, sizing, and operation pattern of a BESS [14]. However, the costs—consisting of the battery cost, installation cost and maintenance cost of the BESS—are included in the objective function. Therefore, the obtained siting and sizing of the BESS are not truly appropriate in the aim of improving the efficiency such as minimizing voltage deviation, power loss, and peak demand of the distribution network. Moreover, the comparison of different optimization algorithms has not been investigated to verify the obtained simulation results. Hence, this work aimed to find the optimal siting and sizing of a BESS in distribution networks with the connected RES where the load demand is varied across a day. The objective function was to minimize costs incurred in the distribution networks including the costs of voltage deviation, power loss, and peak demand. Therefore, the truly appropriate optimal siting and sizing of the BESS in distribution networks can be provided. The BESS installation was evaluated in the IEEE 33-bus distribution network. The simulation results were provided by two algorithms comprising of the genetic algorithm (GA) and particle swarm optimization (PSO) and were compared to both verify the simulation results and obtain the appropriate algorithm.

The main contribution of this work includes:

