On the Assessment of the 2030 Power Sector Transition in Spain

: Recently, the European Union has recognized that more ambitious plans in reducing emissions are needed in order to comply with the target 1.5–2 ◦ warming limit for this century. Along this line, the main objective of this paper is to study the evolution of the power sector in Spain, taking into account the Paris Agreement and the further European Union Directives. In particular, we have studied the substitution by renewable energies of all coal power plants before 2030. For this study, we have applied linear programming techniques to optimize the deployment of the additional wind and solar resources. If, in addition to the substitution of coal power plants, we also consider the expected increase in demand for the period 2019–2030, we ﬁnd that the present park of renewables should be increased by a factor of about 115%. We have also statistically analyzed the amount of surpluses and shortages in energy, assuming that the demand curve would have a daily shape similar to the present one. As a result, we have found that additional storage capabilities of around 55 GWh for 11 h would be needed in order not to waste more than 25% surplus energy by curtailment. As for backup, we propose in a ﬁrst step to use the overwhelming amount of gas combined cycle units which are available.


Introduction
Most of the recent scenarios and road maps related to the incoming energy transition at the global and European levels contemplate a strong reduction of carbon emissions in all sectors, mainly in those related to power generation, transport, buildings and industry [1][2][3]. This reduction of CO 2 emissions is especially critical in the case of the power sector, particularly in the case of Europe, for which the emissions by 2050 should be close to null [4,5]. To reach this goal, the European Union (EU) has proposed a series of partial targets which, in the case of the power sector, the percentage of renewables should be 32% of the total gross energy in 2030. This implies about 57% of renewable energy by 2030 will be in the electricity mix [6].Within renewables, the larger percentages will correspond to wind and solar, which will almost double and triple, respectively, in relation to their present energy contributions [7]. For the case of Spain, as well as in many other European countries, this objective is planned to be reached by progressively closing all the coal power plants before 2025 and simultaneously increasing by a large amount the percentages of renewable sources such as solar, wind and biomass. As for the other major European countries, the corresponding dates for the phaseout of all coal thermal plants are planned according to the following schedule: France in 2023, United Kingdom and Italy in 2025 and Germany by 2038 [8,9]. The corresponding year for Germany is much further away than for the other countries due mainly to the undertaken simultaneous denuclearization process.
As it is well-known, the integration of high shares of variable renewable energies (VRES) in the power and distribution grids might involve a series of difficulties due to the fact that some of the main renewable resources (solar and wind) are intermittent or non-dispatchable. Therefore, in this situation, in order to obtain a high degree of power integration, it is necessary to draw upon a combination of efficient and flexible backup plants, large energy storage systems and a high degree of digitalization to manage the distribution of electricity from the generation sources in order to meet the varying electricity demands of the end user [10].
The main objective of this work is the study of the (2020-2030) evolution of the power mix in Spain to comply with the total elimination of coal generation. For the phaseout of all coal, the substitution of all coal power plants by renewable resources, especially VRES (wind and solar), is proposed. This paper is structured in five sections. After this short introduction (Section 1), in Section 2, we have carried out an in-depth study of the current situation of renewables in Spain. For this purpose, we have analyzed the present renewable generation by means of fan plots undertaken 24 h a day, during the four seasons. Next, in Section 3, we analyze the consequences that the replacement of a load-following dispatchable coal power plant by VRES sources has on the overall response of the distribution grid. In Section 4, we propose a model based on linear programming techniques to optimize the large deployment of VRES to cover the 2030 power demand requirements. In this process, the resulting surplus energy as well as the storage and backup needs are also calculated. Finally, this paper ends with the summary and main conclusions in Section 6.

Present Situation of Power Generation in Spain
Before we make a critical assessment of the power transition to 2030 in Spain, it is convenient to consider first its present situation according to the last available data (2017) [11]. A summary is shown in Table 1 for all generating sources, both in power units (MW) and also in energy units for the year 2017. It is also convenient to include the values of the capacity factors which indicate in percentage the number of hours of a year that a given source would have to function at its specified nominal power to generate its total annual electricity. Among all generation sources, nuclear has the highest capacity factor as observed from Table 1. The lowest capacity factor corresponds to hydroelectricity followed by combined-cycle gas turbines (CCGT), which means, as we will see, that both sources have a high potentiality of playing a meaningful role in the incoming transition. Compared to other European countries, the capacity factor corresponding to solar photovoltaic (PV) energy is somewhat higher in Spain than in countries like Germany or France due to its higher solar radiation [12]. Observe also that the capacity factor of concentrating solar power (CSP) is higher than for PV as expected due to its storage capability. Finally, we would like to point out that the electricity system in Spain is quite diversified, and it incorporates a high proportion (34%) of renewable sources. Also, the relation between the total installed power and the yearly maximum demand is quite high.
A very significant aspect of the power system of a given country is the daily pattern of power demands which, for the case of Spain, is shown in Figure 1. This figure shows the hourly (0-24 h) average for all days of the year. As can be observed, it shows a minimum (about 23 GW) low consumption and a weak maximum of around 31 GW in the early afternoon. From Figure 1, it can also be deduced that the daily variation of the demand is about 30%, a percentage which has a large influence in the adjustment of the demand to the generation in the so-called demand-side response techniques.  Source: authors based on the data from Red Eléctrica Española (REE) [11].
The current situation of the conventional power sources in Spain has been discussed by the authors elsewhere [13]. Therefore, in this section, we will focus on the renewable energy sector, which is the one that will undergo major changes in relation to the 2030 electricity transition. For the study of the high integration of renewables in the distribution grid, it is very helpful to represent their behavior every 24 h for all days of the year (2017) by using fan charts (These plots have become a method for visualising the uncertainty of a random variable during a time period. Using shading fan charts focuses the attention towards the whole distribution and away from a single central measure. These figures have been built using the package fanplot [14] from the R project [15]) (Figures 2-5) since they provide a visualization of the prediction intervals running from the darkest shade of the figures for the 50th percentile to the lightest ones at the 10th at the bottom and the 90th at the top intervals. In the case of VRES in Spain, it is also very convenient to represent them for the different seasons of the year due to the large differences of the corresponding resources among them. As expected for PV ( Figure 2), there is only a generation between the Sun's rise and set, and the pronounced maximum is located around the middle of this period. The vertical scale of all fan charts has been adjusted to the maximum observed production during the evaluated year (2017). To emphasize the highest observed generation at the top of all these figures, we depict a horizontal red line showing these values.   Figure 2. The Solar Photovoltaic seasonal pattern for 2017. Source: authors based on the data from REE [11]. Figure 3 shows the corresponding graph for the daily evolution of solar CSP, which differs from that of PV in two significant aspects: the maxima are practically flat, around 2 GW, and, in the case of Spring and Summer at midnight, still produces about one-fourth of the power, presenting the minimum early in the morning of the next day. Evidently these two facts are due to the thermal storage capabilities of most CSP plants which allows the absorption of part of the solar energy during the central hours of the day and delivers it after dawn.   Figure 3. The Solar Thermal generation seasonal pattern for 2017. Source: authors based on the data from REE [11]. Figure 4 represents the wind generation for the different seasons of the year. We see that the vertical scale for wind corresponds to higher levels of power than for the case of solar energies (see also Table 1). It is also interesting to remark that the winter season has the strongest winds, which coincides when the solar production is at a minimum, and the opposite happens in summer. It is evident that disparities like these between the intensities of the resources through the different seasons would help the large-scale integration of VRES.    Figure 4. The wind generation seasonal pattern for 2017. Source: authors based on the data from REE [11].
So far we have described in detail the behavior of solar and wind power, which are also called non-dispatchable or variable renewable sources since their availability depends on the climate conditions. We now present in Figure 5 the graph corresponding to hydroelectricity, which is the most flexible dispatchable renewable source available in Spain, and therefore, it can be used as base-load and load-following plants to balance the whole power system because of its fast response to large gradient power variations in order to store power surpluses or to serve as back-up plants. Also, in the case of the variation of the hourly power of Figure 1, note its role in the increase in power in the time interval from 6 to 9 h when the electrical machinery of most industries start to work.  Figure 5. The hydropower seasonal generation pattern for 2017. Source: authors based on the data from REE [11].
Finally, in Figure 6, we depict the share of each VRES versus the total VRES generation for three years making use of ternary density plots. These graphs are based on kernel density plots (These plots produce a smooth surface estimating the probability density function of a continuous variable and visualise the distribution of data over a continuous area. It can be understood as a variation of a histogram that uses kernel smoothing to plot values, allowing for smoother distributions [16].) for the years 2013, 2015 and 2017. We have selected a set of three odd years to better show the evolution of the three main VRES during a five year interval. From them, it can be observed that the deployment of CSP has increased in this period of years and the dispersion of the mix is clearly greater. For the particular case of Spain, CSP represents a promising source as has been already evidenced by other authors [8]. The potential role of CSP in Spain will be further evidenced in Section 4.

The Main Strategies for the 2030 Energy Transition
As pointed out in the Introduction, the main objective of the incoming energy transition is the decarbonisation of the economy and, in particular, of power generation sources. In this sense, the EU has strongly recommended that the member states accelerate as much as possible the phaseout of all coal power plants before 2030 since their emissions accounted for about two-thirds of all power sector emissions in 2017 [17]. In the case of Spain, the present Government is also committed to starting a phaseout by the second half of the next decade of nuclear plants, which, together with the coal ones, add up to about 40% of the Spanish electricity system. Evidently, all this amount of eliminated power will have to be substituted by renewable sources. Below, we treat, in more detail, the decarbonisation process as well as the storage and backup plants needed for the high-integration of renewables into the power grid.

Coal Power Plants Phaseout
As shown in Table 1, 17% of electricity (42,423 GWh) was generated from coal in 2017, mainly by 15 large thermal plants which emit 42.936 Mtons of CO 2 (about 57% of the total) [11,18]. Most of these coal power plants will probably have to either close down or to undertake costly expenses to reduce the emission of CO 2 and other contaminant gasses to the atmosphere. Due to this, the new Government manifested last September that 2025 should be the end of the coal era in Spain [19]. In spite of this, the EU has mandated that some of these plants should be closed no later than 2020 since they have not yet undertaken some of the last reforms dictated by the EU. In relation to gasses mainly used in combined-cycle gas turbine (CCGT) plants (see Table 1), the Government informed that several studies are needed to consider whether the actual existing plants are enough or perhaps their capacities should even be expanded, the reason being that CO 2 emissions per kWh of CCGT plants are less than half those of coal power plants [10]. Therefore, the CCGT plants could play a significant role in the incoming 2030 energy transition due to their dispatchability and flexibility. Although CCGT plants in 2017 reported very low capacity factors (see Table 1), their operation could continue due to the received "capacity payments" aimed at remunerating power plants for remaining on standby in case of demand peaks (see Section 3.4 for further information). The main reasons for the observed low capacity factor of CCGT is due to several reasons, among them are a decrease in the total yearly demand during the crisis (2008-2014), the preference of coal power plants because of their lower fuel price and the relatively low price of CO 2 emission allowances.
We should also observe that the European Union will have, by the end of 2020, a new climate and energy framework (2030) of the EU Emision Trading System (EU-ETS) [20] so that it becomes much more expensive for large industries to liberate CO 2 emissions to the atmosphere. Therefore, by reducing the permits of emissions starting in 2021, the price of the EU-ETS will increase, and consequently, it is expected to change the European energy model towards cleaner energies. This increase in the price of the EU-ETS is already noticeable since the price of 1-tonne-equivalent CO 2 cost e25 last September, which is more expensive than three times that of the previous year [21]. The advantage of this type of tax applied mainly to the power generated by coal is that it clearly reflects the environmental costs in the price of the electricity. It is also expected that the cost of emitting one tonne of CO 2 will be increased to close to 40 euros for the period 2020-2023. This is very interesting for European countries since prices considered above 10-15 euros per tonne are sufficient to make low-emission alternatives compete with coal and gas during the 2030 transition [22,23].

Denuclearization
As we can observe from Table 1, nuclear energy is at present the first source of power in Spain amounting to 55,539 GWh, or 22.3% of the total. This amount of power is provided by seven nuclear reactors of about 1 GW each and with a use or shelf life of 40 years, which would end in the period 2023-2028 (www.world-nuclear.org). However, very often, the useful life is extended to periods longer than 40 years because of the following considerations: (1) the periods of about one month per year for the recharging of nuclear fuels should not be counted since the reactor is stopped; (2) after passing a strict revision performed by independent entities, the reactors can be authorized to function again for several additional years, usually 10 to 20. For these reasons, Spain has decided to phaseout all its reactors during the period 2026-2035, mostly after 2030, or when it has accomplished the 70% renewables target for 2030 [24]. It is interesting to point out that this decision has already been approved very recently by the Minister of Ecologic Transition and the Presidents of the utilities which run the reactors (Iberdrola, Endesa and Naturgy) in a recent metting (28 January 2019).
The possible phaseout of all nuclear reactors in ten years starting in 2026 would pose a big challenge to our power system since, as we have seen, nuclear power is at present the first source of power and the Government has already informed that the first priority will be the total decarbonization of the power system. There is also the concern of a possible increase of CO 2 emissions, since those from nuclear plants are practically null. In fact, according to the last press declarations of Spain's Energy Secretary of State (Mr. Domínguez-Abascal), most reactors will be probably dismantled after 2030 [25]. Nuclear energy does not release CO 2 to the environment; however, the risk of long-term radioctive waste has become a serious drawback for its continuity. For this reason, the nuclear phaseout deadline, now estimated by the mid-thirties, provides enough time to progressively substitute nuclear plants with VRES sources.

Intensive Forthcoming Deployment of Additonal Renewable Plants (2019-2030)
Although in the period 2012-2018 the installed capacity of renewables in Spain (wind and solar PV) remained practically constant, this situation will change in 2019 and 2020 due to the last auctions which were already allocated more than one year ago, so that the corresponding plants are already under construction [26,27]. This would represent a sudden increase of 9 GW in renewables (see Figure 7) corresponding to relative increases of 80% and 22% for PV and wind respectively. Although significant, these already resolved auctions are only the first step forward in the right direction to reach the objectives of the energy transition. In this direction, the Spanish Government is at present designing a plan for the construction of renewable plants at the rate of about 3-5 GW per year until 2030. As can be checked from Table 1, wind energy represents a much more important contribution to the total electricity generation (19.1%) than solar PV (3.2%) or CSP (2.2%). 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999   We can also see from Table 1 that even if biomass represents only a small percentage of the total power generation, it has an advantage over wind and solar power by being dispatchable, and therefore, it can also be used as backup energy. In addition, some studies show that the technical potential of other renewables (mainly biomass) could be, for the case of Spain, as much as 11% of the total generated electricity [29].

Flexible and Load Following of Dispatchable Generation Plants
For the correct high-integration of non-dispatchable VRES demanded by the incoming 2030 energy transition, it is necessary that the whole power system includes an ample series of flexible generation plants to balance the high variability introduced by the wind and solar sources. The flexibility of our present system was principally granted by the fossil fuel plants (coal and gas from CCGT) and, of course, by the relatively small hydroelectric resources (see Table 1). These dispatchable sources are also said to provide a balance regulation. For instance, a high flexibility is required when wind changes its intensity upwards or downwards, provoking variations in the generating power systems of several thousands of MW per hour which have to be balanced by load-following technologies like the thermal plants, CCGT, pumped storage and hydroelectricity.
In relation to the load-following properties of generation plants, it is interesting to discuss, for example, the evolution of the power sources like those shown in Figure 8 corresponding to a week and showing the highest yearly value of wind power. (The fact that the yearly wind maximum occurs on 26 June 2017 is not contradictory with the results of Figure 4, showing that the most windy season on the average is winter.) If the overall power system is flexible enough, even if the value of wind corresponds to its highest observed generation in 2017 (16 GW) (Observe in Figure 4 that the maximum wind generation occured in Spring, although the highest average wind generation is in Winter.), most of the other sources could still be lowered to generate the same amount of electricity. This can be possible since the dispatchable sources like coal and CCGT can be lowered (see Figure 8) to generate about 3.0 GW and 1.3 GW, respectively, values which are much lower than their median ones shown in Table 1. In addition, simultaneously, part of the wind power (about 2 GW) could be diverted to hydro-pumped storage, as shown in Figure 8. It is also interesting to note that the 16 GW generated at the maximum is not too far from producing the aforementioned energy surplus. In effect, the 16 GW plus the constant 6 GW of nuclear energy is very close to the night daily minimum shown in Figure 1. This means that if we built a considerable number of additional wind plants, there will be situations in which there will be a lack of sufficient storage and more available power than that absorbed by the demand. In this case, it is said that the situation of curtailment has been reached.
Next, we also analyze a week with a low VRES generation as is shown in Figure 9. From this figure, it can be deduced that, of all the dispatchable sources of Spain's power system, the one that shows the highest slope during several hours is gas (CCGT). Note that, in the first half of the week, wind power generation is quite high, the opposite of what occurs in the second half. To adapt the system to this situation, CCGT plants are programmed to ramp up from 3 GW to near 17 GW when the wind generation slows down, as can be seen during 12 May 2017. Computing the slope of the observed generation by source, we see that, in the case of the CCGT plants, the ramp speed is very high, of the order of 32 MW/min in critical hours. Conversely, the coal generation is practically constant during the whole week since its ramping rate is much lower. Note also in Figure 9 that, when power is stored by hydro-pumped storage (the negative values in the graph), the hydroelectric generation is practically stopped.

Surplus and Backup Energies
As shown by Wagner [30], it is relatively easy to show that, if the national grids like the one treated in this work were exclusively dependent on VRES power, there would be, on the one hand, a generation of surplus energy in some moments and the need of backup in others [31]. Therefore, it would be very convenient to store the surplus energy from the system and to latter return it when needed. Of all the storage techniques applied to very large systems like the national grids, hydro-pumped storage is at present the most efficient and flexible technique [32], but there are many limitations for their construction: plane orography, a lack of sufficient water, as well as environmental restrictions. Pumped storage is, therefore, very useful to adapt the supply to the demand curve. In the particular case of Spain, hydro-pumped storage amounts to about 6 GW of which 3.3 GW [32] is pure pump. This amount of storage is enough for the present needs. From Figures 8 and 9, the amount of hydropower that is diverted to storage can be observed from the negative values of the vertical axis. Figure 10 shows the peaks and hours of the hydro-pumped stored electricity during 2017. A hydro-pump storage is very appropriate for large grid applications, but currently, other forms of energy storage like electrochemical batteries are being seriously considered, especially in the case of medium-scale PV plants [33,34]. This process is also driven by the decrease in prices of battery storage units [35].

Prospective Pathways for the 2030 Energy Transition
As indicated in the Introduction, in this section, we propose a model based on linear programming techniques for the minimization of the amount of VRES needed for the total replacement of all coal power plants. This is followed by the calculation in Section 5.1 of the subsequent surplus and backup energies, and as a side result, we also evaluate the energy storage needs. Finally, in Section 5.2, we estimate the total amount of corresponding CO 2 emissions avoided as a consequence of the coal power plant phaseout and their substitution by VRES.

A Proposed Optimal Model Towards the Total Phaseout of Coal Power Plants
A key question in any renewable energy deployment strategy is finding the optimal mix of the different resources contributing to the total demand. Since the VRES sources are weather-dependent, the optimal renewable mix plays a critical role for adjusting the supply and demand. Both supply and demand are random processes riding atop generally predictable trends. In order to asses the optimal VRES mix, we propose the use of a mathematical model based on linear programming.
The objective of our optimization model is to simultaneously minimize both the excess and lack of generation compared to the instant demand. Based on these premises, we look for an optimal VRES power mix that keeps those sources that positively contribute to generation (in terms of low GHG emissions) and replace fossil fuel-fired power plants whenever possible. In the following analysis, we propose the total substitution of coal, which is currently in the European agenda policies. This methology has already been used in a different context by us [36].
From now on, we will also name, in general, these differences as slacks (an excess of generation and a lack of production). Consequently, for the set of all hours of the year (8760 observations), we look for the optimal combination of installed capacities of VRES (wind, solar PV and solar CSP) that would minimize the total algebraic sum of the slacks (surpluses, s i , and shortcuts, d i ), while keeping hydroelectricity, nuclear and gas (CCGT and cogeneration) and totally removing coal. Moreover, we assume that the total demand will increase to a value of 278 TWh in 2030 (assuming an increase of 12.55% from 2018 to 2030 based on results from [37] (2016). In addition, this demand for 2030 is very close to the scenarios proposed in the expert's committee for energy transition, recently ordered by the Spanish Government [38]). The mathematical linear program for this particular problem, built on an hourly basis, is where x i , y i and z i are the observed generations from Wind, PV and CSP, respectively, in the hour "i" and λ 1 , λ 2 and λ 3 are, respectively, the optimal multipliers for Wind, PV and CSP that we are searching. Also, see that the right-hand side of the constraint in Model (1) represents the often-called reduced demand. This program has 17,523 variables (8760 × 2 slacks + 3 λ multipliers) and 26,283 constraints (8760 hourly constraints + non-negativity constraints of all variables).

Results
By solving the optimization problem, a key result is the magnitude of the multipliers (λ i ) that provide the best trade-off between all slacks in order to minimize its total sum for the whole set of hours in 2017. The results obtained for the VRES multipliers are shown in the first row of Table 2. At this point, we should note that the additional proposed VRES capacity is (λ i − 1) multiplied by the existing capacity for each source from Table 2. In order to better visualize the obtained results, we have depicted in Figure 11, for a randomly chosen week (The fourth week of the year, from January 22th until January 28th), the demand (black curve) and the model output (red curve). In this figure, we can appreciate the crossing between both curves. As shown above, this model minimizes the area between both curves; therefore, it minimizes the shortages and surpluses. In order to benefit from the surpluses of generation, we need to develop storage systems. The capacity of these storage systems should be based not only on the amount of stored energy but also on the power of the storage system. Based on the proposed increase of VRES shown in Table 2 we can readily compute and analyze the hourly slacks (both surpluses and shortages) and obtain power differences and time intervals of the individual slacks. Devoting our attention to the periods of power surpluses, we can compute for each one of them the accumulated energy surplus, as well as the length interval, which are key variables to estimating the needed grid storage capabilities.
The results from the analysis show that there has been surpluses of energy during 308 periods of the year. Obviously, these periods present different durations as well as different accumulated energies. We have observed that the maximum length of all periods is 80 h and for the minimum 1 h (which is the resolution of the model). The median shows a length period duration of 7.0 h and a mean of 9.7 h. Analogously we can proceed in the same manner with the shortages. In Table 3, we show the descriptive statistics of the length and energies of the periods for the surpluses and shortages.

Surplus Backup and Storage Management
A more detailed approach to the above slack analysis leads us to think of a bivariate random variable (energy and period length) and to build confidence intervals for these new variables. In Figure 12, we show a bivariate kernel density plot of the empirical distribution of stored energy requirements in terms of the amount of energy and the duration of the periods corresponding to the surpluses. In this scenario, it can be estimated that 50% of the storage requirements would be covered with 32 GWh during 9 h approximately, and 75% of the storage needs would require 54 GWh and 11 h. Currently, the only affordable system capable of this amount of storage for a country with the orography of Spain is a hydro-pumped storage [39]. Based on these results, it is reasonable to think a VRES promotion joined with storage systems would allow the adjustment between the generation and demand for short periods (between 5 and 12 h). Next, we will discuss in more detail the results obtained for the surpluses and the shortages. In relation to the surpluses, the most important aspect is if we are able to collect all of this energy in the available storage systems. When dealing with systems at a national level, practically, the most viable storage technique is hydro-pumped systems due to their large storage capacity and their fast response to power demands from the grid. In Spain, all the hydro-pumped storage systems in operation at present amounts to 5.97 GW [32], and a government report informs that, by 2020, it will scale up to 6.3 GW [40]. Since from Table 3 we get 10.1 GW for the maximum power surplus, it means that it should be a priority to construct more hydro-pumped capacities of at least about 3.8 GW. In this manner, no surplus energy would be lost, except about 20-25% wasted in the round-trip cycling process during storage. In spite of this, we believe that it should be a priority to add more additional storage of about 4 GW to make viable the total decarbonisation.
In the case of the shortages, according to the results obtained from Table 3, the whole electricity system would need a yearly amount of backup energy of around 27.8 TWh. However, from this amount, we should subtract 75% of the surplus just calculated if we assume 25% of energy losses in the entire storage process. Evidently, there are few options to provide the needed backup power, since it has to be dispatchable, to be flexible and to have a high ramping rate (see Section 3.4). Hydroelectric power plants could be used, but these resources are scarce and already used to reinforce the high demand in the late morning hours and in the evening (see Figure 5). A more realistic solution is to use CCGT plants for backup since many of these plants are idle for long periods of time as can be deduced from the low value of their capacity factor in Table 1. Also from Table 3, we can appreciate that the maximum power needed for backup is 8140.5 MW, which is about one third of the CCGT installed power (24.9 GW from Table 1). In this table, it is also shown that the maximum demand of CCGT during the year has been 16,948.5 MW, leaving a safe interval for the abovementioned need for a backup.

CO 2 Emission Avoided
A simple calculation permits us to find the reduction in CO 2 emissions in the optimal model that we have just proposed for the total substitution of coal power plants. From the total emissions (74.9 million ton) of Spain's power system, the amount due to electricity generated from coal power plants represented 42.9 million tonnes and those of CCGT represented 15.05 million tonnes [18]. Since in the development of our model in Section 4, we had eliminated all coal power plant generation, the corresponding emissions should be also eliminated. On the contrary, in the case of CCGT emissions, we have to additionally consider the ones emitted in the abovementioned backup processes. From the elimination of coal emissions and the relatively small addition coming from the backup, we calculate a savings of 37 million tonnes or 51% of the total emissions attributed to the power generation sector. Note that, in this calculation, we have not considered the emissions from the renewables' entire lifecycle [10].

Summary and Conclusions
As indicated in the Introduction (Section 1), the main goal of this paper is to study the 2030 power transition in Spain. Accordingly, we first made in Section 2 an in-depth study of the 2017 power generation from VRES (wind, solar PV and solar CSP) in Spain following the scheme of fan charts (Figures 2-5) to provide a visual sequential distribution of the generation during the 24 h of the day and the different seasons of the year. Next, Section 3 is dedicated to the main strategies to be followed in relation to the 2030 power transition. In this sense, the most important governmental decision is the total phaseout of coal generation and its substitution by VRES. This will require an intensive development of VRES of about 5 GW of power per year [24]. Since, as we have noted, coal is a dispatchable kind of energy, its substitution will create important problems of grid stability. Therefore, this is one of the main challenges for which we propose a solution based on the use of the remaining idle CCGT plants with the advantage that gas plants have much higher ramping speeds and flexibility than coal ones.
As we have pointed out in this work, the substitution of all coal power plants by VRES in a period of 10-12 years will not be free of difficulties, mainly due to the uncertainty in their generational dependence on climate conditions as well as the limitations on the large-scale storages currently available. One of the main contributions of this study is the estimation of what we have called the optimal mix, which is based on linear programming tools. This optimal mix not only inform about the desirable proportion of the main renewable sources but also provides key information about the risk of power shortages, which is very relevant for backup requirements. Moreover, in those situations when generation exceeds the demand, our results may help to design proper storage systems. Our results suggest that wind and solar PV should double their installed capacity while concentrated solar should increase by about four times its current capacity. In addition, this increase of VRES should be closely followed by an increase in large-scale storage systems (pumped storage) and/or the implementation of demand side management as well as an increase in the interconnection capacity with France [24].
Focusing our attention on shortage periods, our findings show that the current extra available capacity of combined cycle gas turbines, which is about 8 GW, can cope with those shortage situations in the near future without the need of additional backup systems investment. However, our proposed increase of renewables in the mix will not yet reach the target of 70% announced by the current government for 2030 [24]. An additional increase of renewables beyond our estimation will also require larger investments in storage systems in order to avoid the curtailment scenarios.
This work opens two interesting lines of future research: Firstly, the use of linear programming to design more advanced models for the very high integration of renewables and, secondly, the analysis of surpluses derived from our model will contribute to a better development of storage systems and smart grids requirements so as to take profit of those periods when generation becomes greater than demand.
Finally, from our results it can be concluded the following actions:

A summary of the required actions to be taken during the energy transition (2020-2030) in Spain
• The progressive replacement of all coal power plants by renewables: This implies more than duplicate the present VRES capacity (114.4%) of renewables in 2030. • In order to minimize the need of backup and storage, an optimal development of renewables is required. Linear programming has been used to find the optimal balance between VRES with the following results for the increase of individual VRES by the factors: Wind, 100%; solar PV, 85%; and solar CSP, 305%. • From the above results, a promotion of solar CSP (305%) presents a challenge for Spain since it usually includes storage. • Since the calculated amount of renewables implies both surpluses and shortages, electricity storage actions should be taken as well as backup reinforcement. • An analysis of the calculated surpluses shows the need of storage of around 54 GWh for 11 h to be able to capture 75% of this energy. • The need for backup should be at least 8.14 GW. Currently, there is a similar amount of CCGT available. Funding: This research received no external funding.