An Energy Management System for PV Sources in Standalone and Connected DC Networks Considering Economic, Technical, and Environmental Indices

: This research proposes an efﬁcient energy management system for standalone and grid-connected direct current (DC) distribution networks that consider photovoltaic (PV) generation sources. A complete nonlinear programming model is formulated to represent the efﬁcient PV dispatch problem while taking three different objective functions into account. The ﬁrst objective function corresponds to the minimization of the operational costs with respect to the energy purchasing costs at terminals of the substation, including the maintenance costs of the PV sources. The second objective function is the reduction of the expected daily energy losses regarding all resistive effects of the distribution lines. The third objective function concerns the minimization of the total emissions of CO 2 into the atmosphere by the substation bus or its equivalent (diesel generator). These objective functions are minimized using a single-objective optimization approach through the application of the Salp Swarm Algorithm (SSA), which is combined with a matrix hourly power ﬂow formulation that works by using a leader–follower operation scheme. Two test feeders composed of 27 and 33 nodes set for standalone and grid-connected operation are used in the numerical validations. The standalone grid corresponds to an adaptation of the generation and demand curves for the municipality of Capurganá, and the grid-connected system is adapted to the operating conditions in the metropolitan area of Medellín, i.e., a rural area and a major city in Colombia. A numerical comparison with three additional combinatorial optimizers (i.e., particle swarm optimization (PSO), the multiverse optimizer (MVO), and the crow search algorithm (CSA)) demonstrates the effectiveness and robustness of the proposed leader–follower optimization approach to the optimal management of PV generation sources in DC grids while considering different objective function indices.


General Context
The energy transition is currently a necessity for humans due to global population development and growth, as well as to the high demand for electric energy associated with it. This has generated a global warming phenomenon related to the negative environmental impacts of the energy crisis, as well as to the excess of energy demand and low generation, which is mainly based on fossil fuels [1,2]. Electrical networks can be considered part of the three main greenhouse gas emitters (mainly CO 2 ), surpassed only by extensive livestock and transportation systems. The electrical sector's emissions of atmospheric pollutants are associated with thermal generation plants that use coal, natural gas, or diesel to produce electricity [3,4]. With the aim of reducing the negative impacts of conventional fossil fuel-based generation, modern power grids are gradually integrating renewable energy resources at all voltage levels, i.e., from high-to low-voltage networks [5,6]. This has been possible thanks to the advances made in power electronics and renewable generation [7,8], with photovoltaic (PV) generation being the most abundant and installed renewable source around the world.
Colombia's energy matrix is composed mainly of conventional large hydroelectric generation systems (68.4%) and thermal power plants (30.6%). Only 1% is associated with non-conventional generation sources, i.e., renewable energy (data gleaned by observing electrical consumption during 2018 [9]). Within the energy matrix of Colombia, 69.4% of the electricity is produced by clean sources (hydroelectric and renewable), and the remaining electricity is generated by fossil fuel-based resources. By analyzing this behavior, it is possible to observe the need to diversify the energy matrix, given its high dependence on hydroelectric generation (which could have a significant impact if there is a deficit in precipitations) and fossil fuels. Thus, creating opportunities for the growth of renewable energy sources in the coming years [10,11]. It is also important to highlight that Colombia's geographical location (i.e., between the equatorial line and the tropic of Cancer) implies no influence of the seasons, with a high number of solar hours throughout the year [12] and important solar radiation levels.
The problems and opportunities described above have caused Colombia to be considered a potential candidate for the inclusion of PV power generation, for which many literature works and PV generation projects have been conducted [11,13]. Research in this field has focused on two kinds of electrical networks: grid-connected and standalone, also known as urban and rural networks. Furthermore, in recent years, there has been a particular increase in the implementation of direct current (DC) grids due to the advantages of this technology in comparison with alternating current (AC) grids, such as low implementation costs and operational complexity given the absence of reactive components [14][15][16]. The widespread inclusion of PV distributed generators, and the implementation of DC grids have created a need to study and propose energy management systems that allow for a smart operation of PV distributed generation (DG) in both urban and rural DC networks by considering power generation and demand, as well as all technical parameters related to the urban and rural regions of Colombia. The aim of this research work is to improve the technical, economic, and environmental conditions of this type of grid.

Motivation
In recent years, many researchers, industrial companies, and governments have set out to ensure resilient energy systems composed of renewable energy resources and smart energy systems that allow obtaining technical, economic, and environmental benefits for both users and operators [17,18]. In this vein, DC grids are widely used and studied because of their aforementioned advantages. In light of the global trends and the needs and challenges identified for Colombia, the government has developed different laws and regulations in order to encourage the adequate development of electrical systems in the short and long term [19,20]. Here, the aim is to promote the massive integration of renewable energy and resilient electric systems with high quality levels [21][22][23][24]. Based on the current need to propose energy management systems for DC grids with improved technical, economic, and environmental conditions, this work focuses all efforts on obtaining an efficient system for operating PV generation sources in DC standalone and grid-connected networks in both urban and rural areas. This involves reducing operating costs, power losses, and CO 2 emissions.

State of the Art
In the literature, different approaches have been proposed for solving the problem regarding the optimal operation of PV generation units in electrical distribution grids using energy management systems. An example of this is the work by [22], who thoroughly analyzed the possibility of supplying part of the electrical energy consumption of residential users in Bogotá, Colombia, based on the benefits granted by Law 1715 of 2014 [19]. The authors analyzed two different residential consumers from strata 2 and 3 of the Colombian socio-economic scale (where 1 is the lowest level) by considering penetrations of PV generation ranging between 10 and 100% of their self-consumption. Numerical results demonstrated that, in all cases, positive profits are perceived by the users during the first year of operation of their PV residential installations. The authors of [25] proposed an efficient convex optimization model for optimally operating PV generation sources in DC distribution networks, with the aim of minimizing CO 2 emissions. Their optimization model was based on the branch power flow formulation, and numerical results in the DC versions of the 33-and 69-bus test systems demonstrated the effectiveness and robustness of the proposed conic optimization model when compared to the exact nonlinear programming solvers available in the GAMS software. However, after multiple simulations, it was observed that the solution of the conic model could deviate from the exact solution of the studied problem if a component of the energy losses is not considered during the optimization process. The authors of [15] proposed an efficient optimization approach based on combining the vortex search algorithm (VSA) and the successive approximations (SA) power flow method, which employs a master-slave optimization approach to locate and operate PV generation sources in AC and DC networks. Thus, VSA is a nature-inspired optimization method that employs the behavior of fluids for solving nonlinear problems with continuous variables. Numerical results in the 33-and 69-bus test systems demonstrated the effectiveness of the proposed approach in comparison with the Chu and Beasley Genetic algorithm (CBGA) presented by [12] in terms of the quality of the solution and processing times. The CBGA employs an iterative process based on genetic evolution that uses selection, recombination, and mutation. The study by [26] presented the application of the generalized normal distribution optimization approach to locate and size PV sources in DC grids. This approach uses evolution rules for exploring the solution space with the aim of finding a good-quality solution. According to the numerical results, this method outperforms the reports of the VSA and CBGA in [12,15] in terms of the solution obtained, the standard deviation, and the processing time required. However, the main flaw in these works corresponds to the use of the maximum power point of the PV distributed generators to define the optimal sizes of the PV sources, which implies that, in order to obtain the expected objective function values, the PV sources must generate the maximum power available, which is not adequate if the demand curves vary. With the same operation scheme for the PV distributed generators, other works have been reported in the literature whose goal is to solve the optimal dispatch power problem in DC networks by using master-slave strategies. These works have used the 69-and 33-bus test systems to evaluate the effectiveness of the proposed solutions in terms of solution quality, repeatability, and processing times. One example of this is the implementation of the multiverse optimization algorithm (MVO) [27], which employs the universe's dynamics for solving continuous problems. The work by [28] used PSO, a technique that takes advantage of the hunting dynamics of birds and fish to obtain solutions of good quality in problems with continuous variables. The CSA has also been used, which is inspired by the hunting strategies of crows for solving continuous problems [29]. Table 1 summarizes the main works found during this research, which address the power dispatch problem of PV distributed generators in DC grids. The above demonstrates the need and importance of energy management systems for the optimal dispatch of PV distributed generation in electrical networks to improve technical, economic, and environmental conditions in a scenario of variable power generation and demand. Furthermore, it can be noted that these energy management systems must be efficient with regard to solution quality, standard deviation, and processing times. Thus, the aim is to obtain solutions of good quality and with a faster response to changes in data associated with power demand and renewable generation. Furthermore, this work identified the need to obtain all data related to the technologies, energy and maintenance costs, emission indices, and environmental and power demand conditions of the electrical systems and users for the studied regions.

Scope and Main Contributions
The main contributions of this research are listed below: i.
A characterization of data and technical, economic, and environmental parameters for grid-connected and standalone DC grids located in urban and rural regions of Colombia. ii. A new energy management system approach to operate PV generation sources in standalone and grid-connected DC networks, which is based on a master-slave methodology. The master stage involves the salp swarm algorithm with a continuous codification that considers PV generators with variable generation instead of the traditionally used maximum power point operations. The slave stage implements a matrix hourly power flow that evaluates all of the solutions provided by the master stage in order to guarantee shorter processing times and excellent convergence. iii. The inclusion of three different objective functions in the proposed energy management system approach allows the distribution company and the users to select the best performance indicator as a function of operating policies. These objective functions are the minimization of the operating costs associated with energy purchasing and PV maintenance costs, the minimization of the total CO 2 emissions, and the minimization of the energy losses. The three objective functions are formulated for evaluating a single day of operation. iv. A new matrix hourly power flow methodology based on the successive approximation method, whose aim is to calculate the impact of the different power generation and demand levels of an operation day on the grid. This allows the reducing of the processing times in comparison with the traditional methods used in the literature.
It is worth mentioning that, in this research, the following considerations are taken into account. (i) The two DC distribution grids set as grid-(rural) and standalone (urban) areas in Colombia are considered for the numerical validations. The rural area corresponds to a standalone distribution network in the municipality of Capurganá, and a grid-connected network in the metropolitan area of Medellín is taken into account. (ii) The PV generation curve is set for each one of these areas while considering solar radiation and temperature data provided by NASA, as well as polycristalline photovoltaic panels. (iii) The expected daily power consumption is defined by considering historic data reported by distribution companies that operate the electrical networks in Capurganá and Medellín. In addition, note that in order to validate the effectiveness of the SSA approach, numerical comparisons with multiple combinatorial optimizers are carried out, namely with PSO, MVO, and CSA.

Paper Structure
This research article is organized as follows. Section 2 presents the general mathematical formulation of the energy management system that represents the problem regarding the optimal operation of PV generation units in DC distribution networks while considering different objective functions. Section 3 describes the general implementation of the SSA approach to solve continuous optimization problems by presenting its generic mathematical structure, as well as the proposed codification vector that represents the PV expected dispatch for each period of time. In addition, this section presents the proposed matrix hourly power flow formulation. Section 4 shows the parametric information of the urban and rural test systems under study, as well as the procedure followed to obtain the PV generation and demand curves for the Colombian regions under study. Section 5 presents all the numerical validations, including their analysis and discussion. These results include a complete comparison with several well-known combinatorial optimization methodologies. Finally, Section 6 lists the main conclusions of this research, as well as some possible future works.

Mathematical Formulation
This section presents the mathematical formulation for the optimal power dispatch of PV sources in DC grids (i.e., the energy management system), including the objective functions used and the set of constraints that represent a DC grid while considering economic, technical, and environmental objective functions.

Objective Functions
As objective functions, three different grid indices were considered, namely the reduction of operational costs (economic index), the reduction of power losses associated with the transport of the energy in the electrical grid (technical index), and the reduction in CO 2 emissions associated with the energy supplied by polluting generators (environmental index).

Reduction of Operational Costs
Equation (1) corresponds to the economic index. This objective function aims to minimize the energy operating costs of the DC grids (E cost ) by considering the energy purchasing cost of the conventional generators ( f 1 ), as well as the maintenance costs of the PV sources ( f 2 ) for a day of operation in 1 h intervals.
By using Equation (2), it is possible to calculate the energy purchasing costs of the conventional generators, which is herein associated with the slack bus of the electrical system. In this Equation, C kWh corresponds to the energy costs by kWh, p s i,h denotes the power supplied by the conventional generator located at node i at hour h, and ∆ h is the period of time in which the power is supplied by the generator. In this equation, H and N represent the set of hours considered in the analyzed time horizon (24 h in this particular case) and the total nodes that make up the electrical system, respectively.
Equation (3) calculates the maintenance costs associated with the PV sources. In this equation, C O&M represents the maintenance costs by kW produced by the PV sources, and p pv i,h denotes the power produced by the PV sources located at bus i, during the period of time h.

Reduction of Energy Losses
Equation (4) allows the total energy losses related to the transport of energy in the electrical system for a day of operation to be calculated. In this equation, R l and I l denote the resistance and current of branch l, while L represents the set of branches that make up the electrical system.

Reduction of CO 2 Emissions
Finally, this paper considers the minimization of CO 2 emissions related to convectional generators among the objective functions. This is possible by means of Equation (5).
It is important to highlight that this work does not consider CO 2 emissions by PV sources, as this renewable energy source entails no emissions. Some works argue that the construction of this technology generates environmental impacts, but these are not considered when the PV sources are operating in the electrical grid [30].

Set of Constraints
The set of constraints that represent the problem addressed in this paper is presented in Equations (6) to (10).
Equation (6)  Finally, inequality constraint (11) allows the PV sources to deactivate maximum power point tracking, which will depend on the grid's energy requirements. In this inequality constraint, C pv h is the expected PV generation behavior curve for the area where the distribution grid is located.

Fitness Function
In this paper, aiming to ensure that all constraints related to the DC grid's integration of PV sources are observed, as well as to improve the exploration of the algorithm, a fitness function (FF) is used [15].
Equation (12) penalizes the objective function if the technical or operating limits are violated. In this equation, Pen is the penalization value (see Equation (13)), which is calculated by using max and min functions that take a value of zero when the constraint is satisfied; otherwise, they take the violation value. In the proposed FF, the constant α is used to normalize the penalization value before it is added to the objective function OF.

Optimization Methodology
The problem regarding the optimal power dispatch of PV sources in DC grids is addressed via a master-slave methodology. Here, the proposed approach uses SSA as the master stage [31], in conjunction with the DC version of the successive approximations (SA) power flow method as the slave stage [27]. The SSA is entrusted with defining the power that each photovoltaic distributed generator (PV-DG) located in the network must generate for each hour of operation. Therefore, this study uses the codification presented in Figure 1. On the other hand, the SA deals with the constraints associated with the mathematical model defined from (1) to (10   , where the number of columns corresponds to the number of PV sources located in the network (i.e., i) for each hour of solar resource availability (i.e., H). In the case of Colombia, the solar resource is available for 13 h a day, i.e., from 7:00 to 19:00 [32]. Under these conditions, PV generators dispatch a power of 0.82 MW during hour 7, 0.91 MW during hour 8, 0.13 MW during hour 9, and 0.91 MW during hour 19. Similarly, the PV generator i generates a power of 0.55 MW during hour 7, 0.96 MW during hour 8, 0.16 MW during hour 9, and 0.14 MW during hour 19. This codification allows the proposed approach to provide the optimal operation of PV sources while considering the hourly variation of the solar resource.
The next subsections describe each stage of the proposed solution methodology.

Salp Swarm Algorithm
The SSA is a bio-inspired metaheuristic method originally proposed in [31], which is based on the behavior of salps in their natural habitat. Salps are fish that live in swarms and form chains, which facilitates their movement through the deep ocean while searching for food in hard-to-reach places. This behavior can be mathematically modeled through some simple rules of evolution, which will be explained below [31,[33][34][35][36].

Initial Population
In the SSA, the initial population takes the structure shown in (14).
where S t is the matrix containing the position of the salps at iteration t, N i is the number of individuals that make up the population, and N v is the number of variables or the dimension of the solution space, i.e., the product between the number of PV generators located in the network and the hours of solar resource availability (i · 13).
To create an initial population of individuals while observing the structure shown in Figure 1, Equation (15) is used, which generates a matrix of random numbers that contains all the possible solutions within the operating range of the PV generators.
where ones(N i , N v ) is a matrix filled by ones, rand(N i , N v ) is a matrix of random numbers that take values between 0 and 1 and are generated by means of a uniform distribution, and Y min and Y max are vectors representing the lower and upper bounds of the solution space, as shown below: being the vectors that contain the lower and upper limits of the decision variables associated with the dispatch of a PV generator i, as shown below: When the initial population of salps is generated, the objective function of each of the individuals is evaluated, as shown in (16).
During this process, the population is rearranged according to the value of the fitness function, and the best salp is selected as the leader, as shown in Equation (17), while the others are considered to be followers.
Remark 1. Since the problem addressed in this paper involves minimization, the values of FF(S t ) are arranged from lowest to highest. Similarly, FF(·) represents the adaptation function to be minimized, which may be the operating costs, the energy losses, or the polluting gas emissions, according to the needs of the network operator.

Salp Chain Movement
In the SSA, salps are divided into two groups: leaders and followers. The leader leads the chain to the best food source found so far, while the followers follow each other, i.e., they follow the leader directly or indirectly. Depending on their position in the salp chain, they can move in two different ways: (i) with respect to the leader's position and (ii) based on the principles of classical mechanics.

1.
Case 1: Movement with respect to the leader's position In the first half of the population, the salp chain moves around the leader, as shown in (18).
where S t+1 i,j is the new position of salp i in the j-th dimension, S t l(1,j) is the position of the leader in the j-th dimension, and C 2 and C 3 are randomly generated values between 0 and 1.
In addition, C 1 is the most important parameter in the SSA, as it is responsible for a correct balance between the exploration and exploitation of the solution space. This parameter is shown in (19), where t is the current iteration, and t max denotes the maximum number of iterations.
Case 2: Movement based on the principles of classical mechanics To update the position of the second half of the population, Newton's laws of motion are employed in order to represent their movement, as shown in (20).

Leader Updating
Once the position of the salps has been modified based on the mechanisms described above, it is necessary to update the position of the best food source in terms of the quality of the food. Said position should be updated if there is a salp whose fitness function is better than that of the leader, as shown by expression (21).

Matrix Hourly Power Flow
This method allows iteratively solving the active power balance equation shown in (6). Therefore, the slave stage can evaluate the constraints established in the mathematical model for each hour of operation of the DC network. In this way, it is possible to determine the economic, technical, and environmental benefits of each of the individuals provided by the SSA for an average day of operation (i.e., power injection vector for each PV generator on an hourly basis). The recursive formula that allows solving the power flow formulated in (5) is presented in (22).
where m is the iteration counter, V d,h is the vector containing the voltage at the demand nodes for each time period h, G ds is the component of the conductance matrix that associates the slack node with the demand nodes, G dd is the component of the conductance matrix that relates the demand nodes to each other, P d,h is the vector containing the active power demand at the load nodes for each time period h, P pv,h is the vector containing the active power generated by each PV unit for each time period h, V s,h is the vector containing the voltage at the substation node terminals for each time period h, which is a known parameter for the power flow solution, and diag(z) is a diagonal matrix made up of the elements of the vector z. Note that the value of P pv is provided by the master stage and is a vector that respects the codification shown in Figure 1. The iterative process ends when the maximum difference of the demand voltage magnitudes between two consecutive iterations is less than the maximum admissible error (i.e., convergence criterion), as shown in (23): where is the convergence error. In this paper, a value of 1 × 10 −10 was assigned to since it ensures a correct convergence of the power flow method, which is suggested and evaluated in [27]. The cited work mentions another important stopping criterion for power flow methods: the maximum number of iterations (usually 1000). However, for this work, was enough, as it guarantees an excellent convergence with short processing times. Once the active power flow has been solved using SA for all time periods h, it is possible to calculate the value of E loss . To this effect, it is necessary to calculate the current that circulates through the distribution lines in each time period h, as shown in (24).
where I l,h is the vector in the complex domain that contains the current flowing through the distribution lines of the system, G p is the primitive conductance matrix containing the inverse of the resistance of each line on its diagonal, and A is the incidence matrix. Similarly, to obtain the value of E cost and E CO 2 , it is necessary to calculate the active power generated at the terminals of the slack node, as shown in (25).
where P s,h is the vector containing the active power produced at the slack node, and G ss is the component of the conductance matrix associated with the slack node. Note that in order to determine the value of the objective functions defined in (1), (4) and (5), it is necessary to execute the SA power flow method h max times, which is subject to the operating period of the system. This document assumes a one-day operation, within which the values of the power generated and consumed in the system by the PV sources and the loads are updated on an hourly basis, i.e., h max = 24. Thus, at the end of the day, the total effect on economic, technical, and environmental indicators can be quantified. In this vein, as h max takes a higher value, the power flow method must be executed a greater number of times, thus increasing the time taken by the slave stage to determine the value of the aforementioned indicators.
To avoid this, a modification of the recursive formula shown in (23) is proposed, which is based on the Hadamard matrix product and division, i.e., element-wise product and division, respectively [37]. This modification allows the performing of operations element by element, as long as the arrays to be operated the same size or are compatible in this regard. That is to say if the element of the first array coincides with the element in the same location of the second array [38]. For two matrices, A and B, with the same dimension m × n, the Hadamard product is defined with the operator •. In the same way, the Hadamard division is defined by the operator , as shown in (26) and (27).
These operators allow the evaluation of all the time periods h max established for the system's operation in a single power flow. The modified recursive formula is shown in (28).
where V dh is a matrix containing the voltage at the demand nodes for each time period h, P dh is a matrix containing the active power demand at the load nodes for each time period h, P pvh is a matrix containing the active power generated by each PV unit for each time period h, and V sh is a matrix containing the voltage at the substation node terminals for each time period h. Note that the parameters of the power flow changed from column vectors to matrices whose dimension depends on the number of nodes of the system n, as well as on the period of operation of the system h max . For the purposes of this document, the power flow method will be referred to as the matrix successive approximations (MSA). Likewise, the solution of the MSA iterative formula is obtained when the convergence criterion established in (23) is met by extending it to the matrix formulation, i.e., max max ||V m+1 dh | − |V m dh || ≤ . In the same way, the Hadamard operators can be applied to calculate the current that circulates through the distribution lines and the active power generated at the terminals of the slack node, as shown in (29) and (30). Figure 2 provides a general description of the process adopted by the proposed masterslave methodology in order to solve the problem regarding the optimal power dispatch of PV sources in DC grids.

Start: Read electrical data
Define parameters N i , Nv, t max , Y min and Y max Create the initial population using (15) Calculate the fitness function for each individual using (12) Select and update the salp leader using (17) and (21) t ≥ t max ?
End: Report S l and FF(S l ) Apply evolution criteria defined in (18) and (20) no yes Figure 2. General implementation of the master-slave methodology to solve the optimal dispatch problem for PV sources in DC networks.

Test Systems, Input Data, and Considerations
This work considers two types of DC electrical networks: a grid-connected network (GCN) that uses load demand and generation data for Medellín, a city located in Antioquia, Colombia, which is connected to the national electrical grid and controlled by the electrical company Empresas Públicas de Medellín (EPM); and a standalone network (SN) located in Capurganá, a little town located in Chocó, Colombia, which operates by using diesel and is regulated by the IPSE, a government organization entrusted with planning and promoting energy solutions for standalone grids. The input data, electrical parameters, and distributed energy resources considered for both electric networks are presented below.

Power PV Generation and Demand Curves
This section describes the power generation and demand behavior in the studied GCN and SN. In order to obtain these values, the solar radiation and environment temperature were considered, as well as the power demand behavior data for the connected and standalone grids from 1 January to 31 December 2019. This year was selected with the aim of studying a scenario from before the COVID-19 pandemic, which affected the energy behavior of all users around the world.
To calculate the power production of a PV distributed generation system, the literature widely uses Equations (31) and (32). This is explained by the fact that this mathematical formulation considers the characteristics of photovoltaic technology and the effects of solar radiation and environmental temperature on the hourly energy production, thus allowing the behavior for a day of operation to be obtained.
Equation ( To calculate T c i,h for each hour of operation, Equation (32) is used, where T a h denotes the environment temperature in hour h; T c,NOCT i , G T,NOCT i , and T a,NOCT i are the surface temperature, the solar radiance level, and the environment temperature of the PV system installed in bus i under nominal operating conditions, respectively; η c i is the efficiency; τ is the solar transmittance; and α is solar absorption of the PV systems located at bus i. Figure 3a illustrates the power generation of an average day for both DC networks: GCN and SN. In order to obtain these PV power generation data, a PV polycrystalline silicon panel was considered, which is widely used around the world [39,40], especially in Colombia. The PV parameters reported for this kind of PV panels are the following:  Table 2, namely (from left to right) the hour analyzed, the average daily solar radiation G T and environment temperature T a , and the power generation in pu. C pv , which was obtained by using Equation (31).  Finally, Figure 3b presents the average daily power demand for both regions under study. To obtain said values, this work used the same period of time as the PV generation.
This was based on data reported by EPM for the GCN located in Medellín [42] and by the IPSE for the SN located in Capurganá [43].

Grid-Connected System
To study the GCN, the 33-bus test system reported in [26] was considered, along with the integration of three PV sources at buses 12, 15, and 31, with a nominal power of 2400 kW. These are the locations suggested by the literature for this electrical system. The electrical topology of the GNC system is illustrated in Figure 4. This test feeder is composed of a single slack generator located at bus 1, 33 buses, and 32 branches, with a voltage of 12.66 kV and 100 kW as base values. The electrical parameters for the GCN are presented in Table 3, namely (from left to right) the branch number, the sending node, the receiving node, the resistance of the branch in Ω, the power demand at the receiving bus, and the maximum current allowed in each line, which was calculated by using a power flow in the base case and considering a scenario without PV distributed generation. With the currents obtained by the power flow and table 310-16 of the NTC-2050 [44], (i.e., the Colombian electrical code) the caliber for each one of the branches that make up DC grid was selected.   To calculate the different objective functions under study, the parameters reported in Table 4 were used [46,47]. This table presents, from top to bottom for the GCN and the SN, the energy purchasing costs of the conventional generators, the maintenance costs of the PV sources, and the CO 2 emissions generated to produce a kW of power with the conventional and PV distributed generators. It is important to highlight that, for PV technologies, an emission level of zero was considered, as this kind of renewable energy resource does not pollute during the energy production process [30].

Standalone System
As for the standalone system, the DC version of the 27-node AC standalone network was considered, which is widely used in the specialized literature [48]. To this effect, the reactive components associated with the branches and power loads were eliminated, which is a traditional method for generating DC test systems [14]. The standalone DC grid is composed of a single generator at bus 1, 27 buses, and 26 branches, as shown in Figure 5. Furthermore, this test system considers the integration of three PV sources located at nodes 5, 9, and 19, with a nominal power of 2400 kW, as well as a voltage of 12.66 kV and a power of 100 kW as base values. The parameters used for the standalone DC network are presented in Table 5. This table follows the same order and implies the same voltage bounds and methodology for obtaining the maximum branch currents as the ones proposed in Table 3.

Remark 2.
In this paper, it is assumed that the electrical configuration of the DC equivalent systems is monopolar, i.e., the voltage difference between the positive pole and the neutral wire is the same as that assigned in the AC network [49].

Comparison Methods
In order to evaluate the effectiveness and robustness of the proposed methodology in terms of solution quality, repeatability, and processing times, this paper adapted three continuous optimization methods highly used in the literature for solving the optimal power flow problem in DC networks while considering the operation of PV distributed generators: MVO, PSO, and the CSA. These methodologies were selected due to their excellent performance and high effectiveness [50]. The complete description and iterative algorithms of said techniques are presented in the cited references. Finally, aiming for a fair comparison between the optimization methods, the matrix hourly power flow proposed in this paper was used in the slave stage of all solution methodologies. Furthermore, their optimization parameters were tuned by using PSO, according to that reported in [14]. The optimization parameters obtained for each optimization method are presented in Table 6.

Matrix Hourly Power Flow Results
To demonstrate the effectiveness and applicability of the developed MSA hourly power flow, this subsection compares its results against the traditional SA hourly power flow. To this effect, the urban test system was implemented and solved without the presence of PV sources. This was performed in MATLAB version 2022a while using our own scripts on a Dell Precision 3450 workstation with an Intel(R) Core(TM) i9-11900 CPU@2.50 Ghz and 64.0 GB RAM running Windows 10 Pro 64-bit. Aiming for a fair comparison, both methods were evaluated 1000 consecutive times while considering a maximum permissible error of 1 × 10 −10 in order to determine their computation times. Table 7 shows the numerical results obtained for the MSA in comparison with the traditional SA when calculating the system energy losses for one day of operation. After 1000 consecutive evaluations, the results allow the following remarks to be made. (i) The developed MSA is faster in terms of average computational time when compared to the traditional SA. It only takes the MSA 0.2405 ms to determine the operating state of the system in a daily simulation scenario, which implies that it is at least 67.72% faster than the SA. (ii) These time differences can be seen in the maximum number of iterations. The SA takes a total of 185 iterations to determine the daily operational state of the system (iterations are accumulated hour by hour), whereas the MSA takes only 8 iterations. (iii) Finally, regarding the determination of the system's energy losses, both methods arrive at the same solution with an error of 1.28 × 10 −9 , which is negligible. This means that both of them are suitable for calculating the hourly power flow. However, our proposed reformulation (i.e., MSA) is the most favorable approach due to its higher performance.

Master-Slave Simulation Results
This section shows the results obtained by each optimization algorithm with regard to the problem under study. This analysis allows the best method for solving the problem of optimal power dispatch of PV sources in DC grids in terms of average solution, standard deviation, and processing time while considering economic, technical, and environmental indices as objective functions to be identified. This subsection begins with the GCN simulations (Section 5.2.1), which consider a grid-connected system in the city of Medellín. Then, a standalone network is analyzed (Section 5.2.2), i.e., an isolated system located in Capurganá, Chocó. In both cases, the results are presented in terms of the average reduction in the objective functions (expressed as a percentage): the energy losses associated with energy transport in electrical systems (E loss ), the total operating costs (E cost ), and the CO 2 emission levels associated with the grid and diesel generation (E CO 2 ). Furthermore, the standard deviation and the processing times of the solution methodologies are analyzed. To this effect, all the simulations were performed on the aforementioned computer, executing each optimization algorithm 100 times. Table 8 presents the results obtained by each optimization algorithm in the GCN through the proposed energy management strategies. From left to right, this table shows the solution optimization algorithm employed, the average power losses associated with energy transport in kW (E loss ), the average energy purchasing costs of the conventional generator in USD $ (E cost ) (in this particular case, the local energy cost is fixed by EPM), and the average reduction in CO 2 emissions in kg (E CO 2 ). The first row of this table shows the base case, which corresponds to the GCN without PV sources, and the simulation results obtained in terms of effectiveness, repeatability, and robustness are then presented for each objective function, namely the average solution obtained and the reduction obtained by each solution with respect to the base case, the standard deviation (%), and the processing time required by the solution methodologies in seconds. Finally, it is important to note that each of the answers obtained by the optimization algorithms observes the technical and operating constraints involved in the problem studied herein. The proposed FF function was used with α = 1000, a value that generates a big penalty factor, thus forcing the optimization methods to converge to a feasible solution. This document does not report on the voltage and branch current values obtained by each solution, as it represents a large amount of data.  Figure 6 shows the average reductions obtained by each solution methodology with respect to the base case regarding the three objective functions used. Note that, for the E loss case, the SSA achieved a reduction of 43.9536%, surpassing MVO, PSO, and CSA by 0.2708, 1.9789, and 2.0502, respectively. In the case of E cost , the SSA also obtained the best solution, achieving a cost reduction of 25.3511% and surpassing MVO by 0.0076%, PSO by 0.9622%, and CSA by 1.1245%. Finally, as for E CO 2 , the SSA reports the best results, with a reduction of 25.7468%, outperforming the other algorithms with an average value of 0.8077%. This analysis demonstrates that the SSA is the best method in terms of solution quality for solving the problem of optimal power dispatch of PV in DC grids in the GNC.  To evaluate the accuracy and repeatability of the algorithms, Figure 7 shows the standard deviation values obtained after 100 executions. In this figure, it is possible to observe that the minimum standard deviation is obtained by the SSA for each objective function analyzed. In terms of E loss , the SSA reached a standard deviation of 0.0131%, i.e., an average reduction of 2.0058% with respect to the comparison methods. For E cost , the proposed algorithm obtained a standard deviation of 0.7089%, surpassing the results obtained by MVO by 0.5100%, those of the CSA by 1.1411%, and those of PSO by 1.5490%. Finally, in the case of E CO 2 , the SSA obtained a standard deviation value of 0.6306%, surpassing the other methodologies by 1.1610% on average. This analysis shows that the SSA is the most suitable technique to solve the problem under study in terms of repeatability since it allows finding high-quality solutions every time that the algorithm is executed. Moreover, it can be concluded that the SSA is the most appropriate technique to solve the problem regarding the optimal power dispatch of PV sources in DC networks for each objective function employed in the GCN.

Standalone System
The results obtained after evaluating the optimization methods in Capurganá's standalone electrical network are presented in Table 9. This table has the same structure as Table 8. Note that the base case is presented on the first row of Table 9, which corresponds to the system without PV sources. As in the GNC results analysis, all solution methods satisfy the technical and operating constraints, as an α value of 1000 was implemented. This value was heuristically obtained in both scenarios. Figure 8 uses these results to compare all of the algorithms' solutions for each objective function. Figure 8 presents the average solutions obtained by each algorithm with regard to the three proposed objective functions. For E loss , the SSA obtained a reduction of 26.4560% when compared to the base case, surpassing MVO, PSO, and the CSA by 0.0358, 0.4488, and 1.9090%, respectively. Regarding E cost , the proposed algorithm reported a reduction of 34.6794% with respect to the base case, outperforming the other algorithms by an average of 3.6275%. Finally, in the case of E CO 2 , the SSA reduces the emissions reported by the base case by 34.8747%, surpassing MVO by 0.5426%, PSO by 1.3450%, and CSA by 8.8184%. These results demonstrate that the SSA achieves the best solutions for the studied problem regarding technical, economic, and environmental indices in DC isolated systems.  To demonstrate the accuracy and repeatability of the algorithms, Figure 9 analyzes the standard deviation value obtained after 100 executions. In the first case (E loss ), SSA reached a standard deviation value of 0.0230%, surpassing the results reported for MVO by 0.2126%, for PSO by 0.3865%, and for CSA by 1.7317. As for E cost , the SSA obtained a standard deviation of 0.4363%, outperforming the other methodologies by an average of 1.7333%. Finally, for E CO 2 , the SSA obtained a reduction of 0.4329% with respect to the base case, surpassing PSO by 1.2162%, MVO by 1.5863%, and the CSA by 1.6764%. These results show that the proposed method is highly efficient and ensures solutions of excellent quality every time it is executed with respect to any technical, economic, and environmental objective function in standalone systems.  Figure 9. Standard deviation obtained by the optimization methods regarding the economic, technical, and environmental indices used in the standalone network.

Processing Time Analysis
This subsection analyzes the processing times required by each optimization algorithm to solve the problem regarding the optimal dispatch of PV distributed generation in DC power grids. By observing Tables 8 and 9, it can be noted that the SSA obtains average processing times of 21.2037 and 12.8692 s for CGN and the SN, respectively.
In the case of the GCN, MVO and PSO are the fastest optimization algorithms, but they are trapped in local optima, obtaining solutions of lower quality in comparison with the SSA. The proposed method ranks third, with the worst performance in terms of processing times. However, it obtained the best solution to the problem for each objective function in the GCN networks, taking only around 21 s to perform its task.
In the standalone network, the MVO, PSO, and CSA ranked first, second, and third, respectively, achieving excellent performance in terms of processing times. However, the three aforementioned algorithms continue to be stuck at local optima due to low quality in the exploration stage. In contrast, SSA takes around 13 s to reach a solution, albeit with excellent performance in the exploration stage, which is reflected in the response obtained when solving the problem.
Based on the results, it is possible to conclude that the proposed methodology exhibits higher processing times to solve the problem of optimal power dispatch of PV sources in GCN and SN. However, this constitutes an adequate trade-off between solution quality and processing times. Furthermore, the effectiveness of the matrix hourly power flow proposed in this paper was demonstrated, as all methodologies performed as expected, which can be validated by analyzing the results reported in [27].

Conclusions and Future Work
This document addressed the problem regarding the optimal power dispatch of photovoltaic (PV) distributed generators (DGs) in order to reduce energy losses, operating costs, and emissions by using an energy management system based on a continuous optimization algorithm that employs sequential programming. Reductions in energy losses, grid operating costs, and greenhouse gas emissions were considered objective functions. A master-slave strategy involving the salp swarm algorithm (SSA) and a matrix formulation based on the successive approximations method was implemented on two types of networks (grid-connected and standalone network), considering the typical generation and power demand behavior of Colombia for a day of operation. The study used the data on energy costs and emissions reported by the local electrical operators for both electrical systems. PSO, MVO, and CSA were used for comparison, and all algorithms were tuned via a PSO reported in the literature, with the aim of obtaining the best performance in each solution methodology.
The results obtained in both test systems demonstrate that energy management based on SSA and the proposed matrix hourly power flow reached the best solutions in terms of quality, objective function impact, and repeatability. In numerical terms, the proposed methodology achieved the best average solution and the lowest standard deviation, namely a reduction of 31.68% in the GCN, as well as an average standard deviation of 0.4509%. In SN, an average reduction of 32% was obtained with respect to the objective function. Furthermore, when it was employed, the energy management system obtained an average standard deviation values of 0.45 and 0.29% for the GNC and the SC, respectively. These values ensure that the SSA will find a high-quality solution each time it is executed. In terms of processing times, SSA ranked third in the urban network, with an average time of 21.2037 s, and last in the rural grid, with an average time of 12.8692 s. However, it is important to note that, despite these results, the solutions are obtained in less than 21.5 s, which is still considered to be a short time when dealing with energy management in a grid-connected or standalone grid for a whole day of operation. In conclusion, this work demonstrates that the proposed energy management system, which is based on SSA and a matrix power flow, is the best-performing algorithm when solving the problem of optimal power dispatch of PV sources in grid-connected and standalone DC networks in Colombia, while improving technical, economic, and environmental indices.
As future work, this document proposes the implementation of new solution methodologies to improve economic, technical, and environmental indices in grid-connected and standalone networks. Additionally, SSA could be implemented within a multi-objective strategy that analyzes several objective functions. Furthermore, the implementation of energy storage systems can be considered, thus boosting the economic conditions of the grid and eliminating the variability related to renewable energy sources. Finally, an analysis could be carried out regarding the optimal integration of PV distributed generators and energy storage systems. Funding: This research was funded by the University of Talca (Chile), by Universidad Distrital Francisco José de Caldas (Colombia), by the Colombian Ministry of Science (Minciencias) through its Fondo Nacional de Financiamiento para la Ciencia, la Tecnología y la Innovación, Fondo Francisco José de Caldas, by Instituto Tecnológico Metropolitano, by Universidad Nacional de Colombia, and by Universidad del Valle, under the project titled: Estrategias de dimensionamiento, planeación y gestión inteligente de energía a partir de la integración y la optimización de las fuentes no convencionales, los sistemas de almacenamiento y cargas eléctricas, que permitan la generación de soluciones energéticas confiables para los territorios urbanos y rurales de Colombia, which is part of the research program titled: Estrategias para el desarrollo de sistemas energéticos sostenibles, confiables, eficientes y accesibles para el futuro de Colombia.

Institutional Review Board Statement: Not applicable.
Informed Consent Statement: Not applicable.

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

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