Optimal Siting and Sizing of Battery Energy Storage: Case Study Seventh Feeder at Nakhon Phanom Substation in Thailand

: The optimal siting and sizing of battery energy storage system (BESS) is proposed in this study to improve the performance of the seventh feeder at Nakhon Phanom substation, which is a distribution network with the connected photovoltaic (PV) in Thailand. The considered objective function aims to improve the distribution network performance by minimizing costs incurred in the distribution network within a day, comprising of voltage regulation cost, real power loss cost, and peak demand cost. Particle swarm optimization (PSO) is applied to solve the optimization problem. It is found that the optimal siting and sizing of the BESS installation could improve the performance of the distribution network in terms of cost minimization, voltage proﬁle, real power loss, and peak demand. The results are investigated from three cases where case 1 is without PV and BESS installation, case 2 is with only PV installation, and case 3 is with PV and BESS installations. The comparison results show that case 3 provided the best costs, voltage deviation, real power loss, and peak demand compared to those of cases 1 and 2; system costs provided by cases 1, 2 and 3 are USD 4598, USD 5418, and USD 1467, respectively.


Introduction
Nowadays, the electricity demand has been increased due to the growth of population and the rapid improvement of various technologies resulting in the increase of electrical power generation to meet the demand. In the past decades, electrical power generation is mostly produced from fossil energy, which directly affects global warming from greenhouse gas emissions. For this reason, the electrical power generations generated from renewable energy sources (RESs) have received huge attention at present because they are clean energy sources that are not running out. However, the main limitation of the RESs is the fluctuation of the uncontrollable natural resources. At present, RESs have been widely connected to distribution networks, resulting in the unreliability and low power quality of the distribution networks from the uncertainty power generation. Especially, in Thailand, the investment of the RESs from companies has been increased according to the government's encouragement, which directly affects the distribution network operators (DNO) because RESs are connected to the distribution networks. For this reason, energy storage systems (ESSs) have been used in the distribution networks with the connected RESs to deal with the uncertainty of the power generation problem from the RESs [1] and improve the performance of the distribution networks, especially voltage profile improvement and power loss reduction, which are the significant factors of power quality of the distribution network with the connected PV by providing optimal siting and sizing of BESS installation where Li-ion is used as the BESS. The objective function is to improve the distribution network performance by minimizing the costs incurred in the distribution network within a day comprising of voltage regulation cost, real power loss cost, and peak demand cost. Fourier series is applied to define the state of energy (SoE) of the BESS, which indicates the amount of energy remaining in the battery in each period because Fourier series is the continuous signal that can express the SoE of the BESS for all considered period; this corresponds to the fact that the BESS power level in real-world applications is continuous. Moreover, the over-discharge must be efficiently prevented, which means charging quantity must be equal to discharging quantity in one cycle [24]. Particle swarm optimization (PSO) is adopted to find the minimum value of the objective function because its performance in obtaining the optimal siting and sizing of the BESS is verified in [52][53][54][55][56][57], and PSO has been also applied to efficiently solve several recent optimization problems in different fields [58][59][60]. The BESS installation simulation is conducted on the 56-bus realistic radial distribution network with the connected PV located at the seventh feeder of Nakhon Phanom substation, Thailand. The contribution of this research is to improve the performance of the realistic radial distribution network with the connected PV in terms of voltage profile improvement, power loss reduction, and peak demand reduction by providing optimal siting and sizing of the BESS installation. The dynamic load and PV data in each time period were really measured from the substation and PV installation point, respectively, which contains double the number of data than that used in [24,52]. Therefore, the results will be more accurate and be able to efficiently provide the optimal siting and sizing of the BESS in the real distribution networks with the connected PV.
The rest of the article is as follows. Section 2 presents the battery energy storage systems and formulations. Problem formulation is explained in Section 3. Section 4 describes the methodology. Results and discussion are presented in Section 5. Finally, the conclusion is provided in Section 6.

BESS and Formulations
In this research, the Li-ion battery is chosen as the BESS to install in the realistic radial distribution network with the connected PV. The Fourier series is used in the BESS simulation to predict the SoE of the BESS.

BESS
The Li-ion has been widely used both in the literature and real-life applications because of its good qualities, such as fast charging, high energy-to-volume density, low self-discharge, and long-life service. However, Li-ion should not be used for a long period of operation because many factors, such as the number of battery operation cycles, depth of discharge (DoD), and temperature affect the lifetime of the Li-ion. Thus, for a long period of operation of Li-ion battery, a high-cycle operation should be avoided, DoD should not be over 80% of its maximum capacity, and the appropriate temperature is around 15-35 • C [61,62].

BESS Formulations
The BESS simulation in this research focuses on the charging and discharging rates by considering the energy difference of the BESS between the consecutive time interval of the SoE. The charging and discharging rates at each time interval (C iT ) in a one-day operation of the BESS (24 h) can be formulated as in Equation (1).
where C iT is charging and discharging rates in the considered period, P B (t) is the charging or discharging power of the BESS at times t = 1, 2, 3, . . . , m, and m depends on the time interval that one-day operation hour is divided, such as considering every 1 h (m = 24), 30 min (m = 48), or 15 min (m = 96), etc. The Fourier series is applied to express the SoE of the BESS and its obtained by substituting the Fourier coefficient (C iF ) from Equation (2) into Equation (3).
where a 0 , a n , b n are the constant Fourier coefficient, Fourier cosine coefficients, and Fourier sine coefficients, respectively. n is the number of Fourier coefficients, which is set to 8 for this study [24,52]. E B (t) is the energy of the BESS at time t. T is the total time period (24 h). The constant Fourier coefficient (a 0 ) does not affect the determination of E B (t), but it is used to ensure that the SoE value is not less than zero or less than the minimum of DoD (DOD min ).
To find the charging or discharging rate, which is the status, of the BESS at each time t interval, the difference of energy levels (∆E B ) of the BESS between the present period, t, and the previous period, t − 1, is calculated as in Equation (4). If the value of ∆E B is greater than or equal to zero, the BESS is in the state of charging, and if the value of ∆E B is less than zero, the BESS is in the state of discharge. The charging and discharging rates can be found according to Equations (5) and (6), respectively [24].
where η c is the battery charging efficiency, η d is the battery discharging efficiency, η bat = 0.9 is the total efficiency of the battery [24], η c = η d = √ η bat , ∆t is the sampling time interval. The optimal size of the BESS can be computed by Equation (7), and the lifespan of the BESS can be found from Equations (8) and (9) [24] as follows: where BatterySize (unit.h) is the optimal size of the BESS and the unit of the BESS depends on the unit of the battery energy value, E max B and E min B are the maximum and minimum energy of the BESS, DOD max is a maximum depth of discharge, which is set to 0.8 in this study [52], Cycles are the operation cycle of the BESS in a day, E B (t) and E B (t − 1) are the magnitude energy of the BESS at time t and t − 1, respectively, CycleLi f e is the total life cycles of the BESS, which is equal to 3221 cycles in this study [61], and D is the period of the BESS operation (365 days).

Problem Formulations
The optimal siting and sizing of the BESS installation presented in this research is proposed to improve the performance of the distribution network with the connected PV in terms of voltage profile improvement, power loss reduction, and peak demand minimization. The technical constraints of the distribution network are also considered to ensure network security and limitations.

Objective Function
The objective function of the optimal siting and sizing of the BESS installation is to improve the distribution network performance by minimizing costs incurred in the distribution network (C SYS ) caused by voltage deviation, real power loss, and peak demand, which are voltage regulation cost (C VR ), real power loss cost (C LOSS ), and peak demand cost (C P ), respectively. The calculation of these values can be found in the provided equations.
where N is a total bus number, V t i is the voltage per-unit of the i th bus at time t, V re f is the reference voltage (1 per-unit), γ VR is a voltage regulation cost rate (0.142 USD/p.u.) [23], M is a total branch number, Line_Loss is an active power loss in each branch, γ LOSS is an active power loss cost rate (0.284 USD/kWh) [24], P max is a maximum peak demand of real power during the considered period, and γ P is a peak demand cost rate (200 USD/kWh/year) [24].
This study aims to find the optimal siting and sizing of the BESS in the distribution network to improve the system performance in terms of voltage profile improvement, power loss reduction, and peak demand reduction. However, each term of improvement has different units; for example, voltage is in p.u., real power loss is in MW, and peak demand is in MW. Therefore, these terms are converted into costs incurred in the distribution network, caused by voltage deviation, real power loss, and peak demand, to calculate the objective function in the same aspect. Moreover, the battery costs such as cost to charge/discharge the battery, installation cost, and maintenance cost are excluded in the objective function. This is because if these battery costs are included in the objective function, the solutions will be obtained by partly considering minimum battery costs instead of fully considering system performance improvement. As a result, the truly appropriate siting and sizing of the BESS to improve the system performance in the stated terns will not be able to obtain.

Voltage Constraint
Voltage magnitude at every bus for all considered time period must be in the standard range (±5% of V re f ) as expressed in the given equation [52].
where V Lower , V U pper are the lower and upper bounds of standard range voltage, respectively. V t i is the voltage per-unit of the i th bus at time t.

Line Constraint
The apparent power of each line is restricted in the power line limits as expressed in the following equation: where S ij is the apparent power flow from the ith bus to the jth bus, and S max is the maximum apparent power flow of the transmission line (p.f. = 1).

Battery Constraint
To ensure the BESS is operated within the power and capacity limits in all time intervals, the power and capacity of BESS are bounded by Equations (17) and (18), respectively.
where P Bmin , P Bmax are the minimum and maximum power of BESS, respectively, P cha (t) is a power charge of BESS at time t, P dis (t) is a power discharge of BESS at time t, and E Bmin , and E Bmax are the minimum and maximum energy of BESS, respectively.

Methodology
The optimal siting and sizing of the BESS installation in this study were operated on the distribution network with the connected PV. The results were simulated by using MATLAB with MATPOWER 7.0, N.Y., USA [63] interface. The PSO was adopted to evaluate the minimum value of the objective function for finding the optimal siting and sizing of the BESS installation.

Case Study
The distribution network used in this study is the seventh feeder of Nakhon Phanom substation, Thailand, which is a 56-bus distribution network as shown in Figure 1. The first bus is defined as the slack bus, and the detailed data of real and reactive powers at each bus and line impedance are provided in Table A1 in Appendix A, in which the base voltage is 12.66 kV, and the base power is 10 MVA. The PV (5.88 MW) was installed at the 47th bus and the output power of PV can be found in Table A2 in Appendix A. The load magnitudes of each bus at each time t are defined according to Equations (19) and (20) for real power and reactive power, respectively. The PV power and load demand of the 56-bus distribution network are presented in Figure 2, in which these data are provided by Provincial Electricity Authority (PEA), Bangkok, Thailand. These PV power and load demand are chosen from the data collected over a year where the day when the reverse power flow reached the highest value was selected. Therefore, this study could improve the performance of the worst day and cover the problem of the other days.
where P t i , Q t i are the real and reactive powers of the i th bus at time t, respectively. P 0i , Q 0i are the base real and reactive powers at the i th bus obtained from Table A1 in Appendix A, respectively. p t , q t are the real power coefficient and reactive power coefficient at time t presented in Table A2 in Appendix A, respectively, to change the demand every considered time t interval.

PSO
The principle of PSO for solving optimization problems is inspired by the foraging behavior of a flock of birds or fishes [52]. The steps of the PSO process for solving problems are as follows: In the first step, the number of populations or particles ( ) is defined where each particle consists of decision variables ( ), the starting position of each particle is initialized, and its velocity is initially set to zero. Afterward, the objective function is evaluated by using the initial positions and velocities of the particles, and then the initial personal best ( ( )) of each particle and the initial global best ( ) are obtained (the global best is the best particle among all personal bests). Following this, the inertia is calculated according to Equation (21). The velocity of each particle is then updated by Equation (22), and the position of each particle is also updated by Equation (23). The updated position of each particle is substituted to evaluate the objective function. Then, the personal best and global best are updated. Repeat the process until the maximum iteration is reached. The flowchart and pseudo-codes of PSO are shown in Figures  3 and 4, respectively.

PSO
The principle of PSO for solving optimization problems is inspired by the foraging behavior of a flock of birds or fishes [52]. The steps of the PSO process for solving problems are as follows: In the first step, the number of populations or particles ( ) is defined where each particle consists of decision variables ( ), the starting position of each particle is initialized, and its velocity is initially set to zero. Afterward, the objective function is evaluated by using the initial positions and velocities of the particles, and then the initial personal best ( ( )) of each particle and the initial global best ( ) are obtained (the global best is the best particle among all personal bests). Following this, the inertia is calculated according to Equation (21). The velocity of each particle is then updated by Equation (22), and the position of each particle is also updated by Equation (23). The updated position of each particle is substituted to evaluate the objective function. Then, the personal best and global best are updated. Repeat the process until the maximum iteration is reached. The flowchart and pseudo-codes of PSO are shown in Figures  3 and 4, respectively.

PSO
The principle of PSO for solving optimization problems is inspired by the foraging behavior of a flock of birds or fishes [52]. The steps of the PSO process for solving problems are as follows: In the first step, the number of populations or particles (nPop) is defined where each particle consists of decision variables (nVar), the starting position of each particle is initialized, and its velocity is initially set to zero. Afterward, the objective function is evaluated by using the initial positions and velocities of the particles, and then the initial personal best (P best (i)) of each particle and the initial global best (G best ) are obtained (the global best is the best particle among all personal bests). Following this, the inertia is calculated according to Equation (21). The velocity of each particle is then updated by Equation (22), and the position of each particle is also updated by Equation (23). The updated position of each particle is substituted to evaluate the objective function. Then, the personal best and global best are updated. Repeat the process until the maximum iteration is reached. The flowchart and pseudo-codes of PSO are shown in Figures 3 and 4, respectively.
where V(i) is the velocity of the ith particle, P best (i) is the personal best position of the ith particle, G best is the global best position, P(i) is the current position of the ith particle, w is the inertia of P(i), it c is a current iteration, it max is a maximum iteration, c 1 and c 2 are set to 2, and r 1 and r 2 are randomly generated numbers between 0 and 1.  Initialize position and velocity of each particle Obtain initialized personal best and global best of each particle Update personal best and global best Update inertia by (21) and update velocity of each particle by (22) Evaluate objective function

Update personal best and global best
Is the iteration condition satisfied?
Obtain the best feasible solution

End
No Yes Update position of each particle by (23) Initialize the parameters of PSO (lb, ub, w, c1, c2, nVar, nPop, itmax) Initialize position of each particle P(i) (i = 1, 2, 3, …, nPoP) Initialize velocity of each particle V(i) (i = 1, 2, 3, …, nPoP) Evaluate the objective function to obtain initialized Pbest(i) and Gbest while the end condition is not satisfied Update inertia by (21) Update velocity of each particle by (22) Update position of each particle by (23) Evaluate the objective function Update Pbest(i) of each particle and Gbest end while   Initialize position and velocity of each particle Obtain initialized personal best and global best of each particle Update personal best and global best Update inertia by (21) and update velocity of each particle by (22) Evaluate objective function

Update personal best and global best
Is the iteration condition satisfied?
Obtain the best feasible solution

End
No Yes Update position of each particle by (23) Initialize the parameters of PSO (lb, ub, w, c1, c2, nVar, nPop, itmax) Initialize position of each particle P(i) (i = 1, 2, 3, …, nPoP) Initialize velocity of each particle V(i) (i = 1, 2, 3, …, nPoP) Evaluate the objective function to obtain initialized Pbest(i) and Gbest while the end condition is not satisfied Update inertia by (21) Update velocity of each particle by (22) Update position of each particle by (23) Evaluate the objective function Update Pbest(i) of each particle and Gbest end while

The Procedure of the Optimal Siting and Sizing of the Battery Energy Storage System (BESS)
The procedure of the optimal siting and sizing of the battery energy storage system (BESS) can be described as the following steps: 1.
Model the distribution network as detailed in Section 4.1 in the MATPOWER; 2.
Define candidate buses in the distribution network; 3.
Choose one candidate bus to install the BESS; 4.
Solve the optimization problem by using PSO; 5.
Perform power flow calculation and evaluate the objective function; 6.
Repeat steps 4 and 5 if the maximum iteration is not reached; otherwise, proceed to step 7; 7.
Obtain the optimal Fourier coefficients of BESS installation at the considered bus from step 3; 8.
If the candidate bus is not the last candidate, return to step 3; otherwise, proceed to step 9; 9.
Obtain the optimal location and size of the BESS with the lowest objective function value; 10. Substitute the Fourier coefficients provided from step 9 in Equations (1)-(9) to generate the parameters of the BESS.
The flowchart and pseudo-codes of the proposed method are shown in Figures 5 and 6, respectively.
Energies 2021, 14, x FOR PEER REVIEW 9 of 21 The procedure of the optimal siting and sizing of the battery energy storage system (BESS) can be described as the following steps: 1. Model the distribution network as detailed in Section 4.1 in the MATPOWER; 2. Define candidate buses in the distribution network; 3. Choose one candidate bus to install the BESS; 4. Solve the optimization problem by using PSO; 5. Perform power flow calculation and evaluate the objective function; 6. Repeat steps 4 and 5 if the maximum iteration is not reached; otherwise, proceed to step 7; 7. Obtain the optimal Fourier coefficients of BESS installation at the considered bus from step 3; 8. If the candidate bus is not the last candidate, return to step 3; otherwise, proceed to step 9; 9. Obtain the optimal location and size of the BESS with the lowest objective function value; 10. Substitute the Fourier coefficients provided from step 9 in Equations (1)

System Performance Evaluation
The performance of the distribution network is evaluated in various terms by referring to the objective function, which comprises of voltage deviation index, power losses, and peak demand.

Voltage Deviation Index (VDI)
The voltage deviation index (VDI) is applied to evaluate the voltage profile improvement of the network. VDI is the maximum difference value between the voltage of each bus in the distribution network over 24 h and the reference voltage, presented in percent (% ). A smaller VDI value means a better voltage profile, and the VDI can be calculated by Equations (24) and (25).
where % is the VDI of the bus, is the reference voltage (1 p.u.), is the voltage in p.u. of the bus, and % is the total VDI of the distribution network.

Power Losses
The power losses incurred in the distribution network composed of real power loss, reactive power loss, and apparent power loss. These power losses can be computed by the provided equations.
= + where is the real power loss, is the reactive power loss, is the apparent power loss, is the real power loss of the branch, is the reactive power loss of the branch, is the total branch number. is a time interval, and is the total time period.

System Performance Evaluation
The performance of the distribution network is evaluated in various terms by referring to the objective function, which comprises of voltage deviation index, power losses, and peak demand.

Voltage Deviation Index (VDI)
The voltage deviation index (VDI) is applied to evaluate the voltage profile improvement of the network. VDI is the maximum difference value between the voltage of each bus in the distribution network over 24 h and the reference voltage, presented in percent (%VDI). A smaller VDI value means a better voltage profile, and the VDI can be calculated by Equations (24) and (25).
where %VDI i is the VDI of the ith bus, V re f is the reference voltage (1 p.u.), V i is the voltage in p.u. of the ith bus, and %VDI is the total VDI of the distribution network.

Power Losses
The power losses incurred in the distribution network composed of real power loss, reactive power loss, and apparent power loss. These power losses can be computed by the provided equations.
where Pl is the real power loss, Ql is the reactive power loss, Sl is the apparent power loss, P l loss is the real power loss of the lth branch, Q l loss is the reactive power loss of the lth branch, M is the total branch number. i is a time interval, and T is the total time period.

Peak Demand
The peak demand is considered from the real power flow at the slack bus over 24 h, in which the positive value of the real power flow indicates the power flowing into the network and the negative value of the real power flow indicates power flowing out of the network.

Results and Discussion
The optimal siting and sizing of the BESS installation are presented to improve the performance of the realistic distribution network with the connected PV, which is the seventh feeder of Nakhon Phanom substation in Thailand. The parameters of PSO were population number (nPop) = 60 and maximum iterations = 1000. The technical constraints of the distribution network consist of the voltage limits, which is ± 5% of the reference voltage (12.66 kV), and the rated line current, which is 410 A (the rated line current limit of the 185 sq.mm. Space aerial cable is according to the Provincial Electricity Authority (PEA) standard). The simulation is conducted in MATLAB interfaced with MATPOWER. The simulation results are compared between three cases where case 1 is without PV and BESS, case 2 is with only PV, and case 3 is with both PV and BESS.

Optimal Siting and Sizing of BESS Installation
The BESS is installed at each bus from the second to 56th bus to find the optimal location for the BESS installation. The values of the objective function of all three cases are shown in Table 1, in which case 3 shows the best five bus locations of the installed BESS, providing the minimum objective values together with the size and lifetime of the BESS. It is found that the best location for BESS installation to improve the distribution network performance is located at bus 47, which is the same location as PV installation, following by buses 46, 45, 44, and 43, respectively. Although the 48th bus is actually the bus that has the most voltage deviation problems, it is not a suitable bus for BESS installation to improve the network performance. It is also found from Table 1 that even though BESS installation at the 47th bus has the highest values of power and capacity, it is still the most appropriate location for the performance improvement due to the best value of the objective function (C sys ). The lifetime values of BESS from each location are slightly different, but the 47th bus still has the longest lifetime, which is 8.71 years. When comparing the costs incurred in the distribution network, including voltage regulation cost, real power loss cost, and peak demand cost, it is found that the costs from cases 1 and 2 are USD 4598 and USD 5418, respectively, and the costs from case 3 in which BESS is installed at the 47th bus is USD 1467. Hence, only PV installation could worsen the network performance. However, PV installation, together with the optimal siting and sizing of BESS installation, could efficiently improve the network performance.
The SoE of the BESS at the 47th bus over 24 h from 00:00 a.m. is presented in Figure 7 to observe when the BESS is charging or discharging, and charging/discharging rate can be obtained. It is noticeable that the energy of the BESS was slightly changed from 00:00 a.m to 6:00 a.m. and continuously decreased until reaching the lowest value, which is around 12.50 MWh, at 8:00 a.m. From 8:00 a.m. to 6:00 p.m. (at the 18th hour), the energy of the BESS was sharply increased until the maximum value, which is approximately 62.72 MWh. After that, the BESS was discharged from the maximum energy to its initial value at the last hour. It is found that the energy of the BESS was increased in the time when PV supplied energy to the network (6:30 a.m. to 6:00 p.m.) because BESS stored surplus energy from PV, which exceeded the demand in the network. Despite the discharge of some energy from 6:30 a.m. to 8:00 a.m., this was due to the network performance improvement by mainly considering the objective function. In the period when supply from PV was stopped, the SoE of BESS was also dropped to supply the stored energy back to the network. This could verify that the BESS could efficiently balance the supply and demand of the network. MWh. After that, the BESS was discharged from the maximum energy to its initial value at the last hour. It is found that the energy of the BESS was increased in the time when PV supplied energy to the network (6:30 a.m. to 6:00 p.m.) because BESS stored surplus energy from PV, which exceeded the demand in the network. Despite the discharge of some energy from 6:30 a.m. to 8:00 a.m., this was due to the network performance improvement by mainly considering the objective function. In the period when supply from PV was stopped, the SoE of BESS was also dropped to supply the stored energy back to the network. This could verify that the BESS could efficiently balance the supply and demand of the network.

Voltage Deviations
The voltage deviations index (% ) comparison of each case was obtained, as shown in Table 2. It can be derived that % of case 3 is the lowest (146.46%), which means that the BESS installation could improve the voltage profile of the distribution network with the connected PV. In Figure 8, the voltage profile of the 48th bus where the voltage deviation problems are the most frequently detected in the distribution network over 24 h is presented. For cases 1 and 2, it was found that the voltage level was lower than the lower bound of the voltage limit from 6:30 p.m. (the 18th hour and a half) to 11:00 p.m. (the 23rd hour). In addition, for case 2, the voltage level was higher than the upper bound of the voltage limit from 11:30 a.m. (the 11th hour and a half) to 3:30 p.m. (the 15th hour and a half). For case 3, installing the BESS at the 47th bus could maintain the voltage level within the voltage limit range over 24 h.

Voltage Deviations
The voltage deviations index (%VDI) comparison of each case was obtained, as shown in Table 2. It can be derived that %VDI of case 3 is the lowest (146.46%), which means that the BESS installation could improve the voltage profile of the distribution network with the connected PV. In Figure 8, the voltage profile of the 48th bus where the voltage deviation problems are the most frequently detected in the distribution network over 24 h is presented. For cases 1 and 2, it was found that the voltage level was lower than the lower bound of the voltage limit from 6:30 p.m. (the 18th hour and a half) to 11:00 p.m. (the 23rd hour). In addition, for case 2, the voltage level was higher than the upper bound of the voltage limit from 11:30 a.m. (the 11th hour and a half) to 3:30 p.m. (the 15th hour and a half). For case 3, installing the BESS at the 47th bus could maintain the voltage level within the voltage limit range over 24 h.

Power Losses
The real power losses of all three cases over 24 h are displayed in Figure 9. For case 1, the real power loss was continuously less than 0.05 MW from 00:00 a.m. to 6:30 p.m. (the 18th hour and a half), however, after that the real power loss of this case was consider-ably increased until reaching the maximum value at 7:30 p.m. (the 19th hour and a half), which is equal to 0.33 MW. For case 2, the real power loss has occurred the same as case 1 except for the period from 6:30 a.m. (the sixth hour and a half) to 6:30 p.m. (the 18th hour and a half). Especially, the loss for case 2 dramatically climbed to the highest point, which is 0.47 MWh at the 12th hour, and during the time from 10:30 a.m. (the 10th hour and a half) to 4:30 p. m. (the 16th hour and a half), the real power loss of this case was more than those of cases 1 and 3. For case 3, the real power loss was slightly more than those of cases 1 and 2 during 2:30 a.m. (the second hour and a half) to 5:00 a.m. (the fifth hour) and was slightly more than that of case 1 from 11:30 a.m. (the 11th hour and a half) to 3:30 p.m. (the 15th hour and a half). Moreover, the real power loss of case 3 was less than those of both cases 1 and 2 in the other period. The summation of the power losses including real power loss, reactive power loss, and apparent power loss over 24 h of all three cases are presented in Table 2. It is found that case 2 met more power loss than those of cases 1 and 3, especially, the real power loss of case 2 was equal to 5.90 MW, which was much more than those of case 1 (2.89 MW) and case 3 (4.10 MW).

Power Losses
The real power losses of all three cases over 24 h are displayed in Figure 9. For case 1, the real power loss was continuously less than 0.05 MW from 00:00 a.m. to 6:30 p.m. (the 18th hour and a half), however, after that the real power loss of this case was considerably increased until reaching the maximum value at 7:30 p.m. (the 19th hour and a half), which is equal to 0.33 MW. For case 2, the real power loss has occurred the same as case 1 except for the period from 6:30 a.m. (the sixth hour and a half) to 6:30 p.m. (the 18th hour and a half). Especially, the loss for case 2 dramatically climbed to the highest point, which is 0.47 MWh at the 12th hour, and during the time from 10:30 a.m. (the 10th hour and a half) to 4:30 p.m. (the 16th hour and a half), the real power loss of this case was more than those of cases 1 and 3. For case 3, the real power loss was slightly more than those of cases 1 and 2 during 2:30 a.m. (the second hour and a half) to 5:00 a.m. (the fifth hour) and was slightly more than that of case 1 from 11:30 a.m. (the 11th hour and a half) to 3:30 p.m. (the 15th hour and a half). Moreover, the real power loss of case 3 was less than those of both cases 1 and 2 in the other period. The summation of the power losses including real power loss, reactive power loss, and apparent power loss over 24 h of all three cases are presented in Table 2. It is found that case 2 met more power loss than those of cases 1 and 3, especially, the real power loss of case 2 was equal to 5.90 MW, which was much more than those of case 1 (2.89 MW) and case 3 (4.10 MW).

Peak Demand
The peak demand, which is the peak real power demand, at the slack bus over 24 h is depicted in Figure 10. It could be observed that the peak demands of both cases 1 and 3 flowed in only one direction flowing into the network, while the peak demand of case 2

Peak Demand
The peak demand, which is the peak real power demand, at the slack bus over 24 h is depicted in Figure 10. It could be observed that the peak demands of both cases 1 and 3 flowed in only one direction flowing into the network, while the peak demand of case 2 flowed in both directions (into and out from the distribution network). It is found from case 1 that the maximum real power was equal to 6.75 MW at 7:30 p.m. (the 19th hour and a half), which is the highest demand of the day. For case 2, the maximum real power flowing into the distribution network is equal to 6.75 MW at 7:30 p.m. (the 19th hour and a half), which is the same value and hour as case 1, while the maximum reverse power flow is equal to 3.70 MW at 12:00 a.m. (the 12th hour), which is the period of real power supplied by PV. Finally, after the BESS installation in case 3, the real power demand could be maintained within the range of 0-2 MW over 24 h. When compare the peak powers of case 2 and 3, it can be seen that the peak power of case 3 is more than that of case 2 during 2:30 a.m.-5:00 a.m. and 8:00 a.m.-6:00 p.m. This means the BESS was charging during these periods, which matches with Figure 7 when the SoE of the BESS was increased. For the other periods when the peak demand of case 3 is less than that of case 2, it means the BESS was discharging to the network, which can be observed from Figure 7, when the SoE of the BESS was decreased. Thus, the capacity of the BESS significantly depends on the PV power and load demand in the distribution network. Moreover, the BESS installation can delay the distribution network improvement to meet the increasing electricity demand in the future. After the BESS installation simulation at the seventh feeder of Nakhon Phanom substation with the connected PV of PEA in Thailand, it is found that the optimal siting and sizing of the BESS installation are at the 47th bus and 4.50 MW/62.72 MWh, respectively, by considering the system cost objective function. It is also found that this siting and sizing of the BESS could significantly improve the performance of the distribution network in terms of voltage deviation improvement, power loss reduction, and peak demand reduction when compared to the cases without BESS installation. By considering the siting of the BESS in the distribution network, it is found that the siting of the BESS affects the system constraints, especially voltage constraints. Only some buses in the network can be selected to install the BESS to improve the voltage profile to be within the standard value. For the sizing of the BESS, the BESS has similar sizes for the BESS installation at different buses in the distribution network. The appropriate size of the BESS of each distribution network depends on the imbalance of supply and demand of that network. Moreover, it could be analyzed that the BESS installation in different siting and sizing results in different performance improvement of the distribution network with the connected PV.
By considering the performance of the distribution network with the connected PV after the BESS installation, it is presented that the voltage profile in one day (24 h) was improved and could be maintained within the constrained voltage limits. Hence, the After the BESS installation simulation at the seventh feeder of Nakhon Phanom substation with the connected PV of PEA in Thailand, it is found that the optimal siting and sizing of the BESS installation are at the 47th bus and 4.50 MW/62.72 MWh, respectively, by considering the system cost objective function. It is also found that this siting and sizing of the BESS could significantly improve the performance of the distribution network in terms of voltage deviation improvement, power loss reduction, and peak demand reduction when compared to the cases without BESS installation. By considering the siting of the BESS in the distribution network, it is found that the siting of the BESS affects the system constraints, especially voltage constraints. Only some buses in the network can be selected to install the BESS to improve the voltage profile to be within the standard value. For the sizing of the BESS, the BESS has similar sizes for the BESS installation at different buses in the distribution network. The appropriate size of the BESS of each distribution network depends on the imbalance of supply and demand of that network. Moreover, it could be analyzed that the BESS installation in different siting and sizing results in different performance improvement of the distribution network with the connected PV.
By considering the performance of the distribution network with the connected PV after the BESS installation, it is presented that the voltage profile in one day (24 h) was improved and could be maintained within the constrained voltage limits. Hence, the power quality has been enhanced, leading to the reliability improvement of the distribution network. Regarding power loss, the BESS installation could also considerably reduce the power losses in the distribution network, resulting in more profits of DNO from the electricity selling. In addition, the BESS installation could also deal with the inequality problem between supply and demand in the distribution network by storing energy into the BESS when demand is less than supply and supplying energy when demand is more than supply, especially the peak demand time. The benefit of the peak demand reduction for the DNO is to extend the time for planning, improving, and expanding the distribution network to accommodate the increasing electricity demand in the future. Another benefit is to reduce greenhouse gas emissions due to electricity generation from fossil fuels.
The optimal siting and sizing of the BESS introduced in this study could not only improve the performance of the distribution network with the connected PV, but it could also increase profits and improve reliability for the DNO. Moreover, the implementation presented in this research could efficiently provide the optimal siting and sizing of the BESS with the connected PV in the real distribution networks; therefore, it could also be efficiently applied to other real distribution networks with the connected PV or connected RES.

Conclusions
In this study, the optimal siting and sizing of the BESS installation in the realistic radial distribution network with the connected PV, which is the seventh feeder at Nakhon Phanom substation in Thailand, is proposed to improve network performance in terms of voltage deviation improvement, power loss reduction, and peak demand reduction. The optimal siting and sizing of the BESS installation were provided by considering minimum objective function value, which is the total costs incurred in the distribution network within a day including voltage regulation cost, real power loss cost, and peak demand cost. The BESS installation was simulated in the seventh feeder of Nakhon Phanom substation, Thailand, and the PSO optimization algorithm was applied to obtain the solution. After the BESS installation, it is found that the voltage profile was improved and within the voltage constraints, resulting in better power quality and more reliability. The real, reactive, and apparent power losses were reduced to be lower than those of the case without the BESS installation. The peak demand, which is the real power demand flowing through the slack bus, was changed to be within the range of 0-2 MW and flowed into the distribution network that is only in one direction during the considered 24 h. It is also found that BESS installation could reduce costs incurred in the distribution network with the connected PV from USD 5418 to USD 1467, resulting in the more income from the electricity selling to the DNO.
From the achieved results, the analysis in economic terms is considered to find if it is worth installing the BESS in the real distribution network, and how long will it take to obtain the benefits in return.

Data Availability Statement:
The authors confirm that the data supporting the findings of this study are available within the article.
Acknowledgments: Authors would like to acknowledge Pradit Fuangfoo for his helpful technical discussions.

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

Appendix A
The system data for the seventh feeder at Nakhon Phanom substation of Provincial Electricity Authority, Thailand, is presented in Table A1.  The dynamic load and PV of the seventh feeder at Nakhon Phanom substation of Provincial Electricity Authority, Thailand, is presented in Table A2.