**4.2. Modeling stochastic spot and forward electricity prices**

where:

*xspot*,*<sup>h</sup>*

*Eh*

*w*

*pF <sup>i</sup>*,*<sup>t</sup>*

*pS h*

*Ct*

*pF i*

E: Expected value operator *w*: Monte Carlo sample path

*h* : Hourly time step

*W* : Total number of Monte Carlo samples

*xi*,*<sup>h</sup>* : Energy sold and instrument *i* in hour *h*

*t*: Time period beginning after a balancing decision

110 Dynamic Programming and Bayesian Inference, Concepts and Applications

*<sup>w</sup>* : Energy sold in spot market in hour *h* and Monte Carlo sample *w*

( ) , , , ,

î

Î

*h t*

<sup>ì</sup> <sup>=</sup> <sup>ï</sup> <sup>=</sup> ×

*I x x i spot p*

*F*

å <sup>×</sup> *<sup>w</sup> it it <sup>w</sup> i t <sup>w</sup> ih h*

*w* : Effective future price of instrument *i* in period *t* and Monte Carlo sample *w*

×= å *w w t h h t*

*<sup>I</sup> <sup>w</sup>*(*xi*,*<sup>t</sup>*): Revenue due to energy the sold by instrument *i* in period *t* and Monte Carlo sample

,

*S x i forward*

Î

*<sup>T</sup> <sup>w</sup>*(*xi*,*t*, *xi*,*t*−1): Transaction costs due to the change in the amount of instrument *<sup>i</sup>* held in the

0 ,

*<sup>w</sup>*,*<sup>h</sup>* <sup>0</sup>*t*: Forward price of instrument *i* and Monte Carlo sample *w* at the beginning of period *t*.

<sup>ï</sup> - = <sup>=</sup> <sup>í</sup> ïî =

, ,1

<sup>í</sup> <sup>=</sup> <sup>ï</sup>

,

*<sup>p</sup>* (61)

*C MC E* (62)

*i spot*

*<sup>p</sup>* (63)

*<sup>w</sup>*: Energy generated in hour *h* and Monte Carlo sample *w*

*Emax*,*t*: Maximal energy that can be generated in period *t*

*w*: Spot price in hour *h* and Monte Carlo sample *w*

*MC*: Constant marginal cost of generation.

*w*: Costs of energy in period *t* and Monte Carlo sample *w*

portfolio after the rebalancing decision at the beginning of period *t*

, ,1

*it it*

( ) ( ) , 0

*w h <sup>t</sup> <sup>w</sup> <sup>i</sup> it it*

3% , ,

*<sup>F</sup> x x i forward T xx*


*xi*,*t*: Energy to be sold by instrument *i* in period *t*

The problem formulation relies on Monte Carlo simulations to represent uncertainty on the future development of key variables. In addition, stochastic simulations are used to confront the algorithm with mapping scenarios for approximating both, the Value and the Risk functions.

A synthetic ensemble of 2000 annual realizations of hourly power prices in the spot market were generated by means of spectral representation techniques [10]. Forward prices and spot prices are not statistically independent. The forward prices corresponding to each spot price sample are calculated considering both, the expected value of the spot price and the mean value of each spot price time series. To simulate the changes in the forward prices accounting for the correlation to each sample of the spot prices a simple model is introduced.

Under perfect competition and rationality on the expectation formation, the price of a forward product should converge to the mean expected spot prices for the delivery period. This is relatively easy to calculate for the first hour of the simulated time. Assuming that the whole Monte Carlo set of spot prices was simulated taking the same price forecast as the market, the price of any forward should be the mean spot prices for the delivery period:

$$p\_{FA}^{\text{w,h}} = \frac{1}{\left(H\_i - \left(h\_i^d - 1\right)\right)} \sum\_{j=h\_i^d}^{H\_i} \mathbb{E}\left[\left.p\_S\right.^j\right] = \frac{1}{W\left(H\_i - \left(h\_i^d - 1\right)\right)} \sum\_{j=h\_i^d}^{H\_i} \sum\_{w=1}^W p\_S^{\text{w,h}}\tag{64}$$

$$h\_i^d = \begin{cases} H0\_i \, \text{if } h \le H0\_i \\\ \, h \, \text{if } h > H0\_i \end{cases} \tag{65}$$

Finally, a *contango* situation is considered in the forward market. A risk premium of 8% in excess of expected spot prices is considered for the forward prices in the future market to compensate for the volatility risk. This premium reduces linearly during the delivery period

The model for future prices for each instrument *i*, hour *h* and sample *w* is thus as follows:

1

where *β* is the risk premium paid in excess to the expected spot price and set *β* =8*%*.

<sup>ê</sup> <sup>ú</sup> <sup>ë</sup>

*S*

Other relevant source of uncertainty considered is the random failure of the generating units. The stochastic model of generator outages is built considering that the unit can reside in four mutually exclusive states: Operation (required), Reserve (not required), Unavailable (required) and Unavailable (not required), as shown in the diagram of space states in Figure 6 [11].

Reserve Operation

Dispatch decision spot price < marginal cost ← → spot price > marginal cost

> Repair Rate

(restrictions)

Operation Failure Rate

Unavailable (required)

Figure 6. Four-state stochastic model of the generation units

This unit model accounts for the fact that peaking units exhibit higher availability rates. This result is explained by the fact the failure probability is typically very small when the unit is in the stand-by state. A generator is economically called online if its marginal cost of production

This unit model accounts for the fact that peaking units exhibit higher availability rates. This result is explained by the fact the failure probability is typically very small when the unit is in the stand-by state. A generator is economically called online if its marginal cost of production is below the prevailing spot prices, following the decision model of equation (42). Variable costs of generation are

The operation-failure cycles of the generating unit are obtained from a chronological Markovian stochastic simulation. For each spot price sample, a time series of power output is synthesized for

1. Based on failure and repair rates defined by the state the unit resided in the previous hour, a random failure is simulated [12]. If a failure is in place, the output power is set to zero for this

2. The dispatch of the unit is simulated, taking into account the marginal cost of generation and the prevailing sample spot price at that time interval. Here perfect foresight of the spot price is

This chronological stochastic model reproduces with accuracy the dynamics involved in failure and repair cycles of generators, giving the possibility to select different failure rates depending on whether

As already mentioned before, the financial decision process can be modeled by means of a MDP. Naming profit *<sup>w</sup> B* for each sample the sum of income, cost and transaction cost over all instruments,

every generation unit. The hourly power output is simulated o following three steps:

assumed in order to decide the dispatch and fulfill the minimal generation times. 3. If dispatched, other unit's technical restrictions are fulfilled, e.g. ramping capabilities.

assumed linear with power output, i.e. marginal costs are constant.

**Figure 6.** Four-state stochastic model of the generation units

Unavailable (not required)

Repair Rate Repair Rate Repair Rate

Reserve FailureRate

particular hour.

the unit is generating or is in stand-by.

**4.4. Risk constraint formulation** 

the objective function (56) becomes:

*p*

<sup>é</sup> <sup>ù</sup> - - - <sup>ê</sup> <sup>ú</sup> <sup>+</sup> <sup>ê</sup> <sup>ú</sup> - - - -

*d H H W d <sup>i</sup> <sup>i</sup> w j w j <sup>d</sup> <sup>d</sup> i i i i <sup>w</sup> i i j h <sup>h</sup>*

<sup>1</sup> <sup>1</sup> 1 1

*H H H h*

( )

Risk-Constrained Forward Trading Optimization by Stochastic Approximate Dynamic Programming

= = =

å å å *i i d d i i*

1 1

( )

*j*

û

http://dx.doi.org/10.5772/57466

(69)

113

20

*S*

*p*

, ,

of the future and becomes zero at the last hour of delivery.

( ( ))

*H h h*

× ×

( ( ))

1

b

*w h i i*

<sup>×</sup> æ ö - = + ç ÷ è ø

*H h H*

*d*

*WH h*

*i*

**4.3. Reliability model of the generation units**

×

,

*i*

*F*

*p*

where:

*Hi* : delivery period for instrument *i*

*H* 0*<sup>i</sup>* : first hour of delivery period for instrument *i*

For the first hour, this model represents the expectation of the market for each delivery period. However, this expectation should change according to the values that the spot prices take in each sample and the information gathered by a *virtual* market taking place in each particular sample path. If perfect foresight is assumed, each virtual market could calculate without uncertainty the hourly forward price for its particular spot prices sample path simply as:

$$p\_{FB\stackrel{W,h}{i}} = \frac{1}{H\_i - \left(h\_i^d - 1\right)} \sum\_{j=h\_i^d}^{H\_i} p\_S^{\
u,j} \tag{66}$$

The equation (64) represents a model where any additional information that arrives as the spot price of the particular sample path is different form the forecasted in the first hour is dismissed by the virtual market. Thus, this model is representative of reality only for the first hour of simulation where no additional information could have been gathered by the virtual markets. On the other hand, the equation (66) represents a model where all the additional information is obtained beforehand for each Monte Carlo sample. Likewise, this model is suitable only for the last hour of simulation where all information is already known by the virtual market within each Monte Carlo sample. Finally, the two models can be combined, in order to simulate the forward price dynamics in correlation to the spot prices of each Monte Carlo sample path. In this work, it is assumed that the information gathered by each virtual market grows linearly, augmenting for each hour1 . Then, equations (64)2 and (66) are combined by a weighted average:

$$p\_{FC\stackrel{\text{w},h}{i}} = \frac{\left(H - \left(h\_i^{d} - 1\right)\right)}{H\_{i}} \cdot p\_{FA\stackrel{\text{w},h}{i}} + \frac{\left(h\_i^{d} - 1\right)}{H\_{i}} \cdot p\_{FB\stackrel{\text{w},h}{i}} \tag{67}$$

$$\begin{split} \; \_{PC\stackrel{\text{w},h}{i}} & = \frac{\left(H - \left(h\_{i}^{d} - 1\right)\right)}{H\_{i}} \cdot \frac{1}{W\left(H\_{i} - \left(h\_{i}^{d} - 1\right)\right)} \sum\_{j=h\_{i}^{d}}^{H\_{i}} \sum\_{w=1}^{W} p\_{S}^{\text{w},j} + \\ & + \frac{\left(h\_{i}^{d} - 1\right)}{H\_{i}} \cdot \frac{1}{H\_{i} - \left(h\_{i}^{d} - 1\right)} \sum\_{j=h\_{i}^{d}}^{H\_{i}} p\_{S}^{\text{w},j} \end{split} \tag{68}$$

<sup>1</sup> The assumption that the information is linear with time could be replaced with a more complex information model, such as a function of the cumulated difference between the initial forecasted spot price and the particular spot prices of each Monte Carlo sample path.

<sup>2</sup> The prices for the first hour in a real market situation should consider the real market prices.

Finally, a *contango* situation is considered in the forward market. A risk premium of 8% in excess of expected spot prices is considered for the forward prices in the future market to compensate for the volatility risk. This premium reduces linearly during the delivery period of the future and becomes zero at the last hour of delivery.

The model for future prices for each instrument *i*, hour *h* and sample *w* is thus as follows:

$$\begin{aligned} p\_{FI} &= \left( 1 + \beta \frac{H\_i - h\_i^d}{H\_i} \right). \\ \cdot \left[ \frac{\left( H - \left( h\_i^d - 1 \right) \right)}{H\_i} \cdot \frac{1}{W \left( H\_i - \left( h\_i^d - 1 \right) \right)} \sum\_{j=h\_i^d}^{H\_i} \sum\_{w=1}^W p\_S^{w,j} + \frac{\left( h\_i^d - 1 \right)}{H\_i} \cdot \frac{1}{H\_i - \left( h\_i^d - 1 \right)} \sum\_{j=h\_i^d}^{H\_i} p\_S^{w,j} \right] \end{aligned} \tag{69}$$

where *β* is the risk premium paid in excess to the expected spot price and set *β* =8*%*.
