EG2230 Monte Carlo Simulation
EG2230 Monte Carlo Simulation
2
Electricity market simulation
Objective
• The objective of a simulation of an electricity market is to predict how the electricity market
will behave given inputs such as
- resources,
- demand,
- rules for electricity trading.
• The choice of simulation model depends on which problems that are to be studied.
• Typical applications:
- Investment decisions.
- Policy decisions.
• The simulations shows what can happen
—not what will happen!
3
Electricity market simulation
Simulation methods
Deterministic approach
• Create scenarios for the future including time series for load, variable renewable generation,
etc.
• Simulate the system for example by solving a
cost minimisation problem ( EG2240 Power System Planning).
Probabilistic approach
• Identify probability distributions for available resources and demand in the system.
• Simulate the system using analytical or Monte Carlo methods.
- There is an analytical method called probabilistic production cost simulation, but it can
only be applied to simplified electricity market models (not used in practice).
- For complex models, Monte Carlo simulation is necessary.
4
Repetition
Density function
Consider a random variable, X:
Definition B.1. The probability that an observation of a random variable X belongs to
a given set X is given by the density function fX(x), i.e.,
P(X X ) = f X x dx.
X
For discrete random variables we have
fX(x) = P(X =x ).
5
Repetition
Distribution functions and duration curves
Definition B.2. The probability that X x is given by the distribution function FX(x),
i.e.,
FX(x) = P(X x).
Definition B.3. The probability that X x is given by the duration curve F̃ X x , i.e.,
F̃ X x = P(X x).
6
Repetition
Relation between definitions of probability distributions
Theorem B.4. The density function, the distribution function and the duration curve
are related through
x
F̃ X x = 1 – FX(x) = 1 – f X t dt = fX t dt.
– x
7
Repetition
Expectation values
Definition B.6. The expectation value of X is given by
Theorem B.10. If x is the smallest possible outcome of X then the expectation value
of X is given by
E[X] = x + F˜X x dx .
x
8
Repetition
Variance and standard deviation
Definition B.7. The variance of X is given by
Var X = E X – E X 2 = E X 2 – E X 2 (general),
2
Var X = fX x x – E X (discrete r.v.),
x
2
Var X = f X x x – E X dx (continuous r.v.).
–
Definition: The standard deviation is the square root of the variance, i.e.,
X = Var X .
9
Repetition
Additional calculations
Theorems B.8/B.9.
E[aX] = aE[X]
E[X + Y] = E[X] + E[Y]
Var[aX] = a2Var[X]
Var[X + Y] = Var[X] + Var[Y] + 2Cov[X, Y]
10
Repetition
Covariance
Definition B.11. The covariance between X and Y is given by
Cov[X, Y] = E[(X – E[X])(Y – E[Y])] = E[XY] – E[X]E[Y].
Theorem:
Cov[X, Y] = Cov[Y, X]
Cov[X, X] = Var[X]
11
Repetition
Correlation coefficient
Definition B.12. The correlation coefficient between X and Y is given by
Cov X Y
X Y = ----------------------------------------- .
Var X Var Y
Definition: The random variables X and Y are independent if an observation of X
does not provide any information about the outcome of Y and vice versa.
12
Probability distributions
Uniform distribution
X U(a, b)
fX F X F̃ X
1 1
0.5 0.5
x x
a b a b
13
Probability distributions
Two-point distribution
Xcan only have two outcomes
fX F X F̃ X
1 1
0.5 0.5
x x
a b a b
14
Probability distributions
Normal distribution
X N(, )
fX F X F̃ X
1 1
0.5 0.5
x x
X X
15
Simulation of electricity markets
Idea
Y gY X
16
Simulation of electricity markets
Idea
• The objective of the simulation is to determine the probability distribution of the result
variables.
• In many cases it is sufficient to study a few key values (which we will refer to as system
indices).
• A system index is a statistical measure (mostly the expectation value) of a result variable.
17
Simulation of electricity markets
System indices
Definition 9.1. The Total Operation Cost, TOC, is the sum of the operation cost in all
power plants, as well as any other operation costs (as for example compensation for
consumers who have been involuntarily disconnected).
Definition 9.2. The Expected Total Operation Cost is ETOC = E[TOC].
18
Simulation of electricity markets
System indices
Definition 9.3. The result variable LOLO* is a binary variable which is equal to one if
load shedding occurs (i.e., if at least one consumer has been involuntarily discon-
nected due to capacity limitations in the system) and zero otherwise.
Definition 9.4. The risk of power deficit is LOLP = E[LOLO].
Ekyaalo
Kasozi
21
Simulation of electricity markets
Example: Ekyaalo District
Ekyaalo
Kasozi
• There is a run-of-the-river (i.e., no reservoir) hydro power plant in Kasozi (500 kW, negligible
variable costs).
• There is an 11 kV-line between Kasozi and Ekyaalo (1 000 kW, negligible risk for outages).
• Ekyaalo is the main load centre (around 87.5% of the total consumption in the system).
• Challenge: Load shedding in evenings almost daily.
• Question: What are the benefits of adding another diesel generator set in Ekyaalo?
22
Simulation of electricity markets
Example: Ekyaalo District
Solution
Existing Additional
System index
system generator
ETOC [¤/year] 61 229 75 353
EENS [kWh/year] 18 041 3 950
LOLP [%] 3.3 0.8
• The investment cost for an additional diesel generator set is around 5 000 ¤/year.
• The operation cost will increase by around 14 124 ¤/year.
• The income will increase by around 0.6 ꞏ 14 124 = 8 474 ¤/year.
• The costs of the investment is larger than the additional income.
• However, the investment will result in much better reliability of supply.
23
Monte Carlo simulation of electricity markets
Overview
Random Inverse
U Y Model X MX
number transform Sampling
g(Y)
generator method
24
Random numbers
• A random number generator is necessary to create random samples for a computer
simulation.
• A random number generator is a mathematical function that generate a sequence of
numbers.
• Modern programming languages have built-in functions for generating random numbers
from U(0, 1)-distributions and some other distributions.
• Starting with a certain seed, X0, the random number generator will generate a deterministic
sequence of numbers, {Xi}.
• The sequence will eventually repeat itself.
• The sequence will imitate a real sequence of U(0, 1)-distributed random numbers.
25
Random numbers
Pseudo-random numbers
• The designation pseudo-random numbers is sometimes used to stress that the sequence of
numbers is actually deterministic.
• One method to make it more or less impossible to predict a sequence of pseudo-random
numbers it to use the internal clock of the computer as seed.
• An advantage of pseudo-random numbers is that a simulation can be recreated by using the
same seed again.
• A good random number generator will generate a sequence of random numbers which
- is as long as possible (before it repeats itself),
- is distributed as close to a U(0, 1)-distribution as possible,
- has a negligible correlation between the numbers in the sequence.
26
The inverse transform method
• How do we generate the inputs Y to a simulation of an electricity market?
- A pseudo-random number generator provides U(0, 1)-distributed random numbers.
- Y generally has some other distribution.
• There are several methods to transform U(0, 1)-distributed random numbers to an arbitrary
distribution.
• In this course we will use the inverse transform method, which works well in computer
simulations.
27
The inverse transform method
Theorem 9.7. If U is a U(0, 1)-distributed random number then Y is a distributed ac-
cording to the distribution function FY(x) if Y is calculated according to Y = F Y– 1 U .
FY(x)
1
U
0.5
Y
28
The inverse transform method
Example
Problem
A pseudo-random number generator providing U(0, 1)-distributed random numbers has
generated the value U = 0.40.
a) Transform U to a result of throwing a fair six-sided die.
b) Transform U to a result from a U(10, 20)-distribution.
29
The inverse transform method
Example
Solution
a) Graphic solution:
FX x
1
1 2 3 4 5 6
Y
In the general case, a discrete inverse distribution function can be calculated using a search
algorithm.
30
The inverse transform method
Example
Solution
b) The inverse distribution function is given by
10 x 0,
– 1
F Y x = 10x + 10 0 x 1,
20 1 x.
Y = F Y– 1 0. 4 = 14.
31
Normally distributed random numbers
The normal distribution does not have an inverse distribution function! However, it is possible to
use an approximation:*
Theorem 9.8. If U is a U(0, 1)-distributed random number then Y is a N(0, 1)-distrib-
uted random number, if Y is calculated according to
U if 0 U 0. 5 ,
Q=
1 – U if 0. 5 U 1,
t = – 2 ln Q ,
c0 + c1 t + c2 t 2
z = t – --------------------------------------------------
1 + d1 t + d2 t 2 + d3 t 3
–z if 0 U 0. 5 ,
Y= 0 if U = 0. 5 ,
z if 0. 5 U 1.
33
Correlated random numbers
• It is convenient if the inputs Y in a computer simulation are independent, because then the
random variables can be generated separately.
• However, it is also possible to generate correlated random numbers.
• There are several methods that can be used. In this course, we will only consider two cases:
- Multivariate normal distributions.
- Finite populations.
34
Multivariate normal distributions
Theorem 9.9. Let X = [X1, …, XK]T be a vector of independent N(0, 1)-distributed
components. Let B = 1/2, i.e., let i and gi be the i:th eigenvalue and the i:th eigen-
vector of and define the following matrices:
P = [g1, …, gK],
= diag(1, …, K),
B = P1/2PT.
Then Y = + BX is a random vector where the elements are normally distributed with
the mean and the covariance matrix .
35
Finite populations
• This method is only applicable to discrete probability distributions with a finite number of
possible outcomes.
- However, a continuous probability distribution can of course be approximated by a
discrete distribution.
• The idea is to use the joint distribution function for the inverse transform method.
• Original distribution function: FY1, Y2y1, y2is the probability that Y1 y1 and Y2 y2.
• Modified distribution function: Arrange all states of the variables in an ordered list; FY1, Y2n
is now the probability to select one of the n first states in the list.
36
Finite populations
Example
Problem
Consider the multivariate probability distribution fY1, Y2 to the right.*
y2
Randomise values of Y1 and Y2 using the random number U1 = 0.12 from
a U(0, 1)-distribution.
y1
38
Finite populations
Example
Solution
The modified distribution function is shown to the FY
right. 1
The value U = 0.12 corresponds to the second state,
i.e., Y1 = 1 and Y2 = 2.
0.5
U n
1 2 3 4 5 6 7 8 9 state
39
Probability distributions of scenario parameters
• Typical inputs to simulations of electricity markets include
- Demand.
- Available generation capacity.
- Available transmission capacity.
• How do we determine the probability distributions of these inputs?
• The models of generation capacity, transmission capacity and demand will depend on the
level of detail that is needed. Here, we will introduce simple basic models.
40
Model of electricity consumption
A simple model of electricity consumption includes the following properties:
• Total demand, Dtot.
• Distribution of demand between areas (only for multi-area models).
The probability distribution of the load cannot be computed but must be estimated from
historical data and forecasts for the future.
• Alternative 1. Use a standard probability distribution (for example the normal distribution)
with the same statistical properties as historical data.
• Alternative 2. Create a duration curve directly from historical data (or forecasts).
41
Model of electricity consumption
Duration curve from historical data
Definition 9.10. The load curve states the load at a certain time, i.e.,
D(k) = load hour k [MWh/h].
Definition 9.11. The real load duration curve states the load level that is exceeded for
a certain time, i.e.,
LDCR(k) = load level that is exceeded during k hours [MWh/h].
42
Model of electricity consumption
Duration curve from historical data
Example:
MWh/h D(k)
E[D] = 12 600 MWh/day
k
6 12 18 24 h
The expectation value of the load is equal to the area below the load curve.
43
Model of electricity consumption
Duration curve from historical data
Example:
44
Model of electricity consumption
Duration curve from historical data
Definition 9.12. The inverted load duration curve states how long time a certain load
level is exceeded, i.e.,
LDC(x) = number of hours when the load is exceeding x [h].
• Dividing LDC(x) by the length of the studied time period, T, gives the normalised load duration
curve.
• The normalised duration curve states the probability that a certain load level is exceeded (cf.
definition B.3).
45
Model of electricity consumption
Duration curve from historical data
Example:
h LDC(x)
E[D] = 12 600 MWh/day
x
200 400 600 800 MWh/h
We have only switched the y and x axes; hence, the area below the curve has not changed.
46
Model of electricity consumption
Duration curve from historical data
Example:
% F̃ D
x
200 400 600 800 MWh/h
Now, the y-axis has been scaled by 1/T; the expected load is therefore the area below the curve
multiplied by T.
47
Model of thermal power plants
• A simple model of thermal power plants include the following properties:
• Installed capacity, Ĝ g .
• Generation cost, CGg(Gg)
• Availability, pg.
Moreover, it is assumed that failures are independent of the load and the state of other power
plants.
48
Model of thermal power plants
• A thermal power plant is modelled by one input, G g (available generation capacity).
• It is assumed that the available generation capacity has a two-point distribution.
• The probability distribution of the available generation capacity cannot be computed but
must be estimated from historical data and forecasts for the future.
f Gg
pg
qg x
0 Ĝ g MW
49
Model of thermal power plants
Availability from historical data
Definition 9.13. The Mean Time To Failure is calculated by
K
1
MTTF = ----
K tu k ,
k=1
where K are the number of periods when the power plant is available and tu(k) is the
duration of each of these periods.
50
Model of thermal power plants
Availability from historical data
Definition 9.14. The Mean Time To Repair is calculated by
K
1
MTTR = ----
K td k ,
k=1
where K are the number of periods when the power plant is unavailable and td(k) is
the duration of each of these periods.
51
Model of thermal power plants
Availability from historical data
Definition 9.15. The failure rate is the probability that an available unit will fail and can
be estimated by
1
= ---------------- .
MTTF
Definition 9.16. The repair rate is the probability that an unavailable unit will be re-
paired and can be estimated by
1
= ---------------- .
MTTR
52
Model of thermal power plants
Availability from historical data
Definition 9.17. The availability is the probability that a power plant will be available
and can be estimated as the share of a longer time period during which the unit is
available:
MTTF
p = … = --------------------------------------- = ------------- .
MTTF + MTTR +
Definition 9.18. The unavailability is the probability that a power plant will be unavail-
able and can be estimated by
MTTR
q = 1 – p = --------------------------------------- = ------------- .
MTTF + MTTR +
53
Model of thermal power plants
Availability and utilisation
• Availability. Probability that a power plant can be used.
• Capacity factor. The average available capacity divided by the installed capacity.
1 T
capacity factor = -------- t = 1 G t .
TĜ
• Utilisation factor. The average real generation divided by the installed capacity.
1 T
utilisation factor = -------- t = 1 G t capacity factor.
TĜ
• Full load hours. The number of hours a unit would be able generate its full capacity without exceeding the real annual
generation.
1 T
full load hours = ---- t = 1 G t = T ꞏ utilisation factor.
Ĝ
54
Model of wind power
A simple model of wind power plants include the following properties:
• Installed capacity, Ŵ n .
• Generation cost, CWn(Wn).
- The variable cost is generally negligible.
• Availability, p.
• Wind speed distribution, F̃ v .
Moreover, it is assumed that failures and wind speed are independent of each other as well as of
the load and the state of other power plants.
55
Model of wind power
A wind power plant or a wind farm (i.e., a group of wind power plants) can be represented by a
single input, W n (available generation capacity) and a constant variable operation cost, Wn
(which can generally be assumed as zero).
• The density function for W n can be computed by combining the probability distribution of
the wind speed by the power curve (the wind power generation as a function of wind speed),
i.e., W n v .
- See the course compendium for details.
56
Model of wind power
• The probability distribution of the wind speed must be estimated from historical data or
forecasts (similar to the probability distribution of the load).
• A standard probability distributions that is commonly used for wind speeds is the Rayleigh
distribution.
fv F̃ v
high v high v
low v
x x
m/s m/s
57
Model of wind power
• The power curve depends on the type of wind power plant.
v v
m/s m/s
58
Scenario generation
Example 1: Diesel generator sets
Problem
• Each diesel generator set in Ekyaalo has the capacity 150 kW and the availability is 80%.
• Use the random numbers 0.438 and 0.723 from a U(0, 1)-distribution to randomise the available
generation capacity of the diesel generator sets.
59
Scenario generation
Example 1: Diesel generator sets
Solution
• The inverse of the distribution function for G is given by
–1 x = 0 0 x 0. 2 ,
FG
150 0. 2 x 1.
60
Scenario generation
Example 2: Hydro power plant
Problem
• The hydro power plant in Kasozi is run-of-the-river (i.e., no reservoir).
- 90% probability that the water flow is enough to generate the installed capacity (500 kW).
- 10% probability that the available generation capacity is uniformly distributed between
300 and 500 kW.
• Use the random number 0.978 from a U(0, 1)-distribution to randomise the available gener-
ation capacity of the hydro power plant.
61
Scenario generation
Example 2: Hydro power plant
Solution
F̃ H x
• The figure shows the duration curve of the available hydro
power generation capacity. 1
• The inverse of the duration curve is given by 0.5
x
– 1 500 0 x 0. 9 ,
F̃ H x = 200 400 600 kW
2 300 – 2 000x 0. 9 x 1.
62
Scenario generation
Example 3: Demand
Problem
F̃ tot x
• The figure shows the duration curve of the total load in D
Ekyaalo District. 1
• The share of the total load that is located in Kasozi is U(0.10, 0.5
0.15)-distributed. x
• Use the random numbers 0.076 and 0.780 from a U(0, 1)-distri-
bution to randomise the demand in Kasozi and Ekyaalo 200 400 600 kW
respectively.
63
Scenario generation
Example 3: Demand
Solution
• The inverse of the load duration curve is given by
600 – 1 000x 0 x 0. 2 ,
F̃ – 1tot x =
D
450 – 250x 0. 2 x 1.
65
Electricity market models
Example: Ekyaalo District
Scenario parameters
C = share of the total load that is located in Kasozi,
Dtot = total load in the system,
G g = available generation capacity in diesel generator set g,
H = available generation capacity in the hydro power plant.
Model parameters
G = variable operation cost in the diesel generator sets = 1,
L(P) = loss function for the 11 kV-line = 10–4P2.
66
Electricity market models
Example: Ekyaalo District
Result variables
DE = load in Ekyaalo,
DK = load in Kasozi,
ENS = energy not served,
Gg = generation in diesel generator set g,
H = generation in the hydro power plant,
LOLO = loss of load occasion,
P = power flow from Kasozi to Ekyaalo,
TOC = total operation cost.
It can be noted that we may not need to compute any other result variables than ENS, LOLO and
TOC.
67
Electricity market models
Example: Ekyaalo District
Calculations to simulate one scenario
• Compute the load in each area:
DE = (1 – C)Dtot,
DK = C ꞏ Dtot.
• Compute the maximal export from Kasozi:
P = H – DK.
• Can the load in Ekyaalo be covered by import from Kasozi, i.e., is P – L P DE? If yes, then
the results are
ENS = 0, LOLO = 0, TOC = 0.
68
Electricity market models
Example: Ekyaalo District
Calculations to simulate one scenario (cont.)
• Can the load in Ekyaalo be covered by import from Kasozi plus generation from the diesel
generator sets, i.e, is
P – L P G 1 G 2 DE? If yes, then the results are
E
ENS = 0, LOLO = 0, TOC = G D – P + L P .
ENS = DE – P + L P – G 1 – G 2 , LOLO = 1,
TOC = G G 1 + G 2 .
69
Simple sampling
Law of large numbers
Theorem 9.19. If x1, …, xn are independent observations of the random variable X
then
n
1
m X = ---
n xi
i=1
is an unbiased estimate of E[X].
70
Simple sampling
Estimating variance
Theorem 9.20. If x1, …, xn are independent observations of the random variable X
then
n
1
s X2 = ------------ xi – mX 2
n–1
i=1
is an unbiased estimate of Var[X].
n
1 n
s X2 can be rewritten as ------------ x i2 – ------------ m X2 .
n–1 n–1
i=1
71
Simple sampling
Example: Ekyaalo District
Problem
Run a small Monte Carlo simulation (10 scenarios) of the Ekyaalo District and estimate ETOC,
EENS and LOLP.
Solution
• Generate 10 values each for the scenario parameters.
• Apply the electricity market model on the 10 scenarios.
• Estimate the expectation values of the result variables.
72
Simple sampling
Example: Ekyaalo District
Solution Scenario, i
1 2 3 4 5 6 7 8 9 10
g 1 i [kWh/h] 150 0 150 150 150 150 150 150 150 150
g 2 i [kWh/h] 150 150 0 150 150 150 150 150 150 0
h i [kWh/h] 344 500 500 500 482 500 500 500 500 500
d iE [kWh/h] 451 276 241 198 256 408 349 207 297 237
d iK [kWh/h] 73 39 39 25 44 59 50 33 40 33
p i – L p i [kWh/h] 264 440 440 452 419 422 430 445 439 445
toci [¤/h] 187 0 0 0 0 0 0 0 0 0
ensi [kWh/h] 0 0 0 0 0 0 0 0 0 0
loloi 0 0 0 0 0 0 0 0 0 0
73
Simple sampling
Example: Ekyaalo District
Solution
The resulting estimates are
10
1
ETOC ------ toci = 18.7 ¤/h,
10
i=1
10
1
EENS ------ ens i = 0 kWh/h,
10
i=1
10
1
LOLP ------ lolo i = 0%.
10
i=1
74
Simple sampling
Estimates
• Monte Carlo methods do not provide an exact answer to a problem, but an estimate of the
answer.
• The estimate is based on many random observations.
- Different simulations (for example different seeds to the random number generator) will
produce different values of the estimate!
- The estimate is thus a random variable in itself.
• A good estimate should have a high probability that the estimate is close to the true value.
75
Simple sampling
Notation
• Generally, a Monte Carlo simulation aims at estimating an expectation value, for example X.
• For a general discussion of the results of a specific simulation method, we consider the
probability distribution of the estimates, i.e., we study the properties of MX.
• When computing the results of one specific simulation, we are in fact computing an outcome
of MX; therefore, we use the notation mX.
76
Simple sampling
Accuracy and precision
Accuracy
• Difference between X and E[MX].
• Constant value depending on the simulation method (which determines the probability
distribution of MX and consequently E[MX]).
• Corresponds to systematical error.
Precision
• Difference between X and mX.
• Constant value depending on the simulation method (which determines the probability
distribution of MX and consequently Var[MX]).
• Corresponds to random error.
77
Simple sampling
Accuracy and precision
Low
precision x x
X E[MX] X E[MX]
fM fM
X X
High
precision x x
X E[MX] X E[MX]
78
Simple sampling
Variance of the estimated expectation value
Theorem 9.21. In simple sampling, the variance of the estimated expectation value
is
Var X N – n
Var M X = ----------------- ------------- .
n N
• The factor (N – n)/N is called fpc (finite population correction).
Var X
• For infinite populations we get Var M X = ------------------ .
n
• In simulations of electricity markets we usually have some continuous scenario parameters
infinite population.
• Even if the population is finite, it is generally not worth excluding scenarios from reappearing
in the set of samples
in practice we will have an infinite population.
79
Simple sampling
Confidence interval
Definition 9.22. A confidence interval is an interval which has some specific proba-
bility (confidence level) to include the true value.
• The confidence level can be chosen arbitrarily. Common choices are 95%, 99% or 99.9%.
• To calculate the confidence interval, we need to make an assumption about the probability
distribution of MX.
n
• MX = X i {central limit theorem} normally distributed
i=1
80
Simple sampling
Confidence interval
Theorem 9.23. Let t be the value such that (t) = 1 – /2.* If MX is normally distrib-
uted then m X t s X n is a confidence interval with confidence level 1 – .
Confidence level, 1 – 95% 99% 99.9%
t 1.9600 2.5758 3.2905
82
Simple sampling
Example: Ekyaalo District
Solution
8 849 2 863 198 1 000
mTOC = ------------- 8.8, s TOC = ------------------- – ------------- 8. 8 2 785.7
1 000 999 999
785. 7
mTOC 1. 96 ------------- , i.e., 8.8 0.9 ¤/h, is a 95% confidence interval for ETOC.
1 000
505 2 36 634 1 000
mENS = ------------- 0.5, s ENS = ---------------- – ------------- 0. 5 2 36.4
1 000 999 999
EENS = 0.5 0.4 ¤/h.
10 2 10- – 1 000
mLOLO = ------------- = 0.01, s LOLO = -------- ------------- 0. 01 2 0.0099
1 000 999 999
LOLP = 1.0 0.6 %.
83
Variance reduction techniques
• We have in many cases some knowledge about the system to be simulated.
• This knowledge can be used to improve the accuracy of the simulation.
• Methods based on some knowledge of the system are called variance reduction techniques,
since improving the precision is equivalent to reducing Var[MX].
• In this course, we will only consider one variance reduction technique, namely correlated
sampling.
84
Correlated sampling
• We want to compare two expectation values, X1 and X2.
• Study M(X1 – X2).
• Expectation value:
E[M(X1 – X2)] = E[X1 – X2] = E[X1] – E[X2] = X1 – X2,
i.e., M(X1 – X2) is an unbiased estimate of the difference between the systems.
• Variance:
Var X 1 – X 2 1
Var[M(X1 – X2)] = --------------------------------- = --- Var X 1 + Var X 2 – 2Cov X 1 X 2 .
n n
• If X1 and X2 are sampled independently then we will have Cov[X1, X2] = 0.
• The variance will be lower if X1 and X2 are positively correlated.
85
Correlated sampling
• If the probability distributions for the inputs to the models g1 and g2 are the same, then we
can use the same scenarios yi, i = 1, …, n, for both models:
x1, i = g1(yi) and x2, i = g2(yi).
If the models have some common properties then we would have Cov[X1, X2] > 0.
• In practice, not all inputs need to be the same for both models, as long as there are some
input values which result in
Cov[X1, X2] > 0.
• In practice, inputs do not need to have the same probability distributions in both models;
generating them from the same pseudorandom number may still result in Cov[X1, X2] > 0.
86
Correlated sampling
Example: Ekyaalo District
Problem
Run a small Monte Carlo simulation (10 scenarios) of the Ekyaalo District to compare ETOC, EENS
and LOLP for the system if there is one and two diesel generator sets respectively.
Solution
• Generate 10 values each for the scenario parameters.
• Existing system: Apply the electricity market model (considering only G 1 ) on the 10
scenarios.
• Additional generator: Apply the electricity market model (considering both generators) on
the ten scenarios.
• Estimate the expectation values of the differences between the two systems.
87
Correlated sampling
Example: Ekyaalo District
Scenario, i
Solution
1 2 3 4 5 6 7 8 9 10
g 1 i [kWh/h] 150 0 150 150 150 150 150 150 150 150
g 2 i [kWh/h] 150 150 0 150 150 150 150 150 150 0
h i [kWh/h] 344 500 500 500 482 500 500 500 500 500
d iE [kWh/h] 451 276 241 198 256 408 349 207 297 237
d iK [kWh/h] 73 39 39 25 44 59 50 33 40 33
p i – L p i [kWh/h] 264 440 440 452 419 422 430 445 439 445
toc i1 [¤/h] 150 0 0 0 0 0 0 0 0 0
ens i1 [kWh/h] 37 0 0 0 0 0 0 0 0 0
lolo i1 1 0 0 0 0 0 0 0 0 0
toc i2 [¤/h] 187 0 0 0 0 0 0 0 0 0
ens i2 [kWh/h] 0 0 0 0 0 0 0 0 0 0
lolo i2 0 0 0 0 0 0 0 0 0 0
88
Correlated sampling
Example: Ekyaalo District
Solution
The resulting estimates are
10
1
ETOC ------
10 toc i2 – toci1 = 3.7 ¤/h,
i=1
10
1
EENS ------
10 ensi2 – ensi1 = –3.7 kWh/h,
i=1
10
1
LOLP ------
10 lolo i2 – lolo i1 = –10%.
i=1
89