A Procedure for Modeling Photovoltaic Arrays under Any Configuration and Shading Conditions

Daniel Gonzalez Montoya 1,*, Juan David Bastidas-Rodriguez 2, Luz Adriana Trejos-Grisales 3, Carlos Andres Ramos-Paja 4, Giovanni Petrone 5 and Giovanni Spagnuolo 5 1 Departamento de Electrónica y Telecomunicaciones, Instituto Tecnológico Metropolitano, Medellin 050013, Colombia 2 Escuela de Ingenierías Eléctrica, Electrónica y de Telecomunicaciones, Universidad Industrial de Santander, Bucaramanga 680002, Colombia; jdbastir@uis.edu.co 3 Departamento de Electromecánica y Mecatrónica, Instituto Tecnológico Metropolitano, Medellin 050013, Colombia; adrianatrejos@itm.edu.co 4 Departamento de Energía Eléctrica y Automática, Universidad Nacional de Colombia, Medellin 050041, Colombia; caramosp@unal.edu.co 5 Department of Information and Electrical Eng. and Applied Mathematics, University of Salerno, 84084 Fisciano, Italy; gpetrone@unisa.it (G.P.); gspagnuolo@unisa.it (G.S.) * Correspondence: danielgonzalez@itm.edu.co; Tel.: +57-4-4600727 (ext. 5560)


Introduction
Photovoltaic (PV) systems are considered one of the most important renewable energy sources; since the sunlight is almost everywhere, it is free, and the energy production does not generate greenhouse gases.In addition, PV panel prices reduce every year, and the maintenance costs are relatively low [1].According to the International Energy Agency, in 2016 a total of 75 GW from PV systems were installed around the world, 50% more compared to 2015.In this way, the installed global PV capacity reached 300 GW [1], approximately.These facts justify the growing interest in researching PV systems, particularly in modeling techniques to analyze their electrical behavior and viability evaluation.
Modeling techniques are a useful tool for power prediction analysis, the evaluation of maximum power point tracking (MPPT) strategies, and the validation of reconfiguration algorithms, among others.Typically, those models are static, since the dynamics of the PV array are much faster than the dynamics of the power electronics that the array is connected to [2].
A PV array is constructed by connecting panels in a particular configuration, and each PV panel is composed of one or more modules in series connection.In turn, each module is a set of series-connected cells with a diode connected in an antiparallel, denominated bypass diode, to protect the cells [3].Therefore, a PV module can be considered as the basic unit to model the array.The single-diode model is one of the most widely reported and accepted equivalent circuits [4,5] to represent a PV module, because it provides a tradeoff between complexity and accuracy.The parameters of the single-diode circuit can be calculated using procedures as the ones introduced in [4,6]; such procedures take into account the operating conditions (i.e., irradiance and temperature) and the PV modules' datasheet information.
The electrical model of a PV array can be defined as an equivalent circuit able to reproduce the array's electrical behavior.Such an electrical model is constructed by connecting PV modules in a particular configuration.The most common array configurations are series-parallel (SP), total cross-tied (TCT), bridge-linked (BL), or honey comb (HC) [3].For a given operating condition, each one of these configurations provides a particular current vs. voltage (I-V) and power vs. voltage (P-V) curves, which may contain different numbers of local maximum power points (LMPPs) and a different global maximum power point (GMPP).Therefore, for a given operating condition, there is at least one configuration that provides the largest GMPP or, in other words, that best mitigates the effects of a particular mismatching condition [7].
Several works have introduced techniques for modeling a particular configuration: SP arrays [8][9][10], TCT arrays [3,10], BL arrays [10,11], and HC arrays [10,12].However, the strict definitions of TCT, BL, and HC assume that an array is formed by modules instead of commercial panels [13], which may have several modules [14].Thus, a TCT, BL or HC array formed by PV panels containing more than one module will not match the conventional definition of such topologies; hence, they cannot be accurately analyzed using the reported models.
In this paper, configurations such as SP, TCT, BL, and HC are considered regular, because they follow fixed connection patterns; while other configurations are considered irregular.Such is the case of the arrays introduced in [15] where the conventional structures (SP, TCT, BL, and HC) are combined to form hybrid configurations with the aim of studying the effect of the ties and the power response under partial shading conditions.In order to illustrate the irregular configuration concept, Figure 1 shows a 4 × 4 PV array formed with panels of two PV modules each.Such an array is irregular because its ties do not follow any conventional pattern.
To the best of the authors knowledge, there is only one modeling procedure able to reproduce the electrical behavior of a PV array with any regular or irregular configuration [16].In such a paper, the authors propose dividing the PV array into sub-arrays.Each sub-array is analyzed by using node voltage analysis to create a system of nonlinear equations assuming that the array voltage is known, since it is usually defined by the power converter.Such a system of nonlinear equations is solved by using a numerical method to obtain the sub-array current.Finally, all the sub-array currents are added to obtain the whole array current.Nevertheless, when the number of meshes in a sub-array is lower than the number of nodes, the number of nonlinear equations obtained with nodal analysis is greater than the one obtained with mesh analysis.Therefore, the system of nonlinear equations to be solved by following the procedure proposed in [16], compared with the system of nonlinear equations obtained with mesh analysis, is larger and more complex.
This paper presents a modeling procedure for calculating the current of any regular or irregular PV array configuration formed by N rows and M columns of panels (N × M) operating under both uniform or partial shading conditions.The proposed approach divides the array into sub-arrays that can be solved independently as in [16], and it introduces a mathematical procedure to solve the sub-arrays by using mesh current analysis.In this way, the proposed procedure complements the solution introduced in [16], and the sub-arrays are analyzed through the procedure that provides the minimum number of nonlinear equations.The modeling procedure is implemented in a MATLAB (2015a, MathWorks, Natick, MA, USA) script and validated through experimental and simulation tests.The experimental tests were performed in a 3 × 3 PV array connected in SP, TCT, BL, and irregular configurations operating under partial shading conditions.The simulations consider a 10 × 5 PV array connected in SP and irregular configurations exposed to partial shading conditions to illustrate the application of the proposed model in medium PV arrays.The paper is organized as follows: Section 2 describes the proposed modeling approach and its integration with the procedure introduced in [16] through a simple application example.Sections 3 and 4 present the experimental and simulation results, which validate the performance of the proposed approach.Finally, the conclusions close the paper.

Modeling Procedure
This section introduces the proposed model.The single-diode model used to represent each PV module, including the associated bypass-diode, and a brief definition of the sub-array (SA) concept [16] is presented.Later, the proposed method is used to calculate the SA current by using mesh current analysis and a pseudo-code to evaluate the system of nonlinear equations.Afterwards, the array current calculation of the SA currents is presented.A flowchart summarizes the integration of the procedure introduced in this paper and the procedure proposed in [16] to analyze any PV array.A pilot example is used to explain each stage of the procedure for clarification.

PV Module Model
In this paper, the single diode model (SD) is adopted to represent the PV module operation due to its tradeoff between accuracy and complexity [4,5].Figure 2 shows the equivalent circuit, including the bypass diode, which must be considered when the modules operate under partial shading conditions.In the circuit, the current source I ph represents the photovoltaic current, the diode D models, the P-N junction nonlinear behavior, and the resistances R h and R s represent the leakage currents and ohmic losses, respectively.
A module connected into an array will be shared by two mesh currents (see Figure 2), the one at the left and the one at the right of the module, if such module is not placed in the first string of the array.When the module is placed in the first string, the current mesh at the left is zero.By applying Kirchhoff's voltage and current laws (KVLs and KCLs), it is possible to define the relationship between the module voltage (V) and the mesh currents at the right (I a ) and at the left (I b ) of the PV module, as shown in Equation (1), where I sat is the inverse saturation current of the PV module diode, N s is the number of series-connected cells into the module, and β = n • k • T pv /q, where n is the ideality factor, k is the Boltzmann constant, q is the electron charge, and T pv is the module temperature in Kelvin.Moreover, I sat,by is the inverse saturation current of the bypass diode and β by = n by • k • T by /q, where n by is the ideality factor of the bypass diode, and T by is the bypass diode temperature in Kelvin.
(1)  The values of the module parameters (I ph , I sat , n, R s , R h , I sat,by , and n by ) are calculated by means of systematic procedures as the ones proposed in [4,6].Such procedures consider the weather conditions (irradiance (S) and temperature (T)) and the electrical characteristics of the PV module taken from the manufacturer datasheet.Moreover, the works reported in [17][18][19] present methods designed to estimate the irradiance and temperature of PV plants.Finally, the parameters n, R s , R h , I sat,by , and n by can be considered constant while I ph and I sat depend on S and T for each module [6].

Varray
It is worth noting that Equation (1) is not an explicit and strongly non-linear function, so it is not possible to express V as an explicit function of the mesh currents (i.e., I a and I b ) even by using the LambertW function.Thus, it is necessary to use a numerical method (e.g., Newton-Raphson) to obtain V from Equation (1).

Definition of Sub-Arrays
In [16], a sub-array (SA) is defined as a string, or set of strings, that has no ties with other strings to the left or to the right (see Figure 1).In this way, a sub-array has the same number of rows as the entire array, but a different number of columns depending on the parallel connections between the strings.The sub-array concept takes advantage of the architecture of a particular PV configuration to identify the parts of the array that can be analyzed and modeled independently.For a better understanding of the SA definition, Figure 3 shows a 3 × 3 SP array and a 3 × 3 irregular array in which the two first strings (from left to right) are connected, as is shown by the ties inside the dashed ellipses, while the third string (from left to right) is not connected to the others.The dotted rectangles indicate the sub-arrays in both configurations; thus, the SP array has three sub-arrays while the irregular array has two.
Considering a PV array of N rows and M columns (N × M), its internal connections can be defined by a (N − 1) × (M − 1) matrix, called the connection matrix (M conn ).In such a matrix, the presence or absence of a tie between two consecutive strings is represented by 1 or 0, respectively.If the column j of M conn is a column of zeros, then there is no connection between strings j and j + 1 of the array; therefore, based on an examination of M conn from left to right, each column of zeros indicates the end of a sub-array and the beginning of the next one.From this analysis, it is possible to define the number of sub-arrays in a PV array (N sa ) as shown in Equation ( 2), where N z is the number of columns of zeros in M conn .
(2) Considering the PV array of Figure 3b as a pilot example, M conn is a 2 × 2 matrix, where its first column is filled with ones, while the second column is filled with zeros, as is shown in Equation (3).Therefore, the array has two sub-arrays: SA 1 and SA 2 , since N z = 1 and N sa = 2, according to Equation (2).
In the proposed solution, the parameters required by the SD model (I ph , I sat , β, R s , R h , I sat,by , and β by ) are calculated for each module of the array considering the weather conditions.Such parameters are then organized in N × M matrices (M I ph , M Isat , M β , M Rs , M Rh , M Isatby , and M βby ).Hence, for the analysis of each SA, it is necessary to extract its parameters from the those matrices.The process to obtain the matrices of parameters for each SA is not described in this paper since it is explained in detail in [16].

Calculation of the Sub-Array Current
The aim of the analysis is to find the current of SA i , i.e., I sa,i with i ∈ [1, 2, ..., N sa ], for a given array voltage (V array ) by using mesh analysis.However, from such an analysis, it is not possible to obtain a system of explicit non-linear equations with the mesh currents as unknowns variables, because the modules voltages cannot be represented as explicit functions of the mesh currents as explained in Section 2.1.Therefore, the calculation of the mesh currents in SA i is carried out by solving a system of non-linear equations organized in a vector (F mesh,i ), whose elements are obtained by applying the KVL to each mesh of the sub-array.
The first step is to identify the number of meshes in SA i (N m,i ).For that purpose, the connection matrix of SA i must be defined from M conn according to the process described in [16].The sub-arrays of the pilot example are shown in Figure 4.In such a case, the connection matrices M sa conn,1 and M sa conn,2 are presented in Equations ( 4) and ( 5).Analyzing the sub-arrays, from left to right, it is possible to identify that there is one mesh between two consecutive strings, and each additional tie between two strings creates a new mesh.Moreover, the last string (from left to right) creates a mesh with the array input voltage (V array ) as is illustrated in Figure 4. Hence, N m,i is calculated by adding the number of columns (M sa,i ) and the number of ties between the columns of the SA i (N t,i ), respectively, where N t,i is obtained by adding the elements of M sa conn,i , as shown in Equations ( 6) and (7).
Therefore, the SA i has N m,i unknown mesh currents, i.e., I j,i for j ∈ [1, ..., N m,i ], which form the sub-array mesh currents vector I m,SAi .The numbering of the mesh currents in I m,SAi is obtained by examining the sub-array from top to bottom and from left to right, while the mesh currents' directions are selected clockwise.Then, by applying Equations ( 6) and (7) to the pilot example, N m,1 = 4 for SA 1 and N m,2 = 1 for SA 2 .In addition, the mesh current vector of SA 1 will contain four elements i.e., I m,SA1 = [I m1 , I m2 , I m3 , I m4 ], while the mesh current vector of SA 2 will contain one element, i.e., I m,SA2 = [I m1 ].
The next step is to calculate the voltage of each module in SA i ; hence, it is necessary to identify its mesh currents (i.e., the elements of I m,SAi ) to the left and to the right of each module.The mesh currents to the right and to the left of the module in row r and column c (i.e., module (r, c)) of SA i are I a (r, c) and I b (r, c), respectively.The relation of I a (r, c) and I b (r, c) with the elements of I m,i is described using an N × M sa,i matrix (M sa mc,i ), where the element (r, c) of M sa mc,i (i.e., M sa mc,i (r, c)) contains the index of the mesh current at the right of the module (r, c) of SA i .This is, M sa mc,i (r, c) = a means that I a (r, c) = I m,SAi (a).If c > 1, M sa mc,i (r, c) = a also means that the mesh current at the left of the module (r, c + 1) is I b (r, c + 1) = I m,SAi (a).Moreover, currents to the left of the first column are zero, i.e., I b (r, 1) = 0 A with r ∈ [1, ..., N].Once I a and I b of each module have been identified, the voltage of each module in SA i is calculated by solving Equation (1).
In the pilot example, the meshes in SA 1 and SA 2 has been numbered as shown in Figure 4.According to such a numeration, for SA1 M sa mc,1 is defined as a 3 × 2 matrix as given in Equation (8).As an example, the currents to the right and to the left of the module in the position (r, c) = (1, 1) are identified from Equation ( 8) as I a (1, 1) = I m,SA1 (1) = I m1 and I b (1, 1) = 0, respectively.Moreover, for the module in the position (r, c) = (2, 2), the current at the right is I a (2, 2) = I m,SA1 (4) = I m4 , and the current at the left is For SA 2 , M sa mc,2 is defined as a 3 × 1 matrix as given in Equation ( 9).Considering the module in the position (r, c) = (1, 1), through the same analysis applied for SA 1 , the current at the right is I a (1, 1) = I m,SA2 (1) = I m1 , and the current at the left is I b (1, 1) = 0.The same situation occurs for the rest of the modules in the sub-array because it is a single string.
In this way, the mesh currents for each module of each sub-array are identified completely and the modules' voltages can be calculated by solving Equation (1).
The vector of non-linear equations F mesh,i is obtained by applying KVL to each mesh in the sub-array.The element F mesh,i (m) results from applying the KVL to mesh m.Moreover, the meshes are numbered from top to bottom and from left to right, in the same way the mesh currents were numbered.The procedure used in this paper to calculate F mesh,i is summarized in Algorithm 1 to simplify its implementation in different programming languages.In such an algorithm, n m is an auxiliary variable used to simplify the construction of the pseudocode.The for loops in lines 2 and 3 go over the columns and rows of SA i , respectively, to identify the mesh currents affecting each module in the sub-array.Then, the current to the right of the module (i, j) (I a (i, j)) is assigned using M sa mc,i .The value of I b (i, j) is defined as 0 [A] for the first column (string) of the array, and it is defined using M sa mc,i for the other columns.With I a (i, j) and I b (i, j) defined, Equation ( 1) is solved to obtain V(i, j).Applying the KVL in each mesh of SA i , it can be observed that V(i, j) is negative for the mesh to the right of the module (i, j) and positive for the mesh to the left of the module (i, j).This is implemented in lines 8, 12, and 13 of Algorithm 1. Finally, in the rightmost mesh, V array needs to be added with a positive sign.
The structure F mesh,1 and F mesh,2 for the pilot example are presented in Equations ( 10) and ( 11), respectively.Those systems of nonlinear equations are obtained by applying Algorithm 1 to SA 1 and SA 2 using Equations ( 8) and ( 9) and applying Equation (1) for each module.
Algorithm 1 Calculate F mesh,i .
INPUT: V array , I m,SAi , M sa mc,i , N m,i , M sa,i , SA i parameters matrices OUTPUT: F mesh,i Set n m = M sa mc,i (i, j), I a (i, j) = I m,SAi (n m ) 5: Solve V(i, j) from Equation (1) with I a (i, j) and I b (i, j) else 10: Set Solve V(i, j) from Equation (1) with I a (i, j) and I b (i, j) 12: Set F mesh,i (n m ) = F mesh,i (n m ) + V(i, j) 13: Set n m = M sa mc,i (i, j) and F mesh,i (n m ) = F mesh,i (n m ) − V(i, j) Once the system of nonlinear equations is defined and it can be evaluated, it must be solved in order to find the vector I m,SAi .Such a system can be solved by means of numerical methods [20].In this paper, the function fsolve included in MATLAB was used with the Trust-Region Reflective method as solver.After I m,SAi has been found, I sa,i is defined as the current of the rightmost mesh in SA i , as shown in Equation (12).
In the case of the pilot example, by solving F mesh,1 and F mesh,2 for a given value of V array , it is possible to find the mesh current vectors I m,SA1 and I m,SA2 .Then, the current of SA 1 and SA 2 are defined as I sa,1 = I m,SA1 (4) and I sa,2 = I m,SA2 (1), since N m,1 = 4 and N m,2 = 1.

Calculate the Array Current
When all the sub-arrays' currents have been calculated for a given array voltage (V array ), the array current (I array ) is obtained by adding the sub-array currents as shown in Equation (13), where N sa is the number of sub-arrays.
Finally, I array = I sa,1 + I sa,2 for the pilot example used through this section.

Integration of the Proposed Solution with the Nodes Voltages Method
Figure 5 shows the general flowchart of the approach presented in this paper integrated with the procedure introduced in [16].
The first part of the procedure is common for both methods, since the first steps are aimed at identifying the sub-arrays and defining their parameters.Then, the method to solve each SA is selected according to the one providing the minimum number of unknown variables.Both methods provide the SA current; then, when all of them have been solved, the array current is obtained by adding their currents as given in Equation (13).It is worth noting that the procedure described in Figure 5 provides the array current for a given array voltage.Therefore, it can be used to construct the I-V and P-V characteristics or to perform dynamic simulations of PV arrays with any configuration.
Flowchart of the proposed modeling approach integrated with the procedure given in [16].

Experimental Validation of the Proposed Model
The experimental validation was performed with 3 × 3 PV array connected in SP, TCT, BL, and the irregular configuration illustrated in Figure 3b.Such configurations were formed using nine ERDM10 PV panels (ERDM Solar, San Andrés Tuxtla, Ver., Mexico) as shown in the experimental platform presented in Figure 6.It is worth noting that an ERDM10 panel contains just one module, i.e., one bypass diode.Moreover, the experimental platform is formed by a current sensor, an oscilloscope a voltage supply, and an electronic device that performs a voltage sweep to obtain the arrays' I-V and P-V curves.In addition, the temperature was measured on the surface of the PV modules using an infrared thermometer.Such a temperature was considered the same for the bypass diodes due to the complexity of taking the measure inside the junction box of each module.In any case, since the bypass diode is placed at the rear of the panel, the temperature of both the bypass diode and the panel is very near.From the study presented in [21], it is observed that both module and bypass diode temperatures can be considered similar if the PV array does not experiment fast irradiance changes.
Finally, the experimental measurement of the I-V curves were carried out in a short time in order to avoid sudden changes in the irradiance level.
The electrical characteristics of the panels were obtained from the manufacturer datasheet [22] and the single-diode model parameters were calculated using the procedures proposed in [4,6].The single-diode model parameters obtained are presented in Table 1.The partial shading conditions for the SP, TCT, BL, and the irregular configuration are described M I ph−SP , M I ph−TCT , M I ph−BL , and M I ph−Irreg matrices, respectively, as shown in Equation ( 14).Those matrices have different values because the irradiance levels were different for all the tests.Moreover, the same partial shading pattern were considered for all the configurations, i.e., the bottom row of the array was shaded, as can be observed in M I ph−SP , M I ph−TCT , M I ph−BL , and M I ph−Irreg .
The rest of the single-diode model parameters matrices are defined as 3 × 3 matrices with the information of Table 1.Finally, the connection matrix of the SP and TCT arrays are 2 × 2 matrices in which all elements are zero and one, respectively, while the connection matrices of BL (M conn−BL ) and irregular (M conn−Irreg ) arrays are given in Equation ( 15).
Current sensor  Figures 7 and 8 present the I-V and P-V curves from the experimental tests and the proposed modeling procedure.Moreover, Table 2 shows the mean absolute percentage error (MAPE) in the prediction of the current (E i ), power (E P ), and GMPP (E GMPP ) of the proposed model for comparison with the experimental results.The values of E i , E P , and E GMPP are below 0.81%, 0.78%, and 0.87%, respectively, which shows that the proposed model can reproduce the electrical behavior of regular and irregular PV array configurations operating under partial shading conditions.

Simulation Results for a Medium PV Field
A 10 × 5 PV array, operating under mismatching conditions, was simulated (in a 2.7 GHz Intel Core i5 processor) to illustrate the performance of the proposed model in medium arrays with respect to the model introduced in [16].The PV field was connected in an SP configuration and an irregular configuration shown in Figure 9.Both arrays were simulated using a nodal analysis approach (as described in [16]), a mesh analysis approach, and the proposed approach.The results were compared with circuital implementation of the arrays in MATLAB/Simulink (2015a, MathWorks, Natick, MA, US) using the SimElectronics toolbox.The simulated PV arrays considered ERMD85 PV panels [22], which are composed of one module.Moreover, the single-diode model parameters, shown in Table 3, were obtained using the procedures introduced in [4,6].The partial shading profile for both configurations is defined by the M I ph matrix, as shown in Equation ( 16), while the matrices M Isat , M β , M Rs , M Rh , M Isatby , and M βby are defined as 10 × 5 matrices with the parameters of Table 3.

The SP Array
When the PV field is connected in an SP configuration, the connection matrix is a 9 × 4 matrix of zeros.By applying the procedure described in the flowchart of Figure 5, such an array has five independent sub-arrays (N sa = 5), each one with nine nodes and one mesh.According to the proposed model, each sub-array must be solved by using the mesh currents analysis.However, the sub-arrays were solved using node voltage analysis, as proposed in [16], so that the performance of the two models could be compared.
Figure 10a shows the I-V and P-V curves of the SP configuration obtained with the proposed model, the model introduced in [16], and the circuital implementation.Moreover, Table 4 presents the simulation time (t sim ) of the two models and the MAPE of the reproduction of the current (E i ), power (E P ), and the GMPP (E GMPP ) of the two models with respect to the Simulink/SimElectronics results.The values of E i and E P are less than 0.9%, and E GMPP is about 0.001% for both models, which illustrates the agreement between the models and the circuital implementation.However, the simulation time required by the model proposed in [16] is approximately 22 times greater than the simulation time of the proposed model.This is because the model proposed in [16] needs to solve a system of nine nonlinear equations and nine unknowns for each sub-array, while the proposed model needs to solve one nonlinear equation with one unknown.In general, for an N × M SP configuration there will be M sub-arrays with N − 1 nodes.Then, the model introduced in [16] needs to solve M systems of nonlinear equations, each one with N − 1 equations and N − 1 unknowns.Instead, the proposed model needs to solve M nonlinear equations with one unknown each, which significantly reduces the calculation burden and the simulation time.The execution time obtained in Simulink/SimElectronics was 13.2 s, which is lower than the times obtained with the proposed procedure and the model reported in [16], both implemented in MATLAB.However, the construction of the circuit in the Simulink environment is a time-consuming task when medium or large PV arrays are considered.For example, Figure 11 shows the 10 × 5 SP array implemented in Simulink, where each module was modeled using the single-diode model.It can be seen that the circuit has a considerable size, and any desired change in the value of the parameters or connections (e.g., an evaluation of the reconfiguration structures) will require the user to modify several elements of the scheme.Instead, the proposed model allows one to change the parameters and connections automatically by modifying the corresponding matrices residing in the computer memory.Moreover, the proposed model can be implemented in any programming language, which avoids the use of commercial and costly software such as Simulink/SimElectronics.In addition, implementing this type of model in, for example, C + + will provide much shorter processing times, as discussed in [16].In any case, in this work, the Simulink/SimElectronics simulation results are taken as a reference to evaluate the accuracy of the proposed procedure due to the extended use of this software in the literature.

The Irregular Array
The simulated irregular array is formed by three sub-arrays (N sa = 3), as illustrated in Figure 9, and its connection matrix is introduced in Equation ( 17).It can be observed that N n,1 = 9 and N m,1 = 11 for SA 1 (i.e., nine nodes and eleven meshes), N n,2 = 15 and N m,2 = 5 for SA 2 , and N n,3 = 9 and N m,3 = 1 for SA 3 .The three sub-arrays were solved by using nodal analysis (as proposed in [16]), mesh analysis, the integration of both methods (as proposed in this paper), and the circuital implementation.This was done to compare the performance of these models and to illustrate the advantages of the proposed model.The I-V and P-V curves obtained with the aforementioned methods are shown in Figure 10b; additionally, the simulation times and the MAPE of the current, power, and GMPP of the circuital simulation results are presented in Table 4.
The errors in Table 5 show that the three methods are able to reproduce the electrical behavior of an irregular PV array with errors less than 0.9%.However, the simulation time of the proposed model was almost half of the simulation time of the model proposed in [16] and the simulation time with mesh analysis.Therefore, the simulation time integrating mesh currents and nodal voltage analysis, to solve each sub-array with the smaller number of nonlinear equations, is less than the simulation time obtained by solving all the sub-arrays with nodal analysis or mesh analysis.The execution time obtained in Simulink/SimElectronics was 11.1 s.As in the previous example, such a time is lower than the ones obtained with the proposed modeling procedure and the procedure presented in [16].However, as was discussed in the previous subsection, the simulations results obtained in Simulink/SimElectronics were used as a reference for the accuracy of the model.

Conclusions
This paper introduced a modeling procedure to reproduce the electrical behavior of a PV array connected in any configuration for a given array voltage.The configuration is represented by a matrix of ones and zeros that represent the presence or absence of connections between two consecutive strings.From such a matrix, it is possible to divide the array into sub-arrays, which can be solved independently to obtain its output current.If the sub-array has fewer meshes than nodes, the mesh current analysis is used to construct a system of nonlinear equations.This paper proposes an algorithm to obtain and evaluate such a system of nonlinear equations so that the system can be solved with a numerical method.Once it is solved, the sub-array current can be calculated and added to the other sub-array currents to obtain the array output current.The proposed method was also integrated with the method introduced in [16], which solves sub-arrays using nodal analysis, to solve sub-arrays with less node voltage than mesh currents.With such integration, the solution of an array requires less time than it would if all the sub-arrays were solved using a single analysis method.
The experimental validation, using a 3 × 3 PV array connected in SP, TCT, BL, and irregular configurations under partial shading conditions, validated the proposed approach in the reproduction of I-V and P-V curves.In all cases, the proposed solution provided errors below 1% in the prediction of current, power, and GMPP values; such results evidence the accuracy of the proposed solution.In addition, the simulation tests carried out using a medium-sized PV array (10 × 5 connected in SP and irregular configurations) also confirmed the suitable operation of the proposed procedure.Moreover, the execution times obtained with the proposed approach were lower than the ones obtained using the procedure presented in [16], confirming the improvement achieved with the integration of nodal and mesh analysis.As in the experimental tests, the errors obtained with the proposed modeling procedure were below 1%.The obtained error values are an improvement over values obtained by other reported techniques such as those in [8,22,23] or [24], which are procedures applicable only to SP arrays.The procedure introduced in this paper can be used for any PV array configuration.In this way, the proposed modeling procedure can be used for PV system reconfiguration analysis, for validation of MPP strategies, and, in general, for designing and planning PV systems.Moreover, since the presented model considers different irradiance and temperature conditions for the modules and bypass diodes of an array, the proposed procedure can be useful to analyze the electrical behavior associated with thermal phenomena as the ones studied in [25].
One limitation of the proposed solution is that it is able to model PV arrays with the same number of modules in each columns (i.e., symmetric structure).However, symmetric structures are widely used in commercial PV arrays [3].The authors are currently working to overcome this limitation, since in a commercial PV array a damaged PV panel can be replaced by a panel with similar electrical characteristics but with a different number of modules, obtaining an asymmetrical structure.The authors are also working on the implementation of the modeling procedure in other languages (such as C and C + +) to improve its versatility.Furthermore, the proposed model can be modified to consider different circuital representations of the PV module, such as the ideal single-diode model [22], the R s model [5], and the two-diode model [26], among others, with the aim of evaluating different PV technologies, accuracy levels, and calculation speeds.

Figure 1 .
Figure 1.An irregular PV array formed by panels of two modules each.

Figure 2 .
Figure 2. Single diode model equivalent circuit including the bypass diode D by .

Figure 3 .
Figure 3. Illustration of the sub-array concept.(a) Sub-arrays in a SP configuration.(b) Sub-arrays in an irregular configuration.

Figure 4 .
Figure 4. Sub-arrays of the PV array shown in Figure 3b (a) SA 1 and (b) SA 2 .

Figure 9 .
Figure 9.The irregular PV array used in simulations.

Figure 10 .
Figure 10.The circuital simulation, the proposed solution, and the procedure introduced in [16]: (a) the SP array; (b) the irregular array in Figure 9.

Table 2 .
Mean absolute percentage errors for experimental tests.

Table 3 .
Parameters for the simulations tests.

Table 4 .
Simulation time and mean absolute percentage errors for the SP simulation test.

Table 5 .
Simulation time and mean absolute percentage errors for the irregular simulation test.