Dirt Loss Estimator for Photovoltaic Modules Using Model Predictive Control

: The central problem tackled in this article is the susceptibility of the solar modules to dirt that culminates in losses in energy generation or even physical damage. In this context, a solution is presented to enable the estimates of dirt losses in photovoltaic generation units. The proposed solution is based on the mathematical modeling of the solar cells and predictive modeling concepts. A device was designed and developed to acquire data from the photovoltaic unit; process them based on a predictive model, and send loss estimates in the generation unit to a web server to help in decision-making support. The results demonstrated the real applicability of the system to estimate losses due to dirt or electrical mismatches in photovoltaic plants.


Introduction
Photovoltaic conversion is the direct energy transformation from solar radiation into electrical energy through the photovoltaic effect. The electrical energy obtained can then be injected into the electrical grid by some power electronics converter, giving rise to the mini and micro photovoltaic generation systems. Since the enactment of the resolution of the National Electric Energy Agency (ANEEL), number 482/2012, which regulated the mini and microgeneration distributed systems in Brazil, the usage of photovoltaic solar energy has expanded, achieving thousands of new installations each year [1,2].
It is well-known that photovoltaic solar energy presents financial and ecological benefits associated with the strident reduction in costs for implementing generation systems. The photovoltaic technology has emerged as a trend in the electricity market, once it is a viable solution for the electricity supply by companies and customer. This fact is corroborated by international agencies, which predict that photovoltaic energy increases from 2% of the world energy matrix in 2018 to 25% in 2050 [3].
Despite the many benefits as a source for distributed generation, photovoltaic (PV) modules are sensitive to the accumulation of dust and residues on their surface, causing efficiency reduction common to all generation units. Dirt losses can vary from 2% to 25%, maintaining an average of 5%. The deposit of dirt on the modules' surface has been a research subject in several aspects: qualitative, quantitative, and economic [4][5][6][7][8][9][10][11].
One study focuses on determining the appropriate time interval for cleaning modules, proposing a preventive solution; that is, clean the modules at pre-established intervals [8]. It turns out that the seasons of the year imply different climatic conditions, as rains, winds, and air humidity, which may require monthly or biannual cleaning, especially if it is considered the location and conditions of the generation unit installation. For instance, a module installed on a building tends to accumulate less dirt than another installed on the ground; in the same sense, summer rainfalls tend to keep the modules cleaner in this Once some photovoltaic cell parameters are difficult to be measured dynamically [14][15][16], this work estimates energy losses by adopting the MPC modeling.
Regarding the module's physical structure, there are other materials between the front glass and the cells, such as an EVA layer. Since this work deals with the estimation of losses based on the difference between measured and calculated irradiance, the determination of dirt does not depend on the particles or the physical composition of the module. Figure 2 shows the approximate fundamental cell model with four parameters. The series resistor Rs and the parallel resistor Rp represent the non-idealities [14].

Mathematical PV Modeling
where is the photocurrent, the diode reverse saturation current and the current in the parallel resistance.
, which depends on solar irradiance and temperature, is featured in (2); and are presented in (3) and (4), respectively: Substituting (2)-(4) in (1), we find the output current of the solar cell according to (5). Table 1 summarizes the main variables of (5): Once some photovoltaic cell parameters are difficult to be measured dynamically [14][15][16], this work estimates energy losses by adopting the MPC modeling.
Regarding the module's physical structure, there are other materials between the front glass and the cells, such as an EVA layer. Since this work deals with the estimation of losses based on the difference between measured and calculated irradiance, the determination of dirt does not depend on the particles or the physical composition of the module. Figure 2 shows the approximate fundamental cell model with four parameters. The series resistor R s and the parallel resistor R p represent the non-idealities [14]. Once some photovoltaic cell parameters are difficult to be measured dynamically [14][15][16], this work estimates energy losses by adopting the MPC modeling.

Mathematical PV Modeling
Regarding the module's physical structure, there are other materials between the front glass and the cells, such as an EVA layer. Since this work deals with the estimation of losses based on the difference between measured and calculated irradiance, the determination of dirt does not depend on the particles or the physical composition of the module. Figure 2 shows the approximate fundamental cell model with four parameters. The series resistor Rs and the parallel resistor Rp represent the non-idealities [14].

Mathematical PV Modeling
where is the photocurrent, the diode reverse saturation current and the current in the parallel resistance.
, which depends on solar irradiance and temperature, is featured in (2); and are presented in (3) and (4), respectively: Substituting (2)-(4) in (1), we find the output current of the solar cell according to (5). Table 1 summarizes the main variables of (5): The output current is presented in (1): where I Ph is the photocurrent, I D the diode reverse saturation current and I Sh the current in the parallel resistance. I Ph , which depends on solar irradiance and temperature, is featured in (2); I D and I Sh are presented in (3) and (4), respectively: Substituting (2)-(4) in (1), we find the output current of the solar cell according to (5). Table 1 summarizes the main variables of (5): ( 1

Irradiance Estimation Modeling
The estimation system is based on the photovoltaic cell model presented in (5). The module receives direct irradiation and delivers electrical energy. Therefore, reorganizing (5) using the irradiance (Gac), the proposed model is obtained. The proposed model operates differently from the conventional model, so that outputs the irradiance in terms of the output voltage and current, as well as the temperature and internal resistances of the photovoltaic cell, as described in (7): Using the solar irradiance calculated according to (7), as well as the irradiance measured using a radiometer and, considering a module under normal operating conditions, one may calculate the losses percentage in the photovoltaic module (8):

Determination of Series and Parallel Resistances
The series and parallel resistances affect the cell's normal functioning in a different manner, but both flatten the characteristic I-V curve. In Figure 3, as the R p value is reduced, the I-V curve becomes a straight line with a slope of 1/(R p + R s ) in the region known as the current source. When the R s value is increased, the curve is a straight line with an inclination of 1/R s in the voltage source region. Therefore, for high values of R s and low values of R p , the I-V curve will have a shape of a rectangle. One way to calculate the instantaneous value of the series resistance is obtained by differentiating (1) in relation to the voltage, when V Cel = V OC , and isolating R s , obtaining (9).  IVoc is the output current considered when VCel = VOC, that is, at the limit of the opencircuit voltage. In the first part of Equation (9), the β slope of the I-V curve appears, as shown in Figure 3. The second part inserts the effects of solar irradiance and the output voltage. Solving (9) is non-trivial. As a solution for the dynamic Rs value, this work proposes its estimation through the MPC.
The parallel resistance Rp comes from constructive characteristics of the cell due to the insertion of impurities, which culminate in providing an internal path of low impedance to the current, which appears parallel to the current source IPh in Figure 2. The parallel resistance depends linearly on the temperature, and it is inversely proportional to the irradiance. Rp is calculated in (10). RPref was obtained from a curve plotter in the STC conditions, and the methodology was pointed out in [14]. RPref was set as a fixed value, as it has little impact on the estimation [2]. The STC condition was validated with an irradiance sensor: (10)

Predictive Modeling
The MPC algorithm predicts the values of a signal or variable, identifies patterns or Please ensure your intended meaning was retained [2,13]. Predictive control relies on mathematical representation in the state space of the plant to design the configuration of the controller. In the configuration, the future outputs of a given prediction horizon are estimated at each timestamp (t).
State and output prediction is based on two parameters to design the Predictive controller: control horizon (Nc) and prediction horizon (Np). The control horizon is the number of parameters needed to reach the future control path. Given the state vector x, the future state vector can be predicted with Np samples. The prediction horizon defines the size of the cost function optimization window. Through the prediction horizon, it is determined how many future time intervals are intended to predict the outputs to estimate the necessary performance of the manipulated variable.
Following the guidelines presented in [12], the predictive model is based on the modeling of plants through the state space according to (11): Equation (12) represents the discrete form.  I Voc is the output current considered when V Cel = V OC , that is, at the limit of the open-circuit voltage. In the first part of Equation (9), the β slope of the I-V curve appears, as shown in Figure 3. The second part inserts the effects of solar irradiance and the output voltage. Solving (9) is non-trivial. As a solution for the dynamic R s value, this work proposes its estimation through the MPC.
The parallel resistance R p comes from constructive characteristics of the cell due to the insertion of impurities, which culminate in providing an internal path of low impedance to the current, which appears parallel to the current source I Ph in Figure 2. The parallel resistance depends linearly on the temperature, and it is inversely proportional to the irradiance. R p is calculated in (10). R Pref was obtained from a curve plotter in the STC conditions, and the methodology was pointed out in [14]. R Pref was set as a fixed value, as it has little impact on the estimation [2]. The STC condition was validated with an irradiance sensor:

Predictive Modeling
The MPC algorithm predicts the values of a signal or variable, identifies patterns or Please ensure your intended meaning was retained [2,13]. Predictive control relies on mathematical representation in the state space of the plant to design the configuration of the controller. In the configuration, the future outputs of a given prediction horizon are estimated at each timestamp (t).
State and output prediction is based on two parameters to design the Predictive controller: control horizon (N c ) and prediction horizon (N p ). The control horizon is the number of parameters needed to reach the future control path. Given the state vector x, the future state vector can be predicted with N p samples. The prediction horizon defines the size of the cost function optimization window. Through the prediction horizon, it is determined how many future time intervals are intended to predict the outputs to estimate the necessary performance of the manipulated variable.
Following the guidelines presented in [12], the predictive model is based on the modeling of plants through the state space according to (11): Equation (12) represents the discrete form.
Electronics 2021, 10, 1738 6 of 14 The plant state-space matrices are used to find the augmented matrices [13], which are the basis of the predictive control design. The augmented matrices A, B and C are generated according to (13)-(15), respectively: where o m = 0 0 . Based on the augmented matrices, matrices F and φ are defined, in which the dimensions directly depend on the choice of Nc and Np. Matrices F and φ are presented in (16) and (17), respectively: The optimal solution that defines the action of the MPC controller is presented in (18) [13]: is defined as the Hessian Matrix and R s r(k i ) is related to the operation point of the system. The gain of the MPC controller is presented in (19), considering N c = 4 and, (20) presents the MPC controller output, with K MPC = K x K y . Figure 4 depicts the final configuration of the control as a block diagram: Electronics 2021, 10, 1738 The gain of the MPC controller is presented in (19), considering Nc = 4 and, (20) presents the MPC controller output, with = [K K ]. Figure 4 depicts the final configuration of the control as a block diagram:  A reduced reference PV model (excited by a flashlight) has been used to obtain the state space representation of the PV system. The reference module has the specifications for the MPP point, 8.8 A and 5.1 V. The irradiance obtained by the light beam was of the order of 400 W/m 2 , a current of approximately 3.5 A was drained. Figure 5 presents the PV system (5a) and the step response obtained with an oscilloscope. A reduced reference PV model (excited by a flashlight) has been used to obtain the state space representation of the PV system. The reference module has the specifications for the MPP point, 8.8 A and 5.1 V. The irradiance obtained by the light beam was of the order of 400 W/m 2 , a current of approximately 3.5 A was drained. Figure 5 presents the PV system (5a) and the step response obtained with an oscilloscope.
As a first-order system, the transfer function is presented in its standard form by (21). The term K represents the plant gain and τ the system time constant, according to (22) and (23), where ∆E is the variation of the input and ∆S is the variation of the output.
As a first-order system, the transfer function is presented in its standard form by (21). The term K represents the plant gain and τ the system time constant, according to (22) and (23), where ∆E is the variation of the input and ∆S is the variation of the output.
Observing the response to the step, Figure 5, it is possible to verify Te = 20 µs; ∆E = 1 and ∆S = 3. Thus, the transfer function is given by (24): Adopting Ts = 0.4 µs, (25) and (26) were obtained, which represent the discrete statespace model of the photovoltaic module: Based on the prediction of the state variable, the predicted outputs behave according to (27): where A = 0.9048, B = 3.807 × 10 −7 and C = 7.5 × 10 5 .
The predicted outputs are used to estimate the best range for Rs. N p = 5 and N c = 4 were adopted, and these values were defined from the best performance of the response from computer simulations. Figure 6 shows a block diagram of the MPC estimator with the insertion of the predictive control model. The Reference block provides the reference for the MPC module, supplying the module current under ideal conditions of temperature and irradiance. The MPC controller, together with the state-space model, estimates the energy losses of the photovoltaic module. The predicted outputs are used to estimate the best range for Rs. Np = 5 and Nc = 4 were adopted, and these values were defined from the best performance of the response from computer simulations. Figure 6 shows a block diagram of the MPC estimator with the insertion of the predictive control model. The Reference block provides the reference for the MPC module, supplying the module current under ideal conditions of temperature and irradiance. The MPC controller, together with the state-space model, estimates the energy losses of the photovoltaic module.  Figure 7 presents the results of a comparison between real dirt losses, and a simulation performed using the MPC-based estimator (losses ranging from 80% down to 0%). The proposed model correctly estimates the Rs values to predict the actual PV losses. Table  2 presents the Rs estimated values.  Figure 7 presents the results of a comparison between real dirt losses, and a simulation performed using the MPC-based estimator (losses ranging from 80% down to 0%). The proposed model correctly estimates the R s values to predict the actual PV losses. Table 2 presents the R s estimated values.   Figure 7 presents the results of a comparison between real dirt losses, and a simulation performed using the MPC-based estimator (losses ranging from 80% down to 0%). The proposed model correctly estimates the Rs values to predict the actual PV losses. Table 2    The Rs values represent the first-order portion in the differential equation presented in (9), considering the operation at the maximum power point (MPP) for various irradiance levels.

Results and Discussions
The energy losses MPC estimator is based on the mathematical model of the solar cell for calculating G ac , as well as on the predictive model for estimating an approximation for Rs. In the block diagram presented in Figure 6, the difference between G ac and G am shows how much energy was not absorbed on the front surface of the PV module.
We have designed and prototyped an embedded device that implements the MPC estimator. The device was fitted to the available space in conventional string boxes, and it was installed next to the sectioning elements and DC protection of the generation unit. Figure 8 shows the prototype at the Federal University of Mato Grosso do-Sul photovoltaic solar plant (UFV-UFMS), being connected directly at the output of the arrangement. The device was built to withstand a maximum voltage of up to 900 V and a current of up to 30 A. The prototype has a Microchip DSPic 30F4013 processor as a logical unit and possesses Wi-Fi, RS-232, a USB communication system, a PT-1000 temperature sensor, and a radiometer reading of up to 1300 W/m 2 . The voltage acquired by the device is divided by the number of series modules to properly feed the estimation model. Figure 8 shows the prototype at the Federal University of Mato Grosso do-Sul photovoltaic solar plant (UFV-UFMS), being connected directly at the output of the arrangement. The device was built to withstand a maximum voltage of up to 900 V and a current of up to 30 A. The prototype has a Microchip DSPic 30F4013 processor as a logical unit and possesses Wi-Fi, RS-232, a USB communication system, a PT-1000 temperature sensor, and a radiometer reading of up to 1300 W/m 2 . The voltage acquired by the device is divided by the number of series modules to properly feed the estimation model. The solar irradiance data were acquired from a solarimetric station on-site, which is equipped with a radiometer of reference.
Even the generation unit having an installed power of 10.45 kWp, the inverter is capable of injecting only 8.2 kW into the power grid. As the solar irradiance achieves approximately 750 W/m 2 , the inverter moves its point of operation outside the MPP region, making the voltage of the modules increase to the maximum point voltage (VMPP). The effectively injected power remains fixed at 8.2 kW, resulting in a reduction in energy injection of up to 20% to the maximum available power, which usually happens between 10:00 a.m. and 2:00 p.m., a time interval that presents the maximum instantaneous peaks of irradiance. This difference between the power of the modules and the inverter allows testing the precision of the system in estimating R s even in the presence of electrical incompatibility between the generation system and the inverter.
At the experimental evaluations, a sunny day reference was adopted so that the climatic variations do not interfere with the results. The data were inserted into the MPC estimation system, which returned the incident solar irradiance values and the solar irradiance effectively absorbed by the modules. Figure 9 shows the irradiance values obtained from the radiometer (red line), the irradiance estimated by the prototype MPC (blue line) and the irradiance calculated mathematically, without correction. Figure 10 shows the relative error between the measured and estimated irradiance. Figures 9-11 present the measurements according to the local time, with the first measurement taking place shortly after 7:30 a.m. and the last measurement around 4:00 p.m. Figure 9 shows the irradiance values obtained from the radiometer (red line), the irradiance estimated by the prototype MPC (blue line) and the irradiance calculated mathematically, without correction. Figure 10 shows the relative error between the measured and estimated irradiance. Figures 9-11 present the measurements according to the local time, with the first measurement taking place shortly after 7:30 a.m. and the last measurement around 4:00 p.m.  Once the irradiance used by the modules (Gac) is defined in (6), the estimation system calculates the available electrical power, that is, the power that the electrical system should have demanded from the photovoltaic modules. The goal is to identify the losses due to dirt and the losses resulting from incompatibilities that may exist from the electrical system of the generation unit.
The graph in Figure 11 presents the power reported by the inverter (blue line) and the power calculated by the MPC estimator. Figure 11. Comparison between acquired and estimated powers. Once the irradiance used by the modules (Gac) is defined in (6), the estimation system calculates the available electrical power, that is, the power that the electrical system should have demanded from the photovoltaic modules. The goal is to identify the losses due to dirt and the losses resulting from incompatibilities that may exist from the electrical system of the generation unit.
The graph in Figure 11 presents the power reported by the inverter (blue line) and the power calculated by the MPC estimator. Under normal operating conditions, the power from the inverter should have the same behavior as the estimated power. Once there are differences between both powers, the conclusion is that there may be electrical losses in the system (in this case, losses due to incompatibility between PV system power and maximum inverter power). It is also noteworthy that the estimated peak power is compatible with the solar zenith irradiance on the day of the test (1075 W/m²), reaching 11 kW.
After analyzing the losses results from the experiment, the average daily losses due to dirt were about 4.95%, and the average daily losses due to incompatibility were 15.68%, Figure 11. Comparison between acquired and estimated powers.
Once the irradiance used by the modules (G ac ) is defined in (6), the estimation system calculates the available electrical power, that is, the power that the electrical system should have demanded from the photovoltaic modules. The goal is to identify the losses due to dirt and the losses resulting from incompatibilities that may exist from the electrical system of the generation unit.
The graph in Figure 11 presents the power reported by the inverter (blue line) and the power calculated by the MPC estimator.
Under normal operating conditions, the power from the inverter should have the same behavior as the estimated power. Once there are differences between both powers, the conclusion is that there may be electrical losses in the system (in this case, losses due to incompatibility between PV system power and maximum inverter power). It is also noteworthy that the estimated peak power is compatible with the solar zenith irradiance on the day of the test (1075 W/m 2 ), reaching 11 kW.
After analyzing the losses results from the experiment, the average daily losses due to dirt were about 4.95%, and the average daily losses due to incompatibility were 15.68%, resulting in a total loss of 20.63%.
It is also worth mentioning the performance of the MPC correcting the values of the series resistance of the solar cells. As seen in Figure 9, the green line represents the calculated irradiance without correction of R s , where the effects of the inverter saturation appear characterized by the curve flattening. The blue line represents the estimated irradiance with the corrected values of R s by MPC. One may observe that the line is quite akin to the line of the solar irradiance measured by the radiometer, demonstrating the effectiveness of the MPC estimator.
The performance of the predictive model removed the effects of the disturbance out of the electrical system configuration, presenting only the irradiance that effectively affected the photovoltaic cells of the modules. Comparing the estimated and measured irradiances, the dirt losses were 4.95%, free from the problem arisen by the MPPT tracking and the electrical anomalies of the generation system due to incompatibility between the system and the inverter. Figure 12 presents the daily dirt losses and the daily rainfalls from March to October 2019. Losses are around 15% between March and June, most likely due to the location of the system and the low rainfall in the period. The performance of the predictive model removed the effects of the disturbance out of the electrical system configuration, presenting only the irradiance that effectively affected the photovoltaic cells of the modules. Comparing the estimated and measured irradiances, the dirt losses were 4.95%, free from the problem arisen by the MPPT tracking and the electrical anomalies of the generation system due to incompatibility between the system and the inverter. Figure 12 presents the daily dirt losses and the daily rainfalls from March to October 2019. Losses are around 15% between March and June, most likely due to the location of the system and the low rainfall in the period.
There is a remarkable increase in dirt losses from July to September (around 18%), as the rains were very low during this period. In July, there was only 4 mm of rain, on 26 August mm and on 7 September mm, in the PV plant location. A manual cleaning procedure on the modules was carried out on 27 September, which caused the losses to be reduced sharply on the following day. From additional experiments using a particle sensor along the period of experiments, there were fine particles (particles with diameters between 1 μm and 10 μm) suspended in air, and they may be one impact factor to the dirt on the modules.

Conclusions
This work proposed an MPC system to dirt losses estimates and identifying electrical anomalies in photovoltaic power plants. The MPC system receives energy production data from the inverter and irradiation data from a solarimetric station. The losses estimation is based on the difference between the measured irradiance and the estimated irradiance We have evaluated the MPC estimator for a period of 8 months (March to October/2019). The system estimated losses are 15% between March and June. From July to September, the losses increased to 18% as the rains were very low during this period. Those results reveal that the dirt was determinant to the energy losses in the PV power plant.
The MPC estimator device prototype operates as a power monitoring system, presenting to the administrator the estimation of losses due to dirt and electrical losses. The There is a remarkable increase in dirt losses from July to September (around 18%), as the rains were very low during this period. In July, there was only 4 mm of rain, on 26 August mm and on 7 September mm, in the PV plant location. A manual cleaning procedure on the modules was carried out on 27 September, which caused the losses to be reduced sharply on the following day. From additional experiments using a particle sensor along the period of experiments, there were fine particles (particles with diameters between 1 µm and 10 µm) suspended in air, and they may be one impact factor to the dirt on the modules.

Conclusions
This work proposed an MPC system to dirt losses estimates and identifying electrical anomalies in photovoltaic power plants. The MPC system receives energy production data from the inverter and irradiation data from a solarimetric station. The losses estimation is based on the difference between the measured irradiance and the estimated irradiance We have evaluated the MPC estimator for a period of 8 months (March to October/2019). The system estimated losses are 15% between March and June. From July to September, the losses increased to 18% as the rains were very low during this period. Those results reveal that the dirt was determinant to the energy losses in the PV power plant.
The MPC estimator device prototype operates as a power monitoring system, presenting to the administrator the estimation of losses due to dirt and electrical losses. The device has a Wi-Fi communication system that sends real-time information to a supervisory software enabling the administrator to know any anomalies and make decisions regarding the cleaning and maintenance of the modules. Additionally, an administrator can monitor the energy effectively generated by the system and compare it to the energy generation expected by the system. This prototype aims to meet a demand in the photovoltaic solar energy market that lacks similar monitoring solutions, meeting demands from small microgeneration units to large units.
As a future work, the MPC system and its properties can also be applied to control the power converter to optimize energy harvesting as an MPPT algorithm improvement and/or for increasing current controllers stability and robustness of the converter.