Optimizing Method for Photovoltaic Water-Pumping Systems under Partial Shading and Changing Pump Head

: Photovoltaic systems for pumping water, based on direct current powered motor pumps, have great application in small rural regions without electrical networks. In addition, these systems provide environmental beneﬁts by replacing fossil fuels. However, these systems reduce their performance due to partial shading, which is magniﬁed by the internal mismatch of the PV modules. This work proposes an intelligent, low-cost, and automatic method to mitigate these effects through the electrical reconﬁguration of the PV array. Unlike other reported techniques, this method considers the pump head variations. For that, the global voltage and current supplied by the PV array to the motor pump subsystem are introduced to an artiﬁcial neural network and to a third-order equation, which locates the shaded PV module and detects the pump head, respectively. A connection control implements the optimal electrical rearrangement. The selection is based on the identiﬁed partial shading pattern and pump head. Finally, the switching matrix modiﬁes the electrical connections between the PV modules on the PV array without changing the interconnection scheme, PV array dimension, or physical location of the PVMs. The proposed approach was implemented in a real PV water pumping system. Low-cost and commercial electronic devices were used. The experimental results show that the output power of the PV array increased by 8.43%, which maintains a more stable level of water extraction and, therefore, a constant ﬂow level.


Introduction
Pumping systems are essential due to their great diversity of applications, including water supply, which is extracted from wells, rivers, or underground.Water availability is crucial to community development and food production [1].The electrical grid or fossil fuels conventionally energize water-pumping systems.The continued use of fossil fuels, Pumping systems are essential due to their great diversity of applications, in water supply, which is extracted from wells, rivers, or underground.Water availa crucial to community development and food production [1].The electrical grid fuels conventionally energize water-pumping systems.The continued use of foss their negative environmental impact, and the lack of electricity availability in som regions have boosted the use of renewable energy sources, such as wind, biogas, a tovoltaic (PV) [2].
Photovoltaic water pumping systems (PVWPS) comprise hydraulic, mec electrical, and electronic elements.These components are part of power generatio version, and control.There are several PVWPS models whose element selection d on water demand and location conditions (Figure 1).There are PVWPS off-grid an connected, with and without maximum power point tracking (MPPT), and with an out battery, different power controllers, or different motors and pumps [3].The installation of solar pumping systems without a power grid connection h vided benefits to rural and remote areas where there is no electricity or access to el is limited, and where water availability is required for essential functions or sm cultivation.
Several types of AC motors (induction or synchronous) or DC motors (B Brushless) are used in PVWPS without a power grid connection [4].But DC moto pled to DC pumps are usually used for low-power pumping (5 kW) when a sma munity requires it.This type of motor pump does not require inverters or contro convert the DC output of the photovoltaic array (PVA), as its output can be used by the DC motor pump or using the energy stored in batteries [5].For PVA-based saving systems, a PVWPS without a battery and which is interconnected to the usually preferred because of the fast investment return and low-cost implementat In [6], the study presented a PVWPS based on a DC motor pump.The autho pared the investment costs and amortization periods of systems using DC and A ponents.The results revealed a clear economic benefit for the DC-based system, estimated investment payback period of 2.5 years, compared to 8 years for the AC system.This stark contrast highlights the short-term economic efficiency of the DC Furthermore, despite conversion losses, the DC system demonstrated highe throughput.Compared to DC systems, AC systems typically incur higher initial ment costs, exhibit lower efficiency, and necessitate measures to manage high-su rents.On the other hand, DC water pumps offer technical solutions that are rob cost-effective.However, the direct connection of the DC motor pump is relia straightforward, but it cannot operate at the maximum PVA power point when s diation varies during the day.That is, PVWPS, when adequately designed, ar The installation of solar pumping systems without a power grid connection has provided benefits to rural and remote areas where there is no electricity or access to electricity is limited, and where water availability is required for essential functions or small crop cultivation.
Several types of AC motors (induction or synchronous) or DC motors (Brush or Brushless) are used in PVWPS without a power grid connection [4].But DC motors coupled to DC pumps are usually used for low-power pumping (5 kW) when a small community requires it.This type of motor pump does not require inverters or controllers to convert the DC output of the photovoltaic array (PVA), as its output can be used directly by the DC motor pump or using the energy stored in batteries [5].For PVA-based energysaving systems, a PVWPS without a battery and which is interconnected to the grid is usually preferred because of the fast investment return and low-cost implementation.
In [6], the study presented a PVWPS based on a DC motor pump.The authors compared the investment costs and amortization periods of systems using DC and AC components.The results revealed a clear economic benefit for the DC-based system, with an estimated investment payback period of 2.5 years, compared to 8 years for the ACbased system.This stark contrast highlights the short-term economic efficiency of the DC option.Furthermore, despite conversion losses, the DC system demonstrated higher water throughput.Compared to DC systems, AC systems typically incur higher initial investment costs, exhibit lower efficiency, and necessitate measures to manage high-surge currents.On the other hand, DC water pumps offer technical solutions that are robust and cost-effective.However, the direct connection of the DC motor pump is reliable and straightforward, but it cannot operate at the maximum PVA power point when solar radiation varies during the day.That is, PVWPS, when adequately designed, are high-performance systems, but their performance depends mainly on environmental conditions, such as changes in irradiance, temperature, and partial shading (PS).In addition, other factors include the size of the photovoltaic matrix, the total dynamic height (TDH), and the optimization method applied.
Over the years, advances in research have been reported in the literature to improve the performance, efficiency, and economy of DC motor-pump-based PVWPS.These benefits are achieved by designing new optimization strategies and improving control methods.These strategies include the implementation of different types of pumps and motors, the use of various photovoltaic module technologies, the design of power converters, the implementation of control techniques for the maximum power point tracker (MPPT), and methods of electrical reconfiguration of the PVA [7].Among the main optimization techniques are sizing [8,9], control optimization [10,11], and performance prediction [12,13].
The current PVWPS uses electronic systems that increase output power, performance, and efficiency.Most of the proposed DC PVWPS methods have focused on reducing the number of DC-DC converter stages, improving MPPT controller performance, or developing specific power control systems (PCS).This proposal is due to the nonlinear relationship between water flow rate and solar power.The DC-DC converters most commonly used are the boost converter (29.27%) and buck-boost converter (19.51%) [4].Regarding the MPPT, their algorithms are classified into (a) conventional/traditional and (b) evolutionary [14].
On the other hand, PCS is designed to operate with a specific motor pump or a limited group of motor pumps, which usually restricts the number of usable options [15].A trend that some research groups have worked on is using conventional electric motor pumps coupled with standard industrial-use frequency converters or variable speed drivers [16][17][18][19][20].However, problems have been encountered in the implementation related to adapting the frequency converters to the PVWPS operating requirements.According to [21], one of the problems is the difficulty of implementing maximum power point tracking (MPPT), which was solved by adding a basic industrial programmable logic controller to the system.Other solutions are the fuzzy controllers, external to the frequency converter, operating in an open loop, and whose control action is based on obtaining the dynamic behavior of the irradiance [21].
Two critical aspects have yet to be considered in designing PVWPS control systems: the variation of the pump head (H), and the mismatch of the photovoltaic modules (PVMs).Many authors have considered the photovoltaic modules to be identical and the pumping height to be constant; however, both considerations are wrong.In a photovoltaic waterpumping system (PVWPS), several photovoltaic modules (PVMs) are often interconnected in various configurations, such as series, parallel, or series-parallel, to meet the voltage and current requirements of the system.The overall performance of the PVWPS depends on the collective performance of its component PVMs or PV strings.However, despite being of the same brand and power rating, PV modules have inherent variability due to manufacturing or cell differences, resulting in internal mismatch losses.In addition, external factors such as shading or uneven lighting contribute to power losses, called external mismatch losses.In situations where PVMs in the same string experience different levels of sunlight exposure, especially critical in series-connected strings, these differences intensify power losses within the PVWPS, mainly derived from current losses, since the PVM voltage having a weaker dependence on irradiance [22].Conversely, the partially shaded PVM provides the smallest current of the PVMs; this restricts the available current of the string.
Whereas, referring to the pumping head variation, the flow rate (Q) depends on the pumping head and the insolation level, as the system efficiency increases with the decrease in the pumping head at a uniform irradiation level.This increase is because the PVA can consistently supply the energy demanded by the motor-pump subsystem.A pump requires a precise supply of energy to deliver water at the desired head and flow rate, and the PVA must be carefully dimensioned to provide the required power.A larger PVA capacity allows the pump to start operating at lower irradiance levels, thus starting pumping activity earlier in the day with a higher power output.However, opting for a larger installation involves a significant increase in the initial investment [2].
As mentioned earlier, the presence of shaded PVMs is a cause of the low performance of a PVA.A shaded PVM reduces its output current, consequently reducing the output current of the string where the shaded PVM is located.However, shading is not the only cause of output current variation between PVMs.Some of these causes are due to physical defects and other times by internal variations during the manufacture of internal cells, which is called internal mismatch.Some methodologies are reported to overcome the abovementioned drawbacks, focused on improving the per-day pumping output.These works are based on a reconfigurable photovoltaic array (RPVA), which does not require a power converter and ensures a high percentage of power conversion by electrically rearranging the PVMs on each string with the least current difference.Conventional multistage and other PVWPS methods differ from an RPVA system in that the latter does not always operate with the PV field at its MPP under all irradiance and pumping head conditions.However, the potential increase in daily pumping output could compensate for this limitation and offer advantages comparable to those of MPPT techniques.In [23,24], RPVA systems choose a configuration of the PVA by sensing the input irradiance only.Whereas in [25], a four-module PVA changes its configuration based on the irradiance received by the PVA, a high H, and a PS condition.The PVA output or motor-pumping voltage is continuously sensed and compared with a reference voltage set to identify the favorite configuration.The reference voltages are determined by inspection from the simulation plots.It can also be calculated by solving the different configuration equations.The H variation and the PVM mismatch are not considered.In addition, the reference voltage must be recalculated if any system component is changed.For this, the user manually develops multiple experimental tests.These drawbacks allow for a research opportunity to develop new algorithms as alternatives to increase the performance of PVAs under PS conditions and changes in H.
This paper proposes an intelligent method based on machine learning techniques, which allows for the electrical reconfiguration of PVM connected in a series-parallel PVAs to optimize water pumping.This proposed method reduces the effects of external and internal mismatches.Such reconfiguration consists of detecting the shaded PVM, and then considers its electrical reconnection based on the internal parameters of the rest of the PVMs, because the real PVCs or PVMs have different properties or are subjected to different conditions.In consequence, the solar cell with the lowest output, in the worst-case scenario, determines the output of the entire PV module; mismatch losses can be a serious issue in PVMs and PVAs.That means that the power generation and physical integrity of the PVMs are jeopardized by partial shading.
This method is an alternative to optimize the performance of PVWPS based on conventional CD motor pumps, which are implemented in water wells of low depth (less than 20 m) and with little recovery power.This alternative allows for the system operation, even in periods of lower production, for example, in cloudy days or periods or variable pumping heights, avoiding oversizing the PVA, as well as in installing a variable frequency drive for a conventional AC motor pump (not solar) or by acquiring a controller and special solar pump.The method is based on an artificial neural network (ANN), connection control, and switching matrix.The electrical connections between the PVMs on the entire PVA are modified, while the same series-parallel scheme, the PVA dimension, and the physical locations of the PVMs are maintained.Auxiliary PVMs are not required.
The suggested approach was tested experimentally in a real PVA and was implemented in hardware, in contrast to other PVWPS methods that have been reported.The method functions in real-time and online.It is easy to use and reasonably priced because it only needs a small number of sensors and does not require costly or specialized equipment.
This paper is organized into five sections.Sections 1 and 2 present the introduction and the causes-effects of mismatch in the PVMs, respectively.The proposed method and the experimental validation are presented in Sections 3 and 4. Finally, Sections 5 and 6 present the results, discussion, and conclusions.

Causes and Effects of Mismatch in Photovoltaic Elements
The one-diode model is the most common equivalent electrical circuit of an ideal crystalline solar cell, which comprises the output current ( I), the photocurrent ( I ph , the reverse saturation current ( I 0 ), the series resistance ( R s ), the output voltage (V), and the parallel resistance ( R p .This model is described using Equation (1) [22].
Variations of the one-diode model parameters affect the output of a photovoltaic cell (PVC) [22].The variations are due to internal or external factors.The internal factors are changes in the material properties, such as variability of the cell properties during their fabrication, whereas external factors are failures such as cracked cells, soiling, and soldered cells.Environmental conditions, such as irradiation, non-uniform irradiation, cell temperature, dust, bird droppings, angle, humidity, wind speed, and temperature, are also external factors that affect the performance of photovoltaic devices.
The interconnection of real PVCs or PVMs that have different properties or that are subjected to different conditions results in mismatch losses.Because the solar cell with the lowest output, in the worst-case scenario, determines the output of the entire PV module, mismatch losses can be a serious issue in PVMs and PVAs.This means that the power generation and physical integrity of the PVMs are jeopardized by partial shading.This is because the shaded module forces the rest of the modules connected to the series to reverse their bias and power dissipation [22].When a PVM or PVC is in reverse bias, heat causes it to lose power.Unprotected cells experience a thermal breakdown at high temperatures.For protection, bypass diodes are connected in parallel with the PVM or PVC.When the voltage of the diode drops, it activates, forming a short circuit that allows the current to flow through it [26,27].In addition, a blocking diode can be used in each PV string to avoid failure [28].
In addition to these techniques for protecting external factors, there are methods for reducing internal effects or both.One of these methods is the reconfiguration of the PVA.Such a reconfiguration consists of detecting the shaded PVM, and then considering its electrical reconnection based on the internal parameters of the rest of the PVMs.

Reconfiguration Method for PVWPS
The method is applied in a PVWPS composed of a PVA in a series-parallel interconnection scheme and a conventional motor-pump subsystem.The electrical connections between the PVMs in the entire PVA are modified during the PS conditions and change in H.However, the physical location of the PVMs, interconnection scheme, and PVA dimension are not changed during the reconnections, and auxiliary PVMs are not requested.The proposed method uses a neuronal algorithm, a system of equations of the characterized motor pump system, a connection control, and a switching matrix.The global voltage (V) and the global current (I) supplied by the PVA to the motor pump subsystem are required.The temperature (T) of the PVMs also is needed.Figure 2 shows the flowchart of the proposed method.
The procedure incorporates the training and optimization stage, since the method is predicated on a supervised learning machine.The training is required due to the commercial variety of PVAs and motor-pump subsystems.Similar irradiance and temperature conditions are used for the entire training stage.The linear dependence of voltage on temperature, as well as the linear relationship between current and irradiance, are the reasons for these considerations [4].

𝐸𝑅𝐶𝑠 = (𝑁 !)/(𝑁 − 𝑁 )!
(2 where  is the number of PV modules on the PVA, and NMC is the number of PVMs for each combination. A switching matrix automatically carries out the  in both stages of the method.The decision parameters for the electrical changes are different in each stage.In the Execution of all the electrical rearrangement configuration (ERCs) between PVMs in the PVA, considering each partial shading location (PSLs) and changing H.

2.
Acquisition and storage of the I, V, T, and Q signals.

3.
Pre-processing of the I and V signals.

4.
Training of the ANN partial-shading locator.

5.
Training of the H detector. 6.
Selection of the optimal ERCs.
Details of each step of the training stage are described below.The number of the ERCs is obtained by Equation (2).
where N M is the number of PV modules on the PVA, and N MC is the number of PVMs for each combination.
A switching matrix automatically carries out the ERC in both stages of the method.The decision parameters for the electrical changes are different in each stage.In the training stage, all the ERCs are carried out for each PSL and change in H.In the optimization stage, only the selected ERC is performed.The switching matrix components were chosen considering power, electrical properties, robustness, and lower implementation costs.In the present study, the switching matrix is the same as that proposed in [29].This switching matrix comprises several blocks of single-pole double-throw (SPDT) relays.The total number of blocks depends on the number of PVMs, whereas the total number of relays per block is given by Equation (3).The schematic diagram and connection points for each PVM are shown in Figure 3.
where n is the number of PVMs in series, and m is the number of strings in parallel.
Clean Technol.2024, 6, FOR PEER REVIEW 7 training stage, all the  are carried out for each PSL and change in H.In the optimization stage, only the selected  is performed.The switching matrix components were chosen considering power, electrical properties, robustness, and lower implementation costs.In the present study, the switching matrix is the same as that proposed in [29].This switching matrix comprises several blocks of single-pole double-throw (SPDT) relays.The total number of blocks depends on the number of PVMs, whereas the total number of relays per block is given by Equation ( 3).The schematic diagram and connection points for each PVM are shown in Figure 3.
where  is the number of PVMs in series, and  is the number of strings in parallel.The connection control system independently operates the relays of each block for every PVM (Figure 3), providing the connection of each module (Mi) to the connection points of the PVA, named A, D, Bj, and Cj, as shown in Figure 4.The A and D connection points represent the terminals (or extreme buses) of the PVA.In contrast, the Bjs and Cjs points serve as intermediate points within each PVS, where j = 1, 2…, r, are the number of strings, and r is the maximum number of strings in the PVA.The electrical locations of PVMs in the schematic diagram (Figure 4) were named POSk with k = 1, 2…, x, where x is the maximum number of positions.In addition, the PVMs were labeled as Mi, where i = 1, 2…, z, is the number of modules and z is the total number of PVMs.These notations allow us to distinguish among the possible electrical locations that each number of modules could take, without changing their physical location but with changing their electrical connections.The connection control system independently operates the relays of each block for every PVM (Figure 3), providing the connection of each module (M i ) to the connection points of the PVA, named A, D, B j , and C j , as shown in Figure 4.The A and D connection points represent the terminals (or extreme buses) of the PVA.In contrast, the B js and C js points serve as intermediate points within each PVS, where j = 1, 2. .., r, are the number of strings, and r is the maximum number of strings in the PVA.The electrical locations of PVMs in the schematic diagram (Figure 4) were named POS k with k = 1, 2. .., x, where x is the maximum number of positions.In addition, the PVMs were labeled as M i , where i = 1, 2. .., z, is the number of modules and z is the total number of PVMs.These notations allow us to distinguish among the possible electrical locations that each number of modules could take, without changing their physical location but with changing their electrical connections.On the other hand, the pre-processing of the  and  signals involves applying a weighted average filter and a moving average filter.The pre-processing is applied to various data samplings for all the .This averaging process allows for the acquisition of more accurate and representative data of the phenomenon.However, a lower number of On the other hand, the pre-processing of the I and V signals involves applying a weighted average filter and a moving average filter.The pre-processing is applied to various data samplings for all the ERCs.This averaging process allows for the acquisition of more accurate and representative data of the phenomenon.However, a lower number of samples was required for the optimization stage.In both cases, the experiment has been performed by collecting the same length of data for each sample in the two stages.To mitigate false positives and ensure the disappearance of shadowing, measurements are repeated after a delay.This step is necessary due to the transient nature of the phenomenon.
A feed-forward multilayer perceptron structure is used for the ANN partial-shading locator.The structure consists of one input layer, one output layer, and two hidden layers.Each hidden layer has fifteen neurons.A linear activation function was used for the output layer, and the tangent-sigmoidal function was used for the remaining layers.The Levenberg-Marquardt algorithm (Equation ( 4)) was used to train the artificial neural network (ANN) used in this work [30].The parameters considered are the weight vector (w), the iteration index (k), the Jacobian matrix (J), the transpose (G), and the training error (e).
The weights and biases calculated from the training stage are input as variables that the ANN will use in the optimization stage.
The training of the H detector is based on the characterization of the motor pump subsystem.For that, the current and voltage signals are acquired from the PVA, and then the P-Q curve is obtained.The measurement and acquisition of Q is required only in this step.
Finally, there are several ERCs for the PVA (Equation ( 2)).However, only some of these combinations are the most optimal to mitigate the PS conditions and the changing H. Selecting the set of optimal ERC follows a simple but effective process during the training stage, as follows: 1.
Acquisition and storage of the I and V signals of all the combinations of ERC performed for the different PSLs and changing H. Numbers identify each combination to have a database.

2.
Obtaining of the Power-Voltage (P-V) curves of all the combinations of ERC for the different PSL and changing H.

3.
Selection and storage of the ERCs with the MPP of each PSL and each H.This process is carried out multiple times to pre-select the set of consistent ERCs.
The steps of the optimization stage are: 1. Acquisition, processing, and storage of the I and V signals.

2.
Pre-processing of the I and V signals.

3.
Localization and detection of the PVM with partial shading through the ANN partialshading locator.

5.
Selection of the best ERC.

6.
Reconfiguration of the electrical connections between PVMs of the PVA.
The value of H is detected without requiring a water-level sensor.For that, a thirdorder Equation is used (Equation ( 5)).This equation has constants, which were obtained from the analysis of the motor-pump system.This equation is based on the flow through the piping system, as well as the friction losses in pipes of the primary and secondary sections of the pumping system.The acquired I and V are used to calculate P.Then, this calculated value is used to obtain Q from the P-Q curve, which was previously performed in the training stage.
Experimental results can be validated by Equation ( 6).This equation allows the electrical power consumed by the pump-motor subsystem to be obtained according to the pumping head and flow rate.
where η is the motor pump efficiency, g is the gravity, and ρ is the flow density.

Experimental Validation
The method was implemented in hardware and experimentally tested in a real PVWPS.The tests were conducted at the Polytechnic University of Chiapas in Suchiapa, Chiapas, Mexico, located at latitude 16.6153 • N and longitude −93.08974 • W. The tests were conducted outdoors under natural environmental conditions.The temperature range was 24 • C to 37 • C, and the irradiance range was 300 W/m 2 to 950 W/m 2 .The ERC of each PSL and each H were carried out sequentially during the training stage.
Before testing, the I-V curve of each PVM was obtained for two purposes: to verify the physical condition, and to illustrate the real internal mismatch.The verification tests were conducted ten times in each PVM at 20 • C, with a uniform irradiance of 150 W/m 2 .A 4899 controller, a 500 Ω and 200 W rheostat, and a NEMA 17 stepper motor were used to establish the variation in I-V data.
Figures 5 and 6 depict the block diagram of the experimental configuration and the components needed to put it into practice, respectively.The experimental configuration diagram comprises four main sections.The first section contains a PVA connected in an S-P configuration, a sensors unit, a data acquisition system (DAS) unit, and a digital signal processing unit.The processed signals are voltage (V), current (I), temperature (T), flow rate (Q), and configuration number (Y).The second section comprises a water pumping system, whereas the third section contains a connection control unit and a switching matrix, both enabling the order of the ERCs in the PVMs to be changed.Finally, the fourth section comprises an ANN-based locator of partial shading (ANN-BLPS), a pump head detector, and a configuration selector.Commercial elements were used for the implementation of the proposed method.Six polycrystalline PVMs of 150 W (Imp of 8.06 A and Vmp of 18.61 V) were connected in a topology 3Sx2P.A conventional water motor pump of DC, submersible with a power of 1 Hp, was used.The current sensor was an ACS712, a linear current sensor based on the Hall effect, with a range of ±5 A, an approximate sensitivity of 66-185 mV/A, and an Commercial elements were used for the implementation of the proposed method.Six polycrystalline PVMs of 150 W (I mp of 8.06 A and V mp of 18.61 V) were connected in a topology 3S × 2P.A conventional water motor pump of DC, submersible with a power of 1 Hp, was used.The current sensor was an ACS712, a linear current sensor based on the Hall effect, with a range of ±5 A, an approximate sensitivity of 66-185 mV/A, and an analog output of 0 to 5 Volts.The temperature sensors were DS18B20, which were placed in each of the PVMs.Finally, a voltage divider circuit was connected before acquiring the voltage signal.Due to the maximum output voltage of the array being 60 Volts, signal conditioning was required.
In contrast, the maximum voltage measured with the DAS is 5 Volts.The irradiance of the solar simulator was verified with a solar radiation sensor QMS101, which was conditioned with an ADS1115.Moreover, the water flow sensor was a Digiten G1/2 , with a flow rate range of 1 L/min to 30 L/min.
Experimental tests were undertaken on the PVA under different PSL and changing H.The PSLs were identified with numbers assigned from 1 to 7 (Table 1).A translucent canvas with an irradiance reduction of 90% was used to artificially produce the patterns (Figure 7).Moreover, the H variation was emulated with an arrangement of valves (Figure 8).This arrangement avoids adding too much tubing to the pumping system.The pump heads were 10 m, 15 m, 20 m, 25 m, 30 m, and 40 m.A water storage tank and a water source were used to recycle the water.Experimental tests were undertaken on the PVA under different PSL and changing .The PSLs were identified with numbers assigned from 1 to 7 (Table 1).A translucen canvas with an irradiance reduction of 90% was used to artificially produce the pattern (Figure 7).Moreover, the  variation was emulated with an arrangement of valves (Fig ure 8).This arrangement avoids adding too much tubing to the pumping system.Th pump heads were 10 m, 15 m, 20 m, 25 m, 30 m, and 40 m.A water storage tank and water source were used to recycle the water.Experimental tests were undertaken on the PVA under different PSL and changing .The PSLs were identified with numbers assigned from 1 to 7 (Table 1).A translucent canvas with an irradiance reduction of 90% was used to artificially produce the patterns (Figure 7).Moreover, the  variation was emulated with an arrangement of valves (Figure 8).This arrangement avoids adding too much tubing to the pumping system.The pump heads were 10 m, 15 m, 20 m, 25 m, 30 m, and 40 m.A water storage tank and a water source were used to recycle the water.There are 720 potential ERCs in a 3S × 2P PVA (Equation ( 2)).The training stage involved acquiring, storing, and processing data from the 720 ERCs of each PSL and of each changing H.The training of the ANN-BLPS was conducted using MATLAB software version R2020a.On the other hand, the optimization phase comprised collecting, storing, and analyzing data from PVA experiments conducted with any PSL and changing H.
The ANN-BLPS was implemented in an Arduino Mega with a typical clock speed of 16 MHz, and the signal acquisition and conversion were carried out using the 10 bit ADC of the Arduino Mega, enabling the DAS to be configured for a 1 kSa/s sampling rate.Five consecutive signal samplings were acquired from the ERC of each PSL and H in the training stage.Each sampling contains 1000 samples, resulting in a total of 5000 samples for each of the seven locations considered in Table 1 and each pump head, H.Then, the acquired data are transferred to a computer, preprocessed as mentioned above, and used in the ANN-BLPS during the training stage.
In contrast, in the optimization stage, the microcontroller uses only one sampling of the acquired data.The acquired data are pre-processed before being used by the ANN-BLPS.A moving and weighted average filter is applied to I and V signals, respectively.In addition, Q data are of vital importance for system performance analysis.A second acquisition, processing, and storage system is required for that.The second system comprises a 16 × 2 liquid crystal display (LCD), an Arduino UNO, and a Shield Micro SD (Figure 6).
The switching matrix for 3S × 2P PVA needs 36 SPDT relays in order to complete the 720 ERC.An SPDT relay is needed for PVM. Figure 3 displays the block of relays for each PVM.An Arduino Mega controls the switching matrix (Figure 9).A power protection circuit was implemented to activate the reconfiguration matrix switches.This conditioning includes protection diodes, transistors, optocouplers, and resistors.
16 MHz, and the signal acquisition and conversion were carried out using the 10 bit ADC of the Arduino Mega, enabling the DAS to be configured for a 1 kSa/s sampling rate.Fiv consecutive signal samplings were acquired from the  of each PSL and  in th training stage.Each sampling contains 1000 samples, resulting in a total of 5000 sample for each of the seven locations considered in Table 1 and each pump head, .Then, th acquired data are transferred to a computer, preprocessed as mentioned above, and used in the ANN-BLPS during the training stage.
In contrast, in the optimization stage, the microcontroller uses only one sampling o the acquired data.The acquired data are pre-processed before being used by the ANN BLPS.A moving and weighted average filter is applied to  and  signals, respectively In addition,  data are of vital importance for system performance analysis.A second acquisition, processing, and storage system is required for that.The second system com prises a 16x2 liquid crystal display (LCD), an Arduino UNO, and a Shield Micro SD (Fig ure 6).
The switching matrix for 3Sx2P PVA needs 36 SPDT relays in order to complete th 720 ERC.An SPDT relay is needed for every PVM. Figure 3 displays the block of relay for each PVM.An Arduino Mega controls the switching matrix (Figure 9).A power pro tection circuit was implemented to activate the reconfiguration matrix switches.This con ditioning includes protection diodes, transistors, optocouplers, and resistors.As mentioned above, it is necessary to use six relays or one relay block (Figure 3) t control the electrical location of each PVM.Therefore, six digital pins are required to con trol the six relays of each PVM.In this experimental validation of a PVA of six PVMs, 3 digital pins are required to control the reconfiguration matrix.The controller device used has preset functions for activating a group of specific digital pins, known as the outpu pot, which has eight pins or bits.However, in this case, only the six less significative pin were used.Through a programming sequence, an algorithm was generated to control th ports and, thus, digitally control the relay blocks of each PVM.The Port A, Port B, Port C Port F, Port K, and Port L were assigned to control the relay block belonging to the M M2, M3, M4, M5, and M6, respectively.The digital control words sent to the switching ma trix circuit by each port are displayed in Table 2.These characters control the electrica connection of each PVM within the PVA.As an illustration, if partial shading was detected on the PVA, then the electrical connections of the PVA must be reconfigured.In this case As mentioned above, it is necessary to use six relays or one relay block (Figure 3) to control the electrical location of each PVM.Therefore, six digital pins are required to control the six relays of each PVM.In this experimental validation of a PVA of six PVMs, 36 digital pins are required to control the reconfiguration matrix.The controller device used has preset functions for activating a group of specific digital pins, known as the output pot, which has eight pins or bits.However, in this case, only the six less significative pins were used.Through a programming sequence, an algorithm was generated to control the ports and, thus, digitally control the relay blocks of each PVM.The Port A, Port B, Port C, Port F, Port K, and Port L were assigned to control the relay block belonging to the M 1 , M 2 , M 3 , M 4 , M 5 , and M 6 , respectively.The digital control words sent to the switching matrix circuit by each port are displayed in Table 2.These characters control the electrical connection of each PVM within the PVA.As an illustration, if partial shading was detected on the PVA, then the electrical connections of the PVA must be reconfigured.In this case, the M 1 and M 2 modules must be electrically located on the POS 4 and POS 3 (Figure 4), respectively.In this case, the control words 00101000 and 00111111 are written in the Port A and the Port B, respectively (Table 2).It is essential to mention that the two more significative bits are not used, so zero values were assigned.

Results and Discussion
The I-V curves, obtained from four experimental tests carried out to individually verify the six PVMs, are present in Figure 10.This Figure shows the I-V curve shapes and the variation in current and voltage levels on each PVM.The I-V curves show that the maximum current was 1.38 A, which was obtained in M 3 .The minimum current was 1.15 A, and it was obtained in M 1 .Regarding the voltage, the maximum value was 19.5 V, and the minimum value was 17 V.These voltages were obtained in M 5 and M 2 , respectively.
the M1 and M2 modules must be electrically located on the POS4 and POS3 (Figure 4), respectively.In this case, the control words 00101000 and 00111111 are written in the Port A and the Port B, respectively (Table 2).It is essential to mention that the two more significative bits are not used, so zero values were assigned.

Results and Discussion
The I-V curves, obtained from four experimental tests carried out to individually verify the six PVMs, are present in Figure 10.This Figure shows the - curve shapes and the variation in current and voltage levels on each PVM.The - curves show that the maximum current was 1.38 A, which was obtained in M3.The minimum current was 1.15 A, and it was obtained in M1.Regarding the voltage, the maximum value was 19.5 V, and the minimum value was 17 V.These voltages were obtained in M5 and M2, respectively.Table 3 shows the average maximum power generated by each PVM.The highest average maximum power value was 18.15 W, obtained in M 3 .Meanwhile, the lowest average maximum power value was 13.62 W, obtained in M 1 .These results coincide with the results analyzed in Figure 10.It is important to note that the curves of Figure 10 and the values of Table 3 show variations, even though all PVMs are from the same model and manufacturer, and the tests were conducted under identical controlled conditions of temperature and uniform irradiance.The internal mismatch, presented in real PVMs, is illustrated by these results, which are not considered in reported PVWPS that have been validated through simulation.This drawback makes applying the reported methods in an actual PVWPS more difficult.
Figure 11 shows the P-H curves of the PVA obtained during the 720 ERCs due to the presence of the six PSL and the changing H. On each subplot, each one of the 720 ERCs are represented by a different color.The P-H curves show that the output power of PVA decreases more strongly in some specific combinations of PSL and ERCs.The lowest maximum output power value is 800 W. This value is obtained during PSL on M 1 , the PVM with the lowest performance.
Table 3 shows the average maximum power generated by each PVM.The highest average maximum power value was 18.15 W, obtained in M3.Meanwhile, the lowest average maximum power value was 13.62 W, obtained in M1.These results coincide with the results analyzed in Figure 10.It is important to note that the curves of Figure 10 and the values of Table 3 show variations, even though all PVMs are from the same model and manufacturer, and the tests were conducted under identical controlled conditions of temperature and uniform irradiance.The internal mismatch, presented in real PVMs, is illustrated by these results, which are not considered in reported PVWPS that have been validated through simulation.This drawback makes applying the reported methods in an actual PVWPS more difficult.
Figure 11 shows the - curves of the PVA obtained during the 720  due to the presence of the six PSL and the changing .On each subplot, each one of the 720  are represented by a different color.The - curves show that the output power of PVA decreases more strongly in some specific combinations of PSL and .The lowest maximum output power value is 800 W. This value is obtained during PSL on M1, the PVM with the lowest performance.The power decrease is due to the significant variation of internal mismatch among some PVMs and the external mismatch caused by shading.Equation (1) demonstrates that the output current of photovoltaic devices is affected by the variation of their model parameters.This variation can be due to internal or external factors.The effect on the performance of the six PVMs due to different levels of internal mismatch is shown in Figure 10 and Table 3.In addition, Figure 11 shows that pump head variations influence the power demand, which causes the motor-pump system to need more power to pump the different pump heads that were evaluated.In some cases of PS, the system cannot reach a load of 40 m; this effect is due to the maximum power capacity generated by the PVA.The discrepancies in internal parameters of each real PVM, the electrical alterations produced in each PVA position, the influence of PS, and the changing H are the main causes of these results.The ERC that lessens these conditions can be found by analyzing the differences between the P-H curves to extract characteristics related to the PS and H effect in each PVM.In addition, Figure 11 shows that many configurations of the same test have similar maximum points, and some curves do not have substantial differences.These demonstrate that not all 720 ERCs of each PSL and each H contribute to the output power increase.Because only the configurations that permit the maximum output power of the PVA are selected, these results simplify the suggested system.
Figure 12 shows the results obtained from the training of the ANN-BLPS.This Figure reveals that the recognized PSLs agree with the patterns set on the PVA (Table 1).These results are reaffirmed in the experimental results obtained.
The power decrease is due to the significant variation of internal mismatch among some PVMs and the external mismatch caused by shading.Equation (1) demonstrates that the output current of photovoltaic devices is affected by the variation of their model parameters.This variation can be due to internal or external factors.The effect on the performance of the six PVMs due to different levels of internal mismatch is shown in Figure 10 and Table 3.In addition, Figure 11 shows that pump head variations influence the power demand, which causes the motor-pump system to need more power to pump the different pump heads that were evaluated.In some cases of PS, the system cannot reach a load of 40 m; this effect is due to the maximum power capacity generated by the PVA.The discrepancies in internal parameters of each real PVM, the electrical alterations produced in each PVA position, the influence of PS, and the changing  are the main causes of these results.The  that lessens these conditions can be found by analyzing the differences between the - curves to extract characteristics related to the PS and  effect in each PVM.In addition, Figure 11 shows that many configurations of the same test have similar maximum points, and some curves do not have substantial differences.These demonstrate that not all 720  of each PSL and each  contribute to the output power increase.Because only the configurations that permit the maximum output power of the PVA are selected, these results simplify the suggested system.
Figure 12 shows the results obtained from the training of the ANN-BLPS.This Figure reveals that the recognized PSLs agree with the patterns set on the PVA (Table 1).These results are reaffirmed in the experimental results obtained.Table 4 presents the output power of the PVA without reconfiguration with PS and different pumping heads.This Table also shows the detected pumping head and the output power of the PVA with reconfiguration due to PS during the optimization stage.As can be seen, the intelligent reconfiguration of the PVA increases the output power in all the tests, compensating for the power losses due to shading in the PVMs; this compensation is achieved without oversizing the PVA.The maximum output power improvement is 8.43%.This improvement is achieved with the electrical reconfiguration of the PVMs during shading in M1, which coincides with the PVM detected with lower performance.In this case, the output power of the PVA without reconfiguration was 692.14 W, but after intelligent reconfiguration, the output power value was 750.48 W. From Table 4, it can also be observed that there is a relationship between the output power improvement and the number of shaded PVM.The higher and lower performance improvements are obtained Table 4 presents the output power of the PVA without reconfiguration with PS and different pumping heads.This Table also shows the detected pumping head and the output power of the PVA with reconfiguration due to PS during the optimization stage.As can be seen, the intelligent reconfiguration of the PVA increases the output power in all the tests, compensating for the power losses due to shading in the PVMs; this compensation is achieved without oversizing the PVA.The maximum output power improvement is 8.43%.This improvement is achieved with the electrical reconfiguration of the PVMs during shading in M 1 , which coincides with the PVM detected with lower performance.In this case, the output power of the PVA without reconfiguration was 692.14 W, but after intelligent reconfiguration, the output power value was 750.48 W. From Table 4, it can also be observed that there is a relationship between the output power improvement and the number of shaded PVM.The higher and lower performance improvements are obtained when the PS is applied on M 1 and M 3 , respectively.M 1 has the worst individual output power, and M 3 has the best individual output power of all the used PVMs (Table 3).

Conclusions
The combination of artificial intelligence techniques and the electrical reconfiguration of the PVMs, connected in a series-parallel PVA:

•
Allows for the development of an alternative method for optimizing the performance of low-power PVPWS.The reconfiguration is carried out without changing the interconnection scheme, PV array dimension, and physical location of the PVMs.

•
Mitigates the double effect of internal and external mismatch caused by partial shading and photovoltaic cell variations during manufacture.In addition, the proposed method considers power requirements for dynamic changes in the pump head based on the characterization of the motor-pump system.

•
Is a feasible alternative for water pumping in small communities without electricity.This feasibility is due to its low implementation cost.Since this method does not require an inverter, it avoids oversizing the PVA and installing a variable frequency drive for a conventional AC motor pump (not solar) or acquiring a controller and special solar pump.Because the method requires a conventional DC motor pump, additional low-cost and commercially available electronic devices are used.In addition, all the PVA is dynamic, and no auxiliary PV modules are required.

•
Was implemented in hardware and validated experimentally in a real PVPWS, unlike other methods reported for PVWPS.

•
Achieves a maximum output power improvement of 8.43%.This result demonstrates the ability of the method to maintain a more stable level of water extraction and, therefore, a constant flow level, and this capacity offers greater efficiency in two aspects.On the one hand, it can increase the efficiency and, thus, the productivity of the soil in case it is used in irrigation systems.On the other hand, this ability to maintain an almost constant level of water extraction causes solar pumping to be especially effective in water wells with little recovery power.

Figure 1 .
Figure 1.Schematic diagram of a PVWPS without an electrical network connection.

Figure 1 .
Figure 1.Schematic diagram of a PVWPS without an electrical network connection.

1 .
Execution of all the electrical rearrangement configuration () between PVMs in the PVA, considering each partial shading location (PSLs) and changing . 2. Acquisition and storage of the , , , and  signals.3. Pre-processing of the  and  signals.4. Training of the ANN partial-shading locator. 5. Training of the  detector.6. Selection of the optimal .

Figure 2 .
Figure 2. Flowchart of the proposed method.Details of each step of the training stage are described below.The number of the  is obtained by Equation (2).

Figure 2 .
Figure 2. Flowchart of the proposed method.The steps for the training stage are: 1.Execution of all the electrical rearrangement configuration (ERCs) between PVMs in the PVA, considering each partial shading location (PSLs) and changing H.2.Acquisition and storage of the I, V, T, and Q signals.3.Pre-processing of the I and V signals.4.Training of the ANN partial-shading locator.5.Training of the H detector. 6.Selection of the optimal ERCs.

Figure 3 .
Figure 3. Schematic representation of a relay block with the connections for every PVM.

Figure 3 .
Figure 3. Schematic representation of a relay block with the connections for every PVM.

Figure 4 .
Figure 4.The schematic diagram of the electrical locations of the PVMs in a 3Sx2P PVA.

Figure 4 .
Figure 4.The schematic diagram of the electrical locations of the PVMs in a 3S × 2P PVA.

Figure 5 .
Figure 5. Block diagram of the proposed scheme.Figure 5. Block diagram of the proposed scheme.

Figure 5 .
Figure 5. Block diagram of the proposed scheme.

Figure 9 .
Figure 9. Switching matrix and power-protection circuit.

Figure 9 .
Figure 9. Switching matrix and power-protection circuit.

Figure 10 .
Figure 10.Obtained I-V curves from the experimental tests conducted individually on the PVMs.Figure 10.Obtained I-V curves from the experimental tests conducted individually on the PVMs.

Figure 10 .
Figure 10.Obtained I-V curves from the experimental tests conducted individually on the PVMs.Figure 10.Obtained I-V curves from the experimental tests conducted individually on the PVMs.

Figure 11 .
Figure 11.- curves of the PVA obtained during the 720  due to the presence of the six PSL and changing .

Figure 11 .
Figure 11.P-H curves of the PVA obtained during the 720 ERCs due to the presence of the six PSL and changing H.

Figure 12 .
Figure 12. Results obtained from the training of the ANN-BLPS.

Figure 12 .
Figure 12. Results obtained from the training of the ANN-BLPS.

Table 1 .
Identifier number of the PSLs.

Table 1 .
Identifier number of the PSLs.

Table 1 .
Identifier number of the PSLs.

Table 2 .
Control words for the switching matrix.

Table 2 .
Control words for the switching matrix.

Table 3 .
Average output power generated by each PVM during characterization tests at an irradiance of 150 W/m 2 .

Table 3 .
Average output power generated by each PVM during characterization tests at an irradiance of 150 W/m 2 .

Table 4 .
PVA output power with and without intelligent reconfiguration during PS in each PVM.