{'fraction_non_alphanumeric': 0.02993834980153703, 'fraction_numerical': 0.012097795794274132, 'mean_word_length': 5.041454081632653, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Robustness of electricity systems with nearly 100% share of renewables: a worst-case study

Several research studies have shown that future sustainable electricity systems, mostly based on renewable generation and storage, are feasible with current technologies and costs. However, recent episodes of extreme weather conditions, probably associated with climate change, cast shades of doubt on whether the resulting generation portfolios are sufficiently robust to assure, at all times, a suitable balance between generation and demand, when adverse conditions are faced. To address this issue, this work elaborates a methodology intended to determine a sustainable electricity system that can endure extreme weather conditions, which are likely to occur. First, using hourly production and demand data from the last decade, along with estimates of new uses of electricity, a worst-case scenario is constructed, including the storage capacity and additional photovoltaic power which are needed to serve the demand on an hourly basis. Next, several key parameters which may have a significant influence on the LCOE are considered, and a sensitivity analysis is carried out to determine their real impact, significance and potential trends. The proposed methodology is then applied to the Spanish system. The results show that, under the hypotheses and conditions considered in this paper, it is possible to design a decarbonized electricity system that, taking advantage of existing sustainable assets, satisfies the long-term needs by providing a reliable supply at an average cost significantly lower than current market prices.


Introduction.
Over the recent years, most countries have established different pathways to massively integrate renewable energy sources (RES) into their electric energy systems, keeping in mind two main goals: to develop a more secure and efficient energy system, allowing the population to obtain cheaper electric supply; and to meet the environmental objectives committed in the Paris Agreement [1]. In particular, Spain is one of those countries which has not yet fully developed its high RES potential. The Spanish renewable policies, reflected in the National Energy and Climate Plan (NECP) for 2021-2030 [2], consider ambitious objectives for the full decarbonization of the energy system, starting with the elimination of the so-called "sun tax" imposed by past governments [3][4] and including an estimation of the required public and private investments. In this volatile context, the definition of credible future renewable scenarios, along with their feasibility and cost assessments, become key issues to be faced during the years to come.
Indeed, the analysis of future renewables scenarios is a hot topic in the literature, which has been growing in the last decade. Many papers evaluate the pathways from very different points of view and criteria, considering varying degrees of renewable shares in the system, establishing different time horizons for RES deployment, diverse geographical spans (regions, countries, etc), focusing on technological, economic, social and/or environmental aspects, etc. Some authors define the initial conditions from the current scenario and perform an analysis of the expected evolution up to the target year, considering certain constraints, while others define their own future scenarios and assess possible pathways to achieve them. Beyond those factors, significant differences can be observed regarding the methodologies used in building and assessing the involved scenarios.
On the one hand, for the assessment of future scenarios, some works adopt methods and algorithms previously developed by other authors or companies. A common model used in several papers [5][6][7][8] is the EnergyPLAN [9] developed by Aalborg University (Denmark), for the hourly analysis of regional energy systems over a year. Ref. [5] addresses two renewable scenarios for Macedonia, with a share of 50% and 100% for 2030 and 2050 of RES respectively, combined with pumped hydro storage and electric vehicle (EV) batteries as energy storage systems. Ref. [6] includes variations of wind installed capacity in the model in order to calculate the optimal installed capacity and analyses the influence of wind energy share into the system for two scenarios, including storage systems. Combining the EnergyPLAN model with H2RES [10], a 100% renewable scenario is developed for Croatia in [7], which is aimed at evaluating the role of the storage technology in a renewable self-sufficient energy system, from a technical, economic and environmental perspective. The full transition for the current Portuguese energy system to a renewable system is assessed in [8] for different possible future strategies, duly considering the role of grid interconnections as stabilizing resources that prevent RES curtailment, while also pointing out the importance of energy storage systems. A life-cycle assessment (LCA) is carried out in [11], based on the methodology proposed in [12], to analyse the sustainability of the UK energy system through 36 different (techno-economical, environmental and social) parameters, comparing five future energy mix scenarios with the energy system in 2009, each differing in the share of RES, nuclear and fossil. Additionally, in [13], a modelling framework of an integrated hybrid LCA model is presented, based on [14] and covering nine world region for 2050, for the evaluation if the environmental impact through climate change mitigation scenarios. The results for the European scenario are considered in [15], which assesses the environmental impact of a combination of 44 scenarios, optimizing the total system costs for different shares of low-carbon fossil energy options, variable RES technologies and storage systems.
The Brazilian power generation paradigm change is faced in [16] with a Multi-Criteria Decision Analysis (MCDA), whereby five scenarios for 2050 are evaluated and ranked depending on the perception of experts on the scenario evaluation process. The Business as Usual (BaU) case is analysed as baseline scenario and four alternative scenarios are designed in accordance with [17] and modelled using MESSAGE-Brazil v.1.3 integrated model, originally developed by IAEA [18], with a higher integration of RES. In ref [19], an analysis is performed focused on the RES potential in the energy mix of Thailand and Indonesia from base year 2010 to 2050, considering different renewable energy policy scenarios. The LEAP energy model [20] (developed by Stockholm Environmental Instituted) is used to simulate three scenarios for each country (reference, renewable and renewable potential) with the aim to obtain the CO2 emissions and electric cost of production and to compare the results with the reference case. The variability and uncertainty of wind and solar resources is assessed in [21] regarding the integration of RES in the United States electric systems, focusing on the feasibility and implications, from a technical, economical and sustainable perspective, of six highly renewable scenarios for 2050, using ReEDS model [22]: two baseline scenarios which reflect futures with continued reliance on conventional generation and four scenarios where 80% of all electricity generation in 2050 is sourced from renewables (wind, solar, geothermal, biomass and hydropower). Ref [23] is aimed to establish a roadmap towards 100% RES generation in Nordic countries. Besides considering the role of high level of solar and wind shares in the renewable transition, this study evaluates with the TIMES-VVT algorithm, developed by [24], the feasibility of power-to-gas technology to enable the utilisation of sustainable synthetic gas (methane), produced from 100% renewable electricity, in other sectors beyond power generation.
On the other hand, some researchers develop their own methodologies and algorithms in order to analyse future scenarios and roadmaps. Ref. [25] performs an evaluation of a system composed of 30 interconnected European Countries, and estimates the optimal scenario minimizing the energy sources cost using a constrained linear optimization model in which a sensitive analysis of weather data, cost parameters and policy constraints is performed. In [26], a theoretical model is defined in order to perform an environmental, economic and social evaluation of the potential contribution of PV energy to sustainable development, taking into account the PV deployment roadmaps of several international institutions (International Energy Agency [27,28], Green Peace [29] and International Renewable Energy Association [30]). The arbitrage potential of wind and solar surplus in a 100% renewable generation in Denmark is analysed in [31], with the help of a linear algorithm called WDRESM (Weather-Driven Renewable Energy System Modeling). This tool considers both renewable generation and storage system, and calculates the required storage capacity, firstly, for the optimal balance and, later, for the optimal storage volume. Furthermore, both [32] and [33] simulate hourly-based scenarios considering the inclusion of RES in the respective regions using their own algorithms. Ref. [32] proposes a new 100% renewable electricity model for the Australian National Electricity Market with the aim to identify and quantify the challenges associated to warranting a reliable system. Ref. [33] considers all the municipalities of Spain and evaluates, with a MATLAB algorithm [34], the rooftop PV potential and the feasibility and economic impact of deploying a brand new system based on rooftop PV and battery storage systems. Moreover, alternative scenarios, comprising the current renewable portfolio and the future RES facilities considered in the Spanish NECP, are analysed, in order to determine least-cost combinations of PV and battery storage systems as a function of hydro generation dispatchability. Likewise, [35] proposes a new specific energy system model for the power generation in Spain, integrating LCA indicators of current and future electricity generation technologies.
Also, in this regard, based on so-called holistic indicator RESI (renewable energy security index) defined in [36], [37] explores the relationship between energy security and climate change by combining LCA and energy system methodology (ESM). Two scenarios for 2050 are analysed (BaU, in accordance with [35], and an alternative energy security scenario) aimed to obtain the mix with optimal energy system costs and to establish an energy policy-making process for achieving that mix. LUT develops a model in [38] for calculating the least-cost energy transition pathways with high levels of spatial (20 regions in Europe) and temporal (hourly) resolution, pointing out the versatility of solar PV and its role in the European energy transition. Several simple logistic curves are used in [39], in combination with the data of the last two decades, for simulating and forecasting the growth and penetration of RES technologies and the increase of the electric energy consumption in India for six different scenarios. By defining an economic model for calculating CAPEX, based on the capacity factor and CO2 emissions, [40] evaluates four potential renewable energy scenarios (BaU, strengthened solar, strengthened wind and suggested scenario) for 2030 in South Korea, aimed at achieving the objective proposed by South Korean Government [41]. The results of each scenario are compared with the BaU case, to assess the influence of the wind and solar installed capacities in the total Korean energy mix, from an economic, environmental and feasibility perspectives.
Finally, some papers carry out a literature review of previous assessments and/or define their own scenarios according to the results described in the reviewed publications. In Ref [42], four different scenarios are proposed and analysed for the future of RES, using the BaU scenario as reference, and focusing the others on the climate change, the energy security and a combination of both criteria for a clean and secure energy future of many countries and world regions. More than 50 papers are reviewed in [43], in order to carry out a LCA along the guidelines provided by ISO 14040 [44] and 14044 [45], in which the performance of the energy production technologies is harmonised according to the results found in the revisions. Ref. [46] is focused on evaluating the potential of power systems to deal with high integration of variable RES in future flexible power systems, considering both generation and storage technologies. Table 1 summarizes the publications reviewed above, providing information about the model used in the evaluations and the scope of the assessment. To sum up, a lot of analyses can be found in the literature regarding the assessment of technological, socioeconomic and environmental aspects of RES integration, but very few are focused on evaluating the robustness of the resulting scenarios against the yearly variability of RES. Some of those studies reveal the significant influence that the longterm uncertainty of non-dispatchable RES generation (e.g., wet vs. dry year, windy vs. calm year, etc.) can have on the reliability of energy supply, with the associated risks of not being able to withstand the most adverse combinations of generation and consumption. Indeed, totally unexpected, rare meteorological phenomena, such as the Filomena storm in the Iberian Peninsula [47], or the heavy snowfall in Texas [48], have recently shown that major blackouts and/or socially unacceptable electricity prices can take place if there is a temporary shortage of generation (renewable or conventional) to serve the peak demand. Moreover, such worst-case scenarios recur periodically in different systems. For instance, in the case of Texas, a similar incident took place in 2011 2) Life cycle assessment performed with data of energy technologies from literature review for harmonising results.
[49], but the measures taken since then have not been sufficiently effective, in view of what has happened ten years later. Consequently, there is a clear need to more deeply study worst-case scenarios that could trigger electric supply failures, before it can be stated whether a whole system can safely meet the electricity needs of the system under study.
In this conceptual framework, given the time scales involved in the system adaptation, we can formulate the following research questions: 1. What should the RES portfolio be, so that it can deal with the worst-case expected scenario? 2. How will the variability of the wind/hydro year affect the resulting LCOE? 3. How will the configuration and costs of the added PV, along with those of the required storage, affect the LCOE?
To answer those and other related questions, this work performs a feasibility analysis of the electrical energy mix that may arise in Spain beyond 2035-40, when RES penetration levels exceeding 85-90% are expected. For this purpose, the hourly electric generation and consumption profiles over the last decade are considered. Nuclear and fossil generation production (except for cogeneration) is eliminated from the hourly balances, and the gap is filled with a least-cost combination of new RES facilities (wind and solar) along with battery storage. After evaluating each year separately, the worst-case scenario is defined by identifying throughout the entire decade the most unfavourable combination of hourly energy production that matches the electric demand. The assessment considers the same technologies and hypotheses as in the sustainable scenario proposed in [33], albeit not so much focused on rooftop PV, and compares the resulting LCOE for every year with that of the worst case. Moreover, the sensitivity of the LCOE with respect to several key parameters is analysed. These include: 1) share of dispatchable generation; 2) time alignment between the RES production and the net demand; 3) utilisation factor of the installed RES capacity, 4) share of PV system installed on the ground vs rooftop, and 5) battery costs.
The paper is organised as follows: Section 2 details the different steps of the proposed methodology, which is applicable to any electricity system for which the required data are available. In Section 3, the assessment method is applied to the Spanish case over the decade 2010-2019, while Section 4 discusses the results obtained, regarding the relevance of every analysed parameter. The paper concludes with further reflections on the addressed research questions.

Methodology
The methodology used in this study consists of three major steps. Firstly, for every year considered, the least-cost combination of RES and storage capacity satisfying the hourly demand is determined, duly considering the existing and expected RES assets. Secondly, a synthetic yearly scenario is created based on the worst-case combinations of RES production for the decade considered. The worst-case year is assessed in the same way as regular years, and the resulting LCOEs are calculated. Finally, a sensitivity analysis of the LCOE with respect to several key parameters, characterizing the hourly RES production and unitary costs, is performed. Each step is described in detail below.

RES portfolio optimization
The proposed method to determine, for a given year, the optimal combination of RES and storage systems, follows [33]. The salient features of this methodology are summarized as follows (see the Annex): 1) It considers the hourly electricity actually produced by each RES technology (wind, PV solar, thermal solar, hydropower and biomass) in the year considered, while removing the contribution of nuclear and fossil generators (cogeneration assets are retained).
2) An estimation of the energy consumed by light-duty vehicles is performed, assuming the entire fleet is electrified, which is added to the hourly base-case demand.
3) The hourly electricity gap, created by the removal of thermal generation units and the addition of EV demand, is assumed to be filled by a least-cost combination of PV energy and battery energy storage. The hourly contribution of the additional PV is based on the data provided by the Photovoltaic Geographical Information System (PVGIS) [50].
The cost optimization is performed in terms of the LCOE (Levelized Cost of Energy) for the whole system, including the additional PV and storage capacity, defined as follows: Where D is the annual electricity demand, n is the number of generation technologies considered, Pi is the installed power for technology i, Ii is the unitary investment cost per unit power, and Ri is the depreciation period.
Such definition of the LCOE, based on [51], is a simplification of the actual formulation made by the Joint Research Centre of Europe [52], based on two assumptions: 1) the temporal evolution of capital recovery factors is ignored; and 2) the OPEX (operational and maintenance costs) is negligible compared with the CAPEX.
The least-cost scenario is obtained through an iterative exhaustive search process, in which all feasible combinations of additional PV power and storage capacity are sequentially explored and the one with lowest cost is identified. In this context, a feasible solution is the one for which sufficient electricity production (coming from RES or storage) can be committed to cover the demand for every hour of the year. The reader is referred to the Annex for more details.

Worst-case scenario assessment
After performing the hourly energy balance and calculating the resulting LCOE for every year of the last decade, a hypothetical synthetic year, representing the worst-case scenario, is created by combining the most adverse conditions of energy generation and consumption.
Regarding the electricity production, the worst year for each technology is simply the one with the lowest capacity factor, defined by the ratio of the produced energy and installed power. For instance, in Spain, the capacity factor of the wind energy over the last decade As for the electricity demand, the worst case is defined in a similar fashion, except for the fact that the four seasons are separately considered. So, the worst year, in terms of demand, is a "frankestein" year composed of the four seasons with largest consumption in the decade considered. This way, we do not exclude the possibility of having to face a year in the future with very cold winter and high temperatures in summer.
The worst case so defined accounts for the lowest contribution of each existing technology and the highest electricity consumption, leading to the largest possible gap between the existing installed portfolio and the expected demand. Then, the algorithm described in Section 2.1 is applied to this synthetic scenario in order to obtain the optimal additional PV power and storage system, and the resulting LCOE estimation.

Sensitivity assessment
Apart from the installed capacity for each technology, the main outcome of the portfolio optimization process described above is the resulting LCOE for every year considered (in this work a decade plus the worst-case, synthetic year). The next step consists of performing an assessment of the influence that several key factors exert on the costs. Those factors have to do with the RES generation uncertainty and dispatchability, alignment with the demand and expected evolution of costs, as discussed in the sequel: 1) RES dispatchability. In this work, only the hydro generation is assumed to be partly dispatchable in time. Indeed, cogeneration (and biomass) could also shift its production in time to a certain extent, but this possibility will be neglected, as cogeneration production is significantly conditioned by the steam needs of the associated industrial processes. Specifically, in addition to the base case assumption (40% of hydro is dispatchable) additional dispatchability ratios are considered, up to 85%. Then, the portfolio optimization algorithm is run for each dispatchability ratio assumed, and the impact on the resulting LCOE is quantified. Logically, the more dispatchable the RES generation, the lower the required storage capacity and associated LCOE.
2) RES alignment with demand. A coincidence factor (CF) is introduced for each RES technology, characterizing the extent to which its production matches or is synchronized with the residual demand, i.e., the demand not yet served by the remaining RES sources. The CF for technology i is mathematically defined as the scalar (or inner) product of the hourly production vector, ! , and the residual or remaining electric consumption vector, 0 ! , both with 8760 components in a regular year (leap years with 8784 components), duly normalized as follows: The residual or remaining electric demand, 0 ! , is defined by: where ( ) is the total demand at hour t, and -( ) the hourly energy produced by the non-dispatchable technology k.
3) Net utilization factor (UF): relates the fraction of annual energy produced by a given technology, which is actually used, with its installed power. Mathematically, the net utilization factor for technology i is defined as follows: Where ! is the annual energy produced by technology i ( ! ) minus the curtailed energy, and ! is the corresponding installed power. Note the difference of the UF defined by (4) with respect to the conventional capacity factor, which assumes that all the energy produced is consumed (no spillage occurs).
Besides the UF for each technology separately, the UF is also computed for the overall electricity generation, which is referred to the total installed power, including the additional PV facilities.
4) Share of rooftop PV. A major unknown in future decarbonized scenarios, particularly in countries such as Spain with low latitudes, is the share of PV facilities that will be deployed on rooftops, with unitary costs clearly exceeding those of utility-scale facilities on ground. So, in addition to the base case scenario, where all additional PV is assumed to be built in the form of large plants, the LCOE is recalculated and compared for increasing shares of rooftop PV, in order to assess the impact of having more decentralized RES, which do not require additional land surfaces.
5) Storage costs. Finally, the influence on the resulting LCOE of the cost of massive storage systems is assessed. For this purpose, a sensitivity analysis is performed for several possible values of battery costs, that will fluctuate depending on many factors, such as policies, maturity of competing technologies (Li-ion, NaS, flow batteries), availability of raw materials, etc. This way, a range of LCOE values is obtained, representative of future foreseeable conditions affecting the costs of battery storage.

Case Study
In order to apply the methodology proposed above to the Spanish case, the hourly data corresponding to generation, demand and costs for the last decade are first gathered, from which the least-cost RES plus storage portfolios are obtained for each year and for the worst-case scenario. Then, a sensitivity analysis is carried out for the relevant factors described above.

Base case scenario
According to the proposed methodology, the necessary data and parameters to define the base case are listed below: • Hourly generation over the last decade (summarized in Table 2). • Hourly demand over the last decade (summarized in Figure 4). The data collection comprises two major components: data corresponding to the energy production and consumption during the last decade, and economic parameters required for the LCOE calculation.
Regarding the electricity production, the Spanish Transmission System Operator (REE) daily provides the contribution of each generation technology to the electricity mix, duly separating the data corresponding to the islands from those of the continental Spain [53]. Each daily report, in our case spanning the decade 2010-19, contains power datasets, which are equivalent to hourly energy values.
The hourly electricity consumption is estimated by combining the contribution of all technologies (including non-renewable sources) with the electricity imported from or exported to the neighbour countries and Balearic Islands, through the existing interconnections. Table 2 provides the Spanish electricity mix for the last decade. In addition to the renewable energy produced by the existing assets, the analysis considers the sustainable power facilities forecasted in the target scenario defined by the Spanish NECP for 2030 [2]. Table 3 shows the installed power capacity over the last decade, along with the provisions made in the NECP. In this work, a hypothetical scenario, well beyond 2030, is considered, in which both nuclear power and combined cycles have been decommissioned. The next step consists of scaling up (in the case of RES) or down (in the case of cogeneration) the actual generation profile for every year, in order to obtain the hourly production for each technology according to the forecasted sustainable scenario of the NECP. However, as the hourly values of the PV production are only available for the period 2016-2018 in [53], considering that the yearly variability of the solar resource is moderate, an average of existing hourly data is taken for the remaining years. (1) Thermal renewable considers biogas, biomass and geothermal energy.
Year interest shown by the stakeholders when asking the TSO for new connection points to the transmission system. The variability of the annual energy production can be observed in Fig. 2, where the maximum, minimum and average yearly values are represented for all the technologies considered in this model. As can be seen, the most volatile source is hydro (36 TWh ± 43 %), followed by wind (107 TWh ± 12%). On the other hand, the standard deviation of PV production for the analysed decade is less than 3.9%.

Figure 2. Maximum, minimum and average RES energy production.
In this work, the demand of EVs is added to the current demand. For this purpose, according to [33], it is assumed that the Spanish fleet of light-duty vehicles, when fully electrified, would consume about 60 TWh/year. The hourly charging profile for the EV Year demand is taken from [54], which regularly monitors a representative sample of charging points. The total electric consumption for the decade considered in this work is represented in Fig. 3.   Regarding the second component of the data collection process, Table 5 shows the economic parameters assumed for the estimation of LCOEs: investment cost per unit power and depreciation period for each technology, according to [55], [56] and own estimation. An adaptation of Eq. (1) is performed to duly consider the operational and fuel costs of cogeneration, waste and thermal renewable energy. The contribution of these sources to the LCOE is estimated depending on the used energy and the average market energy price.

Worst case scenario
By combining the data of energy production and consumption over the last decade, the worst-case hourly scenario is obtained as follows: 1. For each RES technology, the profile corresponding to the year with lowest capacity factor is selected, and then the hourly values are duly scaled to consider the installed capacity foreseen in the NECP. Table 6 presents the values of the capacity factor for each technology and year (lowest marked in red).  2. The season in the decade with highest demand is used to define the demand of that season in the worst-case year, and then the 60 TWh consumed by the EV fleet are added throughout the year according to the recorded hourly profiles.
To summarize, Table 7 shows the electricity produced by each source and the electric consumption in the worst-case scenario, along with the corresponding year. (1) Thermal renewable, cogeneration and waste have been considered as a single aggregated source, as explained in Table 6.

Filling the gap.
In this section, the methodology described in Section 2.1, aimed at filling the gap between the forecasted demand and the RES production forecasted by the NECP, with a least-cost combination of additional PV and storage, is applied to the Spanish case. In the base case scenario, it is assumed that a predefined fraction of 40% of hydroelectricity is fully dispatchable. This yields nearly a 100% renewable energy system (actually 93%, as cogeneration is mostly non-renewable), capable of supplying the required electricity on an hourly basis, under the most adverse conditions found in the last decade.
The algorithm (described in the Annex) provides the optimal amount of PV and battery storage that should be added to the electricity mix, and the resulting LCOE for each year and the worst case, as shown in Table 8.

Sensitivity analysis.
Once the base-case scenario is evaluated, the sensitivity of the results against the parameters defined in Section 2.3 is analysed.

Dispatchability.
The RES dispatchability, in this work restricted only to the hydro sources, is considered the single most relevant variable. In order to duly assess the role of this important factor, every year in the last decade, along with the worst-case year, is repeatedly analysed for increasing dispatchability levels of the hydro resource, namely 55%, 70% and 85%, and the resulting LCOE is computed. The application of the optimization algorithm provides the results summarized in Table 9, for each simulated scenario, including the additional PV power, the storage capacity and the LCOE. Table 9. Additional utility-scale PV, storage and LCOE.
The evolution of the LCOE for increasing dispatchability levels is represented in Fig 6. The trend clearly shows how the value of the LCOE decreases as the hydro resource is more dispatchable, owing to the availability of higher amounts of energy to be shifted in time for meeting the demand peaks, and hence the lower storage capacity requirements. Higher dispatchability levels allow the seasonal component of the storage system, which is only useful to meet the electricity consumption in a few peak hours, to be reduced.

Coincidence Factor
As defined in Section 2.3, for a given technology, the coincidence factor constitutes an indicator of synchronization or alignment between its production and the net demand, throughout the hours of a year. In this section, the variability of wind and hydropower coincidence factors is analysed, and its influence on the LCOE of future foreseeable scenarios is assessed. The analysis of the PV production has been excluded, as the corresponding data is only available for three years, as explained in Section 3.1. Figure 7   shows the results corresponding only to the 40% hydro dispatchability of the base-case (in this and the following figures, the red dot represents the worst-case synthetic year).

Figure 7 Technology coincidence factor vs LCOE
The high p-value for the wind CF suggests that this variable is not significant in order to explain the LCOE value, which is the reason why it will not be further pursued in this study. In the case of the hydro CF, the significance level is nearly 90%, which means that the null hypothesis cannot be rejected, and so it makes sense to consider the influence of this parameter in the analysis. As might be expected, there is a significant inverse relationship between the hydro CF and the LCOE, the coefficient being -40.2.

Utilization Factor
The utilization factor (UF), calculated according to Eq. (4), plays the role of evaluating the annual use of the installed power capacity, which can hence potentially impact the LCOE. The PV technology has been also excluded from this analysis as explained above. Figure 8 shows the results obtained in the evaluation of the UF. As can be observed in Fig. 8, both variables are significant (p-value less than 0.05), so the null hypothesis cannot be rejected and therefore their inclusion in the analysis makes sense. The sign of the regressors indicates the existence of an inverse relationship between the values of the UF and the LCOE, as would be expected.
Additionally, the UF of the overall energy production with respect to the total installed power is estimated, in order to assess the correlation between the use of the total capacity and the LCOE. Figure 9 shows the values of the UF factor when applied to the whole portfolio. It is evident that the UF, when applied to the entire energy production, provides also good results as explanatory variable with a P-value lower than 0.05 (R 2 close to 0.9) showing a significant correlation with the LCOE. This is so because, being the installed capacity and the electric consumption approximately the same every year, the net demand to be matched by additional PV and battery storage is lower when the installed power is better harnessed.

PV power costs.
In this section, the LCOE for the entire system (average MWh consumed) is analysed for several values of PV investment cost, in order to assess the differences in costs of deploying utility-scale PV (base case scenarios) or rooftop PV.
In addition to that of the base case (500 €/kW), the methodology is applied for three increasing unitary costs, namely 667 €/kW, 833 €/kW and 1000 €/kW, approximately representing hypothetical scenarios in which the share of additional rooftop PV power is 33%, 67% and 100%, respectively, instead of being located entirely on the ground.
The results provided by these simulated scenarios are shown in Figure 10 for the year 2014, considered as an average year, separating the contribution to the total LCOE made by the renewable assets already considered by the Spanish NECP, the additional PV and the battery storage. Figure 10. Sensitivity of overall LCOE to PV power investment costs.
The increase of the PV investment costs yields two cumulative effects on the LCOE: 1) an increase of the LCOE directly produced by the higher PV costs; 2) indirectly, owing to the increase of PV costs, the optimal configuration of the additional PV power and batteries, required to fill the energy gap, shifts towards a decrease of the PV installed power and an increase of the storage capacity, which also increases the LCOE. Figure 11 shows the variation of the optimal installed capacity for both technologies, PV and batteries, provided by the optimization procedure. Figure 11. Installed PV power and storage capacity variation with respect to the base case for increasing investment costs of PV facilities.

Battery cost.
The results obtained above lead to relatively low LCOE values, in general smaller than current wholesale electricity markets in Europe. However, those base case values are obtained with a forecasted battery cost of 100 €/kWh. As mentioned in section 3.1, raw materials scarcity, high demand, etc. may significantly impact the battery storage market prices, and hence the resulting LCOE.
This section compares the LCOE for several values of the battery storage investment costs: 100 €/kWh (base case), 150 €/kWh, 200 €/kWh and 250 €/kWh. Figure 12 shows the results for the year 2014.

Figure 12. Sensitivity of overall LCOE to battery storage investment costs.
By reducing the cost of battery storage, the PV power considered in the optimization algorithm decreases, while at the same time the battery capacity required to match the load increases. In other words, as the relative PV/battery costs increase, the PV installed power is partially replaced by a higher capacity storage system, lowering the total cost. Figure 13 shows the percentage change of the optimal installed PV power and storage capacity provided by the methodology. As can be seen, the relative increase of PV installed power is roughly symmetrical with the relative decrease of storage capacity. In the above sections, a future hypothetical scenario is considered for Spain, without nuclear and combined cycles, in which the resulting electricity gap is covered with a leastcost combination of PV plus battery storage, leading to a portfolio that is almost 100% renewable. Such base-case scenario is replicated eleven times, for the generation profiles corresponding to all years of the last decade plus a synthetic year representing the worstcase combination of RES production and demand. Then, for assumed investment costs of PV power and battery storage, the resulting LCOEs are computed for every year. The results obtained in the Spanish case show that, even considering a hydro dispatchability of just 40% (conservative scenario), the system LCOE for the worst-case year would be 38.6 €/MWh, with a minimum value of 31.9 €/MWh in 2014, an exceptional year in terms of demand and generation conditions. Even in the worst case, the overall LCOE would remain below the current market levels, which is good news.
Moreover, a sensitivity assessment is performed with respect to five parameters, classified in three categories: 1. Degree of dispatchability associated with existing RES, particularly hydro generation. 2. Weather-related parameters (distribution of generation in time): coincidence and utilization factors for wind and non-dispatchable hydro generation. 3. Cost-related parameters: battery and PV installation costs (ground vs roof). Table 10 gathers the computed LCOE elasticities for all the variables considered, as well as their variation ranges. Regarding the first group, it has been observed that, as expected, increasing the level of hydro dispatchability reduces the LCOE, as hydro is acting as a natural storage. The observed elasticity of the LCOE to hydro dispatchability is -0.04, which means that each 10% increase in dispatchability would reduce on average the LCOE by 0.4%. Thus, despite the range of dispatchability considered being large (40%-85%), its impact is not very relevant.
For the second group, the influence of the coincidence factor is not statistically significant (see the high p-values in Figure 7) and is therefore ignored in Table 10. However, the utilization factor correctly explains the variation in annual costs, particularly that of the wind resource. Throughout the period considered, the wind utilization factor fluctuates between 1814 and 2138 hours, leading to LCOEs in the range 38.6-31.9 €/MWh, corresponding to an elasticity of -0.44 (i.e., 4.4% reduction in LCOE for every 10% increase of the wind UF). Note that although the sensitivity is large, the range of variation is rather small (18%). Somewhat the opposite happens with hydroelectricity, showing a much lower elasticity (-0.09) but a much larger range of variation (140%). When both factors are combined, it turns out that the overall impact of the hydro resource variability on the LCOE of the Spanish mix becomes more relevant.
Finally, regarding the costs of batteries and PV installations, both have similar elasticities, close to 0.2. Given that, in recent years, they have experienced cost reductions of nearly 20% per year [55], if this trend continues, the expected LCOE would be reduced annually by 8%.

Conclusions
The aim of this work was twofold: 1) to establish a systematic methodology to analyze the sensitivity of the results provided by the model developed in [33] to several major factors affecting the system LCOE, such as share of dispatchable generation, weatherrelated variability (mainly wind and hydro, but also temperature, which affects the demand), and investment costs of batteries and PV facilities (mainly conditioned by the location of the plants: ground or rooftop); 2) to apply the assessment methodology to a big system, such as the Spanish one, throughout a whole decade, including the worst-case combination of generation and demand. In this way, the three research questions formulated in the introduction are addressed.
Regarding the design of a resilient system that could withstand extreme conditions, according to the experience from the last decade, it has been found for the Spanish system that the deployment of PV and battery storage assets would have to be increased by 60% and almost 30%, respectively, with respect to the installed capacities that would result if only the 2019 weather and demand conditions were taken into account [33]. This represents the excess capacity that will be needed to hedge against adverse combinations of demand and non-dispatchable generation, such as those recently observed in the cold events Filomena (Spain) or the rare one in Texas. As expected, the average cost to serve electricity gets reduced when the share of dispatchable hydro increases, albeit the impact is not significant (0.4% reduction in LCOE for every 10% increase in dispatchability) provided at least 40% of hydro can be shifted in time according to the system needs.
As far as the weather-related characteristics are concerned, both the wind and hydro utilization factors have a large impact on the LCOE. While the former features a narrow range of variability, somewhat the opposite happens with the hydro utilization factor. However, despite this asymmetry, both effects are significant in the Spanish system.
In response to the last research question, also as expected, it has been found that reducing the costs of PV and storage installations will result in a significant reduction in the LCOE (2% reduction of LCOE for every 10% reduction in any of both costs). Given that, in recent years, both PV and storage costs have enjoyed about 20% reductions per year, if this trend continues, it is expected that the LCOE values forecasted in this work get reduced by up to 8% per year.
Considering the above results, it can be concluded that, under the hypotheses and conditions analyzed in this work for the Spanish case, it is possible to design an emissionfree electricity system that, taking advantage of existing sustainable assets, meets the long-term needs by providing a reliable supply, at an average cost which is noticeably lower than current wholesale market prices. The methodology devised in this work, could be easily applied to any other system and latitude.
The optimization algorithm, fully described in [33], can be summarized as follows: 1) First, the hourly generation profile for each technology and the hourly electric demand is identified for a certain year.
2) Secondly, the dispatchable energy is separated from the regular hydraulic production depending on the dispatchability share selected for the analysis (40%, 55%, 70% or 85%).
3) The third step estimates the minimum additional PV capacity which is necessary to meet the annual energy balance, assuming an unlimited storage system: where /0 is the annual PV electricity production, D is the annual demand and E is the annual electricity produced by the assets considered in the NECP. 4) Starting from the minimum PV capacity provided by (A), the required storage capacity is sized by performing an estimation of the battery system capable of meeting the hourly demand during the whole year. The minimum suitable value is the one satisfying the hourly balance equation: where t is an hourly index, ( ) is the total hourly energy production (NECP assets plus PV), ∆ ( ) is the hourly charged/discharged energy exchanged by the storage system and :!;/ is the available dispatchable energy.
With an unlimited storage system, arbitrary amounts of energy can be arbitrarily shifted in time throughout the whole year. However, as the installed storage capacity decreases, a value is reached for which the problem is infeasible for one or more hours. Thus, an iterative process is performed to obtain the minimum feasible value by starting from a sufficiently large storage capacity and then reducing it by small discrete steps.
5) The discharging/charging process consists of obtaining energy from the storage system (∆ ( ) < 0) when the hourly balance is negative ( ) − ( ) < 0, until the balance is null or the batteries are empty, and charging the batteries with the energy surplus (∆ ( ) > 0) when the hourly balance is positive, ( ) − ( ) > 0, until all the surplus energy is depleated or the stored energy reaches 100% of the installed capacity.
6) The state of charge of the system is defined as follows: where ( ) is the state of charge at hour t, C is the maximum installed capacity and ∆ ( ) is the charged/discharged energy derived from the balance requirements, equation (B). 7) When the minimum suitable storage capacity is obtained, the LCOE is estimated for the resulting battery size and the installed power of each RES technology, including both the NECP provisions and the additional PV (utility-scale and/or rooftop, depending on the scenario being considered). So, the storage installed capacity must be reduced to cope with the additional PV assumed, by repeating the iterative procedure of steps 4-7.
9) Once the optimal configuration of PV plus storage is updated, the LCOE is reestimated accordingly. The process is repeated, with increased values of PV installed power, successively leading to smaller amounts of storage capacity. The iterative procedure stops when the storage capacity cannot be further reduced if the energy balance is to be satisfied at every hour of the year. In this way, all the possible combinations of RES production and storage systems are analysed.
10) The outcome of the procedure is the RES generation portfolio and the associated storage system with lowest LCOE, for a given year.