**3.2. Trading power in spot markets**

Currently, electricity is traded forward on bilateral negotiations and on centrally-run electronic platforms like power exchanges. Electricity can be traded in anticipation from one to three years (mostly OTC) to several months ahead. Shorter term forward markets negotiating electricity with delivery horizon of weeks, or even one day in advance in the so-called dayahead markets are quite common. Market liquidity is typically higher as the contracting horizon shortens.

Finally, each thread can restart the simulation process using as starting values for *θ* and *A*

The final approximation is not as good as the one carried out by a single thread for the same amount of simulations. This is due to the fact that the decisions taken by the single thread algorithm have always all the information gathered up to the decision point while the multithread algorithm lacks the information gathered by other threads since the last synchro‐ nization. Nevertheless, with the correct choice of synchronization and simulation cycles, the

Since about two decades, the power industry had undergone a major restructuring in many countries. The former vertically-owned and centrally-planned electricity utilities have been unbundled in separate and independent business segments: the generation, transmission and distribution sectors. Unlike the latter two segments, which have remained as natural monop‐ olies under regulation, power generation is now a business subject to competition in the open

Electricity is a commodity with some very distinctive features. First, modern societies are exceedingly dependent on a continuous delivery of electrical power, placing a very high value to supply reliability. Because electrical energy cannot be economically stored in considerable amounts, production and consumption must be continuously in perfect balance. In addition, power demand is nearly price irresponsive (inelastic) in the short-run. Therefore, power prices often escalate to very high quotes (price spikes) when supply/demand conditions are tight. Most of these circumstances are short-lived, e.g. equipment outages, transmission congestion

The exceptionally high volatility of electricity prices imposes high financial risks when trading electricity and forces generation companies to make decisions and commitments under high uncertainty. Thus, stochastic modeling and optimal decision making under uncertainty are

Currently, electricity is traded forward on bilateral negotiations and on centrally-run electronic platforms like power exchanges. Electricity can be traded in anticipation from one to three

climatic events, etc., and price rapidly reverse to normal levels [6].

key tasks in modern power trading and power risk management [7].

**3.2. Trading power in spot markets**

(40)



overall optimization process can run much faster.

102 Dynamic Programming and Bayesian Inference, Concepts and Applications

**3. Electricity trading**

**3.1. Electricity markets**

marketplace [5].

Because of technical requirements of real time system balance, spot power markets are always centralized and run by entities in charge of the physical operation of the system to keep reliability and security. Equilibrium spot prices are computed each 5 min, 30 min or in hourly basis according to the realized power demand and the last bid accepted for keeping the system balance in real time. Rigorously, locational marginal prices are set in order to account for transmission constraints. Therefore, spot prices reflect the actual conditions of the system at the time of delivery.

Though spot prices are subject to high uncertainty, liquidity of this market is warranted as the generator can always sell its production at real time prices. For this reason, the spot market is regarded a last-resort market. One advantage of participating only in this market is that unavailability of the generating unit does not have financial consequences for the generator other than the opportunity cost of the lost production.

Let *pS* (*t*) the prevailing price at the *t*-th time interval in the spot market, *PS* (*t*) the power delivered by the generating unit and *P*max its generating capacity. Under the hypothesis the generator is price-taker and its marginal costs of generation, denoted by *MC*(*t*), are constant with the rate of production, the optimal operating policy is:

$$P\_s(t) = \begin{cases} 0 & \text{if } p\_s(t) < MC(t) \\ P\_{\text{max}} & \text{if } p\_s(t) > MC(t) \end{cases} \tag{42}$$

The operating profit *BS* (*t*) the generator obtains in the spot market by implementing this optimal production policy can be written as:

$$B\_s(t) = \max\left[p\_s(t)P\_{\max} - MC(t)P\_{\max}, 0\right] = \max\left[\left(p\_s(t) - MC(t)\right)P\_{\max}, 0\right] \tag{43}$$

This equation shows the operating flexibility of generator to alter its output in response to the spot price in order to avoid operating losses if prevailing spot prices drop below marginal costs.

Figure 3 depicts the discontinuous nature of the profit function *BS* (*t*) when participating in the spot market, i.e. *BS* (*t*)≥0 for all prices. Indeed, this profit function can be assimilated to a call option with strike price *MC*. Figure 3 also schematically illustrates the probability density function (pdf) of the spot price of electricity *f* (*pS* ). This function is typically highly rightskewed and presents strong leptokurtosis.

**Figure 3.** Profit function of selling power in the spot market

The expected value of the profit in the spot market per unit of generating capacity *bS* (*t*) under the optimal operating policy is described by the following equation:

$$\mathbb{E}\left[b\_S\right] = \int\_0^{MC} \left[0 \cdot p\_S f(p\_S)\right] dp\_S + \int\_{MC}^0 \left[\left(p\_S - MC\right) f(p\_S)\right] dp\_S \tag{44}$$

0

¥

b

00 0

() () ( )

*MC MC*

The resulting probability density function of the hourly operating profit is illustrated in Figure 4. Despite the high variance of the profits, the function clearly shows that the generator cannot lose money when participating in the spot market, even if the unit is technically unavailable.

Given the dramatic volatility of real time electricity prices, a major activity of power trading is structuring hedging strategies by means of tradable derivative instruments like future and option contracts [8]. A power company owning a set of generating units may decide either to sell electricity in advance at a fixed price in a forward market, or wait to the time of delivery and receive the spot price. Deciding on committing production forward or being exposed to

By selling forward its production, the generator may hedge against a sudden decline of electricity spot prices during the delivery horizon, thereby securing an operating margin. This hedging strategy isolates the generator from the price risk. However, the generator in exchange

Electricity markets are typically arranged under a two-settlement system. This approach preserves the economy and efficiency of the physical operation of the power system from any financial commitment the market players have entered into in the past. Under the twosettlement scheme, only deviations from contractual obligations are negotiated in the spot

The revenue from the forward contracting is given by the volume sold *PF* times the price *pF* agreed in the forward contract, i.e. *RF* = *pF PF* . On the other hand, the revenue captured by selling in the spot market is given by *RS* = *pSΔP* = *pS* (*PS* −*PF* ). So, the total revenue *RF* from

resigns the opportunity of selling electricity in the spot market if high prices happen.

*SS SS S S p f p dp q f p dp p q f p dp* (47)

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

105

Risk-Constrained Forward Trading Optimization by Stochastic Approximate Dynamic Programming

( 0) *<sup>S</sup> q f p MC* - ³

*Sb*

= + = + òò ò

( ) *<sup>S</sup> f b*

0

**Figure 4.** Probability density function of the operating profit in the spot market of electricity

volatility of real-time power prices has however a drastic impact on risk.

forward contracting and delivering power in the spot market is given as:

b0

**3.3. Trading electricity in forward markets**

market.

$$\mathbb{E}\left[b\_S\right] = \int\_{MC}^{\phi} \left[\left(p\_S - MC\right)f\left(p\_S\right)\right]dp\_S \ge \mathbb{E}\left[p\_S\right] - MC\tag{45}$$

It is noteworthy to observe that the first term in equation is the probability of obtaining a zero profit in the spot market. Note also that E *pS* =*MC* only if *MC* =0. By selling the production in the spot market, the generator never incurs in operating losses, i.e. Pr(*bS* <0)=0 as it can immediately stop production if *pS* <*MC*.

We consider now the more general case where generating units are unavailable, either for planned or unplanned reasons, during a fraction of the time. Let *p* the failure probability and *q* =1− *p* the probability of the unit being available, provided the failure and operating states are the only two mutually exclusive states in which the generator resides. We further assume that the price level and the state of the generator are statistically independent. Under these considerations, the generator cannot always capture de spread *pS* −*MC* and thus the proba‐ bility of obtaining a positive profit will decrease accordingly. The expected operating profit under these conditions is then:

$$\mathbb{E}\left[b\_S\right] = q \int\_{MC}^{\phi} \left[\left(p\_S - MC\right)f(p\_S)\right] dp\_S \tag{46}$$

The probability of having zero profit *β*<sup>0</sup> =Pr(*bS* =0) is given by:

Risk-Constrained Forward Trading Optimization by Stochastic Approximate Dynamic Programming http://dx.doi.org/10.5772/57466 105

$$\beta\_0 = p \prod\_{0}^{\alpha} f(p\_S) dp\_S + q \prod\_{0}^{MC} f(p\_S) dp\_S = p + q \prod\_{0}^{MC} f(p\_S) dp\_S \tag{47}$$

The resulting probability density function of the hourly operating profit is illustrated in Figure 4. Despite the high variance of the profits, the function clearly shows that the generator cannot lose money when participating in the spot market, even if the unit is technically unavailable.

**Figure 4.** Probability density function of the operating profit in the spot market of electricity
