# Solar Photovoltaic Integration in Monopolar DC Networks via the GNDO Algorithm
## 3 Solution Methodology
### Power Flow Solution  
The power flow problem in electrical engineering is nonlinear and associated with determining the voltage variables in electrical systems under steady-state operating conditions [30]. In the case of the optimal siting and sizing of PV generation units in monopolar DC networks, the power flow solution is the fundamental key to determining the total energy purchasing costs at terminals of the substation [24]. In this research, the power flow solution technique implemented is the successive approximation method reported in [22].  
The general power flow formula for the successive approximation power flow method is given in Equation (25).  
\[V_{d,h}^{m+1}=Y_{dd}^{-1}\Big{[}diag^{-1}\Big{(}V_{d,h}^{m}\Big{)}\Big{(}P_{ pp,h}-P_{d,h}\Big{)}-Y_{ds}V_{s,h}\Big{]}, \tag{25}\]  
where \(m\) is the counter assigned to the power flow iterations; \(V_{d}\) is a vector that contains all the demanded voltage variables for each period \(h\); \(P_{pv,h}\) corresponds to a vector that contains the power outputs in the PV generators for each period \(h\); \(P_{d,h}\) represents a vector that contains all the power consumption in the load nodes for each period \(h\); \(V_{s,h}\) is the voltage output at the substation bus at any period; \(Y_{dd}\) contains all the conductance relations among load nodes, which is a square invertible matrix; \(Y_{ds}\) represents a rectangular matrix that associates the substation bus with the load nodes; and \(diag(u)\) corresponds to a diagonal matrix composed of the elements of the \(u\) vector.  
To determine whether the power flow Formula (25) has converged to the power flow solution, the difference between the voltage magnitudes of two continuous iterations is evaluated as defined in Equation (26).  
\[\max_{h}\Bigl{\{}||V_{d,h}^{m+1}|-|V_{d,h}^{m}||\Bigr{\}}\leq\gamma, \tag{26}\]  
where \(\gamma\) represents the maximum convergence error, i.e., \(\gamma=1\times 10^{-10}\)[22].  
Once the power flow problem is solved by reaching the desired convergence, the power flow generation in the substation bus is obtained via Equation (27).  
\[P_{s,h}^{sub}=\bigl{\{}diag(V_{s,h})(Y_{ss}V_{s,h}+Y_{sd}V_{d,h})\bigr{\}}. \tag{27}\]  
Note that, with the power generation values at the substation bus, which are given by Equation (27), the component of the objective function \(z_{1}\) is obtained. One of the most important aspects of combinatorial optimization is that it uses a fitness function to replace the original objective function, thus enabling the exploration of infeasible solution regions in the search for better objective function values (which increases the probabilities of finding the global optimum) [31; 32]. The proposed fitness function for the studied problem takes the following structure.  
\[A_{f}=z_{\text{cost}}+\begin{bmatrix}\gamma_{1}\max_{h}\bigl{\{}|V_{d,h}|-v_{ d}^{\text{max}},0\bigr{\}}+\gamma_{2}\max_{h}\bigl{\{}|v_{d}^{\text{min}}-|V_{d,h }|,0\bigr{\}}-\\ \gamma_{3}\min_{h}\Bigl{\{}P_{s,h}^{sub},0\Bigr{\}}-\gamma_{4}\min_{j,h}\bigl{\{} _{kj}^{\text{max}}-|i_{kj,h}|,0\bigr{\}}\end{bmatrix}, \tag{28}\]  
Note that, in \(A_{f}\), the parameters \(\gamma_{1}\), \(\gamma_{2}\), \(\gamma_{3}\), and \(\gamma_{4}\) correspond to the penalization factors of the objective function. These factors are activated in case the voltage regulation limits the maximum admissible current flow in the lines, or the positive semi-definite power generation requirements in a slack source are violated. Based on the recommendations of [24], the magnitude of said factors is selected as \(100\times 10^{3}\).  
The main characteristic of the fitness function defined in Equation (28) is that when all the constraints of the optimization model (1)-(11) are fulfilled, the \(A_{f}\) value is equal to the objective function, i.e., the global optimum the solution that guides the GNDO in the exploration and exploitation of the solution space is indeed the optimal solution of the MINLP model of Equations (1)-(11).