Method to Calculate the Electricity Generated by a Photovoltaic Cell, Based on Its Mathematical Model Simulations in MATLAB

This paper presents a practical method for calculating the electrical energy generated by a PV panel (kWhr) through MATLAB simulations based on the mathematical model of the cell, which obtains the “Mean Maximum Power Point” (MMPP) in the characteristic V-P curve, in response to evaluating historical climate data at specific location. This five-step method calculates through MMPP per day, per month, or per year, the power yield by unit area, then electrical energy generated by PV panel, and its real conversion efficiency. To validate the method, it was applied to Sewage Treatment Plant for a Group of Drinking Water and Sewerage of Yucatan (JAPAY), México, testing 250Wp photovoltaic panels of five different manufacturers. As a result, the performance, the real conversion efficiency, and the electricity generated by five different PV panels in evaluation were obtained and show the best technical-economic option to develop the PV generation project.


Introduction
According to the World Energy Outlook 2014, the global demand for electricity continues to rise at a high rate [1].This incremental demand is supplied by fossil fuels by 70%, while the remaining 24% is supplied by nuclear energy and hydropower, and only 6% is supplied by renewable energy.Renewable energy sources have the characteristics of generating clean energy available in nature, contributing to supplying energy demanded of users, reducing the fossil fuels exhaustion, and mitigating the emission of greenhouse gases [2].
Renewable energy with the largest power generation capacity installed is wind power; however, solar energy is growing at a faster rate than any other form of renewable energy.Solar energy is available everywhere in the world; it is considered inexhaustible and has a higher annual generation potential than the annual electricity generation worldwide.The solar energy potential is harnessed by thermal and photovoltaic systems to generate electricity either on a large scale as a solar farm or on small scale as an autonomous or grid connected photovoltaic system (SFV) [3].Today, the SFV begins to penetrate the world market as an opportunity for electrical energy microgeneration, thanks to the opening in regulations, rules, and policies worldwide, increasing the conversion efficiency of the new cells and the cost reduction per kilowatt installed [4].However photovoltaic technology still has significant challenges; one of them is its perception as a source of energy with a prolonged and unreliable return of investment.This is caused by uncertainty in the amount of electricity generation, due to the daily variations of climatic factors, at the locality where the SFV is installed.A determining factor for investment in photovoltaic generation projects is to have the most realistic estimate of electricity generated by SFV from solar energy available in the locality; therefore, a practical method to calculate this energy is required.
The first proposed works in the literature focus the efforts to calculate theoretically the energy potential radiated per square meter (kW/m 2 ) for a locality, due to the high cost T mean Hr day T mean through T jP-N R p and R s associated with instruments measuring solar radiation.The proposed methods are based on solar radiation data, as C. Hotel's model that is based on direct radiation [5], Liu-Jordan's model that is based on diffuse radiation [6], and other theoretical models that are based on both radiations [7].From the earlier works, a second-step model is presented in the literature to estimate energy potential in available areas such as roofs and facades in urban buildings or houses, with the target of estimating incident energy radiated (kWhr/m 2 ), for planning SFV applications.These proposals are based on digital or mathematical surface models (DSM) [8,9], climatic data simulations [10], geographic information systems (GIS) [11][12][13], and photovoltaic geographical information system (PVGIS) [14].All previous methods estimate the energy potential but not the electricity generation by the panel PV.Recently a model was presented for estimating the cell power considering ambient conditions [15] and their dependence on irradiance and temperature [16]; however, this methodology does not consider the number of sunlight hours and the intrinsic cells characteristic.These previous models are based on the GIS, using the available annual average radiation data and efficiency of PV panel to estimate the generation.
Therefore, the methods stated above estimate the potential for solar radiant energy for a specific location, but they do not estimate the real electric energy generation of PV panel.In practice, the difference between the potential energy radiated regarding the electric power generated by a PV panel is significant; this is due to the panels only generating their maximum power peak, under conditions of 1000 W/m 2 at a cell temperature of 25 ∘ C, known as standard test conditions (STC).It is known that there are locations around the world where STC is not reached and therefore the cell never reaches the maximum power point specified by the manufacturer.
Then, the electricity generated by PV cell is a function of the solar incident radiation (); the cell junction temperature ( P-N ); the sunlight exposure hours (Hr day ); the cell conversion efficiency (); and its maximum power point (MPP) [17].
The last two factors depend on the intrinsic characteristics of the cells and will be reflected in the V-I and V-P characteristic curves, so there are differences between different manufacturers.
The aim of this paper is to provide a method using MATLAB to calculate the electrical energy generation of a cell based on its mathematical model and a reliable historical climate database.

Method Development
The proposed method is based on a photovoltaic cell mathematical model and requires, as input, manufacturer cell data sheet and a climate database.As output, the efficiency and electrical energy generated by a PV panel are obtained.
The flowchart (Figure 1) shows the sequence of the fivestep method, which was implemented in the MATLAB simulation software.
Step 1 (historical climate database).PV panels are sensitive to radiation and temperature variations.When the P-N junction temperature of the cell is increased, the output voltage is reduced.Likewise when the incident radiation in the cell reduces, its current output reduces too.The reductions of voltage, current, or both are reflected directly in an output power reduction and therefore reduce the energy conversion efficiency [18].Given the influence of these parameters on the electricity generation of PV panels, it is necessary to have a reliable climate database of the location, at least five years of records to have a tendency.The parameters required by database are as follows: temperature daily mean ( mean ), radiation daily mean ( mean ), and daylight hours daily mean (Hr day ).
Globally, there are several databases available that can be used such as the Center for Atmospheric Sciences NASA Langley Research Data (LaRC), which provide 22 years of historical data from any quadrant of the globe defined by longitude and latitude [19], and the database of the European Solar Radiation Atlas (ESRA) [20].Most countries have an official climate database; in Mexico the Water National Commission (CONAGUA) provides a database with records for each state over the last 50 years [21].Several governmental or educational institutions maintain climate records such as the Advanced Research Center (CINVESTAV) in Merida, Yucatan, Mexico [22].While a database for a location is more specific, the calculation of the method has major approximation to reality; therefore a local database is recommended.
In this case the proposed method was applied to a PV project in a Sewage Treatment Plant for a Group of Drinking Water and Sewerage of Yucatan (JAPAY) located at Merida, same place as CINVESTAV.
Temperature Annual Daily Mean.Using CINVESTAV climate database to validate the proposed method and using the NASA and CONAGUA database as reference, Figure 2 shows the temperature annual and monthly mean ( mean ), averaging at least five years for Merida city.
CINVESTAV database indicates that  mean per year is 26.45 ∘ C, NASA database indicates 26.4 ∘ C, and CONAGUA database indicates 26.2 ∘ C.These records validate the CIN-VESTAV database which will be used in this method. mean value for Merida is 26.45 ∘ C.
Radiation Annual Daily Mean.Using the same procedure, the radiation daily mean ( mean ) of at least 5 years was obtained.
In Figure 3 the database records of annual and monthly radiation are presented.According to the CINVESTAV database, in Merida city,  mean is 425.78W/m 2 .
Daylight Hours Annual Daily Mean.Applying the same procedure, the number of hours of daylight (Hr day ) is shown in Figure 4, for an annual and monthly daily mean of at least five years.The CINVESTAV database indicates that the number of hours with daylight for Merida is 12.17 hr.
Step 2 (data cell manufacturer).The intrinsic characteristic of photovoltaic cells is that other factors determine the performance and efficiency conversion of radiant energy into electrical energy.
Therefore, it is important to identify in the manufacturer data sheet the following parameters: short-circuit current ( sc ), open circuit voltage ( oc ), the temperature coefficient of  sc (  ), the temperature coefficient of  oc ( V ), the total number of cells connected in the panel (  ), the current at the maximum power point ( mpp ), the voltage at the maximum power point ( mpp ), the nominal operating cell temperature (NOCT), and the panel area (m 2 ).In order to implement the proposed method, a 250 Wp polycrystalline photovoltaic panel S60PC, Solartec brand, is used as an example for calculation [23].Table 1 shows the values of the parameters of S60PC PV panel at STC.
Step 3 (cell mathematical model in MATLAB).In order to determine the maximum electrical power point ( mpp ) that a PV panel generates with a specific junction temperature value ( P-N ) and radiation ( mean ) a mathematical model of the photovoltaic cell is necessary to approximate the nonlinear behavior, through its - and - curves.The simplest mathematical model reported includes one diode parallel to a current source [24,25], where the current source represents  mean and the diode represents the P-N cell junction.An improved version adds the series resistance (  ) effects at the output circuit, to enhance model accuracy, but it exhibited deficiencies with high values of junction temperature [26,27].
Later it was suggested to add the effect of a parallel resistance (  ) with diode and current source to improve the behavior of the model [28,29].Recently Ishaque et al. proposed a mathematical model that adds a second diode in parallel, increasing accuracy without losing the simplicity, modeling with better yield to partial shading, and will be applied to monocrystalline and polycrystalline PV panels with low errors [30].
The last two diodes' mathematical model, represented by the equivalent circuit of the PV cell shown in Figure 5, will be used to derive equations that will lead to the mathematical model which is the base of this step.
The values of the series and parallel resistance (  and   ), appearing in the equivalent circuit of the cell, are not available in the manufacturer data sheet.To obtain these values, clearing   and   from the mathematical equations was required.Applying Norton's theorem for nodes analysis, the following equation is derived: where   is the output current of PV cell;  PV is the current generated by the incidence of light;  1 and  2 are currents of diode 1 and diode 2, respectively; and    is the current of parallel resistance.
Replacing  1 and  2 by the diode characteristic equation and replacing    in terms of output voltage (  ) and output current (  ), (1) can be rewritten as where  SAT1 and  SAT2 are the reverse saturation currents of diode 1 and diode 2, respectively;  is the Boltzmann constant;  is the electron charge;   is the number of cells; and  P-N is the junction temperature of cell.
To obtain   value in terms of   in the  mpp , it is necessary to replace   with  mpp and   with  mpp , and this was obtained after cleaning and replacing: Ishaque and Salam [33], and Márquez et al. [34] to model one or two diodes.
Figure 6 shows the result in MATLAB of the characteristic curves - and -, which through iterations obtained the value of   = 0.37 Ω and   = 400 Ω for the 250 Wp panel S60PC.
Calculation of Junction P-N Temperature.From the annual daily average of temperature ( mean ) that was obtained from climate database, it was necessary to calculate the value of  P-N that causes the effect on output voltage.Definitely there is a relationship between the ambient temperature and the junction temperature cell.However this relationship is not direct or linear.
In practice, it is a complex task to measure the cell junction temperature and other variables involved such as solar radiation, wind speed, the spectral distribution of the irradiation, the absorption capacity and heat dissipation, and the intrinsic construction material, as was reported by Lasnier and Gang-Ang [35].In the literature, there are several studies of methods and procedures for determining the coefficient of temperature junction cell, as were presented by King et al. [36], which uses the short current and open circuit voltage of the PV cell.A practice equation for estimating the junction temperature cell is presented by García and Balenzategui [37], through calculations based on the nominal operating cell temperature (NOCT) in compliance with international standards EN-61646, EN-61215, and E1036M applicable to polycrystalline, monocrystalline, and thin film cells.
The value for NOCT of a cell is available on the manufacturer data sheet.The procedure for determining the junction temperature from NOCT is based on the fact that the difference between ambient temperature and the junction temperature is associated but is independent, and it also has a directly proportional relationship to the radiation for values between 400 and 1000 W/m 2 .This allows for determining the junction temperature based on the following equation: Replacing the value of  mean = 26.45∘ C,  mean = 425.78W/ m 2 , and NOCT = 45, the value of  P-N = 39.75 ∘ C is obtained for 250 Wp PV panel.
Validating V-I and V-P Characteristic Curves.Starting from (2) that describes the mathematical model of the photovoltaic cell in terms of the output voltage and output current, it is required to rewrite  PV ,  SAT1 , and  SAT2 in terms of  mean and  P-N : where the values of   ,  V , and   are available in the manufacturer data sheet as described in Step 2.
Using MATLAB Simulink language, the proposed method was implemented and integrated in a scheme that is shown in Figure 7.The values of data sheet parameter PV panel and  mean and  mean from climate database were described.After the value declarations, there are two "interpreted MATLAB function blocks" that represent MATLAB programs to calculate  P-N from  ambient value and calculate   and   values.The center of the figure is a mask which was the main equation ( 2) developed (Figure 8).In the mask, the value of mean maximum power point (MMPP) and the power yield per unit area was obtained by evaluating and simulating all historic parameters.In the end, there is a third "interpreted MATLAB function block" to calculate the aim of this method and the efficiency and the electricity energy generated by the PV panel.
To prove the mathematical model, the characteristic curve V-P with different values of  P-N and  was plotted, from the values defined for the STC.To validate the performance cell simulated in MATLAB, the V-P characteristic curve provided by the manufacturer was compared with the curve plotted in MATLAB.The maximum power point ( mpp ) had to match with the PV panel power peak defined by the manufacturer.The characteristic curves families obtained for the 250 Wp PV panel are shown in Figure 9, denoting that  mpp is 250 W.     corresponds to the annual daily average of power for the last five years in Mérida city.Figure 10 shows the significant difference between  mpp displayed under STC, compared to MMPP at Mérida according to its historical weather.

Mean Maximum Power
The simulation result shows that, depending on the historical values of the temperature and radiation of a locality, the difference between  mpp(STC) and MMPP should be more or less significant.For Merida city the result between both is  mpp(STC) = 250 W respect MMPP = 101 W.
Using the same method implemented in MATLAB Simulink, Figure 10 shows the results for a full day (Apr.22,2014) in Merida using the different values along the day of temperature and radiation.
Figure 11 demonstrates the behavior and variation of  mpp throughout the day.In the morning  mpp increased, in the middle of the day it reached its maximum, and in the afternoon it decreased its value.In fact, for this particular day  and location,  mpp did not reach the value of  mpp(STC) .This is the relevance to work with MMPP.
Power Yield per Unit Area.An important parameter in the planning electrical generation projects with photovoltaic energy is to know the PV panel power yield (Py) per unit area (W/m 2 ).This data allows quantifying the area required for the SFV installation.
The Py can be calculated under two conditions: for real values corresponding to a locality, as described by (6), and for the values in STC conditions, as described by (7). mpp(STC) is the power peak provided for manufacturer data sheet: Py STC =  mpp(STC) International Journal of Photoenergy Applying ( 6) and ( 7), the result for Merida and the 250 Wp PV panel selected is Py STC = 154.32W/m 2 whereas Py local = 62.65 W/m 2 .There is a loss of yield greater than 60%.So this fall should be attenuated or enhanced depending on the panel under test and the locality.A PV panel with high Py requires lower area than any other one with low Py.Therefore dimensioning the area with values at STC is not the most appropriate, because the MMPP varies from one locality to another, but this value is almost lower than  mpp(STC) .
Step 4 (real conversion efficiency).The real conversion efficiency ( real ) indicates the rate between the power yield at locality and the annual daily mean radiation ( mean ) per unit area in the same location.Substituting the values previously obtained of local power yield for the panel 250 Wp at Merida city  real = 14.71%, The manufacturer conversion efficiency ( STC ) described in the data sheet was obtained through (9), comparing the power yield in contrast to the incident radiation at standard condition test.Py STC was obtained in (7), and  STC was defined as 1000 W/m 2 .The efficiency at STC is  STC = 15.43%: The difference between the real efficiency and standard efficiency indicates that even though it is the same panel, out of standard values, the efficiency always drops.
Step 5 (electric energy generated by a PV panel).The last step is to know the electric energy generated (EEG) by the PV panel.It can be obtained in two ways: by multiplying the instantaneous value of  mpp for the duration of each sample and after adding all energy obtained or using MMPP and multiplying by daylight hours annual daily mean.The result was the same, so this paper uses the latter way to obtain EEG.EEG by PV panel in Merida can be calculated by the next equation: Applying the equation above the electricity generated was obtained for annual daily mean for each 250 Wp PV panel S60MC at Mérida as a result of evaluating in MATLAB, historical climate data in the mathematical model of the photovoltaic cell.EEG = 1.22 kWhr/day.

Results
The proposed method was applied to a project for the Sewage Treatment Plant for Group of Drinking Water and Sewerage of Yucatan (JAPAY), México, testing 250 Wp PV panels of five different manufacturers, to generate 95% of electric power  consumption daily average.Table 2 show the PV panel subject test.
The aim of using the proposed method in this project is to determine the electricity generated for each PV panel tested, likewise, to evaluate and select the best efficiency option, to reduce the cost of investment, and to lower the installation area, providing greater certainty and reliability for investment return.
Applying the three first steps of proposed method the results are presented in Table 3 for five PV panels tested.
To continue with the step there, the simulation results are evaluating simultaneously the 5 different PV panels to visualize and validate in the same graph the results of  mpp(STC) regarding MMPP.The resulting V-P curves are shown in Figure 12.
Table 4 shows the result of applying Step 4 to obtain the power yield and the real conversion efficiency, evaluating at STC and for Merida city for the same 5 PV panels.Table 4 indicates that there are differences between the MMPP generated under Merida climatic conditions regarding  mpp(STC) , and therefore the power yield and the efficiency present differences.Some PV panels have greater efficiency than others.
Finally, applying Step 5, Table 5 presents the results of the electrical energy generated (EEG) at Merida, for each 250 Wp PV panel evaluated in MATLAB simulations under the proposed method.Table 5 presents the EEG for a day, month, and year.

Conclusions
In this paper a practical five-step method is presented to estimate the electrical energy generated by PV panel per day, month, and year, based on the MATLAB Simulink mathematical model of the PV cell and the evaluation of historic climatic variables for a specific locality.Most of the literature works only estimate the energy potential by geographic information systems (GIS) and PVGIS, maps of solar radiation (W/m 2 ), digital surface models (DSM), and simulations of climate variables, but any reported method calculates the energy generated and considers any simultaneity to the response due to intrinsic characteristic between different PV panels and the historical climatic database, so the proposed method incorporates these conditions allowing for a more realistic calculation.It has been demonstrated that there are significant differences in electric energy generation and power yield and its efficiency between the five different PV panels under test.These differences are always lower than STC and therefore are important and critical to estimate the number of panels, the facilities total area, and the PV panels investment required on a project.
The proposed method developed represents a powerful software tool for calculating the electric energy generated by a PV panel.The proposed method provides a good reliability and certainty for PV project investment and allows application in different geographical locations, different PV power peaks, and different panels manufacturers.

Figure 3 :
Figure 3: Radiation annual and monthly daily mean.

Figure 6 :
Figure 6: MATLAB iteration result to calculate   and   .
of R s and R p Calculation of T jP-N with NOCT T mean ambient (Merida) E mean-local (Merida)

Figure 7 :
Figure 7: Implementation of proposed mathematical method in MATLAB Simulink.

Figure 8 :
Figure 8: Cell mathematical model inside of MATLAB Simulink mask.

Figure 9 :Figure 10 :
Figure 9: V-P curves evaluating values of  mean and  P-N respect STC values.
of P mpp(mean-local)

Figure 11 :
Figure 11: Simulation of  mpp at Merida for all of one day.

Figure 12 :
Figure 12: Simulation result of  mpp(STC) versus MMPP in Merida for the 5 PV panels.

Figure 13 :
Figure 13: PV facilities of JAPAY in Merida city.

Figure 16 :
Figure 16: Power demand by Sewage Treatment Plant.

Table 1 :
Data sheet parameters of 250 Wp PV panel.

)
[32]ulation of   and   .From (3),   is function of   , and then, for a finite and positive   value,   is obtained through iterations of   so that it approximates  mpp .Applying the equations in MATLAB simulation for photovoltaic panel subject to test, a series or family of curves - and - is obtained, which permitted finding   and   value, closest to  mpp .Several techniques have been demonstrated with simulations by Shongwe and Hanif[31], Xiao et al.[32],

Table 2 :
250 Wp PV panel of different manufacturers.