Methodology and Application of Statistical Techniques to Evaluate the Reliability of Electrical Systems Based on the Use of High Variability Generation Sources

This study presents a new methodology, based on Monte-Carlo techniques to evaluate the reliability of a carbon-free electricity generation system based on renewable sources; it uses as inputs the variation of the electricity demand and the fluctuations in the renewable supply and provides the renewable system to be installed to guarantee a specific supply reliability level. Additionally, looking for a reduction of this renewable system, the methodology determines the improvements by the incorporation of nuclear power and electricity storage. The methodology is of general application, its implementation being possible under different contexts, such as different time horizons and different future energy scenarios, both for developing, emerging, and developed countries. The only requirement is to have a sufficient database from which to make predictions for future scenarios of electrical generation–demand balances. As an example of practical implementation, the electrical system reliability for the particular case of Spain in 2040 has been forecasted. When considering the fluctuations in solar and wind power contributions, very high values of the installed power from these renewable sources are needed to reach a high reliability of the system. These values decrease substantially if contributions from nuclear and storage technologies are included.


Introduction
The worldwide demand for primary energy grows continuously [1] and is covered in a high percentage, in the order of 80%, with fossil fuels [2]. This scenario implies a double problem. The first issue is the foreseeable depletion of these types of fuels [3], which would put into question the continuity of the electricity supply in a more or less near future and would have undoubted economic impacts for countries without fossil resources. The second issue, even more serious and in a shorter term, deals with the unacceptable growth of greenhouse gases emissions due to the utilization of these fossil fuels when the need is already to reduce these emissions as much as possible [4][5][6][7].
For several reasons-easiness to be used, necessity to integrate renewable sources in the energy scenario, reduction of end user emissions, etc.-electricity has a growing participation in the final energy consumption of all countries [8], expecting to exceed 30% in the medium term in many of them [9]. Nowadays, electricity generation is based on the use of fossil fuels in more than a 67% and is responsible for about 35% of the total CO 2 emissions from the energy sector [2]. Therefore, improving electricity generation up to reach a zero-carbon scenario will reduce dependence on fossil fuels and eliminate GHG emissions in significant percentages, becoming an important element for a sustainable energy system [10,11]. To reach this goal of clean generation, the electricity The paper is organized as follows: the current section has introduced the problem and the technical background to address its study; Section 2 details the developed methodology; in the Section 3, this methodology is applied to the case of Spain for the expected electricity scenario in 2040 [53], providing a practical lay out and application of the problem, displaying their results and interpretation; and finally, in Section 4, major conclusions on the methodology and on its application to Spain are detailed.

Methodology
To determine the renewable contribution to the electricity generation in a carbon-free situation, we can follow the IEA approach [54]. The total electricity demand is given by: where ED(i, t) is the evolution of the demand from each sector: I = 1 (transport); 2 (industry); 3 (residential); 4 (services), and 5 (agriculture and fishing), being t the specific time considered. This electricity demand is covered with contributions from the different primary energy sources: PE(j, t)ρ j (2) where PE(j, t) is the evolution of the contribution from each primary energy source: j = 1 (coal); 2 (oil); 3 (natural gas); 4 (nuclear), and 5 (renewable + hydro), and ρ j represents the efficiency, or capacity factor as it is usually referred, of the electricity generation process when using that particular primary energy source. CO 2 emissions from the electricity generation process will be due to the use of the fossil sources in this process. They are given by: PE(j, t)e j (3) with e j being the specific emissivity, in tons of CO 2 emitted for each oil equivalent ton of the primary source j used in the electricity generation process. The decay of these fossil contributions, in a scenario looking for zero-carbon emissions in the electricity generation, should follow the assumed evolution of the CO 2 emissions. So, starting from the values at a particular year t 0 (t 0 = 2016 in the last available version of the IEA database [55]), we can deduce: With the condition to be null for the year t = T f , when the electricity generation should be carbon free, so: TEM(T f ) = 0 and PE(j, T f ) = 0 for j = 1, 2, 3 The requirement for renewable energy contribution in that carbon free scenario is given by: and its evolution to reach the carbon-free situation: where PE(4, t) represents the contribution from nuclear energy to electricity generation that, initially considered as null in T f , could nevertheless be needed to assure a complete reliability of the electricity supply with a lower contribution from renewable sources. Equations (1) and (6) are usually implemented to deduce the annual requirements in electricity and the total renewable energy contributions for its fulfillment, respectively. Nevertheless, a higher time resolution is needed to deduce the reliability of the electrical system. A 100% reliability requirement for a zero-carbon scenario implies the capability of the installed renewable system to provide the needed energy contributions to fulfill the electricity demand. The use of annual averaged generation values is possible for sources that have low variability or low specific importance in the electricity generation mix, such as: cogeneration, waste, biomass, etc. However, this is not the case for solar photovoltaic and wind energies, whose time dependences are very high [56] and uncorrelated with the electricity demand, while they are responsible for higher contributions to renewable electricity generation [14]. Therefore, to determine the reliability of the electricity supply in a zero-carbon scenario, an energy balance should be made with high time resolution. This total electricity balance (TEB) is given by: where CF k ·PE(5, k, t i ) is the electricity provided by the k-th renewable generation source at the time t i , and TED(t i ) is the electricity demand at that time t i . There are two different ways to consider the contribution of the k-th renewable source, dependent on its time availability. For the case of the above-mentioned fully available sources, their contribution can be estimated as its total electric energy generation capacity PE(5, k, t i ) multiplied by its electric generation efficiency, ρ k . For the variable energy renewable sources, as photovoltaic and wind systems, a more elaborated way to estimate their production must be developed.

Statistical Analysis of the Electricity Balance
A possible method for the evaluation of the electricity supply reliability using variable generation sources is the application of a statistical analysis to the existing databases for renewable generation and electricity demand. On this first approach, averaged values are calculated for each one of the time points of the day covered by the database, consequently, the intra-daily variations of these magnitudes along a typical or averaged day are considered.
Using this approach, we can deduce the averaged nominal power of wind and solar photovoltaic sources needed to cover an averaged electricity demand for a particular year in the future. The procedure includes several steps. First, the available historical database for electricity generation and demand should be collected. Second, the extrapolation to a particular time in the future should be addressed. For the electricity demand, daily averaged values deduced from the available database must be obtained and the future demand profile is obtained by applying a multiplier factor to this averaged curve. For the renewable sources, two different groups are considered: low and high variable electricity generation sources. For low variation renewable sources, such as: biomass, hydraulic, cogeneration, residual wastages, etc., the future contributions to electricity generation are obtained by multiplying the calculated mean database values by a multiplier factor. Finally, for the high variable sources, as it is the case for wind and solar PV, an iterative process determines future estimations. The seed value to start the iteration procedure could be the total installed power obtained from a simple electricity balance analysis, which considers a daily equilibrium between electricity generation and demand. Iterations, increasing the renewable power levels, are carried out up to the point in which the electricity balance is positive at all times, reaching, in this case, a 100% supply reliability. Lower reliability values could be accepted if international electricity exchanges to cover electricity shortages are considered.
The expression of the total energy balance at each time measurement point, Equation (8), must be slightly modified to consider the contribution of each renewable source and to estimate demand and generation forecasts: (9) in which MF k is the multiplying factor of the low variable renewable sources, CF k is a constant capacity factor of each low variability source and CF i,k is a variable capacity factor of each high variability source at each time point, P k is the currently installed power of each source, RSF is the setting factor of the iterative process for the high variable sources. Finally, the future demand forecast is estimated through the last term of Equation (8), which has been rewritten to consider demand forecast; P DEM,i is the current power demanded at each time; and MF DEM is the multiplier factor for future calculations.
To have the capability to cover the demand, this balance must be zero or positive all the time or during the desired time percentage to reach the degree of demand coverage. Then, defining Nt as the time coverage percentage in which this energy balance is zero or positive: Nt i (TEB(t i ) ≥ 0) being equal to 1 if TEB (t i ) is positive or zero and 0 if negative, ∑ Nt i is the total number of measurement points. Consequently, the iterative process (carried out through the increase of RSF) finishes when Nt(%) reaches 100% reliability or when the desired demand coverage is reached.

Monte-Carlo Optimization of the Electricity Balance
Nevertheless, the above-described approach does not consider the possible decoupling between electricity demand and variable renewable generation, despite the fact that this effect could seriously compromise the supply reliability. In fact, while the demand profile could be in the high-value zone of its probability distribution function (PDF) for a particular day or period of time, wind and/or photovoltaic production could be in a lower-profile region. Consequently, in this hypothetical situation, the demand would be far from being met, although on average it would be fully covered. Therefore, a more detailed analysis taking into account these possibilities led to the development a stochastic approach that could be addressed by using a Monte-Carlo simulation method. Then, under these conditions, not only intra-daily variations have to be considered, but also the inter-daily ones, in such a way that all variables are randomly sampled covering the whole range of values in their PDF. The Wilks methodology has been followed [57,58] for the Monte-Carlo analysis in this study. Figure 1 displays a flowchart of the methodology followed to carry out this Monte-Carlo analysis. The major difference with the statistical approach resides in the use of a random sampling for the variables following a PDF with a high daily variability, i.e., electricity demand, solar photovoltaic and wind generation. In particular, 59 random combinations of values for these three variables were used. This choice is justified because the output variable under study, the electricity generation-demand balance, has only a oneside interval restriction to meet (electric balance has to be zero or positive, not comprised between two values) and the coverage and confidence intervals obtained with this number of combinations allows for a 95 × 95% confidence and coverage percentages [57,58]. The multi-variable analysis approach of the Wilks formula obtained by Wald [59,60] could also have being used with the same number of random combinations, as this methodology needs the same number of random simulations than Wilk's for one-side interval output variable. needs the same number of random simulations than Wilk's for one-side interval output variable. In this Monte-Carlo approach, an important factor is the estimation of the PDF followed by each variable. Then, the application of the methodology begins with the estimation from the historical database of the PDF followed by each variable. To determine the PDF followed by the different variables, several goodness-of-fit tests have been performed for the data; in particular, the Kolmogorov-Smirnov test has been used to estimate the best fit PDF. In the case that normal is the best-fit PDF, complementary tests such as Chisquare, Shapiro-Wilk statistic and Z-value for both skewness and kurtosis have been performed to reaffirm that the distribution of this variable is compatible with the normal distribution. Uniform and normal are considered to be the most common PDFs found for the different variables. In the case of a uniform PDF, only the minimum (xmin) and maximum (xmax) values allowed to the variable have to be determined (Figure 2A). For a normal PDF, the mean and variance have to be determined, but also the desired coverage, which usually is 95%, then the minimum and maximum values are determined as displayed in  In this Monte-Carlo approach, an important factor is the estimation of the PDF followed by each variable. Then, the application of the methodology begins with the estimation from the historical database of the PDF followed by each variable. To determine the PDF followed by the different variables, several goodness-of-fit tests have been performed for the data; in particular, the Kolmogorov-Smirnov test has been used to estimate the best fit PDF. In the case that normal is the best-fit PDF, complementary tests such as Chi-square, Shapiro-Wilk statistic and Z-value for both skewness and kurtosis have been performed to reaffirm that the distribution of this variable is compatible with the normal distribution. Uniform and normal are considered to be the most common PDFs found for the different variables. In the case of a uniform PDF, only the minimum (x min ) and maximum (x max ) values allowed to the variable have to be determined (Figure 2A). For a normal PDF, the mean and variance have to be determined, but also the desired coverage, which usually is 95%, then the minimum and maximum values are determined as displayed in Figure 2B.
Random sampling of Wilks' methodology consists of 59 random combinations of groups of values for all variables involved in the electric energy balance at all database measurement points. Since all databases have a temporary resolution (number of daily measurement points, Figure 3A), a random sampling should theoretically be carried out for each one of these points. Each sampling should independently follow the variable PDF at each measurement point ( Figure 3B displays a variable following different Gaussian PDFs for each time data point). However, an "independent random sampling" for each daily measurement point ( Figure 3C) is not an appropriate estimation because there could be a very large variation between sampled values of two adjacent points of a variable. In the extreme case, it would be possible to change from maximum to minimum values of a variable between two adjacent measurement points, having the variable a very pronounced Random sampling of Wilks' methodology consists of 59 random combinations of groups of values for all variables involved in the electric energy balance at all database measurement points. Since all databases have a temporary resolution (number of daily measurement points, Figure 3A), a random sampling should theoretically be carried out for each one of these points. Each sampling should independently follow the variable PDF at each measurement point ( Figure 3B displays a variable following different Gaussian PDFs for each time data point). However, an "independent random sampling" for each daily measurement point ( Figure 3C) is not an appropriate estimation because there could be a very large variation between sampled values of two adjacent points of a variable. In the extreme case, it would be possible to change from maximum to minimum values of a variable between two adjacent measurement points, having the variable a very pronounced saw-tooth shape ( Figure 3D), a condition that would be almost impossible to happen in reality.  Random sampling of Wilks' methodology consists of 59 random combinations of groups of values for all variables involved in the electric energy balance at all database measurement points. Since all databases have a temporary resolution (number of daily measurement points, Figure 3A), a random sampling should theoretically be carried out for each one of these points. Each sampling should independently follow the variable PDF at each measurement point ( Figure 3B displays a variable following different Gaussian PDFs for each time data point). However, an "independent random sampling" for each daily measurement point ( Figure 3C) is not an appropriate estimation because there could be a very large variation between sampled values of two adjacent points of a variable. In the extreme case, it would be possible to change from maximum to minimum values of a variable between two adjacent measurement points, having the variable a very pronounced saw-tooth shape ( Figure 3D), a condition that would be almost impossible to happen in reality.  Consequently, instead of this unrealistic situation, what has been carried out is a "single random sampling", i.e., only one sampling consisting of 59 random combinations of values for all the considered variables ( Figure 4). However, by proceeding in this way, one database point has to be chosen, for instance, the one with a greater dispersion among all the daily resolution points, the point for which the random sampling is carried out ( Figure 4A), after which the extrapolation of the 59 sampled values has to be carried out to the remaining time points. For each sampled point, the upper and lower tails are estimated ( Figure 4B). In all cases, the allocation of the upper and lower tails of the PDF would be maintained among all the daily temporary database resolution ( Figure 4C), i.e., it could be said that the whole averaged curve of each variable is shifted to include the sampled point but considering the PDF followed by each point ( Figure 4D). Consequently, instead of this unrealistic situation, what has been carried out is a "single random sampling", i.e., only one sampling consisting of 59 random combinations of values for all the considered variables ( Figure 4). However, by proceeding in this way, one database point has to be chosen, for instance, the one with a greater dispersion among all the daily resolution points, the point for which the random sampling is carried out ( Figure 4A), after which the extrapolation of the 59 sampled values has to be carried out to  Figure 4B). In all cases, the allocation of the upper and lower tails of the PDF would be maintained among all the daily temporary database resolution ( Figure 4C), i.e., it could be said that the whole averaged curve of each variable is shifted to include the sampled point but considering the PDF followed by each point ( Figure 4D). Consequently, instead of this unrealistic situation, what has been carried out is a "single random sampling", i.e., only one sampling consisting of 59 random combinations of values for all the considered variables ( Figure 4). However, by proceeding in this way, one database point has to be chosen, for instance, the one with a greater dispersion among all the daily resolution points, the point for which the random sampling is carried out ( Figure 4A), after which the extrapolation of the 59 sampled values has to be carried out to the remaining time points. For each sampled point, the upper and lower tails are estimated ( Figure 4B). In all cases, the allocation of the upper and lower tails of the PDF would be maintained among all the daily temporary database resolution ( Figure 4C), i.e., it could be said that the whole averaged curve of each variable is shifted to include the sampled point but considering the PDF followed by each point ( Figure 4D).  The way in which each random value would be extrapolated to each time data point depends on the PDF followed by each variable: in most cases, normal or uniform PDFs. For a uniform PDF, given a sampling value, as the interval limits are known, it is easy to extrapolate for the remaining data time points; it is only needed to keep constant the relative tail length (percentage of values above and below the sampled value). For the case of a normal PDF, given a sampling value, the parameters characterizing the normal PDF (mean and standard deviation) are known. Therefore, the allocation of its upper and lower tails can be maintained constant for the remaining time points. For this, the simplest way will be the conversion of the normal followed by each variable at the selected temporal data point to the standard normal, i.e., for the selected point, the transformation = − will be applied, so that Y will follow an N(0,1). Then, this value will be kept constant for all time data points. Therefore, finally, by undoing this transformation, the values of the remaining points with the particular values of their PDF and keeping the same lowerupper tails as the initial point will be obtained. In summary, the curves followed for each of the 59 shortlists of sampled values are estimated; the averaged curves are shifted to include the sampled points. As a result, the electricity balance can be calculated for each group of curves.
From this point, the procedure is similar to the one described in the previous section, with the only difference being that the total energy balance is extended to the 59 sets of randomly sampled variable values of the Wilk's methodology. The 59 electric energy balances are carried out, the balance of balances, has to cover the demand at the desired de- The way in which each random value would be extrapolated to each time data point depends on the PDF followed by each variable: in most cases, normal or uniform PDFs. For a uniform PDF, given a sampling value, as the interval limits are known, it is easy to extrapolate for the remaining data time points; it is only needed to keep constant the relative tail length (percentage of values above and below the sampled value). For the case of a normal PDF, given a sampling value, the parameters characterizing the normal PDF (mean and standard deviation) are known. Therefore, the allocation of its upper and lower tails can be maintained constant for the remaining time points. For this, the simplest way will be the conversion of the normal followed by each variable at the selected temporal data point to the standard normal, i.e., for the selected point, the transformation Y = X−µ σ will be applied, so that Y will follow an N(0,1). Then, this value will be kept constant for all time data points. Therefore, finally, by undoing this transformation, the values of the remaining points with the particular values of their PDF and keeping the same lower-upper tails as the initial point will be obtained. In summary, the curves followed for each of the 59 shortlists of sampled values are estimated; the averaged curves are shifted to include Sustainability 2021, 13, 10098 9 of 26 the sampled points. As a result, the electricity balance can be calculated for each group of curves.
From this point, the procedure is similar to the one described in the previous section, with the only difference being that the total energy balance is extended to the 59 sets of randomly sampled variable values of the Wilk's methodology. The 59 electric energy balances are carried out, the balance of balances, has to cover the demand at the desired degree (for instance, at a 99% or all the time). The total energy balance for each time measurement point and for each sampled value is: (11) in which CF i,j,k is the capacity factor of each high variability source at each time point for each sampled value and P DEM,i,j is the current power demanded at each time and for each sampled value. In order to cover the demand, this balance has to be higher or equal to zero during all the time or during the desired time percentage. Then, defining Nt as the time percentage in which this energy balance is positive: As for the statistical analysis, the iterative process (carried out through the increase in RSF) also finishes when Nt(%) reaches 100% demand coverage or when the desired reliability is reached. To start the iteration procedure, the same seed values than in the previous case would be used; of course, in this first step, the averaged generation-demand balance only covers a percentage of the demand. Then, as explained in the previous method, an iterative process is carried out to improve this balance-a process that finishes when a positive final electric generation-demand balance is achieved for every time interval, or when a lower electric energy coverage percentage is reached, considering that international exchanges could cover the time period in which demand is not fully covered.
In order to reduce the requirements on renewable sources, the methodology also considers the possibility to include in the electricity generation scenario other non-carbon sources, as is the case for nuclear energy and, given the decoupling between generation and demand, also the possibility of electricity storage in order to reduce the amount of electricity excess.

Results and Discussion
In this section, the development of the methodology applied to a particular case is carried out. Specifically, the definition and approach of the problem is presented, together with the necessary information to arrive at the most accurate predictions possible, so that, finally, the results obtained are exposed and their subsequent discussion. In particular, the application of the previously developed methodology to the specific case of Spain has been carried out, aiming to estimate the needed renewable power to install in order to reach a full reliability electricity supply in a zero-carbon scenario.
Although the methodology has been applied to forecast the particular case of Spain in 2040, this methodology is of general application. So, it is possible to implement the described method under different contexts, such as different detail degrees of the available information, of time horizons and of future energy scenarios, both for developing, emerging, and developed countries. The only requirement is to have a sufficient database from which to make predictions for future scenarios of electrical generation-demand balances, in such a way that the carried-out calculations have a sufficiently solid starting point, and consequently, the reached conclusions are consistent enough too.
Concentrating on the example of the methodology application, apart from the economic crisis period (2008-2013), there has been a continuous increase in the electricity demand in Spain, mainly from the industrial, residential, and service sectors, as can be deduced from Figure 5 obtained using the IEA database [55]. Figure 6 shows the data for total electricity demand and the fraction that electricity represents in the total consumption of final energy and their lineal extrapolation up to the year 2040. The obtained results indicate an increase in the contribution of electricity up to 32% with a demand of electricity of about 30 Mtoe (3.49·10 2 TWh), a factor 3 over the values in 1990.  Contributions from each primary energy source to electricity generation [55] are shown in Figure 7. Using the specific emissivity of the fossil fuel detailed at Table 1, and the amount of each fossil fuel contribution to electricity generation, we can deduce the CO2 emissions in this generation process. Total emissions and its exponential extrapolation up to zero carbon emissions in 2040 are plotted at Figure 8.   Contributions from each primary energy source to electricity generation [55] are shown in Figure 7. Using the specific emissivity of the fossil fuel detailed at Table 1, and the amount of each fossil fuel contribution to electricity generation, we can deduce the CO2 emissions in this generation process. Total emissions and its exponential extrapolation up to zero carbon emissions in 2040 are plotted at Figure 8.  Contributions from each primary energy source to electricity generation [55] are shown in Figure 7. Using the specific emissivity of the fossil fuel detailed at Table 1, and the amount of each fossil fuel contribution to electricity generation, we can deduce the CO 2 emissions in this generation process. Total emissions and its exponential extrapolation up to zero carbon emissions in 2040 are plotted at Figure 8 Using Equation (4), we can calculate the amount of each fossil fuel contribution and its evolution up to be null in 2040. The results are plotted in Figure 9; applying Equation (7), the required amount of renewable energy is deduced and displayed in     Using Equation (4), we can calculate the amount of each fossil fuel contribution and its evolution up to be null in 2040. The results are plotted in Figure 9; applying Equation (7), the required amount of renewable energy is deduced and displayed in  Using Equation (4), we can calculate the amount of each fossil fuel contribution and its evolution up to be null in 2040. The results are plotted in Figure 9; applying Equation (7), the required amount of renewable energy is deduced and displayed in Figure 10  Assuming the values in Table 2 for the generation efficiency and the number of annual operation hours at the nominal power of the different generation systems, we can deduce the required nominal power of these systems for the evolution of the generation process up to reach zero carbon emissions in 2040 ( Figure 11).  Assuming the values in Table 2 for the generation efficiency and the number of annual operation hours at the nominal power of the different generation systems, we can deduce the required nominal power of these systems for the evolution of the generation process up to reach zero carbon emissions in 2040 ( Figure 11). Assuming the values in Table 2 for the generation efficiency and the number of annual operation hours at the nominal power of the different generation systems, we can deduce the required nominal power of these systems for the evolution of the generation process up to reach zero carbon emissions in 2040 ( Figure 11).   The values displayed at Figure 11 are only a first approach to the needed nominal power of the renewable electricity generation system, because only mean annual values of the energy generation sources are used (only averaged capacity factor for several generation sources are considered). To determine a more realistic estimation of that power, the methodologies described in the previous section are applied. In this section, the application of the previously developed methodology to the case of Spain, looking for a zeroemission scenario in the year 2040, is carried out. REE data for February 2017 have been used and three different distributions between wind and solar photovoltaic contributions to the total installed renewable power are considered: 40-60%, 50-50% and 60-40%, respectively.

Statistical Approach
Using the REE data [61], the PDF followed by each variable has been obtained and, using them, the two analyzed models based on a statistical approach have been addressed. The first of them only uses the PDFs averaged values, while in the second model, using the Monte-Carlo Wilks methodology, PDF averaged values and their standard deviations are used.

Data Analysis
REE data for each variable with daily variation (demand, wind and solar photovoltaic) has been analyzed and their PDFs have been calculated. As the REE data have a resolution time of 10 minutes, then 144 time data points per variable and day are available. Consequently, 144 different PDFs per variable can be obtained. All of them have turned out to be normal distributions, whose mean and standard deviation values are summarized in Table 3. Figure 12 displays the mean, maximum and minimum values along the The values displayed at Figure 11 are only a first approach to the needed nominal power of the renewable electricity generation system, because only mean annual values of the energy generation sources are used (only averaged capacity factor for several generation sources are considered). To determine a more realistic estimation of that power, the methodologies described in the previous section are applied. In this section, the application of the previously developed methodology to the case of Spain, looking for a zero-emission scenario in the year 2040, is carried out. REE data for February 2017 have been used and three different distributions between wind and solar photovoltaic contributions to the total installed renewable power are considered: 40-60%, 50-50% and 60-40%, respectively.

Statistical Approach
Using the REE data [61], the PDF followed by each variable has been obtained and, using them, the two analyzed models based on a statistical approach have been addressed. The first of them only uses the PDFs averaged values, while in the second model, using the Monte-Carlo Wilks methodology, PDF averaged values and their standard deviations are used.

Data Analysis
REE data for each variable with daily variation (demand, wind and solar photovoltaic) has been analyzed and their PDFs have been calculated. As the REE data have a resolution time of 10 minutes, then 144 time data points per variable and day are available. Consequently, 144 different PDFs per variable can be obtained. All of them have turned out to be normal distributions, whose mean and standard deviation values are summarized in Table 3. Figure 12 displays the mean, maximum and minimum values along the day and, superimposed, several PDFs for specific time values. Along the complete study, we are assuming that these PDFs maintain the same structure up to 2040.  1 The demand PDF has been normalized in such a way that their mean was the unity, while for wind and solar photovoltaic generation, the capacity factor has been used to characterize the mean value of their PDFs. For the other variables (which include the rest of renewable energies, such as hydraulic, cogeneration or residual wastages), their estimations have been carried out by using the mean values of the current generation and the assumption of a multiplying factor to consider future increases in 2040. Table 4 details the characteristics of the renewable sources and the assumed values in 2040. For the other variables (which include the rest of renewable energies, such as hydraulic, cogeneration or residual wastages), their estimations have been carried out by using the mean values of the current generation and the assumption of a multiplying factor to consider future increases in 2040. Table 4 details the characteristics of the renewable sources and the assumed values in 2040.

Daily Averaged Approach
Considering the intra-daily variations in the electricity generation and demand, the procedure described in Section 2.1 has been performed. The obtained results, after the iterative process, are shown in Figure 13. The total renewable power needed to cover the demand with a reliability of 99% for the three considered renewable distribution between wind and photovoltaic sources are 191.1, 222.4 and 268.6 GW, respectively.

Daily Averaged Approach
Considering the intra-daily variations in the electricity generation and demand, the procedure described in Section 2.1 has been performed. The obtained results, after the iterative process, are shown in Figure 13. The total renewable power needed to cover the demand with a reliability of 99% for the three considered renewable distribution between wind and photovoltaic sources are 191.1, 222.4 and 268.6 GW, respectively. Figure 13. Final iteration results for the evolution of electricity balance for the three renewable penetration levels. Figure 13. Final iteration results for the evolution of electricity balance for the three renewable penetration levels.

Monte-Carlo Approach
Using Monte-Carlo techniques, in particular, the Wilks' approach, the procedure described in Section 2.2 is carried out. As in the previous approach, an additional study has been carried out for the three possible scenarios of wind and solar photovoltaic distribution levels. Final electricity balances are shown in Figure 14 for the three scenarios.
The results of the two statistical analysis models for different demand coverage are displayed in Figure 15. Significant increases in the needed power are obtained when the most accurate approach, the Monte-Carlo method, is used. As shown in Table 5 and Figures 15 and 16, total installed powers between 700 and 900 GW are needed to cover the electric demand for all the three renewable penetration level scenarios. In the case under study, the differences in the total installed power between the consideration of an averaged day and the Monte-Carlo analysis to carry out the calculations led to a factor higher than 3 in the power requirements for reliabilities approaching 100% of the time demand coverage.

Monte-Carlo Approach
Using Monte-Carlo techniques, in particular, the Wilks' approach, the procedure described in Section 2.2 is carried out. As in the previous approach, an additional study has been carried out for the three possible scenarios of wind and solar photovoltaic distribution levels. Final electricity balances are shown in Figure 14 for the three scenarios. The results of the two statistical analysis models for different demand coverage are displayed in Figure 15. Significant increases in the needed power are obtained when the most accurate approach, the Monte-Carlo method, is used. As shown in Table 5 and Figures 15 and 16, total installed powers between 700 and 900 GW are needed to cover the electric demand for all the three renewable penetration level scenarios. In the case under study, the differences in the total installed power between the consideration of an averaged day and the Monte-Carlo analysis to carry out the calculations led to a factor higher than 3 in the power requirements for reliabilities approaching 100% of the time demand coverage.      1 Equilibrium in the monthly averaged balance between generation and demand (constant generation and demand, only the capacity factor of each generation source is considered), extrapolation of REE's February 2017 data to year 2040.

Additional Strategies Based on Nuclear Energy and Electricity Storage
Considering that the electricity demand prediction for Spain in 2040 is about 3.49·10 2 TWh, as shown at Figure 6, a total installed power of 40 GW to cover this demand would be required, assuming a constant demand curve over time. Consequently, using only renewable energies, the Monte-Carlo results indicate the need for an increase in the order of a factor of 20 over this initial value. Then, in order to make a future renewable scenario with zero CO 2 emissions in the electricity generation possible, the renewable energies should be supported by other non-polluting generation options. One possible strategy is the use of nuclear energy, which is being used in Spain at this moment. With a total installed power of 7.6 GWs and a capacity factor of 93.4% (data of REE for 2017 [61]), it has a value that is approximately a quarter of the valley demand estimated for the year 2040. The second strategy could be the storage of the electricity generation excess; currently there is in Spain a total power installed of 5 GW, mostly as pumping storage power plants. The pumping storage is not the only way to take advantage of the excess of electricity generation. The use of mega-batteries could be another possible way in the near future, or the use as distributed storage of the large fleet of electric vehicles, which is also expected in the near future, or even other storage technologies that can appear or become worthwhile in the considered 20 year time horizon.
Summarized results of the analyzed scenarios using Monte-Carlo's approach and including nuclear power and electricity storage are displayed in Figures 17-19. This Monte-Carlo approach is the most accurate, since it takes into account the variations for both generation and demand along time, considering their fluctuations between days and within a day. In these three figures, the pure renewable scenario has been also displayed in order to have a reference value. Results for renewable generation, plus the current nuclear installed power and its double and triple values, which approximately coincide with a quarter, half, and three quarters of the valley demand previsions for 2040, are displayed in Figure 17. Similarly, the renewable generation plus current, double, and quadruple of the installed storage capacity are displayed in Figure 18. Finally, Figure 19 shows the combined use of nuclear and storage strategies to reduce renewable power requirements to be installed.
while in the considered 20 year time horizon.
Summarized results of the analyzed scenarios using Monte-Carlo's approach and including nuclear power and electricity storage are displayed in Figures 17-19. This Monte-Carlo approach is the most accurate, since it takes into account the variations for both generation and demand along time, considering their fluctuations between days and within a day. In these three figures, the pure renewable scenario has been also displayed in order to have a reference value. Results for renewable generation, plus the current nuclear installed power and its double and triple values, which approximately coincide with a quarter, half, and three quarters of the valley demand previsions for 2040, are displayed in Figure 17. Similarly, the renewable generation plus current, double, and quadruple of the installed storage capacity are displayed in Figure 18. Finally, Figure 19 shows the combined use of nuclear and storage strategies to reduce renewable power requirements to be installed.     The maintenance of Spain nuclear power, 7.6 GW, shows an important reduction of about 200 GW of the total installed renewable power needed to cover the growing demand. By doubling or tripling this nuclear power, significant additional reductions would be reached, as shown in Figure 17.
Another possible strategy would be the development of storage technologies, as shown in Figure 18. During the whole storage process, an efficiency of 80% has been considered for all possible storage technologies (20% losses during pumping-turbine processes in pumping stations, loading-storage-discharge in battery storage, or in any other storage technology). The existing 5 GW of storage power capacity would lead to significant reductions in renewable power needed to cover the demand. Reductions from about 925 to 250 GW would be reached. The amounts would have additional reductions, to about 175 GW, if the storage power capacity was increased up to 20 GW. The maintenance of Spain nuclear power, 7.6 GW, shows an important reduction of about 200 GW of the total installed renewable power needed to cover the growing demand. By doubling or tripling this nuclear power, significant additional reductions would be reached, as shown in Figure 17.
Another possible strategy would be the development of storage technologies, as shown in Figure 18. During the whole storage process, an efficiency of 80% has been considered for all possible storage technologies (20% losses during pumping-turbine processes in pumping stations, loading-storage-discharge in battery storage, or in any other storage technology). The existing 5 GW of storage power capacity would lead to significant reductions in renewable power needed to cover the demand. Reductions from about 925 to 250 GW would be reached. The amounts would have additional reductions, to about 175 GW, if the storage power capacity was increased up to 20 GW.
The combined use of renewable energies supported by both technologies-nuclear generation and storage technologies-would lead to even better achievements, as displayed in Figure 19. The renewable power to install reaches values of approximately 180 GW for the current nuclear power and storage capacity. Achieving even higher reductions, up to approximately 100 GW of total installed power, when increasing the nuclear installed power by a factor of 3 and the storage capacity by a factor of 4.
The influence in the total installed power when considering the different nuclear generation and storage powers capacities is summarized in Figure 20. As mentioned above, the use of storage technologies is necessary when having important contributions of variable renewables energies, because unacceptable values of installed power are required. Reductions from about 700 or 900 GW, depending on the renewable penetration scenario, to approximately 200 GW with only a few GWs of storage capacity. Even higher reductions, when maintaining or increasing the currently installed nuclear power, are achieved at approximately a rate of 5 GW of total power needed per installed GW of nuclear generation power.
the use of storage technologies is necessary when having important contributions of variable renewables energies, because unacceptable values of installed power are required. Reductions from about 700 or 900 GW, depending on the renewable penetration scenario, to approximately 200 GW with only a few GWs of storage capacity. Even higher reductions, when maintaining or increasing the currently installed nuclear power, are achieved at approximately a rate of 5 GW of total power needed per installed GW of nuclear generation power.

Dependency between Scenarios and Energy Wastages
Another drawback of the pure renewable scenario, which has not been mentioned up to this moment, is the enormous amount of energy wasted (Table 6 and Figures 21-23). The three pure renewable levels indicate that, using only renewable energies to cover the demand, a huge amount of energy per day is lost; the unused energy is mainly concentrated in the central day hours, in which the generation exceeds the demand, fundamentally due to the solar photovoltaic contribution (Figures 13-16). The

Dependency between Scenarios and Energy Wastages
Another drawback of the pure renewable scenario, which has not been mentioned up to this moment, is the enormous amount of energy wasted (Table 6 and Figures 21-23). The three pure renewable levels indicate that, using only renewable energies to cover the demand, a huge amount of energy per day is lost; the unused energy is mainly concentrated in the central day hours, in which the generation exceeds the demand, fundamentally due to the solar photovoltaic contribution (Figures 13-16). The wasted electric energy for the pure renewable scenario is between 3.2 and 3.9 TWh depending on the renewable component scenario. The highest value belongs to the W 40% -SP 60% renewable penetration scenario, while the lowest corresponds to the W 60% -SP 40%. These values could be significantly reduced, simply by maintaining the installed nuclear generation power, by approximately a factor of 2. Meanwhile, the current storage capacity reduces the wasted energy by about a factor of 4. All these values would have additional reductions if the current capacities of both technologies would be increased, reaching a factor of about 30 when tripling the current nuclear power and quadrupling the current storage capacity.    . Wasted electrical energy depending on the generation MIX (pure renewable, renewable with support of nuclear and/or storage) for the W 40% -SP 60% renewable penetration scenario. Figure 22. Wasted electrical energy wasted depending on the generation MIX (pure renewable, renewable with support of nuclear and/or storage) for the W 50% -SP 50% renewable penetration scenario.

Conclusions
Throughout the last decades, and even today, in most countries, the growing worldwide energy demand has been and is mainly covered with fossil fuels. This is a scenario that fundamentally lays out a double problem: the unavoidable depletion of fossil fuel Figure 23. Wasted electrical energy wasted depending on the generation MIX (pure renewable, renewable with support of nuclear and/or storage) for the W 60%-SP 40% renewable penetration scenario.

Conclusions
Throughout the last decades, and even today, in most countries, the growing worldwide energy demand has been and is mainly covered with fossil fuels. This is a scenario that fundamentally lays out a double problem: the unavoidable depletion of fossil fuel reserves and, even more relevant, an unacceptable growth of greenhouse gases emissions. Focusing on electricity, this source has a growing participation in the final energy consumption; consequently, achieving zero emissions in electricity generation is a must for a sustainable energy system. This study has developed a methodology capable of evaluating the reliability of any possible scenario, particularly a carbon-free electricity generation system based on renewable sources. A methodology, which is in turn based on Monte-Carlo sampling, has been presented; in particular, the Wilks methodology has been used to simulate different scenarios for electricity generation and evaluate their reliability to cover the electricity demand. The intra and inter daily variation of electricity demand profiles and these fluctuations in the renewable sources, particularly wind and solar photovoltaic, have been considered. Finally, using all these considerations, the nominal renewable power to be installed in order to cover the demand can be estimated.
As an example of practical application, the developed methodology has been applied to forecast the electricity generation-demand balance in Spain for the year 2040, extrapolating the data from February 2017. The implementation of a pure renewable scenario would lead to unacceptable values of the total power to be installed, depending on the distribution of the wind and solar photovoltaic generation, in the assumed scenario between approximately 700 GW and more than 900 GW. These are huge values considering that the yearly averaged forecasted demand is about 40 GW with peaks of approximately 50-55 GW. Evidently, this enormous amount of renewable power needed to cover the demand with full reliability is not a realistic quantity to install and, additionally, this installed power would lead to a massive amount of wasted energy in many day periods. In particular, this shortcoming would be accentuated during some of the central day hours, specifically when solar photovoltaic would be at its production peak and demand would not be close to its maximum value. Consequently, other generation technologies must be explored. One suitable approach would be the use of nuclear energy and storage technologies in combination with renewable generation. This solution reduces significantly the required renewable power. In particular, maintaining the currently installed power of nuclear energy in Spain, the renewable power to be installed is reduced in about 200 GW. The total power is reduced to about 200-250 GW, depending on the renewable penetration distribution, if the current installed storage capacity is maintained. The joint use of both technologies-nuclear and storage-would lead to about 150 GW, with the currently existent power capacities. The quantity that would reach less than 100 GW with 22GW of nuclear power installed and the currently installed storage capacity would be 5 GW. In addition, the vast amount of energy lost would reduce drastically, from around 3-4 TWh of the pure renewable scenario to close to 0.1-0.2 TWh with the upgraded nuclear and storage capacities.
In conclusion, two remarks can be drawn from the application of the methodology to foresee the electricity balance in Spain for the year 2040, remarks that could also be applied to a greater or lesser extent to any other country. The strong commitment to implement a purely renewable electric energy generation mix would lead to two major drawbacks. The first is the need to install unaffordable power values to cover the electric demand. The second is the enormous energy wastages. Consequently, alternative generation sources meeting the conditions of zero CO 2 emissions have to be added. An appropriate approach would be the use of nuclear generation energy and storage technologies in combination with renewable generation. This solution, maintaining the condition of zero carbon emissions, would significantly reduce the renewable power to be installed and, at the same time, the energy wastage would also be significantly reduced.
Finally, it should be emphasized that the application of the developed methodology is only an example. Although the predictions will probably be acceptably good, to predict any future annual balance, and consequently to determine the power to be installed to cover it, not only one month should be analyzed. Instead, at least the data from a typical winter month and a summer month, and probably even a typical autumn and spring month should be analyzed as well. Ultimately, for a better forecast, it probably would be convenient to analyze the data for each month of a year, so that the power to be installed would be the maximum of these minimum powers required to cover the demand in any of them. To conclude, it is possible to implement the described Monte-Carlo methodology under different contexts, such as developing, emerging, and developed countries, for different detail degrees of the available information, time horizons and/or future energy scenarios. The only requirement is to have a sufficient database from which to make predictions for future scenarios of electrical generation-demand balances. Otherwise, the corresponding assumptions must be assumed, with the risk of arriving at not so accurate predictions.