Forecast Error Sensitivity Analysis for Bidding in Electricity Markets with a Hybrid Renewable Plant Using a Battery Energy Storage System

: Deep integration of renewable energies into the electricity grid is restricted by the problems related to their intermittent and uncertain nature. These problems a ﬀ ect both system operators and renewable power plant owners since, due to the electricity market rules, plants need to report their production some hours in advance and are, hence, exposed to possible penalties associated with unfulﬁllment of energy production. In this context, energy storage systems appear as a promising solution to reduce the stochastic nature of renewable sources. Furthermore, batteries can also be used for performing energy arbitrage, which consists in shifting energy and selling it at higher price hours. In this paper, a bidding optimization algorithm is used for enhancing proﬁtability and minimizing the battery loss of value. The algorithm considers the participation in both day-ahead and intraday markets, and a sensitivity analysis is conducted to check the proﬁtability variation related to prediction uncertainty. The obtained results highlight the importance of bidding in intraday markets to compensate the prediction errors and show that, for the Iberian Electricity Market, the uncertainty does not signiﬁcantly a ﬀ ect the ﬁnal beneﬁts.


Introduction
Among the actions being taken against climate change, one of the main measures is to introduce larger amounts of renewable power sources in electricity systems [1]. As an example, the renewable power installed in Spain recently exceeded the nonrenewable power [2]. Nevertheless, higher integration of renewable power sources implies some concerns associated with their variability.
From the point of view of the system operator, a higher amount of intermittent power sources results in more problems to assure grid reliability and stability. Besides, in order to overcome these problems, greater amounts of energy reserve are needed [3]. This reserve is given by the so-called reserve power plants, and their usage implies a higher electricity price.
From the point of view of the power plant owner, the stochastic nature of the renewable power sources also involves some challenges and problems, mainly due to the rules of the electricity markets in which they participate. In addition, there exist the ancillary service markets. Among them, the most remarkable are the secondary and tertiary markets. In these markets, power supply availability is offered by the power plants. Therefore, in case any of the production plants fail, there is an immediate power production replacement, and thus the grid frequency is kept inside its nominal values [20]. For this study, day-ahead and intraday market participation were analyzed.
The production imbalances are treated separately in the Iberian Electricity Market. On the one hand, in case a plant produces more energy than the amount committed, the plant gets paid with a price equal to or less than the day-ahead price. On the other hand, if the plant produces less energy than the one committed, the plant pays a price equal to or higher than the day-ahead price for that hour. For this study, real data have been considered, and mean values have been applied considering penalties from 2016 to 2018. Penalties of 13% and 14% have been applied for positive and negative imbalances, respectively.

Price Predictions
Since the aim of this study is to evaluate the effects of the prediction errors, no error is applied to the real price. Thus, it is assumed that the price estimations are perfect. As for the values, in order to perform the simulations, real data were taken from the Spanish System Operator Information System [21].
Besides, it should be noted that, in both cases, day-ahead market values are considered since day-ahead and intraday market prices present small differences in the Iberian Electricity Market.

Production Predictions
The stochastic nature of wind and sun introduces uncertainties in the prediction of energy production for future hours. Great advances have been done in the development of forecasting tools in Sustainability 2020, 12, 3577 4 of 18 the last few years, but effectiveness is lost as the prediction horizon increases. Focusing on the Iberian Electricity Market, this becomes a problem since, as presented in Table 1, electricity market auctions are conducted hours before delivery. It should be pointed out that recent changes in the legislation have introduced the Iberian Electricity Market into a European Electricity Market (XBID), in which auctions are conducted every hour. Nonetheless, since this market is still new, few amounts of energy are still bid on in the XBID market in Spain, and there is not enough data to conduct the simulations. For these reasons, this study only considers the participation in the day-ahead and Iberian intraday markets defined in Table 1.
With these ideas in mind, it is important to consider the prediction errors and the potential energy production deviation penalties to perform more realistic simulations.
In most academic papers related to the topic, when applying production prediction errors to day-ahead and intraday market simulations, a constant error is applied to each of them (the same error distribution is applied to each of the hours in those markets) [11,22]. In this paper, however, a more realistic approach is conducted, and the error varies depending on the prediction horizon.
The aim of this study is not to present or develop a new prediction tool, but to apply expected or usual errors given in real predictions. In the case of Spanish System Operator, Red Eléctrica de España (REE), a prediction tool called SIPREÓLICO [10,11] is used in order to perform the wind production predictions for next day and in order to schedule next-day demand. Using data from [10], and fitting it with the least-squares method (LSM), it is observed that the root-mean-square error given in the production predictions, which corresponds to the standard deviation (STD) for each horizon, fits with a square root function (see Figure 1). The formulation is presented in Equation (1): where k is a constant value obtained with the LSM, and ∆t is the time step of the prediction data.

Production Predictions
The stochastic nature of wind and sun introduces uncertainties in the prediction of energy production for future hours. Great advances have been done in the development of forecasting tools in the last few years, but effectiveness is lost as the prediction horizon increases. Focusing on the Iberian Electricity Market, this becomes a problem since, as presented in Table 1, electricity market auctions are conducted hours before delivery. It should be pointed out that recent changes in the legislation have introduced the Iberian Electricity Market into a European Electricity Market (XBID), in which auctions are conducted every hour. Nonetheless, since this market is still new, few amounts of energy are still bid on in the XBID market in Spain, and there is not enough data to conduct the simulations. For these reasons, this study only considers the participation in the day-ahead and Iberian intraday markets defined in Table 1.
With these ideas in mind, it is important to consider the prediction errors and the potential energy production deviation penalties to perform more realistic simulations.
In most academic papers related to the topic, when applying production prediction errors to day-ahead and intraday market simulations, a constant error is applied to each of them (the same error distribution is applied to each of the hours in those markets) [11,22]. In this paper, however, a more realistic approach is conducted, and the error varies depending on the prediction horizon.
The aim of this study is not to present or develop a new prediction tool, but to apply expected or usual errors given in real predictions. In the case of Spanish System Operator, Red Eléctrica de España (REE), a prediction tool called SIPREÓLICO [10,11] is used in order to perform the wind production predictions for next day and in order to schedule next-day demand. Using data from [10], and fitting it with the least-squares method (LSM), it is observed that the root-mean-square error given in the production predictions, which corresponds to the standard deviation (STD) for each horizon, fits with a square root function (see Figure 1). The formulation is presented in Equation (1): where is a constant value obtained with the LSM, and ∆ is the time step of the prediction data. Therefore, the error given is defined with a Ν(0, √∆ ) distribution for each prediction horizon point.
This kind of distribution resembles the one given in a Brownian movement, which is used to define the movement of small particles, as defined by Einstein [23]. Thus, the prediction curves for the simulations are created by applying this Brownian movement distribution. In this case, the errors are applied to the physical magnitudes affecting the prediction: wind speed, irradiance, and air temperature. As an assumption, the same distribution is applied to all of them. Then, once these weather predictions are created, production is calculated. Therefore, the error given is defined with a N 0, k √ ∆t distribution for each prediction horizon point. This kind of distribution resembles the one given in a Brownian movement, which is used to define the movement of small particles, as defined by Einstein [23]. Thus, the prediction curves for the simulations are created by applying this Brownian movement distribution. In this case, the errors are applied to the physical magnitudes affecting the prediction: wind speed, irradiance, and air temperature. As an assumption, the same distribution is applied to all of them. Then, once these weather predictions are created, production is calculated.

Weather Predictions Generation
In order to create the weather time series predictions for each case, an integral term is added to the original time series: where prediction(k + 1) is the value for the prediction time series for instant k + 1, original(k + 1) is the original time series value at instant k + 1, and integral(k + 1) is the added integral error value for instant k + 1. The integral value proposed in this study is calculated using an autoregressive model AR(1): where ε(k) is the random noise at iteration k, with a Gaussian distribution N 0, k √ ∆t , as the one given with the Brownian movement.
A complete prediction time series is created with the following iterative process: (1) Initialize the iteration counter k → 1 .
N iter is the number of iterations conducted to generate the complete time series; since the initial values are predefined, its value is defined in Equation (4).
Another point to note is that, in case non-possible wind speed and irradiance values are obtained, a new random noise is generated until a possible value is obtained. This guarantees that all the cases generated are realistic.
As an example of the results obtained with this method, Figure 2a shows an original wind speed time series and the prediction series created. Note that the prediction error tends to be higher as prediction horizon increases. Figure 2b shows that the desired STD error is reached.

Weather Predictions Generation
In order to create the weather time series predictions for each case, an integral term is added to the original time series: where ( + 1) is the value for the prediction time series for instant + 1, ( + 1) is the original time series value at instant + 1, and ( + 1) is the added integral error value for instant + 1.
The integral value proposed in this study is calculated using an autoregressive model AR(1): where ( ) is the random noise at iteration , with a Gaussian distribution Ν(0, √Δt), as the one given with the Brownian movement. A complete prediction time series is created with the following iterative process: 1) Initialize the iteration counter → 1.
is the number of iterations conducted to generate the complete time series; since the initial values are predefined, its value is defined in Equation (4).
Another point to note is that, in case non-possible wind speed and irradiance values are obtained, a new random noise is generated until a possible value is obtained. This guarantees that all the cases generated are realistic.
As an example of the results obtained with this method, Figure 2 (a) shows an original wind speed time series and the prediction series created. Note that the prediction error tends to be higher as prediction horizon increases. Figure 2 (b) shows that the desired STD error is reached.

Production Predictions Generation
Once the weather predictions are generated, it is possible to calculate the theoretical power produced by the wind turbines and solar photovoltaic (PV) panels. Then, after calculating the instant production in time, the total hourly production is calculated.
As for the wind production, the power is calculated using the P − v curve corresponding to the wind turbines of the case study. Real wind speed (v) values are taken from a weather station near the simulated HRES location. Then, the values are extrapolated to the wind turbine hub height, using Equation (5): where v(z) is the wind speed at hub height z, v(z r ) is the wind speed at the weather station anemometer height z r , and α is the power law exponent, which is calculated by using the expression proposed by Counihan [24] in Equation (6): where z 0 is the surface roughness, which for this case is taken as 0.1 m, referring to an area with few trees.
Regarding the solar power production, it is assumed that the PV panels produce the maximum power available for each of the weather conditions. The power is calculated with Equation (7): where P STC refers to the maximum solar power at standard test conditions (STC), P solar is the solar power produced at T cell ( • C) cell temperature and G irradiance W/m 2 conditions, and γ • C −1 is the power coefficient of the module. The cell temperature is calculated with Equation (8).
where T air is the ambient air temperature and NOCT refers to the cell temperature at nominal operating conditions G = 800 W/m 2 , T amb = 20 • C, v wind = 1 m/s . This value is usually included in the solar module datasheet.

Battery Modelling
Both the energy efficiency of the battery and its state of health (SOH) are considered in the battery model.
The energy efficiency is modelled in terms of the power given by the battery, in contrast to other similar studies in which it is modelled as constant. An equivalent circuit model (ECM) is used to obtain the static response. The model consists of an ideal voltage source (OCV) and a series resistance (R s ). By using this model, the corresponding energy efficiency curves are obtained. Equations (9) and (10) define the efficiency for charging and discharging cases, respectively: The battery efficiency is defined as the relationship between internal and external measured power and varies depending on the flow direction. The efficiency is expressed in terms of the internal power since the optimization uses this variable.
Regarding the SOH of the battery, this parameter can be defined as the current maximum capacity of the battery compared to its nominal value. In this study, the SOH is calculated using the Wöhler method [25,26]. This method is an event-oriented ageing model which calculates the battery degradation based on the performed charging and discharging cycles. The Wöhler method has been previously used in similar studies [11,27,28], and it is suitable due to its simplicity and sufficient accuracy for long-term simulation, like the ones to be conducted.
The method calculates the resting lifetime of the battery based on the relationship between the number of cycles already performed and the maximum number of cycles for its end of life. The maximum number of cycles varies depending on the depth of discharge (DOD), and on the type of battery. For this study, the data are taken from [29]. The total loss of life (LL) is calculated with Equations (11) and (12): where LL i is the loss of life given in each DOD range, n i cycles is the number of cycles given at that range, and N i cycles is the maximum number of cycles for its end of life at that range. From Equation (11), it is possible to calculate the remaining lifetime as follows: where LL year is the loss of life given in a year. The number of cycles performed in a certain period of time is calculated using the Rainflow cycle counting algorithm [30].

Optimization Problem
In order to perform the sensitivity analysis, different forecast error curves are going to be tested for the same optimization strategy. The optimization is conducted using a particle swarm optimization (PSO) algorithm, which enables solving the nonlinear terms of the cost function. The optimization algorithm has two performance terms: enhancing the final profitability and minimizing the battery loss of value.

Optimization Algorithm
Particle swarm optimization is a heuristic optimization methodology, first presented by Kennedy and Eberhart [31], used to solve nonlinear functions. The main basis is to find a solution to the problem by iteratively modifying some initial possible solutions, named particles. The formulation used in this article introduces an inertia weight term, which was firstly presented by Shi and Eberhart [32], and which defines the balance between exploration and exploitation around the possible solutions domain. x Equation (14) defines the speed (v i ) by which particles change their position (x i ), which is calculated in Equation (15). The meanings of each variable and parameter are summarized in Tables 2 and 3. Table 2. Variables used in particle swarm optimization algorithm.

Variable
Definition v i Speed of particle i x i,best Best local position for particle i x i ith particle position x best Best global position The inertia can be calculated in many different ways, and after different comparisons, the linear time-varying method has been found to give better results for this particular case [33]. Equation (16) shows the corresponding formulation: where n iter is the number of the current iteration, and w i min and w i max are the minimum and maximum inertia values, respectively, defined in Table 3.
One of the main benefits of selecting this optimization technique is the few number of parameters needed to adjust in order to solve a problem. Besides, its suitability for solving energy-related optimization problems has been proven in previous studies [34][35][36][37].

Cost Function
The optimization problem covers two aims: maximizing the profits obtained by the plant and minimizing the loss of value.
From the optimization point of view, the profits obtained from wind and solar energy production are constant since they rely on the predictions. Thus, the only variable term considered for the optimization is the profit obtained with the battery at each hour. The battery profits are calculated based on the energy given (positive) or received (negative) by the battery E give bat h and the electricity price predictions (price h ) for each bidding period, which in the Iberian Electricity Market corresponds to an hour.
As explained in the battery modelling section, the energy losses vary depending on the power given/received by the battery. Thus, the given energy can be expressed in terms of the internal energy of the battery at the end of each hour E bat h , considering that the energy is supplied at constant power. Equations (17) and (18) define the energy given for charging and discharging cases: Charge: Discharge: where η chg h and η dis h are the energy efficiencies at hour h for charging and discharging cases, respectively, calculated with Equations (9) and (10).
With these considerations, the variables to be optimized at each case are the energy left in the battery at the end of each hour.
Regarding the loss of value of battery, this term aims to embrace both battery usage and technology degradation. The usage degradation, as explained in the battery modelling section, is calculated by its loss of life (LL) related to the cycles performed, using the Wöhler method. The technology degradation is covered by considering the expected price decrease [7,38].
Using the price values and estimations reported by Bloomberg New Energy Finance [38], an exponential trend line has been modelled, as shown in Equation (16), defining the battery unit price (UP) in (€/kWh).
UP day = 162.3 e −0.1029 d 365 (19) where d corresponds to the day being analyzed, starting from 1 January 2018. Thus, considering both the LL and technology devaluation, the loss of value (LV bat ) of the battery for a determined time span is defined in economic terms as follows: Therefore, considering both profit maximization and loss of value minimization, the cost function for the optimization problem is defined as: where N h is the number of optimized hours, which varies depending on the market (see Table 1).

Bounds and Constraints
The bounds for the optimization variables, which are the energy of the battery at the end of each hour, are related to its minimum and maximum state of charge (SOC). For this case, minimum and maximum values of 20% and 80% have been considered, respectively. Avoiding complete charging or discharging of the battery aims to enhance the battery lifetime, as explained in [39].
Regarding the constraints, the given energy at each hour is limited first by the maximum power. This is modelled by Equations (22) and (23).
where P max bat chg and P max bat dis are the maximum power for charging and discharging cases and are limited by their respective efficiencies. Secondly, in the studied case it is not allowed to charge the battery from the grid. Thus, the maximum charge of the battery for each hour is limited by the corresponding energy and solar production E gen h .
Finally, the last constraints are linked to the energy SOC of the battery at the end of the day. To avoid reaching a minimum SOC value, which would limit the strategy for the following optimization day, a SOC interval is defined for the end of the day.
where SOC 24 min and SOC 24 max are the minimum and maximum SOC values at the end of the day, respectively. In this case, they are set to 55% and 65%, respectively.

Algorithm Initialization Methods
Since heuristic algorithms such as PSO do not always assure finding the global optimal solution, different initialization methods are used to make sure that a profitable result is always obtained.

Random Initialization
In this first method, the initial particles are created in a completely random way.

LP Result-Based Initialization
For this second method, a linear programming (LP) optimization [40] is performed first for a simplified cost function of the case. In order to be linear, this function does not consider neither the battery degradation, nor the energy efficiency: Once this LP solution is obtained, it is included inside the initial population. The rest of the initial particles are created based on this LP result by applying random multiplying factors to it. This way, the LP result improvement is assured.

No Battery Use Initialization
This third method is used when the profit obtained with the previous two methods is below the one achievable without using the battery in that optimization period. In this case, the initial particles are created based on a result in which the battery is not used. Applying this strategy, for the given predictions, a nonnegative result is always ensured.
Besides, it should be noted that, in intraday market optimizations, for the three methods, previous optimization results are considered into the new initializations to accelerate the solution convergence and improve the previously found solution.

Hybrid Plant
The hybrid renewable plant characteristics are defined in Table 4. Solar panels are modelled using the datasheet for Atersa ULTRA A-255 modules [41]. The wind turbines selected are the WindPACT 1.5 MW reference wind turbines from the NREL [42]. As for the battery, the efficiency modelling is based on the datasheet of LifeBatt X-2E 15Ah 40166 Li-ion cells. The plant is considered to be located in the province of Araba, in Spain, and data for year 2018 have been taken for the study. The weather data are taken from the Basque Meteorological Agency, Euskalmet [43].

Sensitivity Analysis
A quantitative sensitivity analysis is performed by simulating the plant operation for a complete year with different setups. The first aim is to analyze the effects of applying different forecast errors. The second objective is to perform a comparison between the results obtained bidding only in the day-ahead market or bidding both in day-ahead and intraday markets.
As for the forecast error cases, different levels of errors are modelled applying the square root error STD functions. The error STD values at 24 h prediction horizon are: 0% (no error case), 5%, 10%, 15%, and 20%. The error standard deviation curves are shown in Figure 3. The plant is considered to be located in the province of Araba, in Spain, and data for year 2018 have been taken for the study. The weather data are taken from the Basque Meteorological Agency, Euskalmet [43].

Sensitivity Analysis
A quantitative sensitivity analysis is performed by simulating the plant operation for a complete year with different setups. The first aim is to analyze the effects of applying different forecast errors. The second objective is to perform a comparison between the results obtained bidding only in the day-ahead market or bidding both in day-ahead and intraday markets.
As for the forecast error cases, different levels of errors are modelled applying the square root error STD functions. The error STD values at 24 h prediction horizon are: 0% (no error case), 5%, 10%, 15%, and 20%. The error standard deviation curves are shown in Figure 3.

Results and Discussion
Simulations have been conducted using an Intel Core i7 CPU with 16 GB of RAM. With the selected parameters, each optimization is performed in less than 40 s. Figure 4 shows the energy imbalances and profit deviations obtained from the forecast error cases both for day-ahead (DM) and combined day-ahead and intraday market (DM + IM) participation.
In Figure 4a, the mean positive and negative deviations between the committed energy production and the real production are shown. It should be noted that, during real-time simulation, no control actions are taken to compensate these deviations since the aim is to analyze the effects of the forecasting errors. As for the imbalances, the result is consistent since the energy imbalance

Results and Discussion
Simulations have been conducted using an Intel Core i7 CPU with 16 GB of RAM. With the selected parameters, each optimization is performed in less than 40 s. Figure 4 shows the energy imbalances and profit deviations obtained from the forecast error cases both for day-ahead (DM) and combined day-ahead and intraday market (DM + IM) participation. increases as the forecast uncertainty rises. Besides, similar results are obtained for positive and negative imbalances, which matches with the applied Brownian movement normal distribution. Figure 4b shows the difference between the total received profit after applying imbalance penalties and the original schedule profit. As happens with the energy imbalances, the result is consistent since higher deviations are obtained for cases in which the forecast error STD is higher. Nevertheless, the profit deviation is not as high as the energy imbalance. This result is given for two reasons. First, the difference is conditioned by the imbalance penalties. Based on real data, these are taken as 13% for positive imbalances and 14% for negative imbalances. Second, it must be considered that the penalty is applied to the hourly price, influencing the final result.  Finally, in both energy and price deviation results, it is observed that, participating in intraday markets, both energy imbalances and profit deviations are significantly reduced. Figure 5 shows the battery profitability frequency distributions for day-ahead market participation strategy and for the combined day-ahead and intraday market participation strategy. In both cases, the profitability obtained with the battery is not high, showing slightly better results when intraday market participation is included. This is related to the fact that, in intraday markets, forecast errors are usually lower and, thus, more precise bidding decisions are taken. In Figure 4a, the mean positive and negative deviations between the committed energy production and the real production are shown. It should be noted that, during real-time simulation, no control actions are taken to compensate these deviations since the aim is to analyze the effects of the forecasting errors. As for the imbalances, the result is consistent since the energy imbalance increases as the forecast uncertainty rises. Besides, similar results are obtained for positive and negative imbalances, which matches with the applied Brownian movement normal distribution. Figure 4b shows the difference between the total received profit after applying imbalance penalties and the original schedule profit. As happens with the energy imbalances, the result is consistent since higher deviations are obtained for cases in which the forecast error STD is higher. Nevertheless, the profit deviation is not as high as the energy imbalance. This result is given for two reasons. First, the difference is conditioned by the imbalance penalties. Based on real data, these are taken as 13% for positive imbalances and 14% for negative imbalances. Second, it must be considered that the penalty is applied to the hourly price, influencing the final result.
Finally, in both energy and price deviation results, it is observed that, participating in intraday markets, both energy imbalances and profit deviations are significantly reduced. Figure 5 shows the battery profitability frequency distributions for day-ahead market participation strategy and for the combined day-ahead and intraday market participation strategy. In both cases, the profitability obtained with the battery is not high, showing slightly better results when intraday market participation is included. This is related to the fact that, in intraday markets, forecast errors are usually lower and, thus, more precise bidding decisions are taken. Finally, in both energy and price deviation results, it is observed that, participating in intraday markets, both energy imbalances and profit deviations are significantly reduced. Figure 5 shows the battery profitability frequency distributions for day-ahead market participation strategy and for the combined day-ahead and intraday market participation strategy. In both cases, the profitability obtained with the battery is not high, showing slightly better results when intraday market participation is included. This is related to the fact that, in intraday markets, forecast errors are usually lower and, thus, more precise bidding decisions are taken. Tables 5, 6, and 7 show the numerical results obtained for each performed complete year simulation. Table 5 shows the results obtained for just day-ahead market participation, Table 6 shows  Tables 5-7 show the numerical results obtained for each performed complete year simulation. Table 5 shows the results obtained for just day-ahead market participation, Table 6 shows the results for day-ahead and intraday markets participation, and Table 7 provides a comparison between the profits obtained in each case, in relative terms. The plant profits decrease in simulations in which the forecast uncertainty increases. Nevertheless, as can be observed in Figure 4b, the profit variation is lower when intraday market participation is applied. In addition, in contrast to the plant profit results, the battery profitability remains almost unchanged for different forecast error cases. The same effect is observed in the remaining battery lifetime at the end of the year. The reason for this is that the main parameter which affects the battery profitability and usage is the price difference and, as this parameter does not change between different simulations, neither does the battery usage strategy.
The small variations between simulations are caused by the effect of the production forecasts in the optimization, since the strategy establishes that the batteries cannot be charged from the grid. As a result, the mean profitability is slightly higher when intraday market participation is performed. The same happens with the battery lifetime.
The effects of participating in intraday markets are better analyzed in a particular day case. As an example, the results obtained for day 83 (24/03/2018), with a forecast error STD of 10% at 24-h prediction horizon, are analyzed. Figures 6a and 7a show the real plant production curve (wind and solar production) versus the predictions conducted at market auction time. Even if, due to the normal distribution, results can vary, by participating in intraday markets, usually more accurate weather predictions are done and, thus, better production predictions. This effect is noted in Figure 8, where the deviation between real production and production estimations is shown. Figures 6b and 7b show the different SOC curve strategies obtained from the optimization, as well as the applied price predictions (which, as explained before, are kept constant for different optimizations). The SOC strategy varies slightly for different market bids. The reason for this could be that the new prediction causes a new optimization result or that PSO does not always find the global best solution. Nevertheless, for new optimizations during intraday markets, the previous optimization result is considered. Thus, the new result improves or keeps the previous solution. Furthermore, the results have a great similarity.
Finally, Table 8 summarizes the results obtained for each market participation strategy. From the table, it is concluded that energy imbalances are reduced considerably, which involves obtaining higher total profits. Besides, for this particular day case, with the intraday market participation the battery usage is more efficient. Thus, a higher profitability is obtained.        Finally, Table 8 summarizes the results obtained for each market participation strategy. From the table, it is concluded that energy imbalances are reduced considerably, which involves obtaining higher total profits. Besides, for this particular day case, with the intraday market participation the battery usage is more efficient. Thus, a higher profitability is obtained.

Conclusions
A sensitivity analysis has been conducted for a HRES with a battery energy storage system. First, the effects of forecast errors have been analyzed. Second, the benefits of participating in intraday markets have also been assessed. All the simulations have been conducted for a complete year using real data in order to obtain realistic results.

Conclusions
A sensitivity analysis has been conducted for a HRES with a battery energy storage system. First, the effects of forecast errors have been analyzed. Second, the benefits of participating in intraday markets have also been assessed. All the simulations have been conducted for a complete year using real data in order to obtain realistic results.
Regarding the sensitivity analysis, the results show that even if energy deviations increase considerably as forecast uncertainty rises, the total profits obtained by the plant do not change substantially. As for energy arbitrage, the profitability obtained is not high and this is caused by the small price deviations in the Iberian Electricity Market. Performing energy arbitrage is important to obtain as much profitability as possible from the price differences in the market, but if these price differences during the day are not high, neither are the benefits obtained from performing this strategy. For that reason, there are cases during the year in which the usage of the battery for arbitrage is not compensated with the cost related to the cycling degradation. In these cases, the optimization algorithm establishes that the battery is not going to be used. This is the reason why such a long life estimation has been obtained at the end of the year in all simulations. Besides, no clear correlation is observed between the used forecast error STD curve and the profitability of the battery, since all the results are similar. This is consistent, as even if energy production constrains the battery strategy, the most limiting factor is usually the price difference, which does not change between simulations.
As for the market participation strategies, it has been proven that the participation in intraday markets enhances the profits and reduces the energy imbalances compared to only day-ahead market participation. This effect is higher as the forecast uncertainty rises.
A final point to note is that, even if profitability increases with intraday market participation, the benefits from performing energy arbitrage are not substantial in the Iberian Electricity Market. Thus, investing in a battery energy storage system just for energy arbitrage application may not be cost-effective. For this reason, as well as for arbitrage purposes, the battery system should be also considered for other remunerated applications such as providing ancillary services or compensating production curtailments. This subject will be treated in future studies.