Plane Thermoelastic Waves in Infinite Half-Space Caused FACTA UNIVERSITATIS Series: Electronics and Energetics Vol. 35, No 1, March 2022, pp. 121-136 https://doi.org/10.2298/FUEE2201121S © 2022 by University of Niš, Serbia | Creative Commons License: CC BY-NC-ND Original scientific paper OPTIMAL BATTERY STORAGE LOCATION AND CONTROL IN DISTRIBUTION NETWORK Miloš Stevanović1, Aleksandar Janjić2, Sreten Stojanović1, Dragan Tasić2 1University of Niš, Faculty of Technology, Leskovac, Serbia 2University of Niš, Faculty of Electronic Engineering, Niš, Serbia Abstract. The paper discusses the problem of the energy losses reduction in electrical networks using a battery energy storage system. One of the main research interests is to define the optimal battery location and control, for the given battery characteristics (battery size, maximum charge / discharge power, discharge depth, etc.), network configuration, network load, and daily load diagram. Battery management involves determining the state of the battery over one period (whether charging or discharging) and with what power it operates. Optimization techniques were used, which were applied to the model described in the paper. The model consists of a fitness function and a constraint. The fitness function is the dependence of the power losses in the network on the current battery power, and it is suggested that the function be fit by a n - order power function. The constraints apply to the very characteristics of the battery for storing electricity. At any time interval, the maximum power that the battery can receive or inject must be met. At any time, the stored energy in the battery must not exceed certain limits. The power of losses in the network is represented as the power of injection into the nodes of the network. The optimization problem was successfully solved by applying a genetic algorithm (GA), when determining optimal battery management. Finally, the optimal battery management algorithm is implemented on the test network. The results of the simulations are presented and discussed. Key words: energy losses, optimal location, battery storage, charge state (SOC) 1. INTRODUCTION Energy security, as well as environmental concerns are becoming an increasingly current and frequent topic of the 21st century. Currently, a large part of the world's energy comes from fossil sources, and humanity is slowly facing the problems of environmental pollution. Therefore, the importance of alternative clean energy sources, which have a tolerable impact on the environment, is of great importance. In order to improve the quality Received July 13, 2021; received in revised form October 26, 2021 Corresponding author: Aleksandar Janjić Faculty of Electronic Engineering, Niš, Aleksandra Medvedeva 14, 18000 Niš, Serbia E-mail: aleksandar.janjic@elfak.ni.ac.rs 122 M. STEVANOVIĆ, A. JANJIĆ, S. STOJANOVIĆ, D. TASIĆ of the power system (increase the reliability, decrease the energy losses, improve the voltage profile of the network) and create better distribution flexibility, renewable energy resources (RES) are necessary for the power system. Photovoltaic devices, electric vehicles, storage systems - batteries are some examples of distributed energy resources. Micro grid is a distribution system that includes various renewable energy sources in the power system. It can operate in two different operating modes: In island operation (autonomous) and be connected to the power system. The presence of several interconnected micro networks in distribution networks improves the performance and reliability of the power system. The micro network operator can reduce the operating costs of the system, while increasing its reliability and environmental performance [1]. Much of the literature deals with the aforementioned [2 – 5]. To make the operation of the electricity network even more flexible and reliable, it is necessary to introduce battery storage systems (BEES). Electricity losses are one of the main issues for distribution system operators, as the planning, management, and maintenance of the distribution network are based on appropriate costs. Therefore, the cost of supply to end - users connected to the distribution system is also affected by the cost of electricity losses. Therefore, the reduction of electricity losses is one of the main goals of electricity distributors, which should ensure efficient and reliable distribution of electricity at an affordable price [3]. Distributed production from renewable energy sources has been growing in recent years, introducing the need for a possible reconfiguration of the current distribution network (DN) which can reduce the load of individual lines and provide less energy losses with corresponding increased reliability and efficiency [6]. Minimizing power losses in the distribution network is one of the main issues of the distribution system, due to the need for reducing control distribution network management costs. Recent developments in battery storage technologies have introduced new capabilities for their power distribution systems within the radial distribution network. Batteries can be properly integrated into the grid and managed to reduce electricity losses, thereby increasing production from renewable energy sources and contributing to voltage regulation due to the production of reactive power from the battery inverter. Reducing electricity losses using BEES in the distribution network has become increasingly attractive in recent years due to a significant increase in technological performance and an expected reduction in BESS installation costs [7]. Energy storage devices in power systems can generally be classified into two types: long-term devices with relatively long response time and short-term storage devices with fast response. Each BEES type can provide a certain set of applications, depending on the range of its technical parameters. The first category is suitable for energy management applications such as peak shaving, loss reduction, island operation, renewable energy, time shift, and long-term voltage control. One of the most important applications in this category is the cutting of the peaks on the load diagram, which the researcher study in detail in [8]. This is especially true for some rapidly evolving technologies, for example, lithium-ion batteries with an expected reduction in capital costs by about 30-50% in the coming years [9, 10]. For these reasons, much of the research is currently focused on different modeling possibilities and simulations of optimal management of BESSs connected to the distribution network. The genetic algorithm has proven to be the most favorable in practice for solving this type of problem [11, 12, 13]. However, these methodologies require intensive computational time. The main goal of this paper is to define a novel optimization model, reducing the computational time, and simultaneously optimize the location and the scheduling of the battery. Optimal Battery Storage Location in Distribution Network and Optimal Battery Control 123 In this paper, the problem of reducing electricity losses using a battery is considered. This paper aims to determine the optimal location of batteries and their management to reduce losses in the distribution network. First, the location of the battery is determined based on the sensitivity coefficient of the network nodes, and then the optimization of battery charging / discharging is performed for the selected location. Optimal battery management involves determining the charge / discharge power of the battery so that daily power losses in the network are minimal. For this purpose, a fitness function has been defined, which includes network and battery models, in the form of the dependence of network power losses on the current battery power. To obtain a simpler solution, it has been proposed that this dependence be fitted with a power function of order n. To the knowledge of the authors, this way of defining the fitness function has not been researched in the literature so far. The optimization problem, in addition to the fitness function, also contains additional limitations such as inequalities and equations that result from the characteristics of the battery for storing electricity (battery size, maximum charging / discharging power, discharge depth, etc.). The optimization problem was successfully solved by applying a genetic algorithm (GA). At the end of the work, the defined optimal battery management algorithm was applied to one test network. The simulation results showed that the proposed method can be efficiently used to reduce electricity losses using a battery. The paper is organized as follows: The description of the problem, modelling of steady-state operation of DN and BESS are presented in Section 2, Section 3 describes the methodology of optimal BESS location and the equations modelling the optimization goal and constraints Finally, in Section 4 radial test grids are presented to validate the proposed methodology for finding the BESS siting and determine optimal power of charge/discharge battery for the selected location. 2. PROBLEM DESCRIPTION AND FORMULATION This paper uses the model of network and model of battery storage, which will be described below. The functional dependency of the power losses in the network on the current battery power was defined. Based on it, the fitness function was formed for the optimization procedure. 2.1. Network and battery modelling 2.1.1. Network modelling The number of nodes and branches leads to an appropriate representation of the network where the incidence matrix A and matrix P are defined according to those given in references [14]. Sk is the complex load force of the k-th node. The generated power in a node is taken as negative (-) and the consumption power as positive (+). The incidence matrix A is of dimension n x n (number of nodes x number of branches), not counting the root node. Matrix A is a square matrix, due to the radial topology of the distribution network. The first and second nodes in the branch are identified by -1 and +1, respectively. Matrix P, dimensions n x n (number of nodes x number of branches) defines whether the k-th branch is located in the path between the j- 124 M. STEVANOVIĆ, A. JANJIĆ, S. STOJANOVIĆ, D. TASIĆ th and the root node. Based on the previous one, the matrix equality holds that T A P I= . The preceding notation is identical to that presented in reference [14]. Branch currents and node voltages are calculated iteratively according to the procedure proposed in reference [14]. The loads connected to the distribution network are characterized by constant currents at each iteration. Under this assumption, the load current of the k - th node is independent of the voltage in that node. So the current of the k-th node. in the j - th iteration it is calculated as: * ( ) ( 1) 3 Sj k I nk j U k = − (1) where ( 1)j k U − is the line voltage value calculated in the previous iteration (j−1) – th, ( )j I nk is injection current in k-th node. During the iterative process, the node voltages are used for the calculation and in the first iteration they should be equal to the root node voltage E0. The corresponding equation according to Kirchhoff's law for each node, can be written for each iteration using the incidence matrix as follows:    ( ) ( )[ ] j jA I I nb = (2) where are ( )j I b branch currents in the j-th iteration, and ( )j I n injection currents in nodes network in the j-th iteration. When branch currents are calculated using the preceding formula, the voltage drop dUk at each node in the network can be written as: ( ) ( )j j U Z Ikk bk  = (3) where is Zk the impedance of the k-th branch and ( )j I bk is current in k–th branch in the j- th iteration . Therefore, in the j-th iteration, for bus voltage at each node of the network we have    ( ) ( )[ ]0j jU E P dUk k= − (4) where E0 is the known root node voltage and dU is voltage drop vector in each of the nodes of the network. Finally, the iterative process is terminated when the following condition is satisfied:       ( ) ( 1) ( 1) j j U U k k j U k  − −  − (5) In other words, the iterative process ends when the relative change in voltage across all nodes in the network in two adjacent iterations is less than the given tolerance ε. Optimal Battery Storage Location in Distribution Network and Optimal Battery Control 125 2.1.2. Battery model The battery model is based on the battery model from reference [15] where the battery is treated as a passive component. Therefore, the power injected into the battery (battery charge) has a positive sign while the power injected by the battery into the network (battery discharge) has a negative sign. The energy accumulated in the battery (charge state) of the SOC at ti+1 is defined by the following linear equation [15]: , ( ) (( ) ( Δ 1 )) , P tist d SOC t SOC t P t tc st ci ii sd d       = + − +     (6) where sd is the battery discharge efficiency, c is the charging efficiency, d is the discharge efficiency, and ,st cP and ,st dP are the battery powers during charging and discharging, respectively. To limit the charging and discharging power of the battery, the previous variables should satisfy the following inequalities: 0 , 0 , 0 1 SOCmax P cst c Tc SOCmax P st d d T d c d          +  (7) where maxSOC is the capacity of the battery, cT and dT are the minimum charging and discharging times, respectively, c and d are binary variables that determine whether the battery is charged or discharged. For 1c = and 0d = the battery is charging, for 0c = and 1d = , the battery is discharging, while for 0c = and 0d = , the battery is offline. 2.2. Problem formulation It is necessary to determine the optimal location and schedule of charging and discharging the battery throughout the day so that the daily energy losses in the network are kept to a minimum. Battery siting is determined based on sensitivity analysis of the power losses given in reference [16]. * * , , 100 10 * 0 W loss W W los W W loss k los s lo s k l s oss s  − = =  (8) where , W loss k is corresponding to the daily power losses for the given grid configuration and * W loss are daily power losses for the referent configuration network. Energy losses during the day can be calculated as the sum of energy losses in individual time intervals. This time interval is chosen so that the power of losses in the 126 M. STEVANOVIĆ, A. JANJIĆ, S. STOJANOVIĆ, D. TASIĆ network could be constant during its duration. Therefore, the total energy losses during one day are calculated as: 1 2 ( 1) N W W W W W Wi iN i = + + + + + =  = (9) where N is the number of time intervals and iW is energy losses in the i - th time interval. Energy losses depend on the power losses in the network and the duration of these losses, while power losses depend on the square of the current flowing through the network elements (line, transformer, generator, etc.). It is a well-known fact that power losses depend on the current squared. However, the power flow through the lines of the network largely contributes to the injection of power into the nodes of that network. Hence the idea, that the power of losses in the network is represented by some function that depends on the power of injection in individual nodes of the network. There can be one node with batteries, and there can be more nodes. Depending on whether one or more nodes are concerned, an appropriate polynomial function is chosen that gives the relationship between the dependence of energy losses and the injection power in the battery nodes. If it is a single node within a battery, the form of the function is as follows: ( ) ( , ) ( , ) 1 n n j i n j i bat i j W a P − − = =  (10) where ( , )bat iP is battery of power in i-th time interval, and n is order of polynomials. Total energy losses during one day are equal to the sum of losses in individual time intervals, based on equality (9) and (10): ( ) ( , ) ( , ) ( 1) 1 N n n j n j i bat i i j W a P − − = = =   (11) In the case of two nodes with batteries, the form of the polynomial function is as follows: ( , ) ( 1, ) ( 2, ) 1 N n i i i i j bat j bat j j W a P P − = =  (12) Based on equality (10) and (12), the total energy losses are calculated: ( , ) ( 1, ) ( 2, ) 1 1 N n n i i i j bat j bat j i j W a P P − = = =  (13) 3.2.1. One battery connected to the network In the next example, only one battery is connected to the network. The day is divided into N equal time intervals. The charging and discharging intervals are equal to c dT TT= = . For each time interval the dependence of the power loss on the network as a function of the current battery power for a particular node is determined for the range of battery power max max, ][ P P− . The idea is to create a dependency of the power losses in the network on the current battery power. An example of the dependence for the interval N = 24 is given in figure 1. In this example, max 1P MW= . Optimal Battery Storage Location in Distribution Network and Optimal Battery Control 127 Fig. 1 Dependency of energy losses as a function of battery power The next step is fit to each of these dependencies analytically with a degree function of the n-th order using equations (9) and (10). Energy losses for each time interval are represented as the power of injection into the nodes of the network. The fitness function is the daily energy loss as a function of battery power. In this example, a quadratic function is chosen for the fitness function because the coefficients a3i, a4i, etc. are extremely small, practically negligible values. It is necessary to determine the vector batP with appropriate constraints so that energy losses are kept to a minimum. The fitness function is given as follows: 2 ( , ) ( , ) ( 1) ( ) N i bat i i bat i i i W a cPP b = = + + (14) where: , ,i i ia b c are coefficients from fitting function and ( , )bat iP is battery power in i-th hours. The coefficients are selected based on the dependence of network losses on the battery injection power for each node 3.2.2. Two batteries connected to the network A similar analysis is done for two batteries connected to the network in nodes 11th and 10th. The day is divided into N equal time intervals. The charging and discharging intervals are equal to Tc = Td = T. The dependence of the network energy loss as a function of the battery power for two selected nodes is determined for each time interval. Based on a loss sensitivity analysis, for the range of battery power [−Pmax, Pmax] a functional relation between the energy losses and the battery power is created. An example of the dependence for the interval N = 24 is given in figure 2. In this example, Pmax = 1MW. In the case of two connected batteries, equations (12) - (14) are used and the total energy losses during the day are determined. As the individual coefficients of higher degrees of polynomial are small, they can be neglected and thus reduce the order of the polynomials. Based on equality (13) it is obtained: 128 M. STEVANOVIĆ, A. JANJIĆ, S. STOJANOVIĆ, D. TASIĆ 2 (00, ) (10, ) (11, ) (01, ) (10, ) (20, ) (11, ) (11, ) (11, ) (10, ) 2 2 2 3 ( 1) (02, ) (10, ) (21, ) (11, ) (10, ) (12, ) (11, ) (10, ) (03, ) (10, ) N i i i i i i i i i i i i i i i i i i i i i a a P a P a P a P P W a P a P P a P P a P=  + + + +  =  + + + + +    (15) (00, )ia , (00, )ia , (00, )ia are the coefficients with the corresponding variables in i - th intervals. Fig. 2 Dependency of energy losses as a function of batteries power in nodes 11th and 10th 2.2.2. Constraints The constraints are maximum charging/discharging power and minimum and maximum battery energy. Charging/discharging power is constrained by the minimum and maximum active power (16): ,min , ,maxbat bat i batP P P−   (16) where ,minbatP is the minimum, and ,maxbatP the maximum battery power. A similar constraints can be applied to the energy of the battery that is limited by its minimum and maximum value. Therefore, 1 min 0, max 1 , N bat i i j j i SOC S SPO tC OC − = +  +  (17) where SOC0,(N−1) is battery energy at the end of the interval tj, SOCmin is minimum battery energy and SOCmax is maximum battery energy. To complete the model of this problem, another condition is introduced as a constraint - the battery at the end of the time cycle (the time cycle is one day), returns to the original state in which it was at the beginning of the time cycle. This limitation is justified by the fact that the battery is globally a passive energy element. Although at some point it can provide energy in the grid and eventually consume energy, in the overall energy balance it neither produces nor consumes the energy. Based on the above, the following can be written: ( , ) ( 1) 0 N bat i i i P t = = (18) Optimal Battery Storage Location in Distribution Network and Optimal Battery Control 129 The last equality emphasizes that the battery returns to its initial state at the end of the day. Constraints (18) can be represented in a matrix form, using equations (19) and (20): ( ) ( ) ,1 ,2 ,3 0 , 1 1 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 1 1 1 0 0 1 1 1 1 1 0 1 1 1 1 1 1 1 bat bat bat max bat N P P P T SOC SOC P −                           −                               (19) ( ) ( ) ,1 ,2 ,3 0 , 1 1 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 1 1 1 0 0 1 1 1 1 1 0 1 1 1 1 1 1 1 bat bat bat min bat N P P P T SOC SOC P −  − −         − − −         − − − −       −         − − − −       − − − − −        − − − − − − −      (20) In developed form, constraint (17) looks similar to the constraint (19) ,1 ,2 ,3 ,24 0bat bat bat batP T P T P T P T+ + + + = (21) The fitness function is the daily energy loss as a function of battery power, equation (11). It is necessary to determine the vector batP , which contains unknown powers in each time interval, with appropriate constraints so that energy losses are kept to a minimum. The degree of the previous function is determined by coefficient values. Coefficients from a previous function that are less than a certain pre-set value are ignored, thus reducing the order of the degree of the function. The optimization problem can be formulated in (22): fitness function: ,min ( )bat iW P constraints: (1) – (7), (16), (19), (20) (22) The optimization process is carried out in two steps. In the first step, the location of the battery is selected according to the maximal sensitivity coefficient (8). Then, using (22), the optimal values of battery powers Pbat, i are determined. The genetic algorithm is used for optimization. 130 M. STEVANOVIĆ, A. JANJIĆ, S. STOJANOVIĆ, D. TASIĆ 3. RESULTS 3.1. Distribution network data Figure 3 shows the test network supplied from the 110 kV network and the substation 110/20 kV. It is a radial distribution system, because breakers S1, S2 and S3 are open. The nominal voltage of the network is 20 kV. The transformer is modeled as a serial impedance. The data for all branches of the grid are given in Table 1, while the data of all network loads are given in Table 2 [15]. Fig. 3 CIGRE European MV distribution network benchmark Optimal Battery Storage Location in Distribution Network and Optimal Battery Control 131 Table 1 Network lines data From node In node Length [km] R [Ω] X [Ω] Installation 1 2 2.82 0.7529 0.5732 Underground 2 3 4.42 1.1801 0.8984 Underground 3 4 0.61 0.1629 0.1240 Underground 4 5 0.56 0.1495 0.1138 Underground 5 6 1.54 0.4112 0.3130 Underground 6 7 0.24 0.0641 0.0488 Underground 7 8 1.67 0.4459 0.3395 Underground 8 9 0.32 0.0854 0.0650 Underground 9 10 0.77 0.2056 0.1565 Underground 10 11 0.33 0.0881 0.0671 Underground 11 4 0.49 0.1308 0.0996 Underground 3 8 1.30 0.3471 0.2642 Underground 12 13 4.89 2.2240 1.7914 Overhead 13 14 2.99 1.3599 1.0953 Overhead 14 8 2.00 0.9096 0.7327 Overhead Table 2 Network load data Busbar Real power [kW] Reactive power [kVar] Power factor (ind.) 1 - - - 2 - - - 3 200 120 0.86 4 400 250 0.85 5 1500 930 0.85 6 3000 2260 0.80 7 800 500 0.85 8 200 120 0.86 9 1000 620 0.85 10 500 310 0.85 11 1000 620 0.85 12 300 190 0.84 13 200 120 0.86 14 800 500 0.85 15 500 310 0.85 16 1000 620 0.85 17 200 120 0.86 The loads connected to this network are a mix of residential and industrial consumption. Since the optimization process is performed over a period of one day, daily active power diagrams for residential and industrial consumption are used [6] and shown in Figure 4. Daily diagrams of reactive power for residential and industrial consumption of end users [6] are shown in Figure 5. Active and reactive power are given in relative units. 132 M. STEVANOVIĆ, A. JANJIĆ, S. STOJANOVIĆ, D. TASIĆ Fig. 4 Daily active power load diagrams for residential and industrial consumption Fig. 5 Daily reactive power load diagrams for residential and industrial consumption The previous method will be applied in the next two examples. In the first example, one battery in one node is used. That node is selected based on the loss sensitivity analysis given in section 2.2 of this paper. The parameter is calculated for the test grid by alternatively adding at each busbars loads with flat profiles, but different rated powers and power factors [17]. Sensitivity coefficients are given in table 3. Table 3 Calculated busbar sensitivity to power losses Busbar 11 10 7 9 8 6 5 4 3 2 14 13 1 12 loss,k [%]] 25.7 25.6 25.5 24.9 24.4 23.9 23.1 22.6 21.9 8.8 8 5.7 0.7 0.6 Hours [h] Hours [h] Optimal Battery Storage Location in Distribution Network and Optimal Battery Control 133 The battery considered in this study is based on lithium-ion technology, which is one of the most promising technologies, with high energy density, high efficiency, and a relatively high number of charge / discharge cycles, and even at higher depths of discharge (DOD). In our example, the following battery parameters were used: sd = 1, c = 1, d = 1, SOC = 90%. Finally, there are no distributed generators in the test network in this study, so the peak load is mostly covered by batteries. In the second example, there were two batteries used, connected to the 11th and 10th nodes of the network. The nodes were also selected based on sensitivity analyses. 3.2. Results of simulation 3.2.1. Results of simulation for one battery connected to the network On the basis of equation (22) for the case with the battery connected in one node the hourly battery powers for the optimum location are calculated. Optimum location is determined in the node 11 based on the loss sensitivity analyses. Charging and discharging battery power for every hour for optimum location is given in figure 6. Positive sign of the battery power means that the battery is charging, negative sign means the discharge of the battery and if battery power is zero, the battery is offline. The optimization problem is solved with the genetic algorithm in MATLAB. The maximal generation number for the GA algorithm is 100, with the population size set to the array length of 24. Optimization is performed on Intel(R)Xeon(R) CPU E5-26670 @ 2,90 GHz processor with 32 GB RAM. The total time of optimization is 23s. As stated before, the first step in the optimization process is the optimal location determination using the sensitivity coefficient. The optimization procedure is thus greatly facilitated. To check the validity of this approach and compare the difference in energy losses on a daily basis for all possible battery locations, an analysis was performed for each node in the network. Fig. 6 Charging and discharging battery power per hour Figure 7 shows the energy losses for each node. Minimal daily energy losses are obtained for the battery placed in node 10, and highest in node 12. The difference between daily energy losses in nodes 10 and 12 is 0,15 MW. Figure 6 shows the schedule of 134 M. STEVANOVIĆ, A. JANJIĆ, S. STOJANOVIĆ, D. TASIĆ charging and discharging battery placed in node 10. During the night, the load of the network is low, and then the battery receives the power from the grid. During peak load periods, the battery injects the energy into the network, and then less energy is received from the grid. For such charge and discharge schedule at node 10, the daily energy losses are the lowest. Fig. 7 Energy losses for different battery locations In figure 8, the charging and discharging battery schedule for battery placed in each node is shown. Fig. 8 Daily load diagrams reactive power for residential and industrial consumption The approximate solution obtained with the sensitivity coefficient (node 11) doesn’t differ from the accurate solution (node 10) because of the small difference among sensitivity coefficients (αloss, 11 = 25,7; αloss, 10 = 25,6). 3.2.2. Results of simulation for two batteries connected to the network Based on the equation (15) for the case of batteries connected in two nodes and optimization formulation (22) the battery powers per hour for optimum locations are obtained. Optimum locations (nodes 11th and 10th ) are determined by the loss sensitivity analysis. The resulting charging and discharging battery power for every hour for both batteries is given in figure 9. Optimal Battery Storage Location in Distribution Network and Optimal Battery Control 135 Fig. 9 Batteries load for location nodes 11th and 10th 2. CONCLUSION In this paper, the optimal battery management and selection of the optimum battery location for the battery energy storage system in the radial distribution network are analyzed. The computational time for the optimization is greatly reduced for two reasons. Firstly, the optimum location is found using the sensitivity coefficient. It is shown that this approximation doesn’t differ from the accurate solution. Secondly, the energy losses in the network are represented as the function of the power of injection into the nodes of the network The fitness function represents the dependence of the energy losses in the network on the current battery power, and it is suggested that the function should be fit by an n - order degree function. The constraints correspond to the characteristics of the battery (battery size, maximum charge / discharge power, discharge depth, etc.). At each time interval, whether the battery is being charged, discharged or offline, the maximum power that the battery can receive or inject must be satisfied and at any time the stored energy in the battery does not exceed certain limits. Finally, the optimal battery management algorithm is implemented on the test network. Two separate cases were considered: with one and two batteries in the network. The results of the simulations are presented and discussed. In this way, the optimal locations of batteries are determined, as well as their way of charging and discharging in certain time intervals that the total energy losses in certain period are minimized. The economic analysis of the number of batteries connected was out of the scope of this paper. Results obtained in the paper clearly show that the energy losses are decreased with the usage of two batteries instead of one, but the price of the battery is not compared with the energy price. This analysis will be the focus of our future research. Acknowledgement: This work has been supported by the Ministry of Education, Science and Technological Development of the Republic of Serbia, Program for financing scientific research work, ev. no. 451-03-68 / 2020-14 / 200133. 136 M. STEVANOVIĆ, A. JANJIĆ, S. STOJANOVIĆ, D. TASIĆ REFERENCES [1] L. Luo, S. S. Abdulkareem, A. Rezvani, M. R. Miveh, S. Samad, N. Aljojo, M. Pazhoohes, "Optimal scheduling of a renewable based microgrid considering photovoltaic system and battery energy storage under uncertainty", Journal of Energy Storage, vol. 28, p. 101306, 2020. [2] A. Rufe, "On the efficiency of energy storage systems – the influence of the exchanged power and the penalty of the auxiliaries", Facta Universitatis, Series: Electronics and Energetics, vol. 34, no. 2, pp. 173–185, June 2021. [3] H. Saboori, S. Jadid, "Optimal scheduling of mobile utility-scale battery energy storage systems in electric power distribution networks", Journal of Energy Storage, vol. 31, p. 101615, 2020. [4] H. Karimi, S. Jadid, A. Makui, "Stochastic energy scheduling of multi-microgrid systems considering independence performance index and energy storage systems", Journal of Energy Storage, vol. 33, p. 102083, 2021. [5] P. Firouzmakan, R. Hooshmand, M. Bornapour, A. Khodabakhshian, "A comprehensive stochastic energy management system of micro-CHP units, renewable energy sources and storage systems in microgrids considering demand response programs", Renewable and Sustainable Energy Reviews, vol. 108, pp. 355–368, 2019. [6] E. Pons, M. Repetto, "A topological reconfiguration procedure for maximising local consumption of renewable energy in Italian active distribution networks", Int. J. Sustain. Energy, vol. 36, no. 9, pp. 887– 900, 2016. [7] I. Staffella, M. Rustomjib, "Maximising the value of electricity storage", Journal of Energy Storage, vol. 8, pp. 212–225, 2016. [8] Z. Qing, Y. Nanhua, Z. Xiaoping, Y. You, D. Liu, "Optimal siting and sizing of battery energy storage system in active distribution network", in Proceedings of the 4th IEEE/PES Innovative Smart Grid Technologies Europe (ISGT EUROPE), 2013. [9] N.S. Pearre, L.G. Swan, "Technoeconomic feasibility of grid storage: mapping electrical services and energy storage technologies", Appl. Energy, vol. 137, pp. 501–510, 2015. [10] G. Carpinelli, G. Celli, S. Mocci, F. Mottola, F. Pilo, D. Proto, "Optimal integration of distributed energy storage devices in smart grids", Trans. Smart Grid, vol. 4, no. 2, pp. 985–995, 2013. [11] D.Magnor, D.U.Sauer, "Optimization of PV Battery Systems Using Genetic Algorithms", Energy Procedia, vol. 99, pp. 332–340, 2016. [12] R. Sakipour and H. Abdi "Optimizing Battery Energy Storage System Data in the Presence of Wind Power Plants: A Comparative Study on Evolutionary Algorithm," Sustainability 2020, vol. 12, p. 10257, 2020. [13] P. Boonluk, A. Siritaratiwat, P. Fuangfoo, and S. Khunkitti, "Optimal Siting and Sizing of Battery Energy Storage Systems for Distribution Network of Distribution System Operators," Batteries, vol. 6, no. 4, 56, 2020. [14] L. Debarberis, P.Lazzeroni, S. Olivero, V.A. Ricci, F.Stirano, M.Repetto, "Technical and economical evaluation of a PV plant with energy storage", in Proceedings of the IECON 2013-39th Annual Conference of the IEEE Industrial Electronics, 2013. [15] P. Lazzeroni, M. Repetto. "Optimal planning of battery systems for power losses reduction in distribution grids," Electric Power Systems Research, vol. 167, pp. 94–112, 2019. [16] S.B. Karanki, D. Xu, B. Venkatesh, B.N. Singh, "Optimal location of battery energy storage systems in power distribution network for integrating renewable energy sources", in Proceedings of the IEEE Energy Conversion Congress and Exposition (ECCE), 2013. [17] E. Bompard, E. Carpaneto, G. Chicco, R. Napoli, "Convergence of the backward/ forward sweep method for the load flow analysis of radial distribution systems", Electr. Power Energy Syst., vol. 22, no. 7, pp. 521– 530, 2000.