Keywords

1 Introduction

Wind power is now widely recognized as an important part of the global energy mix, and the actors of the energy industry must cope with the intermittent and to a large extent unpredictable nature of the wind power production. To deal with this intermittency, various economic and physical tools are available to the agents. On the one hand, intraday markets, where wind power may be traded up to 30 min prior to delivery, allow the wind power producers to adjust their delivery volume estimates as the forecast becomes more precise. On the other hand, physical storage facilities whose cost is constantly declining, may be used to smooth out the production peaks and store the extra power until it can be sold at a profit.

In this paper, we therefore consider the problem of a (small) wind producer who has access to the spot (day-ahead) and intraday electricity markets and has the possibility of partially storing the produced energy using a battery storage facility. The role of battery storage is two-fold: on the one hand, it smoothes the variations of wind power production, and on the other hand, it allows to exploit intertemporal price discrepancies in the day-ahead market. The aim of the producer is to maximize the expected gain of selling in the market the energy produced during a 24-h period. The producer first makes a bid in the day-ahead electricity market for the following day, and then, when the intraday markets for that day opens, may adjust her position by trading in the intraday market. The strategy of the producer therefore consists of a static part (position in the day-ahead market) and a dynamic part (trading strategy in the intraday market). The deliveries in the spot and intraday market must be at all times balanced by the wind production and battery injections/withdrawals. The dynamic trading strategy is thus constrained by the finite capacity of the battery. To determine the dynamic part of the strategy, we set up a stochastic model for the intraday market price and the realized power production.

We mention that the majority of wind power producers in Europe still operate within the framework of guaranteed purchase schemes whereby all the power they produce is bought by the state-owned operator at a fixed price. However, as the guaranteed purchase schemes are either phased out or replaced with more market-oriented subsidies, the wind power producers face the need to sell the future power production in the open markets in the absence of precise knowledge of the volume to be produced.

In the literature, optimal operation of battery storage facilities has primarily been considered in the context of microgrid control (see [11] for an up-to-date review and, e.g., [8] for an example of using dynamic programming techniques similar in spirit to the ones employed in the present paper). Another interesting reference in this respect is [7], where the impact of forecast errors on optimal sizing of battery storage in an isolated microgrid is evaluated. On the other hand, optimal bidding strategies in intraday electricity markets for wind power producers who do not have access to battery storage, have been studied in a number of papers, see e.g., [1, 2, 6, 10]. However, among wind power producers there is an interest towards investing into battery storage to smooth out the intermittency of the renewable resource. More recently, therefore, several authors have considered optimal bidding strategies for systems consisting of a wind power plant and a storage capacity.

In [4, 5], optimal bidding strategies in the day-ahead market for wind-storage systems are determined. The optimization is in this case static and the presence of intraday market or the dynamic properties of market prices are not taken into account. However, a recent study [9] shows that intraday markets are increasingly used by renewable energy producers to balance the forecasting errors in their production. It is therefore important to evaluate the economic benefits of battery storage facilities for renewable power producers and to determine optimal strategies for their operation in the presence of intraday market. One study of bidding strategies in both day-ahead and intraday markets is [3], where it is considered that market participants can readjust their bids 6 times per day in the intraday market. The price are, however, assumed to be the same in the day-ahead in intraday market. Compared to these references, our contribution is to introduce stochastic dynamic models for both the wind power production and the intraday market price, calibrate them to market price and wind production data, and find globally optimal dynamic bidding and operation strategies for the wind producer using the stochastic control approach.

The paper is structured as follows. After describing the optimization problem faced by the producer in Sect. 12.2, we introduce stochastic models for the intraday price process and the realized production process. The methodology for calibrating these models to real data is described in Sect. 12.3. Finally, in Sect. 12.4, we solve the optimization problem of the agent within the framework of stochastic control and optimal quantization and present numerical applications. The data used for model calibration and numerical examples comes from a power plant in France consisting of three 2MW wind turbines.

2 Description of the Model and the Optimization Problem

In this section, we detail our assumptions concerning the structure of electricity markets and formulate the optimization problem faced by the power producer and the models we use for power production and the market prices.

Structure of the Intraday Market

Intraday electricity market is an electricity exchange where blocks of power for delivery on a given day may be traded starting typically from 15 h on the day before, up to a very short time (e.g., 30 or 60 min) before delivery. A block corresponds to the delivery of a certain power throughout a fixed time period, such as an hour, a half-hour or a quarter. The trading day in the intraday market is divided into N such delivery periods of equal length.

Although the trading in the intraday market starts at 15 h of the previous day, at which point purchases/sales can be made for any delivery period of the following day, in practice liquidity becomes sufficient only 2–3 h prior to delivery (see Fig. 12.1). For this reason, and to simplify the analysis, we assume that the power producer may trade in the intraday market only once for each delivery period, at a fixed time interval \(\delta \) (e.g., one hour) before delivery. There are thus N possible trading times, and we shall denote these moments by \(T_1,\dots ,T_N\).

Fig. 12.1
figure 1

Left: French intraday electricity transaction prices for a fixed delivery hour (each point corresponds to a single transaction). Right: bid-ask spread evolution in the German intraday market for a fixed delivery hour. In both cases, we see a sharp increase in liquidity 2–3 h prior to delivery

Strategy of the Producer

The producer makes a bid in the spot (day-ahead) market at time \(t=0\), by making an engagement to deliver the amount \(\overline{P}_k\) of electricity during the delivery period \([T_k+\delta ,T_{k+1}+\delta ]\) for each \(k=1,\dots ,N\). These deliveries will be paid at the spot market price denoted by \(F(0,T_k+\delta )\), \(k=1,\dots ,N\).

At each time \(T_k\), the producer knows the amount of power, which will be generated during the delivery period \([T_k+\delta ,T_{k+1}+\delta ]\) (we neglect the forecast uncertainty at such short time scales), and must decide how much power to buy/sell in the intraday market, and how much power to withdraw from/inject into the battery during this period, under the condition that injections/withdrawals must be balanced by production and market purchases. This decision may be based on the known power production for the upcoming delivery period, but also on the forecasts of power production for future delivery times, as well as the current intraday prices for all future delivery times.

The notation for various quantities is described (recalled) in the following table:

 

\(Q_k \) :

Energy stored in the battery at the beginning of delivery period \(k+1\) (at time \(T_{k+1}+\delta \)).

\(Q_{min}\) :

Minimal energy stored in the battery at all times.

\(Q_{max}\) :

Maximal battery capacity.

\(p_k\) :

Energy purchased in the intraday market during kth delivery period \([T_k+\delta ,T_{k+1}+\delta ]\).

\(P_k\) :

Energy produced during kth delivery period.

\(P(t,T_k)\), \(0\le t< T_k\):

Forecast at time t of energy production during kth delivery period.

\(\overline{P}_k\) :

Energy delivered during kth delivery period according to the engagements taken in the spot market.

\(F_k\) :

Intraday market price at time \(T_k\) for kth delivery period.

\(F(0,T_k)\) :

Spot market price for kth delivery period.

\(F(t,T_k)\), \(0<t<T_k\):

Intraday market price at time t for kth delivery period.

Formulation of the Optimization Problem

The total gain from trading of the wind power producer is given by

$$ G = \sum _{k=1}^N (\overline{P}_k F(0,T_k) - F_k (p_k + \alpha |p_k|)), $$

where the term \(\alpha |p_k|\) models the bid-ask spread in the intraday market. The aim of the producer is to maximize the expected value of this gain under the storage constraint

$$ Q_k \in [Q_{min},Q_{max}],\quad k=1,\dots ,N. $$

The dynamics of the battery storage is described by

$$ Q_k = Q_{k-1} + P_k - \overline{P}_k + p_k. $$

The optimization problem of the producer thus writes:

$$ \max _{\overline{P}_1,\dots ,\overline{P}_N, p_1,\dots ,p_N} \left\{ \sum _{k=1}^N \overline{P}_k F(0,T_k) - \mathbb E\left[ \sum _{k=1}^N F_k (p_k + \alpha |p_k|))\right] \right\} , $$

where \(\overline{P}_1,\dots ,\overline{P}_N\) are constants (determined at time 0), and \((p_k)_{1\le k \le N}\) is a dynamic strategy of trading in the intraday market, that is, a discrete-time stochastic process adapted to the filtration generated by the production values \((P_k)\), the price processes in the intraday market \((F_k)\) and \((F(t,T_k))_{t<T_k}\) and the process of forecast updates \((P(t,T_k))_{t<T_k}\).

Modeling the Dynamics of the Intraday Price Process

To understand how the intraday prices for the future delivery times and the power production forecasts affect the strategy of the producer and formulate the optimization problem for the power producer as a stochastic control problem, we need, in principle, to model the dynamics of the intraday price process \(( F(t,T_k)_{t\ge 0, T_k>t})\) and of the forecast update process \(( P(t,T_k)_{t\ge 0, T_k>t})\) as function of t. Since the dimension of these processes is very large (24 or 48 depending on the number of delivery periods), some form of dimension reduction is necessary. Figure 12.2 shows that, for example, the shape of the forecast curve does not change much in time, and therefore 2–3 stochastic factors should be sufficient to model the dynamics of the entire forecast curve.

Fig. 12.2
figure 2

Evolution of the forecasts for all delivery horizons on a single day, as function of time remaining to delivery day

Inspired by the modeling approaches for the interest rate curve, and to allow negative prices which are common in electricity markets with strong penetration of renewables, we use a Gaussian factor-based model:

$$\begin{aligned} F_t = F(0,t) + {\bar{\alpha }}(t)\sum _{j=1}^{M'} Y^j_t . \end{aligned}$$

Here we recall that \(F_t\) is the “last” intraday price, F(0, t) is the day-ahead price (where the time 0 correspond to the gate closure time of the day-ahead market) and \((Y^j)_{j=1}^{M'}\) are independent Ornstein–Uhlenbeck processes:

$$ dY^j_t = - {\bar{\lambda }}^j Y^j_t dt + {\bar{\sigma }}^j d\widehat{B}^j_t, $$

where, \((\widehat{B}^j)_{j=1}^{M'}\) are Brownian motions under the risk-neutral measure \({\mathbb {Q}}\). Note that we have not included discounting because the effect of interest rates is negligible at intraday time scales. Forward prices are computed by taking risk-neutral expectation:

$$\begin{aligned} F(t,T) = \mathbb E[F_T|\mathscr {F}_t] = F(0,T) + \sum _{j=1}^{M'} {\bar{\alpha }}(T)e^{-{\bar{\lambda }}_j (T-t)} Y^j_t. \end{aligned}$$
(12.1)

To obtain the dynamics of forward prices under the real-world measure, we make a change of probability

$$ \frac{d\mathbb P}{d\mathbb Q}\Big |_{\mathscr {F}_T} = \exp \left( -\int _0^T \phi _t dB_t - \frac{1}{2} \int _0^T \phi _t^2 dt\right) , $$

where the process \(\phi \) is assumed to be deterministic. The process

$$ B_t = \widehat{B}_t + \int _0^t \phi _s ds $$

is then a Brownian motion under the historical measure and we can write

$$ Y^j_t = \bar{\sigma }^j\int _0^t e^{-\lambda _j (t-s)} dB^j_s + \bar{\sigma }^j\int _0^t e^{-\lambda _j (t-s)} \phi ^j_s ds:=\bar{\sigma }^j\int _0^t e^{-\lambda _j (t-s)} dB^j_s + {\bar{\mu }}^j(t). $$

We can then write

$$\begin{aligned} F_t = F(0,t) + {\bar{\alpha }}(t)\sum _{j=1}^{M'}(\overline{Y}^j_t + {\bar{\mu }}^j(t)), \end{aligned}$$
(12.2)

where \(\overline{Y}^j_t = {\bar{\sigma }}^j\int _0^t e^{-\lambda _j (t-s)} dB^j_s\) is a centered Gaussian factor process.

This model describes the dynamics of the intraday price over a single day. The factors \({\bar{\alpha }}\) and \({\bar{\mu }}\) describe the daily seasonality of the price. For estimating this model, we shall assume that the random factors \(\overline{Y}^j\) for different days are independent and compute averages over all trading days present in the data. Of course, intraday prices for different days have different distributions due to the presence of the annual seasonality pattern, but we assume that this pattern is fully taken into account by the day-ahead market price.

The estimation of this model, as well as the one for the forecast dynamics, presented in the next paragraph, may be carried out in two different settings:

  • The number of factors is smaller than the number of different delivery periods for which the price is available in the market at the same time. In this case, one can use the prices for different delivery periods to reconstruct the factors \(Y^j_t\) from the formula (12.1). In other words, the individual factors become observable. It makes sense, then, to model separately the seasonality of each factor with the corresponding mean function \({\bar{\mu }}^j(t)\) as in formula (12.2).

  • The number of factors is larger than the number of different delivery periods for which the price is available at the same time. For instance, one may assume that only the last intraday price is known and the number of factors is greater than one. In this case, the individual factors are inobservable, and one cannot reconstruct the mean function separately for each factor. In practice, we recommend to use the number of factors which is less or equal to the number of delivery periods for which prices are available.

More details on the estimation procedure are given in the following section, where the estimation is based on the last intraday price only and the number of factors is taken equal to one.

Modeling the Forecast Dynamics

Since the electricity price process in the intraday market and the wind power production (forecast) may be negatively correlated, we propose a model for the wind production process, which is of a similar structure to the model for the price processes and includes a possible correlation.

$$\begin{aligned} P_t&= P(0,t) +\alpha (t)(1+ \gamma P(0,t)^\delta )\sum _{j=1}^M (X^j_t + \mu ^j(t)), \end{aligned}$$

where \((X^j)_{j=1}^M\) are independent centered Gaussian factors modeled as Ornstein–Uhlenbeck processes:

$$ dX^j_t = - \lambda _j X^j_t dt + \sigma _j dW^j_t, $$

\(\alpha \) and \(\mu ^j\) are deterministic functions modeling the daily seasonality of the production process, P(0, t) is the forecast at the gate closure time of the intraday market, and \(W^j\) are Brownian motions possibly correlated with the Brownian motions \(B^j\) driving the price process. Note that this model for the production process may allow for negative production values, but such values may also be possible in practice when the wind speed is very low due to nonzero power consumption of the wind turbine. The factor \(1+ \gamma P(0,t)^\delta \) reflects the fact that forecast errors are larger in amplitude when the forecast itself is large.

The forecast processes at other times are given by

$$\begin{aligned} P(t,T) = \mathbb E[P_T|\mathscr {F}_t] = P(0,T) + \alpha (T) (1+ \gamma P(0,T)^\delta ) \sum _{j=1}^M e^{-\lambda _j (T-t)} (X^j_t + \mu ^j(t)). \end{aligned}$$

In other words, the forecast process follows a Gaussian dynamics and is completely determined by the knowledge of the M factors \(X^1,\dots ,X^M\).

3 Model Calibration

In this section we explain how our models for the production \((P_t)\) and the intraday market price \((F_t)\) are estimated from data. The estimation procedure will be different in the one-factor case (one factor for the price and one for the forecast) and the multifactor case, because in the one-factor case it is enough to observe only the price/production to recover the risk factor. We describe the estimation procedure of the model for the production, the one for the price being very similar.

Estimation in the One-Factor Case

We first focus on the estimation of the model for production. Since there is only one factor, we may omit the index j and take \(\sigma =1\) without loss of generality. We assume that the agent observes L realizations of the forecast \((P^l(0,T_k))^{l=1,\dots ,L}_{k=1,\dots ,N}\) and the production process \((P^l_{k})^{l=1,\dots ,L}_{1\le k \le N}\) (each realization corresponds to a single production day in the past), and we introduce the forecast error process \((Z^l_k)^{1\le l\le L}_{1\le k \le N}\), where \(Z^l_k = {P^l_{k} - P^l(0,T_k)}\). We assume that \(Z^l_k\) is a Gaussian vector with parameters

$$\begin{aligned}&\mathbb E[Z^l_k] := \tilde{\mu }_k:= \mu _k\alpha _k (1+\gamma P^l(0,T_k)^\delta ),\qquad \text {Cov}[Z^l_i,Z^m_j] = 0 \quad \text {for}~l\ne m \\&\text {and}\quad \text {Cov}[Z^l_i,Z^l_j] = \alpha _i \alpha _j (1+\gamma P^l(0,T_i)^\delta ) (1+\gamma P^l(0,T_j)^\delta )\varOmega _{ij}(\lambda ),\\&\varOmega _{ij}(\lambda ):= \frac{e^{-\lambda (T_i-T_j)^+} - e^{-\lambda (T_i+T_j)}}{2\lambda }, \end{aligned}$$

where we denote \(\alpha _k:=\alpha (T_k)\) and \(\mu _k = \mu (T_k)\). The log-likelihood of \((Z^l_k)_{k=1,\dots ,N}^{l=1,\dots ,L}\), omitting constant terms, is given by

$$\begin{aligned} l(\alpha ,\mu ,\lambda ,\gamma ,\delta )&= -\frac{L}{2}\log (\det \varOmega (\lambda ))- L \sum _{j=1}^N \log \alpha _j - \sum _l \sum _j \log (1+\gamma P^l(0,T_j)^\delta ) \\ {}&-\frac{1}{2}\sum _{l=1}^L \left( \frac{Z^l}{\alpha (1+\gamma P^l(0,T_\cdot )^\delta )}-\mu \right) ^\top \varOmega ^{-1}(\lambda ) \left( \frac{Z^l}{\alpha (1+\gamma P^l(0,T_\cdot )^\delta )}-\mu \right) \\&= -\frac{L}{2}\log (\det \varOmega (\lambda ))- L \sum _{j=1}^N \log \alpha _j - \sum _l \sum _j \log (1+\gamma P^l(0,T_j)^\delta ) \\&\qquad \qquad -\frac{1}{2}\sum _{l=1}^L \left( \frac{Z^l_{\gamma ,\delta }}{\alpha }-\mu \right) ^\top \varOmega ^{-1}(\lambda ) \left( \frac{Z^l_{\gamma ,\delta }}{\alpha }-\mu \right) , \end{aligned}$$

where we use the shorthand notation \(Z^l_{\gamma ,\delta } = Z^l/(1+\gamma P^l(0,T)^\delta )\).

In an attempt to partially maximize the likelihood in explicit form, we first compute the derivatives with respect to \(\mu \):

$$\begin{aligned} \frac{\partial l}{\partial \mu _i} = {e_i^\top } \varOmega ^{-1}(\lambda ) \sum _{l=1}^L\left( \frac{Z^l_{\gamma ,\delta }}{\alpha }-\mu \right) , \end{aligned}$$

where \(e_i\) is a vector with 1 at the ith position and 0 elsewhere. As a result,

$$ \mu = \frac{1}{L\alpha } \sum _{l=1}^L Z^l_{\gamma ,\delta }:= \frac{1}{\alpha }\overline{Z}_{\gamma ,\delta }, $$

and we can write the simplified form of the log-likelihood

$$\begin{aligned} l(\alpha ,\lambda ,\gamma ,\delta ) = -\frac{L}{2}\log (\det \varOmega (\lambda ))- L \sum _{j=1}^N \log \alpha _j - \sum _l \sum _j \log (1+\gamma P^l(0,T_j)^\delta ) \\ -\frac{1}{2}\sum _{l=1}^L \left( \frac{Z^l_{\gamma ,\delta }}{\alpha }-\frac{\overline{Z}_{\gamma ,\delta }}{\alpha }\right) ^\top \varOmega ^{-1}(\lambda ) \left( \frac{Z^l_{\gamma ,\delta }}{\alpha }-\frac{\overline{Z}_{\gamma ,\delta }}{\alpha }\right) . \end{aligned}$$

Differentiating now with respect to \(\alpha \), and making some straightforward simplifications, we find

$$ \frac{\partial l}{\partial \alpha _i} = -\frac{L}{\alpha _i} +\frac{1}{\alpha _i} \sum _{l=1}^L \frac{Z^l_{\gamma ,\delta ,i}-\overline{Z}_{\gamma ,\delta ,i}}{\alpha _i} e_i^\top \varOmega ^{-1}(\lambda ) \frac{Z^l_{\gamma ,\delta }-\overline{Z}_{\gamma ,\delta }}{\alpha } $$

with the corresponding first-order condition

$$\begin{aligned} 1 = \frac{1}{L} \sum _{l=1}^L \frac{Z^l_{\gamma ,\delta ,i}-\overline{Z}_{\gamma ,\delta ,i}}{\alpha _i} e_i^T \varOmega ^{-1}(\lambda ) \frac{Z^l_{\gamma ,\delta }-\overline{Z}_{\gamma ,\delta }}{\alpha }. \end{aligned}$$
(12.3)

Summing up and substituting into the expression for the log-likelihood, we find that the latter is given by (once again without constant terms):

$$\begin{aligned} l(\lambda ,\gamma ,\delta ) = -\frac{L}{2}\log (\det \varOmega (\lambda )) - \sum _l \sum _j \log (1+\gamma P^l(0,T_j)^\delta )- L \sum _{j=1}^N \log \alpha ^*_j(\lambda ), \end{aligned}$$
(12.4)

where \(\alpha ^*(\lambda )\) is the solution of (12.3). This equation can also be written as

$$ 1 = \frac{1}{\alpha _i} \sum _{k=1}^N \varOmega ^{-1}(\lambda )_{ik} \frac{\widehat{R}_{ki}}{\alpha _k},\quad \widehat{R}_{ki} = \overline{Z_{\gamma ,\delta ,k} Z_{\gamma ,\delta ,i}} - \overline{Z}_{\gamma ,\delta ,k} \overline{Z}_{\gamma ,\delta ,i}, $$

or, in vector notation, as

$$\begin{aligned} \alpha = \widehat{M} \alpha ^{-1}, \end{aligned}$$
(12.5)

where \(M_{ij} = \varOmega ^{-1}(\lambda )_{ij}\widehat{R}_{ij}\).

We compute the maximum likelihood estimator by solving numerically the equation (12.5) and then minimizing the function \(l(\lambda ,\gamma ,\delta )\) given by (12.4).

Estimation in the Multifactor Case

In the presence of M random factors we assume that the agent observes not only the production process and the forecast at date zero, but also, at each trading date \((T_k)_{1\le k \le N-1}\), the forecast of production of the next M delivery periods, that is, \(P(T_k,T_{k+i})\) for \(1\le i\le M\wedge (N-k)\). Let \(Z^{l}_{i,k} = P^l(T_k,T_{k+i})-P^l(0,T_{k+i})\). Then, the random vector \(\{Z^{l}_{i,k},1\le l\le L, 1\le k \le N, 0\le i \le M\wedge (N-k)\}\) is a Gaussian random vector with parameters

$$\begin{aligned}&\mathbb E[Z^{l}_{i,k}] := \tilde{\mu }_{i,k} = \sum _{j=1}^M \alpha (T_{k+i})(1+\gamma P(0,T_{k+i})^\delta ) e^{-\lambda _j (T_{k+i} - T_k)}\mu ^j_k\\&\text {Cov}[Z^l_{i,k},Z^m_{j,n}] = 0 \quad \text {for}~l\ne m\\&\text {Cov}[Z^l_{i,k}, Z^l_{j,n}] = \sum _{p=1}^M \alpha (T_{i+k}) (1+\gamma P(0,T_{k+i})^\delta ) (1+\gamma P(0,T_{n+j})^\delta )\\&\qquad \qquad \times \alpha (T_{j+n})e^{-\lambda _p(T_{i+k}-T_k + T_{j+n}-T_n)}\sigma _p^2 \frac{e^{-\lambda (T_k-T_n)^+}-e^{-\lambda (T_k+T_n)}}{2\lambda }. \end{aligned}$$

Similarly to the one-factor case, one can then write down the explicit likelihood of the model and estimate parameters by numerical maximization of the likelihood function.

Numerical Illustration

In this paragraph we illustrate our estimation procedure on a real data set. For this illustration we use a one-factor specification of the model. For estimating the production model we use a time series of power production from Jan 1st, 2012 to Dec 31st, 2014 from a wind park in France provided by Engie Green/Maïa Eolis, together with a time series of historical forecasts provided by the same producer. The production data had a 10-min frequency and was averaged down to 1 h frequency. The forecast data had 15-min resolution, which was averaged down to 1 h resolution. Every day, 4 forecasts are available, at 0, 6, 12 and 18 h. In this study, we used only the forecast at 12 h, corresponding to the gate closure time of the day-ahead market.

Figure 12.3, left graph illustrates the evolution of the day-ahead forecast and the realized production on September 8, 2014. The right graph of this figure shows the results of estimation. The estimated value of the mean reversion parameter is \(\lambda ^*\approx 3.85 \text {days}^{-1}\); in other words the characteristic length of mean reversion is about 6.2 h. The function \(\alpha (t)\) appears to have a slightly increasing profile reflecting the fact that forecast uncertainty grows with time. The function \(\mu (t)\) is small and negative, which means that the forecasts in our data set may have a small but statistically significant positive bias.

Fig. 12.3
figure 3

Top: Evolution of the day-ahead forecast and the realized production on September 8, 2014 (left graph) and October 19, 2014 (right graph). Bottom: Results of estimation of the model for realized production. Dashed lines show the 5% confidence interval around zero for the estimator of \(\mu \)

For estimating the intraday price model we use the day-ahead price for the Germany-Austria region downloaded from the web site of EPEX Spot, and the average intraday price time series at 1 h frequency for the same region, computed from a high-frequency time series provided to us by EPEX Spot, from Jan 1st, 2014 to Dec 31st, 2014. In this study, we construct a proxy for the ’last’ intraday price for each delivery hour, by taking, for the delivery hour H, the average intraday price for the hour H-1. The Germany Austria region was chosen for reasons of market liquidity and data availability. Figure 12.4, left graph, illustrates the evolution of the day-ahead price and the corresponding intraday price on September 8, 2014.

Since our price and production data sets are from different regions and do not cover the same period completely, we carry out the estimation procedure independently for the two sets and assume that there is no correlation between the innovations of price and production. In the same region, the two processes are likely to be correlated, and our estimation procedure can be easily adapted to that case.

Fig. 12.4
figure 4

Top: evolution of the day-ahead price and the corresponding last intraday price on September 8, 2014 (left graph) and October 19, 2014 (right graph). Bottom: Results of estimation of the intraday price model. Dashed green lines show the 5% confidence interval around zero for the estimator of \(\bar{\mu }\)

Figure 12.4, right graph shows the results of the estimation of the intraday price model. The estimated value of the mean reversion parameter is \({\bar{\lambda }}^* \approx 9.6\), which corresponds to the length of mean reversion of about 2.5 h. The function \({\bar{\alpha }}\) (price volatility) appears to have peaks at 10th and 20th hours, which correspond, approximately, to morning and evening peaks of electricity demand. The estimator of the function \({\bar{\mu }}\) (bias) falls within the 5% confidence interval around zero for almost all hours, which means that day-ahead prices are almost equal to expectations of the last intraday prices under the historical measure.

4 Solving the Optimization Problem by Dynamic Programming and Optimal Quantization

The state variables of the problem are the battery charge state \((Q_k)_{1\le k \le N}\) and the factor processes for the wind production \((X^j_{T_k})_{1\le k \le N}^{1\le j \le M}\) and the intraday market price \((Y^j_{T_k})_{1\le k \le N}^{1\le j \le M'}\). For our optimization problem we consider all processes in discrete time. Define the value function

$$\begin{aligned} v_k(q,x^1,\dots ,x^M,&y^1,\dots ,y^{M'}) \\ =&\min _{p_{k},\dots ,p_N,Q_{k-1}=q}\mathbb E^{T_k, x^1,\dots ,x^M,y^1,\dots ,y^{M'}}\left[ \sum _{n=k}^N F_n(p_n + \alpha |p_n|) \right] . \end{aligned}$$

In the following, to save space, we write x for \(x^1,\dots ,x^M\) and similarly for other variables. The original optimization problem then writes

$$\begin{aligned} \max _{\overline{P}_1,\dots ,\overline{P}_N} \Bigg \{\sum _{k=1}^N \overline{P}_k F(0,T_k) -\mathbb E^{t_0, X_{t_0}, Y_{t_0}}[v_1(Q_0, X_{T_1},Y_{T_1})]\Bigg \}. \end{aligned}$$

The dynamic programming principle for the value function writes

$$\begin{aligned} v_k(q,x,y)&= \min _{p_k: q+ P_k - \overline{P}_k + p_k\in [Q_{min},Q_{max}] } \{\phi _k(y) (p_k + \alpha |p_k|) \\&{\quad }+ \mathbb E^{T_k,x,y}[v_{k+1}(q+ \pi _k(x) - \overline{P}_k + p_k, X_{T_{k+1}},Y_{T_{k+1}}) \} \end{aligned}$$

with the terminal condition

$$ v_N = v_N(q, x,y) = \min _{p_N: q+ P_N - \overline{P}_N + p_N\in [Q_{min},Q_{max}]} \phi _N(p_N + \alpha |p_N|) , $$

where

$$\begin{aligned} \phi _k(y)&= F(0,T_k) +{\bar{\alpha }}(T_k) \sum _{j=1}^{M'} (y^j + {\bar{\mu }}^j(T_k)),\\ \pi _k(x)&= P(0,T_k) +\alpha (T_k) (1+\gamma P(0,T_k)^\delta )\sum _{j=1}^{M} (x^j+\mu ^j(T_k)). \end{aligned}$$

We may also impose a constraint on the state of charge of the battery at the terminal date: \(Q_{T_N} = Q_{T_0}\). In this case, \(v_N(q) =F_N(p_N + \alpha |p_N|) \) with \(p_N = Q_{T_0} - q- P_N + \overline{P}_N\).

To compute the value function and the optimal strategy numerically, we start by discretizing the state of charge of the battery, introducing a uniform grid \(Q_{min} = q_1<\dots <q_{J} = Q_{max}\). This means that the control \(p_k\) also takes a finite number of values. We denote \(v_k(q_j,\dots )\) by \(v^j_k\). Then,

$$\begin{aligned} v^j_k(x,y) = \min _{i = 1,\dots ,J} \{\phi _k(y) \eta (q_i-q_j + \overline{P}_k - \pi _k(x)) + \mathbb E^{T_k,x,y}[v^i_{k+1}( X_{T_{k+1}},Y_{T_{k+1}}) \}, \end{aligned}$$

where we have used the notation \(\eta (p) = p + \alpha |p|\) to simplify the formula.

The second step is to replace the discrete-time Ornstein–Uhlenbeck processes (XY) with a finite-state Markov chain. This will be achieved using the method of optimal quantization. Let \(\mathbb P_k\) be the unconditional distribution of \(Z := (X_{T_k},Y_{T_k})\). Note that it is a multivariate Gaussian distribution with zero mean. For every \(k=1,\dots ,N\), we define the optimal grid of size \(N_q\) by solving

$$ \min _{{\hat{Z}}} \mathbb E^{\mathbb P_k}[(Z-{\hat{Z}})^2], $$

where the minimum is taken over all random vectors supported by \(N_q\) points (and the variable Z is \(M+M'\)-dimensional in our setting). It is known (see e.g., [12] for a review) that the solution is the so called optimal Voronoi quantization which is obtained by nearest-neighbor projection of the vector Z on a set of \(N_q\) points. We shall denote these points by \({\hat{z}}^k_1,\dots ,{\hat{z}}^k_{N_q}\) with \({\hat{z}}^k_j:= ({\hat{x}}^k_j, \hat{y}^k_j)\), the associated Voronoi cells by \(C^k_1,\dots ,C^k_{N_q}\) and the associated probabilities by \(\hat{p}^k_1,\dots ,\hat{p}^k_{N_q}\). To find the points, one can simulate a large number of samples from \(\mathbb P_k\) and use the randomized Lloyd’s algorithm (also known as the K-means clustering algorithm). In the numerical illustration below, since the processes X and Y are one-dimensional and uncorrelated, we use the precomputed grids for the multivariate Gaussian distribution, downloaded from the web site quantize.maths-fi.com.

Next, we replace the continuous process with a Markov chain \(({\hat{Z}}_k)_{0\le k \le N}\) with \(N_q\) states. The transition probabilities of the chain are defined by

$$\begin{aligned}&{\hat{\pi }}^0_i = \mathbb P[{\hat{Z}}_1 = {\hat{z}}^1_i] = {\hat{\pi }}^1_i\\&\text {and}\quad {\hat{\pi }}^k_{ij} = \mathbb P[{\hat{Z}}_{k+1} = {\hat{z}}^{k+1}_j|{\hat{Z}}_{k} = {\hat{z}}^{k}_i] = \mathbb P[Z_{T_{k+1}} \in C^{k+1}_j|Z_{T_k}\in C^k_i]. \end{aligned}$$

These transition probabilities are evaluated by Monte Carlo.

The value function can then be computed on the quantization grid using the following formula:

$$ v^j_k({\hat{z}}^k_m) = \min _{i = 1,\dots ,J} \{\phi _k(\hat{y}^k_m) \eta (q_i-q_j + \overline{P}_k - \pi _k({\hat{x}}^k_m)) + \sum _{l=1}^{N_q}{\hat{\pi }}^k_{ml}v^i_{k+1}(z^{k+1}_l) \}. $$

Numerical Illustration

We first illustrate the computation of the value function \(v_1\) and the corresponding optimal strategy. For the numerical illustration we have taken \(N_q = 500\) quantization nodes, and the state of charge was discretized over \(J=20\) regularly spaced values. The computation of the value function \(v_1\) takes about 10 s on a MacBookPro with i5-2.90 GHz processor and 8 Gb physical memory (C++ implementation using only a single processor core). The value function depends on the spot market engagements \(\overline{P}_k\), and they have been taken equal to production forecasts for the corresponding hour: \(\overline{P}_k = P(0,T_k)\). Figure 12.5 illustrates the evolution of various quantities in our model. The forward price and forecast curves are taken from the market data on a specific day (September 8, 2014); the intraday price and production were simulated using our model estimated from market data, and the state of charge of the battery (SOC) and the amount to be sold in the intraday market were computed from the solution of the HJB equation. In the left graph, prices are in Euros per MWh and in the right graph, all values are shown in KWh, and in the case of production (forecast and realized) refer to the power generated during the specified hour. The model parameters are \(Q_{min}=0\), \(Q_{max}=1000\) KWh, \(\alpha =0.2\) (the intraday market spread) and \(Q_0=0\) (initial state of charge).

Fig. 12.5
figure 5

Sample evolution of the modelled quantities. In the left graph, prices are in Euros per MWh. In the right graph, all amounts are shown in KWh, and in the case of production and amount sold correspond to the production and the amount sold during the specified hour

We next illustrate the effect of the battery capacity \(Q_{max}\) and the intraday market spread \(\alpha \). Still under the assumption that \(\overline{P}_k = P(0,T_k)\) for every k, we show in Fig. 12.6 the maximum expected gain of the power producer for different values of the battery capacity \(Q_{max}\) and different values of \(\alpha \), that is, the value

$$\begin{aligned} \sum _{k=1}^N \overline{P}_kF(0,T_k) - \min _{p_1,\dots ,p_N} \mathbb E\left[ \sum _{k=1}^N F_k (p_k+\alpha |p_k|)\right] . \end{aligned}$$
(12.6)

The dotted line shows the theoretical profit of the power producer if the power production were exactly equal to the day-ahead forecast and no trading in the intraday market were allowed. We see that in the absence of battery storage the expected gain is considerably reduced compared to perfect forecast owing to the intermittency of wind power, but that sufficient storage capacity allows to attain the theoretical value and even exceed since it allows both to smooth the variations of power output and trade in the intraday market. Note that the overall expected gain of the power producer depends on the production forecast and the day-ahead price, therefore it will not be the same for different days (19 October 2014 was a day with relatively strong wind, so the gain of the producer was higher than on 8 September 2014, even though the prices were lower). The extra gain from adding battery capacity (defined as the difference between the value function in the presence of a battery and the value function with zero capacity) is more stable, as shown in Table 12.1.

Table 12.1 Expected gain from adding a 1000 KWh battery capacity, in euros per day
Fig. 12.6
figure 6

Expected gain (en euros) of the wind power producer as function of the battery capacity \(Q_{max}\), for different values of the spread parameter \(\alpha \). The dotted line shows the theoretical profit of the power producer if the power production were exactly equal to the day-ahead forecast. Left: 8 September 2014. Right: 19 October 2014

Finally we study the optimal bidding strategies for the producer in the day-ahead market. These are obtained by maximizing the value function of the producer with fixed bids \(\overline{P}_k\), with respect to \(\overline{P}_k\) with a numerical optimization algorithm (BFGS). Figure 12.7 shows the optimal bids (quantity to be delivered in the intraday market), together with the day-ahead production forecast, and the day-ahead price (thin line with right scale). We see that the producer aims to exploit the intertemporal price discrepancies in the day-ahead market using her battery storage capacity by selling more at times when the day-ahead price is high and buying more when the price is low. However, the gain of the producer from this additional trading is limited: on 8 September 2014 the value function (expected gain) increases from 542.12 euros to 554.26 euros, and on 19 October it increases only from 1001.90 to 1009.07 euros.

Fig. 12.7
figure 7

Optimal day-ahead bids for the power producer compared to production forecast (left scale) and the day-ahead market price (right scale). Left graph: 8 September 2014. Right graph: 19 October 2014