Optimal Placement and Sizing of D-STATCOM in Radial and Meshed Distribution Networks Using a Discrete-Continuous Version of the Genetic Algorithm

: In this paper, we propose a new discrete-continuous codiﬁcation of the Chu–Beasley genetic algorithm to address the optimal placement and sizing problem of the distribution static compensators (D-STATCOM) in electrical distribution grids. The discrete part of the codiﬁcation determines the nodes where D-STATCOM will be installed. The continuous part of the codiﬁcation regulates their sizes. The objective function considered in this study is the minimization of the annual operative costs regarding energy losses and installation investments in D-STATCOM. This objective function is subject to the classical power balance constraints and devices’ capabilities. The proposed discrete-continuous version of the genetic algorithm solves the mixed-integer non-linear programming model that the classical power balance generates. Numerical validations in the 33 test feeder with radial and meshed conﬁgurations show that the proposed approach effectively minimizes the annual operating costs of the grid. In addition, the GAMS software compares the results of the proposed optimization method, which allows demonstrating its efﬁciency and robustness.


Introduction
In electrical power systems, some problems correspond to the high values of energy losses [1]. In addition, these losses are significantly higher in percentage terms in distribution systems, when compared to transmission networks due to the voltage levels used and the radial topology with which they are built [2]. Around the world, electricity distribution networks are the channels that supply electricity to millions of end-users. Furthermore, in the Colombian context, the distribution of electrical energy is carried out at medium and low voltage levels, i.e., with operational voltages typically between 10 kV and 15 kV [3]. The construction of distribution networks usually uses radial topology to minimize investment costs in conductors and protection elements. However, the main problem with these topologies corresponds to the high percentages of energy losses that can occur [2,4].
Losses of power in the supply of energy to consumers represent considerable economic losses for the companies that provide the service. A high percentage of losses in the distribution network produces a reduction in income. It is due to the unbilled energy, which manifests itself as an increase in the rates for the end-users of the service. In the Colombian context, the electrical system has energy losses of around 1.5% to 2.0% of the total energy generated. In medium voltage networks, energy losses can vary from 5% to 18% [2]. Loss levels lower than 10% correspond to networks in which, in compliance with the requirements of regulatory entities, maintenance has been carried out along with replacement of equipment. Levels above 10% are related to the inadequate management of distribution assets [2]. Additionally, since 2007, the Energy and Gas Regulation Commission (CREG), through CREG resolution number 121, limits the maximum charge for losses (13%) transfer to users of electricity service in Colombia [5]. If the losses show an increase concerning this limit, the network operator must assume the differential [5].
To address the technical and economic problems caused by energy losses in distribution networks. The specialized literature proposes different methodologies to reduce technical losses in distribution networks [1]. These methodologies are the location of distributed generation [6], reconfiguration of primary feeders [7], and a connection of shunt capacitors [8,9]. In the same way, distributed generation is the best option to reduce power losses. However, their initial installation costs can be very high compared to strategies such as reconfiguration and shunt capacitor connection [2]. The main problem with capacitor banks is that they inject reactive power in fixed steps of reactive power. They do not consider that the daily demand for active and reactive power along the electrical distribution networks is variable and continuous. In recent years, compensators based on power electronics have gained importance [10] to solve the compensation challenges based on shunt capacitors. Distribution networks utilize these mechanisms due to their versatility and ability to vary reactive power injections depending on the demand. These devices are known as static power compensators (D-STATCOM) [10]. The D-STATCOM implementation presents some relevant advantages, such as (i) high reliability, (ii) low operating costs, and (iii) long useful life (typically 5 to 15 years) [2]. This article proposes the installation and optimal sizing of D-STATCOM in distribution systems to reduce annual operating costs associated with energy losses. The variables of interest in this work will be the size and optimal location of these devices through the distribution network [11].
In the specialized literature, the problem of optimal location and dimensioning of D-STATCOM has been explored mainly through metaheuristic methods; below, some of them are presented. The authors in [12] represent the application of an imperialist competition algorithm to find the optimal location and dimensioning of D-STATCOM in distribution networks. The objectives of the optimization problem are the voltage profile index, the load balance index, and the annual cost savings index. The previous mains are combined to obtain a general objective function using a Max-geometric mean operator. The authors validate the proposed methodology in test systems of 33 and 69 nodes. In addition, they take into account the variability of the system load from a fuzzy technique. The performance of the proposed methodology is slightly better than the bacterial foraging optimization algorithm [13], the secure hash algorithm [14], and the immune algorithm [15], respectively.
The authors in [16] propose an optimization method based on a multi-target particle swarm algorithm; this allows finding the optimal location and dimensioning of D-STATCOM in distribution systems. This method takes into account the possibility of reconfiguring the network for different demand scenarios. The objective function of the problem considers the minimization of active power losses, the voltage stability index, and the load factor of the distribution networks. The algorithm works only under maximum load conditions. Although the results obtained are adequate, working with peak demand can lead to oversizing of the D-STATCOM.
In [17], an ant colony optimization algorithm is worked that integrates a multiobjective fuzzy technique. This work proposes the simultaneous realization of a reconfiguration and the assignment (location and dimensioning) of photovoltaic sources and D-STATCOM in distribution systems. The objective was to minimize network losses and improve voltage profiles. The IEEE 33-node system implements the algorithm. The authors of [18] propose a heuristic method based on power and voltage loss indicators to optimally locate and size D-STATCOM in radial networks to reduce energy losses. However, the au-thors only consider a peak demand scenario. On the IEEE 33-node system, computational validations are performed.
The authors of [19] present an optimization strategy based on the bio-inspired search algorithm in the cuckoo bird for the location and sizing of D-STATCOM. In this work, from the loss sensitivity factor, the optimal location of the D-STATCOM is determined; while through CSA, the capacity of the D-STATCOM is calculated. By a method of successive approximations, the power flow is calculated. The objective function of the problem is the reduction of the total power losses of the system. To demonstrate the efficiency of the algorithm, IEEE 33-and IEEE 69-node systems are used. Table 1 represents a summary of the methodologies most used in the specialized literature for the dimensioning and location of D-STATCOM in distribution networks. From the literature review presented in Table 1, we can note that: (i) most of the objective functions used to study the optimal placement and size D-STATCOM problem in distribution networks focus on minimizing the power losses (energy losses) and voltage profile improvement. A few of them consider investment and operating costs as will be analyzed in this proposal. (ii) In 2021, three recent approaches have introduced the investment and operative costs of the D-STATCOM considering daily active and reactive power curves into the analysis. (iii) Most of the optimization methodologies are based on the usage of metaheuristic algorithms to solve the problem and increase the possibility of escaping from local optimums. For these reasons, after reviewing the specialized literature, this article proposes the location and optimal dimensioning of D-STATCOM in distribution systems through a Chu and Beasley genetic algorithm (CBGA) [27], with coding that integrates discrete and continuous variables.
The discrete-continuous version of the CBGA proposed in this work will be called DC-CBGA. The specialized literature does not report any studies with these characteristics, implementing a unified codification with integer and continuous variables for the CBGA (the discrete part of the codification determines the nodes considering the location of the D-STATCOM, and the continuous part is in charge of their optimal dimensioning). This study proposed a master-slave methodology. The phase directed by the DC-CBGA and responsible for the dimensioning and location of the D-STATCOMs is the master phase. The slave phase is in charge of running the power flow whenever the master phase requires it. It is relevant to highlight that the proposed methodology is functional for radial and meshed topologies.
The slave phase uses the method of successive approximations that is compatible with both types of topology. In addition, it discriminates against the demand according to the application. According to the demand curve of the system, it categorizes three zones, residential, commercial, and industrial. Through a mixed-integer non-linear programming model (MINLP), the above mentioned is represented. The GAMS software compares the results obtained by the proposed methodology. It is relevant to highlight that using a unified codification with integer and continuous variables reduces the total processing time required to solve the problem compared with combined algorithms that divide the exploration of the solution space among discrete and continuous variables. In the same way, it considers the contribution of this research to the optimization with genetic algorithms that involves different types of variables.
The current literature presents three similar works regarding the optimal location and sizing of D-STATCOM in distribution networks. Authors in [2] present a master-slave optimization approach based on the discrete-continuous version of vortex search algorithm to locate and size D-STATCOM in distribution networks with a unified codification. Even if the codification is similar to the DC-CBGA, the main difference of our approach concerning this work corresponds to the possibility of analyzing radial and meshed distribution networks without any special modification to the power flow method in the slave optimization stage. In addition, we consider the effect of residential, industrial, and commercial loads distributed in different areas of the test feeder.
The authors of [11] have proposed a hybrid optimization methodology based on the combination of the CBGA and a second-order cone programming (SOCP) optimization. The CBGA is in charge of determining the nodes regarding the D-STACOM location, and the SOCP model solves the optimal multi-period power flow problem to establish the optimal D-STATCOM sizes; even though this methodology is efficient to solve the problem, it has three main difficulties: (i) the SOCP only works with pure-radial distribution networks; (ii) the SOCP only works with the minimization of the energy losses in the networks; and (iii) the processing times of the methodology can increase significantly as a function of the number of nodes in the distribution system. These difficulties imply that the costs of the final solution cannot be the global optimum due to the problem being solved in a decoupled way. The main advantage of the current proposal, based on the DC-CBGA, is that the methodology can deal with radial and meshed distribution networks with low computational effort. At the same time, the results initially reported in [11] are improved, which demonstrates that the Genetic-Convex approach stays stuck in a local optimum.
Finally, the authors of [26] have presented a generalized optimization model to locate and size STATCOM in power and distribution systems with radial or meshed topologies. To solve the exact MINLP optimization problem, the GAMS software and the BONMIN solver are used; however, the main issue of this methodology is the high probability of being stuck in a locally optimal solution due to 145, the non-linear non-convexity of the solution space. The main advantage of the proposed DC-CBGA is that the optimal solutions reaching the radial and meshed distribution configurations have better quality when compared to the GAMS software, i.e., the DC-CBGA can escape to the local optimums to explore more promissory solution regions.
The rest of this document is presented with the following order: Section 2 describes the general mixed-integer non-linear programming model representing the D-STATCOM location and sizing problem; this model considers a variant formulation in time that minimizes annual operating costs. Section 3 presents the master-slave stages of the solution model. First the slave phase (i.e., power flow through the successive approximations method) and then the master phase based on the discrete-continuous version of the CBGA. Section 4 characterizes the networks used to evaluate the proposed methodology; it uses IEEE 33-node network with radial and meshed configurations. In Section 5, the results obtained are presented, contrasted, and analyzed. Finally, Section 6 contains conclusions.

Mathematical Modeling
This section presents the mathematical model of the optimal location and dimensioning problem of D-STATCOM in electrical power distribution systems with radial or meshed topologies. By containing this problem, a Mixed Integer Non-linear Programming (MINLP) model [26] can be represented as discrete variables (nodes where the D-STATCOM will be located) and continuous (size of the D-STATCOM). In addition, there will be an objective function, which is the sum of the costs for power losses for one year and the annualized investment costs related to the D-STATCOM. Below is presented the mathematical formulation of the problem under study.

Objective Function
The structure of each of the components that make up the objective function, i.e., the annual cost function of energy losses ( f 1 ), and the annualized investment cost function of D-STATCOM ( f 2 ), are defined through Equations (1) and (2).
Equation (1) defines the annual cost functions of energy losses in all sections of the distribution network. C kWh is the average cost per kWh, T is a constant associated with the study period (365 days), Y km is the magnitude of the component associated nodal admittance matrix that relates the nodes k and m with an angle θ km , V kh and V mh are the voltages related to nodes k and m in period h with angles δ kh and δ mh , respectively, ∆ h corresponds to the time associated with the power flow (1 h) evaluation. Finally, H and N are the sets that contain all the periods and all the nodes of the network, respectively.
Equation (2) is the annualized investment cost function of D-STATCOM, where k 1 and k 2 are positive constants. The first refers to the annualized investment costs, and the second refers to the useful life of the D-STATCOM. The parameters α, β, and γ are positive constants and correspond to the variable installation costs of D-STATCOM with nominal reactive power generation capacity, i.e., Q DS k . To obtain the general objective function of the problem (Equation (3)), we proceed to the algebraic sum of Equations (1) and (2).
A cost represents the annual operating cost of the network and the investment in D-STATCOM.

Definition of Restrictions
The constraints of the problem of location and dimensioning of D-STATCOM in distribution networks correspond to the maximum number of D-STATCOM, voltage regulation, active and reactive power balance, and power limit the D-STATCOM can provide. Equations (4)-(8) define the constraints for the problem under study.
Equations (4) and (5) represent the balance of active and reactive power, respectively, for each node and period. It is relevant to highlight that in Equation (5), the variable Q DS k is introduced, which will have the effect of injecting reactive power from the D-STATCOM in the nodes where they are assigned. Variables P g kh and Q g kh are the active and reactive power injections of the generator connected to node k in period h. P d kh and Q d kh are the active and reactive power demands of the loads connected to node k in time h. It is necessary to mention that these consumptions vary according to the average daily demand curve. The inequality in Equation (6) defines the upper and lower limits of voltage for each node's network in each period. This restriction is due to impositions made by regulatory authorities of the electricity sector [28]. The constants V min and V max indicate the permitted voltage limits for all nodes. In Equation (7), the nominal reactive power limit for each D-STATCOM is shown, the binary variable Z k indicates whether or not the D-STATCOM is located at node k. The constants Q DS min and Q DS max are the upper and lower limits associated with the injection of reactive power from the D-STATCOM. The inequality (8) limits the number of installed D-STATCOM in the distribution network, where N DS A is the maximum installed number in the distributed network.
It is necessary to mention that the mathematical model (1)- (8) is, as mentioned in the beginning, an MINLP type. This type is due to several variable types, as follows: continuous variables related to the generation of active and reactive power, including the magnitudes and angles of the nodal voltages; and binary variables associated with the location of the D-STATCOM on the network. Additionally, it has a non-linear structure due to the trigonometric functions and voltage products that present the active and reactive power balance restrictions [2].

Solution Methodology
For the solution of the MINLP (Equations (1)-(8)) model associated with the location and optimal dimensioning of D-STATCOM in electrical distribution networks proposed in Section 2, it suggests a master-slave optimization methodology [2]. The master phase uses a modified CBGA of a discrete-continuous nature. The slave phase employs the method of successive approximations. The master phase defines the nodes where the D-STATCOM and their optimal dimensions are located. On the other hand, the slave phase is in charge of determining the daily energy losses through the multi-period power flow solution [2]. Below are presented each of these phases.

Slave Stage: Power Flow
The slave phase utilizes the successive approximations method. This method is in charge of determining the power flow for each period h [29,30]. The slave stage has a task illustrating the effects of the operational changes caused by the inclusion of D-STATCOM in the network assigned by the master stage. To solve the power balance restriction in Equations (4) and (5) is necessary to rewrite them in their complex form, as observed in Equations (9) and (10) [29].
where S * sh is the complex vector that contains all the apparent power generation at the slack node for each period h, V * sh is the complex vector that holds all the voltages of the slack nodes for each time h, V * dh is a vector that contains all the voltages of the demand nodes, in their complex form, in each time h, Y ss , Y sd , Y ds , and Y dd are sub-matrices obtained from the matrix of nodal admittances that relate the slack and demand nodes, respectively. S * qh and S * dh contain the reactive powers generated by the D-STATCOM and the apparent power demanded for each period h, respectively. Note that V sh is a known variable since these correspond to the voltages of the slack nodes, while V dh is an unknown variable that is necessary to determine in each period. To find the unknown variables V dh , Equation (11) is applied iteratively, which is the result of rearranging Equation (10) as recommended in [29] to solve the power flow problem through the successive approximation method. For this to be possible, the reactive power injections of the D-STATCOM must be known, which is provided by the master stage [2].
m corresponds to the iteration counter. When m equals zero, V 0 dh = 1∠0 • defines the initial values as the initial voltage condition using the per-unit representation. As the counter advances, it updates the values with those obtained in the immediately previous iteration. The iterative process ends when the program reaches the stop criterion, defined through Equation (12).
In Equation (12), the criterion presented must be reached before the maximum number of iterations, where is the assigned tolerance. Convergence is guaranteed since the successive approximation method corresponds to a contraction map, and therefore converges whenever the initial system is far from the stress collapse point [30].

Master Algorithm: Discrete-Continuous Genetic Algorithm
The master phase is the one in charge of making modifications to the network throughout the implementation of the D-STATCOM [29]. Restrictions that help the method find the optimal configuration have directed this process. This article proposes a discretecontinuous version of the CBGA. The hybrid DC CBGA configuration determines the nodes where the D-STATCOM are located (discrete part) and their sizes (continuous side).
The CBGA is part of the metaheuristic evolutionary computation methods based on Darwin's theory of evolution, i.e., the natural selection process present in nature [31]. Mathematically, it is considered a combinatorial optimization technique. This technique has a high probability of finding global explanations for complex problems of great size and along multiple local optima [32]. In the case of electrical engineering, they have been used successfully in problems as electrical demand control [31], reactive power compensation in primary distribution circuits [29], reconfiguration of distribution systems [33], and the location of devices based on power electronics [34]. The implementation of this optimization strategy involves the following stages: selection, recombination, and mutation [33]. Below are some details about the proposed encoding and the phases that make up the CBGA.
First, the algorithm creates (I) individuals randomly in the limits established for the population; the creation of these individuals follows the model described in Equation (13).
Equation (13) represents how the algorithm creates each individual. Vector X I corresponds to the generic form of individual I. This arrangement divides into two parts of an equal number of positions. The first part is discrete; it contains the nodal area, where D-STATCOM (U DS N A ) is localized. The second is continuous in nature and stores the sizes of the D-STATCOM (Q DS N A ). X min and X max are the lower and upper bounds for the population. Its discrete part is between the range of 2 and N (number of nodes), because the slack node is not considered a compensation node. Its continuous part is between Q DS min and Q DS max . Finally, X i represents how it creates each individual, where rand (1) is a single uniformly distributed random number in the interval (0,1). It is worth mentioning that for the first part of the array, the value is rounded to the nearest integer to preserve the discrete nature of the D-STATCOM location problem.
After creating the initial population, which must meet the diversity criterion, that is, no repeating individual, the adequacy function is evaluated (slave phase); and, concerning this, in the population, the individuals are ordered from best to worst. If the process does not achieve this standard, it is mandatory to restart the process. In the selection phase, four individuals are chosen to participate in the tournament; then, the two individuals with the best fitness function (winners) are selected. The previous ones take the role of parents in the recombination phase; in this instance, it chooses a random position of each parent to ensure that the arrangement is divided into two parts. These fragments combine to form two new individuals (children) who possess sections of both parents. After this process, the mutation phase begins, where each child chooses a random position. Randomly the value of the above is replaced considering the limits. Then the adequacy function is evaluated for each mutated child, and a winner is selected, verifying if it fulfills the diversity criterion. If not, it must repeat the process from the selection phase. It replaces the worst individual in the original population as long as he is better. The process continues until it completes the maximum number of iterations. Figure 1 shows the flow chart corresponding to the algorithm used. The previous model does not adhere faithfully to the CBGA due to the adaptations made for this case study. Review the following references [27] for more about the strategy.

Test Systems
To test the methodology applied to this case study, a widely known distribution network is used, composed of 33 nodes and 32 lines called the IEEE 33-bus network system. The system has a voltage of 12.66 kV at its slack node, and a peak active and reactive power consumption of 3715 kW and 2300 kvar, respectively. Additionally, the total losses of the network are 210.9876 kW in the hour of peak demand [2]. This network has an original radial structure with some disused interconnection lines [35] (see Figure 2), which can be enabled to add some meshes to the original radial system. For this research, the pattern structure (radial) and the modified system (meshed) are implemented. The objective is to be able to analyze the DC-CBGA algorithm in radial networks in meshed networks. Table 2 describes the system parameters. Table 3 presents the characteristics of the lines that allow meshing some areas of the system, and Table 4 represents the demand information.    7  200  100  24  420  200  8  200  100  25  420  200  9  60  20  26  60  25  10  60  20  27  60  25  11  45  30  28  60  20  12  60  35  29  120  70  13  60  35  30  200  600  14  120  80  31  150  70  15  60  10  32  210  100  16  60  20  33  60  40  17 60 20 --- The network has three zones with different types of loads: industrial, residential, and commercial. Each of these zones has a different daily demand curve. Table 5 and Figure 3 contain hour-by-hour demand data for 24 h for each of these load types.      Table 6 shows the parameters used for evaluating the objective function (Equation (3)). Additionally, it presents the voltage and base power data of the network. Some of these values are from [2].

Computational Implementation
This section presents the computational results obtained by the proposed masterslave methodology. The Matlab software in its 2020a version on a PC with a seventhgeneration Intel Core i7 7500U 2.70 GHz processor and 8 GB of RAM has implemented this methodology. This software ran on a 64-bit version of Microsoft Windows 10. Table 7 presents the number of iterations of each phase, the population size, and the convergence error. Additionally, to make a statistical assessment of its performance, the algorithm is run 100 consecutive times for each population size. Table 7. Algorithm parameterization.

Radial Configuration
To determine which population size presents the best results for this configuration, the population varies between 20 and 100 individuals, with spaces of 20 individuals. Table 8 shows the evaluated adequacy function (annual operating costs), the nodes and sizes of the D-STATCOM, the processing time of the entire algorithm, and the time per iteration for each population size. Additionally, it presents the base case data. The following observations are from Table 8: The nodes 30 and 14 appear for all population sizes. The third node for all cases is either 25 or 8. Node 30 localizes the commercial area. Node 14 and node 8 are in the industrial area, and finally, node 25 belongs to the residential area (see Figure 2).
According to the information in Table 9, we conclude that: • Nodes 30 and 14 appear in all the solutions obtained by the algorithm. These results confirm that these nodes are the most sensitive in cost minimization terms; this happens when considering discriminated sectors and daily load profiles. • The difference between solution 1 (best) and 10 (worst) is approximately 9 USD, which corresponds to 0.008%. Therefore, in terms of minimizing operating costs in this distribution network, all the solutions present in Table 9 can be considered efficient solutions. The above reflects the precision of the implemented algorithm. It implements the GAMS software to evaluate the performance of the implemented algorithm, which is capable of solving MINLP-type problems. The aforementioned is able through various solvers that the application has. The same model is implemented and executed in GAMS with four different solvers. Additionally, with an article [11] of the specialized literature with the same approach, which uses a Genetic-Convex technique, it is compared to the methodology. Table 10 describes the results of the D-STATCOM location, size, and annual operating costs for six solution methodologies. XPRESS, SBB, DISCOPT, and LINDO correspond to solvers of the GAMS software, the Genetic-Convex method corresponds to the proposal developed in [11], and the DC-CBGA algorithm developed in this article. According to the information in Table 10, we conclude that: • The GAMS solvers used are stuck in a local optimum compared to the DC-CBGA methodology developed. SBB, DISCOPT, and LINDO reduce annual operating costs in the radial distribution network by 15.94%, while the XPRESS solver only reduces it by 13.94%. The solvers identify the same nodes for the compensation of reactants. Additionally, the sizes of the D-STATCOM in these nodes are similar, except for the one located at node 32. This node is the one that generates the difference between the adequacy function, the XPRESS solver, and the others. • The Genetic-Convex methodology reduces annual operating costs by 16.18% for this radial distribution network, which represents an improvement compared to GAMS solvers. However, the proposed technique in this DC-CBGA article reduces operating costs by 1259.50 USD, concerning Genetic-Convex. This result represents a 17.14% reduction of the adequacy function evaluated for the base case. This reduction presents a saving of 22,384.36 USD for the network operator. • An aspect to highlight of the DC-CBGA methodology is the existence of D-STATCOM in each zone of Figure 2, while the GAMS and Genetic-Convex solvers only locate the D-STATCOM in the commercial and industrial areas. Furthermore, the sizes of the D-STATCOM localized by the Genetic-Convex and the DC-CBGA are similar. The only representative differences are the exchange of node 32 for node 25, and a reduction of the compensator connected to node 14 by 56.90 kvar. Therefore, these differences represent the improvement in annual operating costs. Figure 4 presents the discriminated costs for each of the methodologies used. f 1 refers to energy loss costs, f 2 represents investment costs in D-STATCOM, and A cost corresponds to total annual operating costs. Figure 4 shows that GAMS solvers reduce implementation costs compared to DC-CBGA and Genetic-Convex algorithms. The XPRESS solver reduces these costs by 49.51% and 44.45%, and the SBB, DICOPT, and LINDO solvers by 26.01% and 18.60%. The above percentages are about Genetic-Convex and DC-CBGA, respectively. However, the opposite is true for energy loss costs. In percentage conclusions, DC-CBGA invests 80.03% more than the XPRESS solver (approximately 4969.86 USD). However, this investment reflects a better performance of the distribution network, which reduces costs due to energy losses by 8.62% compared to XPRESS (approximately 9199.26 USD). It is also noteworthy that Genetic-Convex and DC-CBGA show similar values in terms of reducing energy losses. The highest difference lies in the implementation costs, where the DC-CBGA reduces these by 1120 USD concerning the Genetic-Convex. This result is because the DC-CBGA efficiently ranges the sizes of the D-STATCOM, generating similar reductions in energy losses through smaller compensators.
Version June 9, 2021 submitted to Energies 15 these by 1120 USD concerning the Genetic-convex. This result is because the DC-CBGA efficiently ranges the sizes of the D-STATCOM, generating similar reductions in energy losses through smaller compensators.

Cost (kUSD)
A cost f 1 f 2 Figure 4. Operating costs discriminated into investment costs and loss costs for the methodologies used in the radial configuration.

355
For this configuration, a population of 20 individuals is taken as in the radial coding since it presented the best results in the previous section. Out of 100 iterations, are selected the 10 best of them. Table 11 represents these results along with the sizes and location nodes of the D-STATCOM. Table 11. Best results of the iterative process for the network in meshed configuration and its base case. According to the information in Table 11, it analyzes that: • Nodes 30, 14, and 32 are present in all the solutions obtained by the algorithm. These results 360 confirm that, for this configuration, these nodes are the most sensitive for minimizing operation costs; this happens when considering discriminated sectors and daily load profiles. As for nodes 30 and 32, they are nodes located in the commercial zone (see Figure 2), and node 14 belongs to the industrial area. • The difference between solution 1 (best) and 10 (worst) is 2.76 USD, which corresponds to 0.00003 365 %. Because of this, all the solutions in Table 11 can be considered efficient solutions. When it comes to minimizing operating costs in this distribution network. This result confirms the accuracy of the DC-CBGA algorithm.
The DC-CBGA algorithm is not compared with other genetic algorithms since there is no article in the specialized literature with this approach. Instead, a comparison is made with four solvers of the 370 GAMS software as is done in the radial configuration. This comparison is to test the efficiency of the algorithm for this particular configuration.

Mesh Configuration
For this configuration, a population of 20 individuals is taken as in the radial coding since it presented the best results in the previous section. Out of 100 iterations, we selected the 10 best. Table 11 represents these results along with the sizes and location nodes of the D-STATCOM. According to the information in Table 11, we conclude that: • Nodes 30, 14, and 32 are present in all the solutions obtained by the algorithm. These results confirm that, for this configuration, these nodes are the most sensitive for minimizing operation costs; this happens when considering discriminated sectors and daily load profiles. As for nodes 30 and 32, they are nodes located in the commercial zone (see Figure 2), and node 14 belongs to the industrial area. • The difference between solutions 1 (best) and 10 (worst) is 2.76 USD, which corresponds to 0.00003%. As a result of this, all the solutions in Table 11 can be considered efficient solutions. When it comes to minimizing operating costs in this distribution network, this result confirms the accuracy of the DC-CBGA algorithm.
The DC-CBGA algorithm is not compared with other genetic algorithms since there is no article in the specialized literature with this approach. Instead, a comparison is made with four solvers of the GAMS software as is done in the radial configuration. This comparison is to test the efficiency of the algorithm for this particular configuration. Table 12 shows the results of the location, size, and annual operating costs of the D-STATCOM for five solution methodologies. XPRESS, SBB, DISCOPT, and LINDO correspond to solvers of the GAMS software and the DC-CBGA algorithm developed in this article. According to the information in Table 12, we conclude that: • The GAMS solvers used are stuck in a local optimum compared to the DC-CBGA methodology developed. SBB, DISCOPT, and LINDO reduce annual operating costs in the radial distribution network by 8.66%, while the XPRESS solver only reduces it by 8.45%. Solvers identify the same nodes for reagent compensation. The sizes of the D-STATCOM vary by 0.104 Mvar at node 13, 0.0078 Mvar at node 16, and 0.0557 Mvar at node 32. Of the above, the most notable difference in size was that of node 13, which suggests that the overshoot of this compensator represents higher investment costs that are not in cost reduction due to energy losses. The graph shown in Figure 5 presents the operating costs discriminated in investment costs and costs due to energy losses for the network in meshed configuration for its base case, the GAMS solvers: XPRESS, SBB, DICOPT, and LINDO, and also for the scenario compensated with D-STATCOM.
Version June 9, 2021 submitted to Energies 16 Table 12 shows the results of the location, size, and annual operating costs of the D-STATCOM for five solution methodologies. XPRESS, SBB, DISCOPT, and LINDO correspond to solvers of the GAMS software and the DC-CBGA algorithm developed in this article. According to the information in Table 12, it analyzes that:

375
• increase in the compensator connected to node 32 by 291.7 kvar. Therefore, these differences represent the improvement in annual operating costs.
The graph present in Figure 5 presents the operating costs discriminated in investment costs and costs due to energy losses for the network in meshed configuration for its base case, the GAMS solvers: XPRESS, SBB, DICOPT, and LINDO and also for the scenario compensated with D-STATCOM.

Cost (kUSD)
A cost f 1 f 2 Figure 5. Operating costs discriminated into investment costs and costs for losses for the methodologies used in the mesh configuration. Figure 5 shows that the DC-CBGA methodology reduces costs due to energy losses by 21.19 % concerning the base case. This percentage represents a saving of 18410 USD produced through an investment of 9340 USD in D-STATCOM. Again the investment costs are lower for the GAMS solvers  Figure 5 shows that the DC-CBGA methodology reduces costs due to energy losses by 21.19% concerning the base case. This percentage represents a saving of 18,410 USD produced through an investment of 9340 USD in D-STATCOM. Again, the investment costs are lower for the GAMS solvers as in the radial configuration. XPRESS reduces investment costs by 13.06% compared to DC-CBGA. The SBB, DICOPT, and LINDO solvers reduced these costs by 18.63% compared to DC-CBGA. This extra investment made by DC-CBGA in reactive compensation produced a reduction in energy loss costs of approximately 2950 USD and 3280 USD to the XPRESS and SBB, DICOPT, and LINDO methodologies, respectively. This reduction confirms that the DC-CBGA sizes and locates the D-STATCOM more efficiently than the GAMS solvers, as demonstrated for the radial case.

Conclusions
This research solves the problem of the optimal dimensioning and location of D-STATCOM in electrical distribution networks, both radial and meshed networks, implementing variations in loads and discrimination by zones: residential, commercial, and industrial. These variations seek to reduce annual operating costs in terms of energy loss costs and implementation of D-STATCOM through implementing a new hybrid optimization methodology based on combined a discrete-continuous CBGA (DC-CBGA) and the successive approximation method. The DC-CBGA takes care of the sizing and optimal location of the D-STATCOM, while the consecutive approximation method takes care of running the power flow whenever the DC-CBGA requires it.
The results obtained show that with a population size of 20 individuals, DC-CBGA finds the optimal solution. The radial and mesh configuration reduces the total annual operating costs of 17.14% and 10.44% through an approximate investment in D-STATCOM of US$11.180 and US$9.340 per year, respectively.
The DC-CBGA methodology achieved better results than the GAMS solvers: XPRESS, SBB, DICOPT, and LINDO for both radial and mesh configurations. In both cases, the GAMS solvers ended stuck in a locally optimal solution. This condition happens because these solvers have non-convex solution spaces, making their exploration difficult with exact optimization methodologies. In addition, the results obtained are compared with the Genetic-Convex method only for the radial configuration. The DC-CBGA methodology reduced energy loss costs by 140 USD with an investment in compensation systems of 1120 USD less than the Genetic-Convex methodology. Additionally, the DC-CBGA obtained processing times of approximately 26 min while the Genetic-Convex close to 3 h, showing a considerable reduction in these, considering that the computer equipment used has similar technical characteristics.
From this study, it will be possible to develop the following further studies: (i) include into the optimization problem the analysis of the uncertainties regarding demand curves or consider periods longer than one day to capture possible different load behaviors, for example, using some weeks or months; (ii) propose a unified optimization methodology based on mixed-integer convex optimization that allows reaching the global optimum of the problem of the optimal location and sizing of D-STATCOM in distribution networks with radial or meshed configurations; (iii) evaluate the effects of the installation of D-STATCOM in three-phase networks with relevant load imbalances. Funding: This work was supported in part by the Centro de Investigación y Desarrollo Científico de la Universidad Distrital Francisco José de Caldas under grant 1643-12-2020 associated with the project: "Desarrollo de una metodología de optimización para la gestión óptima de recursos energéticos distribuidos en redes de distribución de energía eléctrica." and in part by the Dirección de Investigaciones de la Universidad Tecnológica de Bolívar under grant PS2020002 associated with the project: "Ubicación óptima de bancos de capacitores de paso fijo en redes eléctricas de distribución para reducción de costos y pérdidas de energía: Aplicación de métodos exactos y metaheurísticos".
Acknowledgments: This work has been derived from the undergraduate project: "Ubicación y dimensionamiento óptimo de D-STATCOM en redes de distribución radiales y enmalladas empleando una versión discreta-continua de un algoritmo genético" presented by the students Cristian Mateo Castiblanco Pérez and David Esteban Toro Rodríguez to the Electrical Engineering Program of the Engineering Faculty at Universidad Distrital Francisco José de Caldas as a partial requirement for the Bachelor's in Electrical Engineering.

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

Abbreviations
The following abbreviations are used in this manuscript: C kWh Average cost of energy losses (USD-W/h).

Y km
Magnitude of the component associated with the nodal admittance matrix connecting nodes k and m (Ω −1 ).
θ km Angle of the component associated with the nodal admittance matrix that connects the nodes k and m (rad).

V kh
Voltage related to node k in time h (kV).

V mh
Voltage related to node m in time h (kV).
δ kh Angle of stress related to node k in period h (rad).
δ mh Angle of stress related to node m in period h (rad).

S sh
Complex vector of the apparent power generated at the slack node for each period h (kVA).

S qh
Complex vector containing the reactive powers generated by the D-STATCOM (kvar).

S dh
Complex vector containing the apparent powers demanded at the nodes for each period h (kVA). V sh Complex vector of the apparent power generated at the slack node for each period h (kV).

V dh
Complex vector containing all the voltages of the demand nodes for each period h (kV).
Y ss Submatrix containing the admittances relating the slack nodes to each other (Ω −1 ).
Y sd Submatrix containing the admittances related to the slack and demand nodes, respectively (Ω −1 ).

Y ds
Submatrix containing the admittances related to the demand and slack nodes, respectively (Ω −1 ).
Y dd Submatrix containing the admittances relating the demand nodes to each other (Ω −1 ). m Iteration counter. Error tolerance.
γ Constant corresponding to installation costs (USD/Mvar). k 1 Positive constant related to the annualized investment costs in D-STATCOM ( 1 year ). k 2 Positive constant related to the useful life of D-STATCOM (year). X I Generic vector for each individual.

X min
Lower limits set for the population.

X max
Upper limits set for the population. X i Position within vector X I .

U DS
Location node for each D-STATCOM. U N Number of nodes in the network.