Integrated Algorithm for Selecting the Location and Control of Energy Storage Units to Improve the Voltage Level in Distribution Grids

This paper refers to the issue that mainly appears in distribution grids, where renewable energy sources (RES) are widely installed. In such grids, one of the main problems is the coordination of energy production time with demand time, especially if photovoltaic energy sources are present. To face this problem, battery energy storage units (ESU) can be installed. In recent years, more and more attention has been paid to optimizing the use of ESU. This paper contains a simple description of available solutions for the application of ESU as well as an original proposal for selecting the optimal location and control of ESU. The ESU selection method is based on the use of a genetic algorithm and the ESU control method utilizes the fuzzy logic. The combination of the aforementioned methods/algorithms of ESU application is named an integrated algorithm. The performance of the proposed algorithm was validated by multivariate computer simulations with the use of the real low-voltage grid model. The DIgSILENT PowerFactory environment was employed to develop the simulation model of the integrated algorithm. The proposal was utilized to improve the voltage level in the distribution grid and to install the optimal number of ESU. Based on daily load variations for selected load profiles, it was shown that after the ESU application the voltage deviations in the analyzed network were significantly limited. Moreover, the analysis proves that both the location of ESU in the grid and the control of their active and reactive power are important from the point of view of reducing overall costs.


Introduction
Distribution grid operators face numerous challenges. One of them is installing renewable energy sources (RES) deep inside the distribution grid, which in recent years has been the cause of problems with failure to meet the required voltage value [1]. Solar panels (which are an example of RES) appear more and more among prosumers as micro-sources. The greatest production of power by photovoltaic (PV) sources often occurs during the period of low load of the grid. This phenomenon is the cause of voltage problems, especially in low-voltage (LV) grids. In consequence, the power produced by RES cannot be fed into the grid from time to time due to the voltage value that exceeds the permissible upper limit in the connection node.
In order to eliminate the above-mentioned problems, the grids can be rebuilt. It can be done by the increase of the cross-sectional area of the low-voltage power lines conductors-such a method reduces an alternative to classic control, especially where absolute precision is not required, but the simplicity of the solutions and speed of operation are key factors. Examples of the application of fuzzy regulation for ESU control is given in [47,48]. The next method is the use of artificial neural network controller (ANNC). ANNC is made up of elements called neurons, programmed to form a response to the external excitation signal. The neuron is the basic network building block. Its name comes from its biological counterpart, but in this case, the neuron is modeled by a small segment of computer code, called a perceptron. Several neurons stay connected together in a network that learns during the training process how to respond to the excitation signal. It is an iterative process-it involves giving a signal and comparing the response with the reference to make a correction. The advantage of this solution is the possibility of an ongoing 'learning' controller in the context of the decisions made, even if the working environment changes. An example of the use of neural networks for control of ESU for cooperation with RES is presented in [47]. The use of ANNC in the ESU control process turns out to be particularly useful when, for example, load profiles change, but the disadvantage of the solution is the time needed by the controller to 'learn'. It is possible to apply the mathematical programming method-such a method is used in [49]. Stochastic dynamic programming is applied to mitigate fluctuations in the power generated by the wind farm taking into account the ageing process of the ESU depending on the number of cycles performed and the depth of discharge. It is a technique of modeling and solving decision-making problems under conditions of uncertainty. Stochastic dynamic programming, closely related to stochastic programming and programming dynamic, represents the investigated problem in the form of the Bellman equation. The aim is to develop a policy to define the optimal performance in the face of uncertainty. The control of the ESU can also be implemented using heuristic methods, i.e., in [50] the control of the network operation is realized using nondominated sorting genetic algorithm.
The above-mentioned works and papers did not involve the integrated optimization of the location of ESU and the optimization of the parameters of energy storage controllers based on a specific configuration. The goal of the authors is to create an algorithm that optimizes not only the location of ESU but also the operation of ESU in various configurations, taking into account the control of active and reactive power to be generated by ESU. The proposed solution is universal and precise for the application in the process of selection and control of the ESU, in order to obtain the desired voltage levels in low-voltage power grids. With the foregoing in mind, the optimization referred to the ESU are based mainly on the genetic algorithm implemented in PowerFactory software [51,52]. The paper also includes the development of a multiparameter energy storage controller. The controller is based on fuzzy logic, the parameters of which are matched for each location configuration. An evolutionary algorithm is used to select the appropriate parameters of the controller.

Description of the Proposed Algorithm for Selection of ESU Location
The selection of the location of ESU is based on the maximization of the objective (fitness) function f (further described by the (5)). In the genetic algorithm, the best-adapted individuals achieve the highest values of the objective function. Optimization is performed based on daily load variations, where the change is modeled with a dt = 15-min time step, hence number of steps (analysis period) is equal to T = 96 (per 24 h).
The population P was assumed to consist of k max individuals (k is the number of successive individuals in the population; for all symbols see Appendix A). Each individual consists of one chromosome with n-genes. The representing matrix of the P population is described as follows: Energies 2020, 13, 6720

of 27
The gene i, where i = 1 . . . n corresponds to a specific grid node in which it is possible to install an energy storage unit. Values that can be assigned to genes are natural numbers and correspond to a defined type of ESU. The objective function f is calculated for each individual from the whole population-the group of results F t are described by: Selection of ESU is carried out using the so-called roulette method that results in a random selection of individuals taking into account the value of their objective function. Individuals with the highest function of adaptation have the best chance of contributing to the creation of a new generations. New individuals are created using genetic operators, such as crossing and mutation. In each step the new generation is verified, i.e., individuals are discarded after sorting with the lowest degree of adaptation.
The degree of an individual's adaptation is determined by the value of the function F. It can be represented as the sum of the F t calculated after each power flow, for discrete time t = < 1, T >: The condition for stopping the algorithm is reaching the maximum generation number d max . The best individual, whose objective function achieved the highest value of f max , is selected from all populations occurring throughout the reproductive period: After selecting the best individual, gene values in its chromosome are assigned as the final solution. A flow chart of the operation of the described genetic algorithm used for selecting the location of ESU in the grid is shown in Figure 1.

The Objective Function
The practice related to the operation of the distribution grid shows that currently in medium-voltage (MV) and low-voltage (LV) grids the main problems are related to failure to meet the required voltage value and problems with overloading transmission elements. The requirements related to voltage are included as components of the objective function in further consideration. An additional component of the objective function is to reduce active power losses in the grid. These requirements should be met with the lowest possible cost associated with the installation of ESU. The goal of the optimization is maximizing the value of the objective function described by the following formula: where:

The Objective Function
The practice related to the operation of the distribution grid shows that currently in medium-voltage (MV) and low-voltage (LV) grids the main problems are related to failure to meet the required voltage value and problems with overloading transmission elements. The requirements related to voltage are included as components of the objective function in further consideration. An additional component of the objective function is to reduce active power losses in the grid. These requirements should be met with the lowest possible cost associated with the installation of ESU. The goal of the optimization is maximizing the value of the objective function described by the following formula:  The value of the objective function (5) is negatively influenced. The costs related to failure to keep the required voltage level in the grid and the related costs with the installation of ESU have to be reduced.
Component of the objective function responsible for the voltage level is described by the formula: where: W UT -cost related to failure to keep the required voltage level in node n, N-number of nodes in the grid. For example, in the Polish national power system, costs related to failure to meet the corresponding voltage level are divided into three groups. The first group-when the voltage value is within the required range of V minA and V maxA , the additional cost is zero. The second group-when the voltage falls in the range <V minB ; V minA > or <V maxA ; V maxB >, the costs are described by the Formulas (7) and (8): where: ∆V-voltage deviation from the nominal value, Formulas (7) and (8)  The cost of installing ESU is composed of the choice of rated power and capacity of ESU and places of their installation. As the analysis of the grid operation covers 1 day, the cost of installing the ESU in a given node is divided by the total expected period (in days) of the ESU operation (average estimated total time for modern lithium-ion batteries operation is approx. 10 years, i.e., t p = 365 * 10). The total cost (described by the formula (9)) of installing ESU in the grid includes the sum of the costs of all equipment designed for ESU in N nodes: where: W n -cost of installing the ESU in node n, K-cost of a given type of ESU, t p -expected period of the ESU operation (in days).
Energies 2020, 13, 6720 8 of 27 Active power losses ∆P in the power grid multiplied by the electric power price C t and time t can be directly related to costs. The energy losses are cumulative in a grid consisting of L transmission elements: where: ∆P l -active power losses in the grid element l i , L-number of grid elements, dt-15-min time step.
Exceeding the permissible long-term temperature for a given type of power cable insulation reduces the designed insulation durability according to exponential dependence described by the Arrhenius curve [56]. This relationship is contained in the p 4 component, which is described by formulas (11) and (12) and applies to cable lines: , where (L oi > 100%) (12) where: C TP -unit price of a given type of a cable (€/km), L-number of grid elements, l c -cable length (km), L oi -load in the i-th element of the grid (%), T-number of time steps (T = 96), t i -number of steps (in analysis period) when the i-th element of the grid is overloaded, a-auxiliary variable.

The Controller of the ESU
A controller was developed for the proper supply of active and reactive power from the ESU. The scheme of the energy storage control system is shown in Figure 2.
The main criterion for ESU control is the value of voltage V w_n at the point of common coupling (PCC)-node n in Figure 2. It is also possible to measure the voltage on any grid node. In order to ensure the continuity of control, it is necessary to maintain an appropriate level of the battery state of charge (SoC). For this purpose, the designed control system measures the value and direction of the current I in the power line. On the basis of the actual voltage level V w_n , the SoC of the battery, and the anticipated gradient of the power demand (current level of the load daily variation-see Section 3) a decision was made about charging or discharging the ESU. The main criterion for ESU control is the value of voltage Vw_n at the point of common coupling (PCC)-node n in Figure 2. It is also possible to measure the voltage on any grid node. In order to ensure the continuity of control, it is necessary to maintain an appropriate level of the battery state of charge (SoC). For this purpose, the designed control system measures the value and direction of the current I in the power line. On the basis of the actual voltage level Vw_n, the SoC of the battery, and the anticipated gradient of the power demand (current level of the load daily variation-see Section 3) a decision was made about charging or discharging the ESU. Power line load values are converted to relative units taking into account the assumed daily load profile. The output signals of the energy storage controller are reference active power Pref and reference reactive power Qref. After receiving information about the desired power values Pref and Qref, the ESU shall adapt their output power to the PESU and QESU accordingly. The model of the controller was developed in the Power Factory flow software, using the internal DPL programming language.
A controller based on fuzzy logic is used to control the ESU. A diagram of the fuzzy controller operation is presented in Figure 3. The input data is fuzzified according to the characteristics described in Figure 4. Then the data is subjected to further analysis which is carried out using the Defined Rules Base in the Inference Block. After the inference process, the fuzzy values of µP and µQ must undergo the defuzzification process. It is the process that maps fuzzy values of µP and µQ to a crisp set of values of Pref and Qref. Only such values of active and reactive power setpoints Pref and Qref can be sent as a set signal to the energy storage unit.  A controller based on fuzzy logic is used to control the ESU. A diagram of the fuzzy controller operation is presented in Figure 3. The input data is fuzzified according to the characteristics described in Figure 4. Then the data is subjected to further analysis which is carried out using the Defined Rules Base in the Inference Block. After the inference process, the fuzzy values of µP and µQ must undergo the defuzzification process. It is the process that  The main criterion for ESU control is the value of voltage Vw_n at the point of common coupling (PCC)-node n in Figure 2. It is also possible to measure the voltage on any grid node. In order to ensure the continuity of control, it is necessary to maintain an appropriate level of the battery state of charge (SoC). For this purpose, the designed control system measures the value and direction of the current I in the power line. On the basis of the actual voltage level Vw_n, the SoC of the battery, and the anticipated gradient of the power demand (current level of the load daily variation-see Section 3) a decision was made about charging or discharging the ESU. Power line load values are converted to relative units taking into account the assumed daily load profile. The output signals of the energy storage controller are reference active power Pref and reference reactive power Qref. After receiving information about the desired power values Pref and Qref, the ESU shall adapt their output power to the PESU and QESU accordingly. The model of the controller was developed in the Power Factory flow software, using the internal DPL programming language.
A controller based on fuzzy logic is used to control the ESU. A diagram of the fuzzy controller operation is presented in Figure 3. The input data is fuzzified according to the characteristics described in Figure 4. Then the data is subjected to further analysis which is carried out using the Defined Rules Base in the Inference Block. After the inference process, the fuzzy values of µP and µQ must undergo the defuzzification process. It is the process that maps fuzzy values of µP and µQ to a crisp set of values of Pref and Qref. Only such values of active and reactive power setpoints Pref and Qref can be sent as a set signal to the energy storage unit.    The membership functions for individual input variables take the following shapes and values: • µ V -membership function for the voltage V i in the connection node of the ESU. The membership function for the 'too high' voltage fuzzy values is shown in Figure 4a, whereas the membership function for the fuzzy voltage values 'too low' is shown in Figure 4b. The values of V min , V' min , V' max , and V max may be the same as V minB , V minA , V maxA , and V maxB , respectively, included in (7). • µ SoC -membership function for the state of charge of a given SoC ESU; it was assumed that the ESU as an electrochemical battery can operate in the range from 20% to 80% [57] of its capacity (SoC min = 0.2, SoC max = 0.8). Membership function for the fuzzy values of the charge state of a specific reservoir as 'charged' is shown in Figure 4c; the membership function for the state loading of a specific 'discharged' reservoir is shown in Figure 4d.
• µ I -membership function which defines ability of the power grid/line to charge or discharge the ESU; the ability of the power grid/line to discharge the ESU is with subscript 'discharge ability' (Figure 4e) and the ability of the power grid/line to charge the ESU is with subscript 'charge ability' (Figure 4f). The range of I 1 , I 2 , I 1 ', I 2 ' values is from -1 to 1, because the value of the current is in a relative unit related to the maximum value of the current. The values of I 1 , I 2 , I 1 ', I 2 ' are determined in the process of parameters optimization on the basis of given load profiles, as described further in the paper.
Energies 2020, 13, x FOR PEER REVIEW 10 of 28 The membership functions for individual input variables take the following shapes and values: • µV-membership function for the voltage Vi in the connection node of the ESU. The membership function for the 'too high' voltage fuzzy values is shown in Figure 4a, whereas the membership function for the fuzzy voltage values 'too low' is shown in Figure 4b. The values of Vmin, V'min, V'max, and Vmax may be the same as VminB, VminA, VmaxA, and VmaxB, respectively, included in (7) Figure 4c; the membership function for the state loading of a specific 'discharged' reservoir is shown in Figure 4d. I1', I2' are determined in the process of parameters optimization on the basis of given load profiles, as described further in the paper.
Membership functions for reference active power Pref and reference reactive power Qref are depicted in Figure 5. A decision block consists of a rule base and an inference machine. The rule base describes the relationship between the individual input variables and translates them into appropriate output decision drivers. The rule base for the energy storage controller is as follows:

1.
IF the voltage is 'too low' and the ESU is 'charged', THEN 'deliver the active power to the grid'.

2.
IF the voltage is 'too low' and the ESU is 'discharged', THEN 'deliver reactive power to the grid'.

3.
IF the voltage is 'too high' and the ESU is 'discharged', THEN 'get active power from the grid'.

4.
IF the voltage is 'too high' and the ESU is 'charged', THEN 'get reactive power from the grid'.

5.
IF the voltage is NOT 'too high' AND the ESU is 'charged' AND the value of the current in the line indicates 'discharge ability', THEN 'deliver active power to the grid'. 6.
IF the voltage is NOT 'too low' AND the ESU is 'discharged' AND the value of the current in the line indicates 'charge ability', THEN 'get active power from the grid'.
The inference machine operates on the principle of the Mamdani fuzzy implication for rules 1 ÷ 4, which is determined for example in rule 1 by the formula (13). The Mamdani fuzzy implication was chosen because the values of both membership functions (µ V and µ SoC ) are equally important in the decision of ESU operation (charging/discharging): Two kinds of implication are used in rules 5 and 6. In the first step, the Mamdani implication is used for membership function of µ V and µ SoC . Then the Larsen implication, described by the formula (14), is used for the result from the first step and for membership function of µ I : Energies 2020, 13, 6720 12 of 27 The first maximum method, counted from the axis P = 0, Q = 0, is used in the defuzzification process. The crisp value of P ref and Q ref is the result of achieving the maximum of the membership functions µ P and µ Q , respectively (Figure 6), for the smallest absolute value of P and Q.
Energies 2020, 13, x FOR PEER REVIEW 12 of 28 Two kinds of implication are used in rules 5 and 6. In the first step, the Mamdani implication is used for membership function of µV and µSoC. Then the Larsen implication, described by the formula (14), is used for the result from the first step and for membership function of µI: The first maximum method, counted from the axis P = 0, Q = 0, is used in the defuzzification process. The crisp value of Pref and Qref is the result of achieving the maximum of the membership functions µP and µQ, respectively (Figure 6), for the smallest absolute value of P and Q. The controller is parameterized by the appropriate selection of values for the size occurring in the formulas of membership functions (change of parameters of fuzzy numbers) or to change the reference parameters (set of fuzzy numbers). In this case, to specify relevant parameters of membership function, the following cases are considered: The evolutionary algorithm was used in order to select the appropriate values of the SoC1 and SoC1'constants as well as I1, I2, I1', and I2'. The operation of the evolutionary algorithm that was used for the appropriate selection of parameters of energy storage regulators is based on a similar principle as the operation of the genetic algorithm for selecting the location of ESU in the grid. The difference is in the fact that the previously discussed genetic algorithm operated on integers, and the evolutionary algorithm works with real numbers. The latter algorithm was also created in PowerFactory software. Optimization of the parameters of energy storage controllers is carried out using the daily load variations (similar to the genetic algorithm used for location) and assumes minimizing the voltage deviation in all nodes in the grid during the period under study. The minimization of the voltage deviation ΔVi from the permissible values Vmin and Vmax is a function. The objective function M of the evolutionary algorithm is described by the formulas (15)  The controller is parameterized by the appropriate selection of values for the size occurring in the formulas of membership functions (change of parameters of fuzzy numbers) or to change the reference parameters (set of fuzzy numbers). In this case, to specify relevant parameters of membership function, the following cases are considered: • for the membership functions µ SoC_charged and µ SoC_discharged , appropriate values of SoC 1 and SoC 1 constants are selected, respectively, • for the membership functions µ I_max and µ I_min , appropriate values of I 1 , I 2 and I 1 ', I 2 ' constants are selected, • for the membership functions µ V_min and µ V_max , the values are determined as a function of voltage recommended levels for a given grid.
The evolutionary algorithm was used in order to select the appropriate values of the SoC 1 and SoC 1 'constants as well as I 1 , I 2 , I 1 ', and I 2 '. The operation of the evolutionary algorithm that was used for the appropriate selection of parameters of energy storage regulators is based on a similar principle as the operation of the genetic algorithm for selecting the location of ESU in the grid. The difference is in the fact that the previously discussed genetic algorithm operated on integers, and the evolutionary algorithm works with real numbers. The latter algorithm was also created in PowerFactory software. Optimization of the parameters of energy storage controllers is carried out using the daily load variations (similar to the genetic algorithm used for location) and assumes minimizing the voltage deviation in all nodes in the grid during the period under study. The minimization of the voltage deviation ∆V i from the permissible values V min and V max is a function. The objective function M of the evolutionary algorithm is described by the formulas (15) and (16): where:

Description of Analyzed Example Grid for the Integrated Algorithm Validation
A real LV grid area consisting of 19 nodes was selected for the analysis. The structure of the grid Calculation of Ftformulas (2) and (5) If d = dmax, set the best configuration of ESU for fmax The algorithm for selection the parameters of controller (Evolutionary Algorithm -EA) The location algorithm (Genetic Algorithm -GA)

Description of Analyzed Example Grid for the Integrated Algorithm Validation
A real LV grid area consisting of 19 nodes was selected for the analysis. The structure of the grid is presented in Figure 8. The power generation in nodes within the range (3 ÷ 40) kW was modeled. The analyzed grid contains RES (PV sources) which make a relatively high variation of the voltage level. The sources are located at end of the circuit, at six consumers (Lo 521, Lo 524, Lo 525, Lo 527, Lo 528, Lo 530). Two exemplary load profiles (A and B) were assumed in the analysis. Daily variations of power in particular nodes, for the aforementioned profiles, are presented in Figure 9. In order to stabilize the voltage level in the grid, it was proposed to use ESU currently available on the market (Table 1). Using the developed localization algorithm, the analysis included all components of the objective function f described by the formula (5). It was assumed that the installation of ESU is possible in each node of the power grid.
The first component of the objective function of the location selection algorithm and parameters selection was based on minimizing the costs associated with failure to maintain an appropriate voltage level in the grid. The values of V minA and V minB were determined in accordance with the requirements specified in [54] and adopted as follows:

Simulation Results
The results of the simulations (selecting the location and parameters of energy storage controllers) for two assumed load profiles are included in the following tables and figures:    In order to stabilize the voltage level in the grid, it was proposed to use ESU currently available on the market (Table 1). Using the developed localization algorithm, the analysis included all components of the objective function f described by the formula (5). It was assumed that the installation of ESU is possible in each node of the power grid.
The first component of the objective function of the location selection algorithm and parameters selection was based on minimizing the costs associated with failure to maintain an appropriate voltage level in the grid. The values of VminA and VminB were determined in accordance with the requirements specified in [54] and adopted as follows: VminA = 0.9Vref (Vref-reference value of voltage), VminB = 0.8Vref. The value of VminB = 0.8Vref determines the lower limit at which there is still the possibility of using electric power by consumers. According to [54], the upper values of VmaxA and VmaxB should be, respectively: VmaxA = 1.1Vref, VmaxB = 1.2Vref. However, due to the existence of RES, the values of VmaxA and VmaxB were assumed in the simulation on a level narrower than indicated in [54] and they are, respectively: VmaxA = 1.08Vref, VmaxB = 1.1Vref. The purpose of setting such values is to provide prosumers with the ability to inject power into grids from renewable sources. In case of reaching the value of voltage equal to 1.1Vref in the node, the automatic disconnection of the PV installation from the power grid occurs and disables the injection of power to the grid. From the prosumer point of view (in terms of the possibility to inject to the grid the power from PV sources), the voltage in the grid equal to 1.1Vref has the same unfavorable feature as 1.2Vref.

Simulation Results
The results of the simulations (selecting the location and parameters of energy storage controllers) for two assumed load profiles are included in the following tables and figures: • profile A- Tables 2 and 3     Energies 2020, 13, x FOR PEER REVIEW 16 of 28 In order to stabilize the voltage level in the grid, it was proposed to use ESU currently available on the market (Table 1). Using the developed localization algorithm, the analysis included all components of the objective function f described by the formula (5). It was assumed that the installation of ESU is possible in each node of the power grid.
The first component of the objective function of the location selection algorithm and parameters selection was based on minimizing the costs associated with failure to maintain an appropriate voltage level in the grid. The values of VminA and VminB were determined in accordance with the requirements specified in [54] and adopted as follows: VminA = 0.9Vref (Vref-reference value of voltage), VminB = 0.8Vref. The value of VminB = 0.8Vref determines the lower limit at which there is still the possibility of using electric power by consumers. According to [54], the upper values of VmaxA and VmaxB should be, respectively: VmaxA = 1.1Vref, VmaxB = 1.2Vref. However, due to the existence of RES, the values of VmaxA and VmaxB were assumed in the simulation on a level narrower than indicated in [54] and they are, respectively: VmaxA = 1.08Vref, VmaxB = 1.1Vref. The purpose of setting such values is to provide prosumers with the ability to inject power into grids from renewable sources. In case of reaching the value of voltage equal to 1.1Vref in the node, the automatic disconnection of the PV installation from the power grid occurs and disables the injection of power to the grid. From the prosumer point of view (in terms of the possibility to inject to the grid the power from PV sources), the voltage in the grid equal to 1.1Vref has the same unfavorable feature as 1.2Vref.

Simulation Results
The results of the simulations (selecting the location and parameters of energy storage controllers) for two assumed load profiles are included in the following tables and figures: • profile A- Tables 2 and 3 Figure 12 (for profile A) and Figure 18 (for profile B). In the process of selecting the location, ESU were assigned to the nodes where there are voltage problems related to power generation as well as power consumption. Their configuration allows to optimize the costs related to the installation of devices in the grid, as well at the same time, it ensures an acceptable voltage level at nodes in the analyzed grid. By selecting the appropriate parameters of the controller for each ESU, the effect of 'cooperation' of the installed devices can be achieved. Not all devices deliver and receive active power at the same time, and their operation is optimized to get as much efficiency as possible. Additionally, it is possible to supply reactive power to the grid by ESU, therefore, it maximizes their utilization. Table 6 presents the share of individual factors in the total costs that are subject to optimization. The results of the calculations are presented for three variants. Variant 1: without ESU in the grid, variant 2: location and parameterization were carried out on the basis of load profile A, variant 3: location and parameterization were carried out on the basis of load profile B.
Application of ESU in the analyzed grid results in the improved voltage profiles. As it is seen in Figures 10, 11, 16 and 17, voltage variations are significantly limited after ESU application. In the grid with ESU, the voltage is significantly closer to the reference value V ref , what gives comfortable conditions for the operation of the current-using equipment of the consumers as well as enables to inject the power from PV sources.
From the analysis of the results presented in Table 6, it can be concluded that in profiles A and B the main factor (for the assumptions made in the simulation) generating the most costs is the failure to meet required voltage value. Improving the voltage level and, thus, reducing costs can be obtained by installing ESU in the power grid. It is worth paying attention to the fact that the higher the costs associated with failure to meet the required voltage level, the more profitable installing ESU in the grid is.
During the consideration of the location of ESU in power grids, particular attention should be paid to the load profile. For the analyzed load profiles A and B, it turns out that the optimal locations of ESU (Table 2 vs. Table 4) in the grid are different and the parameters of the energy storage controllers are also different (Table 3 vs. Table 5). Changing the parameters of controllers depending on the adopted one load profile is not expensive. Therefore, the parameters of the controllers should be appropriately adjusted each time, depending on the expected load profile. This will allow for more efficient use of ESU. In turn, when choosing a location of ESU, several load profiles should be analyzed. For example, when choosing a location for ESU cooperating with PV sources, at least the profile with PV generation for a common working day should be taken into account and a load profile on sunny weekend days.
Comparison of the results from Table 6 enables to say that if in a given node profile A exists, the savings are higher for ESU optimization on the basis of profile A: € 13.58 (€ 34.85-€ 21.27) than on the basis of profile B: € 4.17 (€ 34.85-€ 30.68). The same conclusion is valid if in a node profile B exists-saving is € 37.41 (€ 77.13-€ 39.72) for the optimization according to profile B, and saving is € 17.31 (€ 77.13-€ 59.82) for the optimization according to profile A. The question of which location of ESU should be used depends on the repeatability of the occurrence of a given load profile: If profile A would occur less than four times a week, it is more advantageous to use the solution for locations from profile B.

Conclusions
This study shows that the use of ESU improves power quality as well as the flexibility of the distribution grid operation. It has also been shown that the location of ESU and the parameters of the ESU controllers affect the cost of ESU application and utilization. In order to select the parameters of ESU and their location in the power grid, a proprietary location algorithm based on a genetic algorithm was used. The controller of the ESU was carried out on the basis of the fuzzy logic, and the selection of parameters of ESU controllers was carried out with the use of an evolutionary algorithm. The objective function used in the authors' research was defined to limit total grid operation costs, which include costs related to failure to meet appropriate voltage level in the grid, costs related to the installation of ESU, costs of energy losses in the network across transmission elements, and costs related to overloading these elements.
The proposal referring to the selection and control of ESU was validated, based on a real LV grid model with quasidynamic daily load variations. In the analyzed grid, there were voltage problems resulting from the high load of the grid and energy production from PV sources. The voltage deviations were almost ±20% from the reference value V ref . After the ESU application, the voltage deviations are limited to around ±10% from the value V ref . Thus, it was shown that the correct choice of the location of ESU in the grid and the selection of the parameters of the controllers allow for ESU effective use, especially enabling to reach the voltage significantly closer to the reference value. The time of the calculation based on the proposed algorithm is short. The proposed integrated algorithm ensures the complex selection and control of the ESU, with taking into account the costs of the investment. Therefore, it can be a very useful universal tool, especially for power system operators, during consideration of ESU application.