PV Array Reconﬁguration Based on Genetic Algorithm for Maximum Power Extraction and Energy Impact Analysis

: Reconﬁguration of PV arrays is one of the most suitable options to face issues affecting the power produced by panels, such as partial shading. This paper presents a reconﬁguration procedure based on a genetic algorithm. The execution times obtained with the proposed approach validate its good performance compared with a traditional brute force algorithm. Finally, different shading patterns are considered in the simulations.


Introduction
There is a high interest in the use of photovoltaic (PV) energy since it is a non-pollutant and an environmental-friendly alternative. Nevertheless, besides its advantages, the performance of the PV installations depends on the weather conditions, which can be dynamic over time. Shading caused by trees, buildings, or passing clouds can be projected on the PV panels, causing drops in the generated power [1,2].
To mitigate the effect of total or partial shading, researchers developed several strategies as the use of the bypass diode, which gives an alternative path to the current so the PV panels do not consume any power. However, this solution introduces multi-peaks in the current vs. voltage (I-V) curves of the PV array due to the diode activation [3,4].
Another strategy is the maximum power point tracking (MPPT), which implies using algorithms such as P&O, fuzzy logic, and incremental conductance, to seek the optimum operation point known as maximum power point (MPP) of the PV array [5,6].
One of the most common practices to reduce the effect of partial shading is reconfiguration. This process involves changing the physical or electrical connections of the panels in the PV array, using a switching matrix based on relays as in [7][8][9].
The different connections between the panels are known as configurations, which can be regular configurations following a defined pattern such as total-cross-tied (TCT), series-parallel (SP), bridge linked (BL), and honey comb (HC). Similarly, modern configurations such as SuDoKu puzzle and Magic Square have their own previously established pattern [10][11][12]. Instead, irregular configurations do not follow any pattern.
Depending on the shading pattern or the environmental conditions on the PV array, a given amount of power can be obtained with each configuration. The goal of the reconfiguration process is to find the configuration which can extract the highest amount of energy. An example is presented in Figure 1, where a TCT configuration is compared with an SP and an irregular one. TCT obtained 641.5124 W, SP delivered 559.1170 W, and the irregular one delivered 646.0916 W. This example shows that the irregular configuration, in this particular example, provides the highest power. One of the main challenges in the reconfiguration procedure is finding the correct combination in minimal time; this problem can be addressed by considering reconfiguration as an optimization problem.
The use of metaheuristic techniques in the reconfiguration process aims at the deployment of the optimum configuration for the working conditions of the PV array before the weather conditions change. In this matter, metaheuristic techniques such as PSO [13], marine predator [14], GOA [15], and GA [16] have been proposed in contrast with techniques based on brute force or analytical methods, which might require longer execution times to perform the reconfiguration of the PV array.
There also exists the drawback of the complexity of mathematical models used to solve the resulting equations of the PV array analysis. To address this problem, techniques such as Newton-Raphson, Lambert-W, or Levenberg-Marquardt have been adopted; those techniques can lead to complex procedures to calculate the current and voltage of a PV array under a particular irradiance and temperature condition [17][18][19]. This problem has been simplified assuming one single configuration. Some authors [16,20] have faced the reconfiguration problem with GAs considering the TCT configuration as a static array, changing the physical position of the PV panels to disperse the shadow without changing its connection. Other authors use the SP configuration [21,22] since it can simplify the equation system by not having a direct parallel connection between the PV strings. Nevertheless, not considering all the configurations in the PV array decreases the versatility of the procedures, avoiding an analysis of the energy impact problem, which might lead to energy losses due to the implementation of improper configurations [23,24].
Considering the previous mitigation strategies, the problem of the energy impact generated by partial shading has been a subject of study since it is one of the main sources of power losses, both for static shadows such as those given by buildings, as well as dynamic shadows such as those caused by clouds [25,26]. These studies often use metrics such as fill factor, percentage of power loss, and performance ratio [27,28], which enable to quantify the power loss due to shading or mismatching between PV panels characteristics.
With a study of the impact of the configurations in PV arrays under different solar irradiation conditions, it is possible to have an idea of the energy losses that may occur at the PV array site, especially if there is information on the shading present in the area. To address reconfiguration as an optimization problem, by taking into account the quantification of the energy impact of the partial shading conditions, this paper proposes a reconfiguration procedure based on a GA to find the configuration with the maximum power. The performance of the GA is then compared with a traditional brute force algorithm to verify that the proposed solution overcomes the problem of long execution times. To calculate the maximum power, the work presented in [29] is used. In this way, the current and voltage of the possible configurations of any PV array are calculated, which consider the modification of the electrical connection between the panels (i.e., dynamic reconfiguration) under partial shading conditions. Moreover, this paper analyzes the impact of different patterns of dynamic shading on the most common configurations, which are contrasted with those obtained by the GA using metrics such as FF, to quantify the percentage of power lost due to weather conditions and the non-deployment of the appropriate configuration.
This paper is organized as follows: Section 2 describes the highlights of the modeling procedure used to calculate the current and voltage of the PV arrays, as well as the explanations of the concepts of the proposed technique based on the genetic algorithm. Section 3 presents the simulation results for the tests performed. Finally, the conclusions are presented in Section 4.

Modeling Procedure
The modeling procedure presented in [29] calculates the current and voltage of any regular (e.g., SP, TCT, or BL) or irregular PV array of size M×N (M rows, N columns) operating under uniform or partial shading conditions. The procedure is based on the single diode model (SDM) including the bypass diode [30]. Therefore, it requires seven parameters: PV current I ph , saturation current I sat , ideality factor η, series resistance R s , parallel resistance R sh , bypass diode saturation current I sat,db , and bypass diode ideality factor η db as it is shown in Equation (1).
where V t is the thermal voltage of the cell, which is expressed as follows: In the previous expression, k is the Boltzmann's constant (1.3839e −23 J/K), T is the cell temperature in Kelvin, and q is the electrical charge of electron (1.6e −19 C). Moreover, I db is the current through the diode, and it is expressed as follows: In partial shading conditions, parameter I ph is related with the amount of solar radiation on the PV panels. Then, to express this relationship with the current of the PV array, the procedure uses a mismatching profile, that is, a representation of the percentage of I ph under the operating conditions for each panel in the array. Equation (4) is an example of the mismatching profile for a 2 × 2 PV array where there are 2 panels receiving 50% of solar radiation and 2 panels with full illumination (100%).
Mismatching pro f ile = 50 100 50 100 (4) The model of the PV array is based on a SP configuration; therefore, one (M − 1) × (N − 1) connection matrix (M conn ) is used to represent the connections between the modules of the PV array. That matrix is filled with 0 or 1, where a 0 indicates no connection between strings and a 1 indicates connection. As an example, connection matrix corresponding to an irregular configuration is described in Figure 2 and the Equation (5) for a 3×3 PV array. Using the connection matrix and the mismatching profile, the procedure adopted in [29] calculates the current for a given voltage for every possible configuration related with the PV array under analysis. Then, it calculates the delivered power and the I-V characteristics of all the configurations evaluated. For large PV arrays, this might be a high-burden computational task due to the calculation of the I-V characteristics for all the possible configurations. In applications of energetic impact analysis, this might lead to a late reconfiguration process which implies power losses due to the shading on the PV array and could also lead to imbalances in the power supplied to the load [31]. To overcome this drawback, this work uses a GA for obtaining the connection matrices associated with the PV array, providing a faster reconfiguration process to calculate the configuration maximizing the delivered power under a given mismatching profile.

Brute Force
This work considers the algorithm explained in [7] as a brute force approach (BF). The procedure also uses the technique of [29] for calculating the current and voltage of the PV array. Nevertheless, it calculates and evaluates the total number of possible configurations, regular and irregular, automatically for the PV array of size M × N, finding globally the configuration that maximizes the power delivered under the given environmental conditions. For the configurations' identification, the algorithm described in [7] uses permutations between the connection matrices, that is, it permutes the position of the 0 and 1 for every configuration in the PV array. Equations (6) and (7) show the correspondent matrices of the example given in [7] for a 3 × 3 array.
After performing all the permutations between the elements of the connection matrix, the algorithm calculates the power and current for each configuration, where the selected configuration will be the one with the maximum power under the particular environmental conditions.
Since this algorithm needs to calculate the power delivered by each configuration, this represents a computationally expensive task for large PV arrays, reflecting a high execution time. For real-time applications, it would not be an optimal option because, while the algorithm obtains the appropriate configuration, the weather conditions could change; therefore, the reconfiguration might not be effective. To overcome that problem, this work adopts a GA to perform the reconfiguration task, as explained below.

Identification of the Optimum Configuration
This work uses a GA to address the PV array's reconfiguration problem. The objective function and GA approach proposed will be explained as follows.

Objective Function
PV array's reconfiguration expressed as an optimization problem implies power maximization. Based on the information given in Section 2.1, the objective function (OF) is given in the following equation: In the previous function, I array and V array correspond to the current and voltage of the PV array, respectively. I array is the summation of the string currents I str,n as it is depicted in Figure 2. I array depends on the mismatching profile and the number of strings of the PV array, while V array depends on the number of panels connected in series to form the PV strings. As it is shown in Equation (8), the main target of the objective function is to calculate the maximum power generated by the configurations operating under a given set of environmental conditions, thus selecting the one with the highest power as the configuration to be deployed.

Genetic Algorithm
Genetic algorithm was developed by [32] as an application of Darwin's natural selection theory to the artificial intelligence field. This algorithm performs its search by population analyses. Those involve creating bit chains that represent the chromosomes. The first step is to select individuals of the current population (parents) who will contribute their genes to the next generation (children). The objective function is evaluated with the current population. Then, the children with the highest objective function will pass to the next generation and, for the rest of the children, the mutation and crossover process will be applied. The chosen descendants, which are the more suitable ones, will pass to the next generation. The algorithm will continue creating descendants until a stop criterion is met (e.g., maximum number of iterations). Each of these stages is related to the objective function and the search space limits, which must be declared accurately to avoid falling into a local minimum.

Reconfiguration Based on GA
This procedure uses the connection matrix concept as population for the GA. After reshaping the population vector to a (M − 1) × (N − 1) matrix, the GA evaluates the objective function for the current configuration. Equation (9) shows an example for the connection matrix of Equation (5), where [0011] is the bit chain or population created for evaluation in the GA.
[0011] = 0 1 0 1 After evaluating the objective function, as explained in Section 2.3.2, the GA approach selects the best individual or configuration evaluated so far, then performs the mutation and crossover processes. The objective function is evaluated for the new descendant or configuration created, and the procedure updates the best individual, which is the configuration with the highest objective function. The process repeats until the number of iterations is reached, then the GA returns the configuration with the maximum power, that is, with the highest objective function.

GA Parameters Tuning
The type of crossover (uniform, single point, and double point) [33] was selected by performing multiple tests with the same configuration, the number of iterations, and population. Then, to choose the optimal crossover type, it was necessary to compare the execution times and the evaluation of the objective function for each test. Once the type of crossover was selected, several new tests were performed changing population size (from 20 to 80 individuals) to obtain a satisfactory trade-off between computation time and objective function value. Finally, the number of iterations was selected based on the performance of the objective function: Figure 3 shows that 10 iterations is the best value, since additional iterations do not improve the objective function. Following the previous procedure, the GA parameters reported in Table 1 were obtained, which includes a population size of 40 individuals and 10 iterations for each cycle. Moreover, a mutation of 0.01 was obtained, which means that 1% of the individuals are subjected to mutation. Finally, the uniform crossover was selected from the results with a crossover probability equal to 1; thus, 100% of the parents genes are used in the crossover procedure.  Then, the GA described in Section 2.3.3 was implemented using the parameters of Table 1. The GA procedure is described in Algorithm 1, where M is the number of rows of the PV array, N is the number of columns, nVar is an auxiliary variable used to simplify the pseudocode description, and Mu and Pc are the mutation and crossover values, respectively.

Results
The cases used to evaluate the performance of the proposed methodology were carried out at simulation level, using different irradiance profiles. Those tests consider 18 JS65 Generate descending population by using crossover and mutation 9: Evaluate objective function 10: Update best individual 11: Set Configuration = best individual and Maximum power = highest values of objective function 12: Set t = t + 1 13: end for 14: return Maximum power, Configuration Yingli panels forming a 6 × 3 PV array, and the simulations were executed using MAT-LAB/Simulink software on a computer with an Intel(R) Xeon(R)CPU E5-2667@2.90 GHz 2.90 GHz (dual processor), 48 GB RAM, and Windows 10 PRO. The metrics adopted for comparison between the GA reconfiguration results and other common configurations such as SP are the execution time and maximum power. Moreover, this section presents an application case with several sizes of PV arrays, under a dynamic shading condition, to compare the proposed technique with the BF approach in terms of execution time. Table 2 shows the first case corresponding to the reported mismatching matrix, along with the configurations found by the BF approach and the proposed GA. As Table 3 shows, the maximum power obtained for both algorithms is the same. Nevertheless, the proposed GA is 98.86% faster than the BF.   Figure 4 illustrates the power vs. voltage (P-V) curves of the GA result along with the irregular configuration given in Table 2 and a SP configuration. This comparison exhibits a power loss of 37.631 W between the SP, which is a commonly-used configuration, and the configuration given by the GA, while the irregular configuration exhibits a loss of 19.132 W. Tables 4 and 5 report the second case. As it was stated for the first case, the maximum power delivered is the same for both algorithms, but the proposed GA provides an improvement of 99.913% in the execution time.   Figure 5 reports the P-V curves corresponding to the mismatching profile of Table 4. For this case, the SP configuration has a loss of 20.712 W, while the irregular configuration presents a loss of 15.293 W compared with the maximum power given by the proposed GA.  Table 4.
Moreover, this work also considers the fill factor (FF) [6] for performance measurement: Equation (10) is for full illumination conditions and Equation (11) is for partial shading conditions, where GMPP stands for global MPP: Table 6 shows the percentage of power loss for the shading scenarios previously described. First, it is necessary to calculate the FF for the full illumination condition, i.e., without any shade present, to consider that value as a base for power loss calculation. This result is obtained using the datasheet data of the JS65 Yingli and the size of the PV array, which has a maximum delivered power of 1.5417 kW. Then, using Equation (10), the FF of the PV array is calculated as FF f ull = 0.7805.
As Table 6 shows, the SP configuration provides the highest percentage of power losses for both mismatching profiles; therefore, the configuration found by the proposed GA provides a better performance during the partial shading conditions under analysis: the GA shows an improvement of 7.493% for mismatching matrix 1 and 3.855% for mismatching matrix 2.  Table 7 presents some reconfiguration approaches reported in the literature, where most of them require current and voltage measures. On the other hand, those approaches consider regular configurations (SP, TCT, HC, BL), which is a remarkable disadvantage with respect to the procedure proposed in this paper which is capable of also analyzing irregular configurations. Therefore, the proposed approach can deliver a more detailed analysis of a PV array, thus improving the possibility to achieve a higher power production.

Analysis of Shading Impact in PV Power Generation
Concerning the results given by the proposed GA in terms of execution time, such a technique can be recommended for both large-scale PV reconfiguration and as a technique for energy impact evaluation considering dynamic shading conditions. In that way, this section presents an analysis of the impact of different shading patterns on PV arrays with different sizes. Figures 6 and 7 show two patterns of dynamic shadows during a day, which are used to simulate the array power production with the proposed GA. Such a performance is contrasted with the results obtained with other known configurations such as SP, TCT, and an irregular one.  Figure 8 shows a summary of the results obtained from those simulations. In the case of the diagonal pattern, the GA obtained the optimum configuration for maximizing the generated power with an irregular configuration. Comparing the power calculated by GA (i.e., irregular 2) with an SP configuration, there exists a power loss of 314 W daily, while for the irregular configuration, 1 is a power loss of 100 W daily, approximately. In the case of rectangular patterns, the configuration found (i.e., SP) was also the optimum along with an irregular configuration and TCT.
According to this information, it is necessary to highlight that not adopting shading mitigation techniques might lead to a reduction in the lifetime of the PV array, economic losses, and unbalance in the loads due to the power losses produced by the shading profiles of the installation zone.  Figure 9 reports that the GA was 963% faster than the BF for the evaluation of the diagonal pattern, and the GA was 1542% faster than the BF for the rectangular pattern. Considering the execution time, the proposed procedure requires a much shorter processing time. Therefore, having a daily shading profile already established, the optimal configuration can be deployed faster to minimize the power losses. Finally, Figure 10 compares the processing time required by BF and GA algorithms to reach the optimal solution for a different number of modules, between 8 and 108, which corresponds to a PV array where the rows are increasing from 2 × 4 to 27 × 4. The black dots highlight the execution time of both algorithms for 20, 40, 60, 80, and 100 panels. For the BF approach, an interpolation of the execution time was made from 24 panels to 60 panels. For 24 panels, the execution time of the BF is about 14.75 h (i.e., 53,100 s), while GA only requires 0.033 ms for the same number of panels. Therefore, the GA solution allows to simulate a higher number of panels. Similarly, for 108 panels (27 × 4 array), the execution time of the GA was only 0.074 ms.

Conclusions
This paper describes a procedure based on a GA as a reconfiguration and energy impact analysis tool, which evaluates the power levels of different PV array sizes and configurations under distinct environmental conditions. For comparison purposes, a BF approach previously published was also implemented. The proposed GA approach reduces, significantly, the computational burden for PV array simulations. Moreover, for large PV arrays, the BF approach supposes an exponential increase in the execution time due to the calculation of every possible configuration for maximizing the generated power. For a reconfiguration process, according to the information of Figure 10, this is very impractical in contrast with the proposed procedure based on a GA.
Considering the execution time, this GA-based tool can work under changing environmental conditions, such as dynamic shadows, to calculate the appropriate configuration in the PV array installation place.
In addition, as it was presented in this work, a proper reconfiguration process implies lower power losses, also increasing the PV array lifetime. Disregarding the suitable configuration of a PV array might lead to possible faults in the loads and a loss of energy over time, which might affect the return of investment calculation. Funding: This research was funded by Minciencias-Ministerio De Ciencia, Tecnología e Innovación, Instituto Tecnológico Metropolitano, Universidad Nacional de Colombia, and Universidad del Valle, under the research project "Estrategias de dimensionamiento, planeación y gestó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", (Minciencias code 71148), which belongs to the research program "Estrategias para el desarrollo de sistemas energéticos sostenibles, confiables, eficientes y accesibles para el futuro de Colombia", (Minciencias code 1150-852-70378, Hermes code 46771).

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