Dynamic Reactive Power Compensation in Power Systems through the Optimal Siting and Sizing of Photovoltaic Sources

The problem of the optimal placement and sizing of photovoltaic power plants in electrical power systems from highto medium-voltage levels is addressed in this research from the point of view of the exact mathematical optimization. To represent this problem, a mixed-integer nonlinear programming model considering the daily demand and solar radiation curves was developed. The main advantage of the proposed optimization model corresponds to the usage of the reactive power capabilities of the power electronic converter that interfaces the photovoltaic sources with the power systems, which can work with lagging or leading power factors. To model the dynamic reactive power compensation, the η-coefficient was used as a function of the nominal apparent power converter transference rate. The General Algebraic Modeling System software with the BONMIN optimization package was used as a computational tool to solve the proposed optimization model. Two simulation cases composed of 14 and 27 nodes in transmission and distribution levels were considered to validate the proposed optimization model, taking into account the possibility of installing from one to four photovoltaic sources in each system. The results show that energy losses are reduced between 13% and 56% as photovoltaic generators are added with direct effects on the voltage profile improvement.


Introduction
Power systems are responsible for interconnecting power generation sources and consumers in high-voltage levels through transmission and sub-transmission systems since large power sources (i.e., hydraulic power plants) and loads are geographically separated by hundreds of kilometers [1,2]. The sector of electricity supply is composed of four main activities: (i) generation, (ii) transportation, (iii) distribution, and (iv) commercialization; these activities make possible the power supply from large and distributed power sources to all end-users from high-to low-voltage levels [3]. The main difference between the transmission and distribution system is associated with the grid topology since the former has multiple meshes to ensure reliability and security. At the same time, the latter is built typically with a radial structure to minimize investment costs and reduce the complexity in the coordination of the protective devices [4]. The electrical power system, in general, can be analyzed from the dynamical and static point of view. In the case of dynamic analysis, differential equations are used to determine the time-domain behavior of the electrical variables (i.e., frequency, active and reactive power flows, etc.) in the event of a large disturbance such as a short-circuit or a large load/generator disconnection [5]. While the static point of view is employed to determine the state variables of the network for a particular load and generation condition considering steady-state operative conditions [6].
In the static analysis of the power systems, one of the main preoccupations in the transmission and distribution sectors corresponds to energy losses caused during energy transportation. The Colombian system is not alien to this problem, since, in the case of highvoltage levels (i.e., ≥220 kV), the number of power losses oscillates between 1.5% to 1.8% of the total power generated; while in the case of the distribution grids, these percentages are between 6% to 18% [7]. To reduce the amount of energy wasted in electricity transmission and distribution activities, one of the main approaches studied by regulatory entities and academics corresponds to the inclusion of the renewable generation since it helps to: (i) reduce the harmful effects of greenhouse gas emissions in predominately thermal generation systems [8], (ii) improve the grid performance, i.e., voltage support and power loss minimization; and (iii) redistribute the power flow in lines, i.e., reduction of the power system stress, which helps make the system more robust regarding contingencies [9,10].
Different models and methodologies which have been developed to include renewable generation appropriately in conventional transmission and distribution networks are presented below.
The problem of the optimal placement and sizing of wind power sources in power systems considering variable power factor have recently been studied by Gil-González, et al. in [9], where the problem was formulated using a mixed-integer nonlinear programming (MINLP) model. The converter interfaces of the wind energy conversion system are used to provide reactive power to the grid when necessary via a nonlinear controller design [11]. The solution of the proposed model has been solved in the General Algebraic Modeling System (i.e., GAMS) software with excellent performance for radial distribution grids and meshed power systems.
For example, the authors of [12,13] have proposed differential evolution algorithms to address the problem of the optimal location, sizing, and power factor of multiple distributed generators (DGs) in order to minimize the power losses in a network. The bee swarm optimization method was employed for the sizing of a hybrid system composed of photovoltaic (PV) panels, wind turbines (WT), and fuel cells in [14]. In references [15,16], a genetic algorithm was implemented for optimal placement and sizing of DGs. This algorithm was also used by Ganguly and Samajpati in [17] to manage DGs' optimal management when integrated into the network. In the specialized literature, hybrid algorithms have also been used, such as a mixed bee swarm and genetic algorithm for DG allocation as proposed by Mahmoud et al., in [18], in order to improve the voltage regulation and to reduce the active and reactive power losses in the distribution network. This method also reduced the number of iterations and improved the standard deviation values in all the case studies used when compared to other proposed algorithms in the specialized literature. Mathematical models of algebraic nature have also been proposed and solved in the GAMS software [19]. Moreover, it is possible to have adequate planning regarding the optimal location and dimensioning of DGs, as reported in [9]. An optimization methodology to size and locate the PV, WT, and capacitor banks considering the uncertainties of the demand caused by electric vehicles and the variations of irradiation, wind speed, and the usual load was presented in [20], where it was applied to a typical radial network. The author of [21] proposed a virtual power plant model that integrates the renewable energies available in the study area to maximize the profit of the operation by satisfying the given demand. The possible combinations of integrating DGs in a network involve multiple search engines based on hierarchical clustering, as proposed in [22], to reduce computation times.
The injection of reactive power to the grid is a significant study area since it allows correcting the power factor and avoiding voltage drops. For example, Quezada et al., in [23] explores the optimal location of capacitive banks through heuristic methods to improve the aspects mentioned above; using batteries, the same objective can also be achieved as observed in references [24,25]. Current technology allows the integration of photovoltaic generators via a three-phase inverter, which, in addition to complying with the basic requirements for their integration, can inject or absorb reactive power into the distribution system, as developed in [26] and improved by [27] using algorithms capable of searching for the maximum power point tracking.
In this paper, a model for the optimal location and sizing of PV plants in AC power systems considering reactive power injection was formulated. The proposed model generates the mixed-integer nonlinear programming (MINLP) model, which is solved using the GAMS software as a tool, as used in similar works [9]. Under the presented model, the PV can inject or absorb reactive power by employing the power electronics devices' reactive power management supply capability for integration with the power grid, according to the grid requirements. Additionally, a loadability factor was integrated, which is used in the power electronic interface to limit the PV's active power to the grid. Note that the main differences of this study regarding the reference [9] are: (i) the usage of real generation and demand curves in the Colombian power system context to characterize the demand and solar radiation behaviors; (ii) the inclusion of the sensitivity analysis in the optimization model regarding the numerical performance of the voltage profiles as a function of the number of PV plants integrated into the electrical grid; and (iii) the usage of the reactive power capabilities of the power electronic interface in photovoltaic applications which have not been previously explored in the relevant literature and was identified as an opportunity of research that this paper attempted to contribute to from the point of view of the exact mathematical optimization.
The remainder of this paper is structured as follows: Section 2 describes the mathematical optimization associated with the siting and sizing of PV sources considering the possibility of injecting reactive power; Section 3 presents the main aspects associated with the implementation of an optimization model in the GAMS optimization package; Section 4 shows the main characteristics of the test feeders composed of 14 and 27 nodes, respectively. Section 5 presents all the numerical simulations and their analysis and discussion; Section 6 presents the main concluding remarks derived from this work and some possible future developments.

Mathematical Formulation
The problem of the optimal location and sizing of PV systems in electrical grids is an MINLP problem [9], where the binary variables are associated with the location of the PV sources and the integer variables correspond to the power flow variables, i.e., voltages, currents, and powers, among others [9]. The complete mathematical formulation of this specific problem is presented below.

Objective Function
The objective function for the problem of the optimal placement and sizing of PV systems in electrical grids considered in this research corresponds to the amount of energy losses during a day (24 load/generation periods) of operation of the network. Equation (1) shows the objective function of the mathematical model.
where z is the objective function value regarding with the daily energy losses in a power system, V i,t and V j,t are the magnitudes of the voltages at nodes i and j, respectively, Y i,j is the magnitude of the admittance between node i and j obtained from the matrix of admittances representing the power system, and θ i,t , θ j,t and φ ij are the angles of node i voltage, node j voltage and admittance between both, respectively. ∆T is the length of the period of time where the generations and loads are constant (typically one hour). Note that Ω N is the set that contains all the nodes of the grid and Ω T is the set that contains all the periods of time of the operation horizon.

Set of Constraints
The set of constraints associated with the problem of the optimal placement and sizing of PV systems in electrical grids includes the active and reactive power balance equations, the voltage regulation bounds, as well as PV generation bounds and the maximum number of PVs available for installation, among others. All the constraints considered in this study are listed below [28] where Equations (2) and (3) define the balance of active and reactive power for each node of the system and for each period of time, P CG i,t and Q CG i,t being the active and reactive power delivered by the conventional generator located at node i; y PV i is the nominal power of the PV system; P PVnom i,t is the active power curve of the PV system for node i at each period of time; Q PV i,t is the reactive capability of the PV system at node i; and P D i,t and Q D i,t are the active and reactive power demanded at node i in the period t. Equation (4) shows the voltage regulation constraint between a minimum (V min i ) and a maximum (V max i ) value allowed by regulatory entities. Equation (5) is the constraint on the power curve, where x PV i is a binary variable indicating whether a PV panel is located at node i; if x PV i = 1, then the PV system is located at node i, and if x PV i = 0, then it is not. Equation (6) shows the interval (area) where the reactive power delivered by the photovoltaic must be defined, and η is the chargeability factor of the PV system-inverter pair, and this value is between 0 and 1. Inequality constraint (7) shows the limit of generators to be placed in the power system, where the maximum quantity allowed is NG max PV . It observes that all the values of the electrical variables described here are per unit values.
Note that the derivation of the reactive power bounds presented by the nonlinear constraint (6) can be made using the power triangle applied to the power electronic converter that interface the PV system to the electrical grid [9]. The derivation of these active and reactive power bounds for the PV system is described below (the η-coefficient will be assumed in this research as 0.9, as recommended in [9]). The relation between the active power and the nominal apparent power rate of the power converter is presented in (8).
Now, if we employ the reactive power as a function of the apparent and active power, we derive that it can be inductive or capacitive as If we substitute (8) in (9), then, we have Figure 1 shows the active and reactive power as a function of the coefficient η. This coefficient limits the quantity of active power that can be delivered and the maximum values of reactive power-either reactive or capacitive-that can take the system per hour. Note in Figure 1 that the active power is given as a function of a typical radiation curve. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23  Time (h) Active/reactive power (pu) Note that the solution of the optimization model defined from (1) to (10) was reached in this paper with the GAMS optimization package using the BONMIM solver that is capable of working with MINLP problems [9]. The main aspects of the GAMS optimizer are described in the next section.

Solution Methodology
The General Algebraic Modeling System (i.e., GAMS) is a programming environment that contains different optimization packages to solve significant problems compactly, as long as they can be represented in algebraic form [19]. This package is used in industry and academia because it contains an easy-to-implement environment, thus separating the proposed problem's mathematical structure and the solution method. This nature of this software allows the user to focus mainly on the accurate modeling of the optimization problem being studied, rather than on the solution technique itself [19].
In the scientific literature, the GAMS optimization software has been employed for solving large-scale complex optimization problems; some of them are presented as follows: optimal planning and operation of power systems [19], optimal design of osmotic power plants [29]; optimal planning of water distribution systems [30]; optimal design of mechanical components [31]; optimal selection and location of batteries in distribution grids [7,25]; optimal location and sizing of distributed generators [32]; solution complementarity problems arising in applied economic analysis [33]; and analysis of the influence of reactive compensators and energy storage devices' location on power systems [34], among others.
To understand the usage of the GAMS software to solve nonlinear programming problems, we present below the main aspects in the implementation of mathematical optimization models in the GAMS interface [35]: 1.
Declaration of sets: Sets are a group of values of one or more elements, which in GAMS are traversed by subscripts. A set can also be made up of other sets.

2.
Declaration of numerical parameters: The parameters are values not dependent on a set and will behave as constants throughout the resolution of the model. New constants can be reached by relating the mathematical operations of previously defined constants. 3.
Declaration of Variables: The variables will depend on the sets and parameters defined above; accordingly, the type of the variable is declared. It is continuous or discrete, and its limits and initial values are defined. The user must define at least the variable that he wants to maximize or minimize.

4.
Declaration of equations: At least one of the equations contained in the proposed model are declared, which is the objective function to minimize or maximize and which depends on the objective variable.

5.
Declaration of the model and launch of the optimization program: A name is given to the program being carried out, and the type of program is determined (LP, MINLP, NLP, etc.), the maximization or minimization of the objective variable is carried out/determined, and it is also indicated if all the previously constructed equations are used. 6.
Report of results: The user determines which variables he wants to print in the report of results. This report shows whether the optimal result was achieved, the value of the variables, and the number of iterations performed, among other information that the user may consider necessary.
Note that the GAMS optimization package was used in this paper to solve the mathematical model of the optimal location of PV systems in AC distribution networks considering reactive power injection. The flow diagram that summarizes the main aspects of the GAMS usage for addressing MINLP models is presented in Figure 2.

Test Systems
To verify the mathematical model of location and optimal sizing of photovoltaic generators in AC power systems considering reactive power injection, the variation of demand and solar power were considered as the conditions throughout this development. Additionally, two test feeders composed of 14 nodes (meshed power system topology) and 27 nodes (radial electric distribution grid) were considered for numerical validations in the software GAMS. All the information regarding the computational validations is described in the following subsections. Table 1 shows the power demand and daily irradiation data, with the base powers of 8433 MW and 532.7 Wh/m 2 . These data are illustrated in Figure 3. It is worth mentioning that the renewable generation from photovoltaic technology can have important fluctuations during the year depending on the weather conditions in the geographical area that this will locate [36]. However, it is acceptable for planning purposes to assume an averaged generation profile to carry out studies about the location of PV sources as the case presented in this research, which is based on a typical Colombian PV curve.

Demand and Solar Generation Curves
The power demand curve is for the interconnected national system of Colombia as of 7 August 2020 [37]. The solar irradiation curve is the average power per hour for August in the measurement station of the National University of Colombia in Bogota. These data are available in [38]. Additionally, it is proposed that up to 4 PV generators will be installed to determine power losses and corresponding locations for each generator within each proposed system.

14-Node Test System
The system of 14 nodes and three generators is used to validate the proposed model. Its parameters are shown in Table 2, and its configuration is presented in Figure 4. The base power is 20 MVA, and the base voltages are 69 kV and 13.6 kV. This system is modified according to the IEEE 14-node test system.   Figure 5 depicts the 27-node test system, which is a system with 27 nodes and one generator. The parameters of this system are shown in Table 3. This is a typical AC distribution system, where the base power is 1 MVA, and the base voltage is 13.8 kV. This system is taken from [9].

Implementation and Results
The solution of the MINLP mathematical model defined in Section 2 uses the GAMS optimization package with the BONMIN solver on a laptop computer with an Intel(R) Core(TM) i5-3230M 2.6 Ghz processor and 6 GB of RAM running a 64-bit version of Windows 10 Pro.

14-Node Test System
The optimal location and sizing of the PV systems in the 14-node test feeder is reported in Table 4. Observe that all the generators are located in demand nodes and not necessarily in those with higher demand values. It is important to note that the PV generators retain their locations and maintain similar power output as new PVs are added to the system. When PV generators are added to the system, the losses are reduced; however, this reduction becomes negligible from the third generator (see columns 3 and 4 in Table 4); this implies that the level of energy losses reduction goes to a saturation zone, where the number of the PV sources does not produce important effects on its reduction.  Figure 6 shows that regardless of the number of PV generators placed, the voltage of all nodes of the system for each hour is within limits set initially (these voltages fulfill the voltage regulation constraint (4)). Adding the PV generators flattens the minimum voltage curve compared to the base scenario and progressively increases the minimum voltage's average value. An elevation of the maximum voltage curves of each scenario is noted, between times 6 and 18, without having a considerable difference between them; i.e., it could be considered that for this test system, only one maximum voltage curve is going to be reached, and variations are made in the minimum voltage curves in all the scenarios.  Figure 6. Voltage limits by PV generator quantities for the 14-node system during the day. Figure 7 shows the reactive power injected by each generator in each scenario during the 24 h. In none of the scenarios, the defined power limits are surpassed. Note that in Figure 7, the PV generator located in node 6 has a slight increase in the night peak hour, where the reactive power injection follows the demand behavior curve. However, it is observed that from 2 PV, located at nodes 3, 10, and 14, the reactive power injected by them is almost negligible in each during entire period analyzed. This leads to the question of why the voltage curves have such similar data for all the placed PVs and do not have such an obvious flattening of the curves as the 14-node system. These aspects can be explained as due to the needs of the system itself to achieve the optimal value of losses.  To present the effect of the PV active and reactive power compensation in the 14node test feeder, Figure 8 presents the daily performance of the conventional power sources connected at nodes 2, 9, and 14. From this figure, we can observe that: (i) all the conventional sources decrease their active power injections with respect to the benchmark case when PV plants start to provide active power to the grid from the period of time between 6 and 19 h; (ii) There is no period of time in which the PV plants completely replace the function of the conventional power sources, i.e., to minimize the daily energy losses, all the generators (PV and conventional power plants) provide active power to the grid; and (iii) all the conventional generators are provided during the entire period of time of reactive power to guarantee the voltage controlled output at these terminals and, at the same time, to help compensate the daily reactive power requirements of all the loads.   Table 5 presents the power capacity and location of the various PV systems for the proposed scenarios. Similarly, as PV generators are added in previous 14-node test feeder, the power losses decrease. In this scenario, the PV generators are located at nodes distant from the conventional generator. This is expected, as the voltages at the nodes will drop as they move away from the slack node. For this reason, PV generators increase the voltages of the nodes. However, for this test system, the panels' effect in improving the voltage is not as noticeable as in the previous cases. This is because the active and reactive power demands are lower than those in the previous cases.  Table 5 presents the power capacity and location of the various PV systems for the proposed scenarios. Similarly, as PV generators are added in previous 14-node test feeder, the power losses decrease. In this scenario, the PV generators are located at nodes distant from the conventional generator. This is expected, as the voltages at the nodes will drop as they move away from the slack node. For this reason, PV generators increase the voltages of the nodes. However, for this test system, the panels' effect in improving the voltage is not as noticeable as in the previous cases. This is because the active and reactive power demands are lower than those in the previous cases. It is observed that for the maximum voltage curve, the voltages do not vary considerably with respect to the base case; therefore, for this particular system, the effect of the PV generators is mainly on the minimum voltage curve and yet it does not change significantly, as seen in Figure 9.  Figure 9. Voltage limits by PV generator quantities for the 27-node system during the day. Figure 10 shows the reactive power delivered by each PV generator in each of the suggested scenarios during 24 h of analysis. They do not exceed the established limits and have a slight elevation when in the evening peak hour of the demand curve. As a main characteristic, it is noticed that the reactive power injection tends to get considerably close to the upper power limit by the time it is at the peak value of the radiation curve.  To graphically present the effect of the PV plants in the performance of the 27-node distribution grid, Figure 11 presents the active and reactive power outputs in the slack node for all the periods under study. From the results in Figure 11, it is possible to note that: (i) the active power injections in the slack node are the same for all the periods between one to six hours and 19 to 24 h, which is expected behavior since in these periods there is no solar radiation, i.e., the possibility of injecting active power from PV sources is null, and (ii) for the cases of PV plants 3 and 4, when the solar radiation is high (periods between 11 to 14 h). The slack source does not provide active power to the grid, which implies that the PV sources supply all the active power consumption of the grid. However, the slack source provides the reactive power in all the periods to ensure the voltage-controlled output at its terminals. Power (pu) P 0PV P 1PV P 2PV P 3PV P 4PV Q 0PV Q 1PV Q 2PV Q 3PV Q 4PV Figure 11. Active and reactive power outputs in the slack node during the day.

Complementary Analysis
In all the proposed systems and scenarios, it is evidenced that the reactive power injection is associated with the needs of the system itself, almost following the power demand curve, with some particular exceptions. According to the results obtained from the voltage graphs in Figures 6 and 9, as the number of PV generators increases, the average voltage of each test system increases, and the difference between the maximum and minimum voltage decreases, as can be seen in Figures 12 and 13, respectively. In the specialized literature, this is referred to as stress profile enhancement. However, when there is no reactive power injection, this profile improvement does not appear; its values could be considered the same from one scenario to another.  The system that is less susceptible to the generators' addition is the 27-node system since it does not improve its voltage behavior as the 14-node test feeder. This is not due to the number of nodes but the system's topology (radial configuration). The 14-node system presents the lowest reduction of energy losses among the two systems analyzed in this research, with a maximum reduction of about 13% (Table 4). It is a test system where the reactive power injection is almost null as the PVs are added. This situation indicates the direct relationship between the reduction of energy losses and the injection of reactive power, along with the peak correction of the maximum and minimum voltage curves.
It is essential to highlight that the following aspects can influence the proposed study regarding the optimal location and sizing of PV plants in power systems: (i) the possible variations that can be experienced by the demand and solar radiation curves, (ii) the ability of the optimization tool to escape from local optimal solutions, (iii) the value assigned to the η-coefficient, and (iv) the economic and regulatory aspects that pertain to the integration of large-scale power plants in the conventional power systems. Note that these aspects can be used to improve the quality and effectiveness of the proposed MINLP model in future research.

Conclusions and Future Works
The problem of the optimal placement and sizing of PV plants in electrical networks from high-to medium-voltage levels was formulated in this research as an MINLP model, where the main characteristic corresponds to the possibility of using the PV converter to supply the reactive power to the power systems concurrently as the reactive power is injected. To make this apparent power compensation, the factor η was introduced in the optimization model to support reactive power from lagging or leading power factors as a function of the power system requirements. In addition, the radiation curve was characterized to ascertain the generation contributions of the various PV sources for 24 h in the context of the Colombian power system using the information as of 7 August 2020 to obtain a realistic simulation scenario of the analysis.
The solution of the proposed MINLP optimization model was addressed with the GAMS software by using the BONMIN optimization package. This software allowed the easy implementation of the model, and it was possible to separate it from the solution method.
According to the data obtained, the size was determined for each of the photovoltaic generators whose location was presented in the demand nodes of the system and, in those where the system was radial, in nodes far from the conventional generation source. It was evidenced that the reactive power injection goes hand in hand with the improvement of the voltage profile; in all the proposed systems and scenarios, it was possible to reduce energy losses between 13 and 56% according to the proposed system and the number of PV generators located. In addition, a methodology was proposed to calculate the average value and compare the improvement of the voltage profile for each system and proposed scenario, where the operational improvement of the inclusion of photovoltaic systems to electric power systems was graphically presented.
Future work is proposed to study the failure and maintenance scenarios in the PV systems and converters. The inclusion of other renewable sources within the model could be considered, such as wind generation or the contribution of electric vehicles and capacitive banks. Further, it is proposed to include economic variables to plan more appropriately for electric power systems.

Data Availability Statement:
No new data were created or analyzed in this study. Data sharing is not applicable to this article.