-
Notifications
You must be signed in to change notification settings - Fork 4
/
esm-lecture-7.tex
956 lines (584 loc) · 28.2 KB
/
esm-lecture-7.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
% NB: use pdflatex to compile NOT pdftex. Also make sure youngtab is
% there...
% converting eps graphics to pdf with ps2pdf generates way too much
% whitespace in the resulting pdf, so crop with pdfcrop
% cf. http://www.cora.nwra.com/~stockwel/rgspages/pdftips/pdftips.shtml
\documentclass[10pt,aspectratio=169,dvipsnames]{beamer}
\usetheme[color/block=transparent]{metropolis}
\usepackage[absolute,overlay]{textpos}
\usepackage{booktabs}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage[scale=2]{ccicons}
\usepackage[official]{eurosym}
%use this to add space between rows
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}
\newcommand{\R}{\mathbb{R}}
\setbeamerfont{alerted text}{series=\bfseries}
\setbeamercolor{alerted text}{fg=Mahogany}
\setbeamercolor{background canvas}{bg=white}
\def\l{\lambda}
\def\m{\mu}
\def\d{\partial}
\def\cL{\mathcal{L}}
\def\co2{CO${}_2$}
\def\bra#1{\left\langle #1\right|}
\def\ket#1{\left| #1\right\rangle}
\newcommand{\braket}[2]{\langle #1 | #2 \rangle}
\newcommand{\norm}[1]{\left\| #1 \right\|}
\def\corr#1{\Big\langle #1 \Big\rangle}
\def\corrs#1{\langle #1 \rangle}
\def\mw{\text{ MW}}
\def\mwh{\text{ MWh}}
\def\emwh{\text{ \euro/MWh}}
\def\el{${}_{el}$}
\def\th{${}_{th}$}
\def\gas{${}_{gas}$}
\newcommand{\ubar}[1]{\text{\b{$#1$}}}
% for sources http://tex.stackexchange.com/questions/48473/best-way-to-give-sources-of-images-used-in-a-beamer-presentation
\setbeamercolor{framesource}{fg=gray}
\setbeamerfont{framesource}{size=\tiny}
\newcommand{\source}[1]{\begin{textblock*}{5cm}(10.5cm,8.35cm)
\begin{beamercolorbox}[ht=0.5cm,right]{framesource}
\usebeamerfont{framesource}\usebeamercolor[fg]{framesource} Source: {#1}
\end{beamercolorbox}
\end{textblock*}}
\usepackage{hyperref}
\usepackage{tikz}
\usepackage[europeanresistors,americaninductors]{circuitikz}
%\usepackage[pdftex]{graphicx}
\graphicspath{{graphics/}}
\DeclareGraphicsExtensions{.pdf,.jpeg,.png,.jpg,.gif}
\def\goat#1{{\scriptsize\color{green}{[#1]}}}
\let\olditem\item
\renewcommand{\item}{%
\olditem\vspace{5pt}}
\title{Energy System Modelling\\ Summer Semester 2020, Lecture 7}
%\subtitle{---}
\author{
{\bf Dr. Tom Brown}, \href{mailto:[email protected]}{[email protected]}, \url{https://nworbmot.org/}\\
\emph{Karlsruhe Institute of Technology (KIT), Institute for Automation and Applied Informatics (IAI)}
}
\date{}
\titlegraphic{
\vspace{0cm}
\hspace{10cm}
\includegraphics[trim=0 0cm 0 0cm,height=1.8cm,clip=true]{kit.png}
\vspace{5.1cm}
{\footnotesize
Unless otherwise stated, graphics and text are Copyright \copyright Tom Brown, 2020.
Graphics and text for which no other attribution are given are licensed under a
\href{https://creativecommons.org/licenses/by/4.0/}{Creative Commons
Attribution 4.0 International Licence}. \ccby}
}
\begin{document}
\maketitle
\begin{frame}
\frametitle{Table of Contents}
\setbeamertemplate{section in toc}[sections numbered]
\tableofcontents[hideallsubsections]
\end{frame}
\section{Introduction to Electricity Markets}
\begin{frame}
\frametitle{The Economic Operation of the Electricity Sector}
Given the many different ways of consuming and generating
electricity:
\begin{itemize}
\item What is the \alert{most efficient} way to deploy consuming and generating
assets in the short-run?
\item How should we invest in assets in the long-run to \alert{maximise economic welfare}?
\end{itemize}
The operation of electricity markets is intimately related to
\alert{optimisation}.
In the past and still in many countries today, electricity was
provided centrally by `vertically-integrated' monopoly utilities
that owned generating assets, the electricity networks and
retailing. Given that these utilities owned all the infrastructure,
it was hard for third-party generators to compete, even if they were
allowed to.
From the 1980s onwards, countries began to liberalise their
electricity sectors, separating generation from transmission, and
allowing regulated competition for generation in \alert{electricity markets}.
\end{frame}
\begin{frame}
\frametitle{Electricity Markets}
Electricity markets have several important differences compared to
other commodity markets.
At every instant in time, consumption must be balanced with
generation.
If you throw a switch to turn on a light, somewhere a generator will
be increasing its output to compensate.
If the power is not balanced in the grid, the power supply will
collapse and there will be blackouts.
It is not possible to run an electricity market for every single
second, for practical reasons (the network must be checked for
stability, etc.).
So electricity is traded in blocks of time, e.g. hourly,
14:00-15:00, or quarter-hourly, 14:00-14:15, well in advance of the
time when it is actually consumed (based on forecasts).
Additional markets trade in backup balancing power, which step in if the
forecasts are wrong.
\end{frame}
\begin{frame}
\frametitle{Baseload versus Peaking Plant}
\alert{Load} (= Electrical Demand) is low during night; in Northern Europe in the winter, the peak is in the evening.
To meet this load profile, \alert{baseload} generation with low fuel and running costs runs the whole time; more expensive \alert{peaking plant} covers the difference.
\centering
\includegraphics[width=9cm]{baseload-peaking}
\source{Tom Brown}
\end{frame}
\begin{frame}
\frametitle{Effect of varying demand for fixed generation}
\centering
\includegraphics[width=10cm]{demand-supply}
\source{Tom Brown}
\end{frame}
\begin{frame}
\frametitle{Example market 1/3}
\centering
\includegraphics[width=11cm]{germany_generation-price-2015-01-06-2015-01-12}
\end{frame}
\begin{frame}
\frametitle{Example market 2/3}
\centering
\includegraphics[width=11cm]{germany_generation-price-2015-03-15-2015-03-31}
\end{frame}
\begin{frame}
\frametitle{Example market 3/3}
\centering
\includegraphics[width=11cm]{germany_generation-price-2015-04-07-2015-04-14}
\end{frame}
\begin{frame}
\frametitle{Effect of varying renewables: fixed demand, no wind}
\centering
\includegraphics[width=10cm]{demand-supply-no_wind}
\end{frame}
\begin{frame}
\frametitle{Effect of varying renewables: fixed demand, 35~GW wind}
\centering
\includegraphics[width=10cm]{demand-supply-with_wind}
\end{frame}
\begin{frame}
\frametitle{Spot market price development}
As a result of so much zero-marginal-cost renewable feed-in, spot
market prices steadily decreased until 2016. This is called the
\alert{Merit Order Effect}. Since then prices have been rising due
to rising gas and CO$_2$ prices.
\centering
\includegraphics[width=10cm]{strompreis-2019.png}
\source{\href{https://www.agora-energiewende.de/fileadmin2/Projekte/2019/Jahresauswertung_2019/171_A-EW_Jahresauswertung_2019_WEB.pdf}{Agora Energiewende Jahresauswertung 2019}}
\end{frame}
\begin{frame}
\frametitle{Merit Order Effect}
To summarise:
\begin{itemize}
\item Renewables have zero marginal cost
\item As a result they enter at the bottom of the merit order, reducing the price at which the market clears
\item This pushes non-CHP gas and hard coal out of the market
\item This is unfortunate, because among the fossil fuels, gas is the most flexible and produces lower \co2
per MWh\el~than e.g. lignite
\item It also reduces the profits that nuclear and lignite make
\item Will there be enough backup power plants for times with no wind/solar?
\end{itemize}
This has led to lots of political tension, but has been counteracted in recent years by the rising CO$_2$ price.
\end{frame}
\section{Optimisation Revision}
\begin{frame}
\frametitle{Optimisation problem}
We have an \alert{objective function} $f: \R^k \to \R$
\begin{equation*}
\max_{x} f(x)
\end{equation*}
[$x = (x_1, \dots x_k)$] subject to some \alert{constraints} within $\R^k$:
\begin{align*}
g_i(x) & = c_i \hspace{1cm}\leftrightarrow\hspace{1cm} \l_i \hspace{1cm} i = 1,\dots n \\
h_j(x) & \leq d_j \hspace{1cm}\leftrightarrow\hspace{1cm} \m_j \hspace{1cm} j = 1,\dots m
\end{align*}
$\l_i$ and $\m_j$ are the \alert{KKT multipliers} we introduce for
each constraint equation; they measure the change in the objective value of the optimal solution obtained by relaxing the constraints (for this reason they are also called \alert{shadow prices}).
\end{frame}
\begin{frame}
\frametitle{KKT conditions}
The \alert{Karush-Kuhn-Tucker (KKT) conditions} are necessary conditions that an optimal solution $x^*,\m^*,\l^*$ always satisfies (up to some regularity conditions):
\begin{enumerate}
\item \alert{Stationarity}: For $l = 1,\dots k$
\begin{equation*}
\frac{\d \cL}{\d x_l} = \frac{\d f}{\d x_l} - \sum_i \l_i^* \frac{\d g_i}{\d x_l} - \sum_j \m_j^* \frac{\d h_j}{\d x_l} = 0
\end{equation*}
\item \alert{Primal feasibility}:
\begin{align*}
g_i(x^*) & = c_i \\
h_j(x^*) &\leq d_j
\end{align*}
\item \alert{Dual feasibility}: $\m_j^* \geq 0$
\item \alert{Complementary slackness}: $\m_j^* (h_j(x^*) - d_j) = 0$
\end{enumerate}
\end{frame}
\begin{frame}
\frametitle{Interpretation of the KKT multipliers}
If say $d_j \to d_j + \varepsilon$ then
\begin{equation*}
f(x^*) \to f(x^*) + \mu^*_j \varepsilon
\end{equation*}
and similarly for $c_i \to c_i + \varepsilon$ and $\l^*_i$.
We will now sketch a proof of this (not in exam). The Lagrangian from last time was defined:
\begin{equation*}
\cL(x,\l,\m) = f(x) - \sum_i \l_i \left[g_i(x) - c_i\right] - \sum_j \m_j \left[h_j(x) - d_j\right]
\end{equation*}
Note that by primal feasibility and complementary slackness at the optimum point $x^*,\m^*,\l^*$:
\begin{equation*}
\cL(x^*,\l^*,\m^*) = f(x^*)
\end{equation*}
Now consider the Lagrangian $\cL^\varepsilon$ for the perturbed problem $d_j \to d_j + \varepsilon$:
\begin{equation*}
\cL^\varepsilon(x,\l,\m) = \cL(x,\l,\m) + \m_j\varepsilon
\end{equation*}
\end{frame}
\begin{frame}
\frametitle{Interpretation of the KKT multipliers}
At the optimum point of the perturbed problem $x^+,\m^+,\l^+$ we have:
\begin{equation*}
f(x^+) = \cL^\varepsilon(x^+,\l^+,\m^+) = \cL(x^+,\l^+,\m^+) + \m_j^+\varepsilon
\end{equation*}
Because everything is differentiable and we only have a small perturbation, we expect that $y^+ = (x^+,\m^+,\l^+)$ is close to $y^* = (x^*,\m^*,\l^*)$ and Taylor expand about this point:
\begin{equation*}
\cL(x^+,\l^+,\m^+) \approx \cL(x^*,\l^*,\m^*) + \sum_l (x^+_l - x^*_l) \frac{\d \cL }{\d x_l} \Big|_{y = y^*}+ \sum_i (\l^+_i - \l^*_i) \frac{\d \cL }{\d \l_i} \Big|_{y = y^*}+ \sum_j (\m^+_j - \m^*_j) \frac{\d \cL }{\d \m_j} \Big|_{y = y^*}
\end{equation*}
From stationarity for the original problem we know that $\frac{\d \cL }{\d x_l} \Big|_{y = y^*} = \frac{\d \cL }{\d \l_i} \Big|_{y = y^*} = 0$. $\frac{\d \cL }{\d \m_j} \Big|_{y = y^*} = 0$ for binding inequalities, and for non-binding inequalities $\m^*_j = \m^+_j = 0$. Thus
\begin{equation*}
f(x^+) = \cL(x^+,\l^+,\m^+) + \m_j^+\varepsilon \approx \cL(x^*,\l^*,\m^*) + \m_j^*\varepsilon = f(x^*) + \m_j^*\varepsilon
\end{equation*}
\end{frame}
\section{Electricity Markets from Perspective of Single Generators and Consumers}
\begin{frame}{Efficient Markets for the short-run}
Assume investments already made in generators and and consumption assets (factories, machines, etc.).
Assume all actors are price takers (i.e. nobody can exercise market power) and we have perfect competition.
How do we allocate production and consumption in the most efficient way?
I.e. we are interested in the \alert{short-run ``static'' efficiency}.
\vspace{.7cm}
(In contrast to \alert{long-run ``dynamic'' efficiency} where we also consider optimal investment in assets.)
\end{frame}
\begin{frame}
\frametitle{Single Generator: Cost Function}
Consider now the market from the point of view of a single generator.
A generator has a \alert{cost or supply function} $C(g)$ in \euro/h,
which gives the total costs (fuel, operation and maintenance costs) for a given
rate of electricity generation $g$~MW.
Typically the generator has a higher cost for a higher rate of generation $g$,
i.e. the first derivative is positive $C'(g) > 0$. For most generators the rate at which cost increases with rate of production itself increases as the rate of production increases, i.e. $C''(g) > 0$.
\end{frame}
\begin{frame}{Cost Function: Example}
A gas generator has a cost function which depends on the
rate of electricity generation $g$ [\euro/h] according to
\begin{equation*}
C(g) = 0.005~g^2 + 9.3~g + 120
\end{equation*}
\centering
\includegraphics[width=6.3cm]{generator_cost_function}
\raggedright
Note that the slope is always positive and becomes more positive
for increasing $g$. The curve does not start at the origin because of startup costs, no load costs, etc.
\end{frame}
\begin{frame}{Optimal generator behaviour}
We assume that the generator is a \alert{price-taker},
i.e. they cannot influence the price by changing the amount they
generate. Suppose the market price is $\lambda$ \euro/MWh. For a generation
rate $g$, the \alert{revenue} from the market is $\l g$ and the generator should adjust their
generation rate $g$ to maximise their \alert{net generation surplus}, i.e. their \alert{profit}:
\begin{equation*}
\max_g \left[ \l g - C(g) \right]
\end{equation*}
This optimisation problem is optimised for $g=g^*$ where by KKT stationarity we have
\begin{equation*}
0 = \frac{\d \cL}{\d g} = \frac{\d f}{\d g} = \l - \frac{dC}{dg} (g^*)
\end{equation*}
We'll write the derivative with a prime to get:
\begin{equation*}
C'(g^*) \equiv \frac{dC}{dg} (g^*) = \l
\end{equation*}
I.e. the generator increases their output until they make a net loss for any increase of generation.
[Check units: $\frac{dC}{dg}$ has units $\frac{\textrm{\euro/h}}{\textrm{MW}} = $ \euro/MWh.]
\end{frame}
\begin{frame}{Marginal cost function: Example}
$C'(g)$ is known as the \alert{marginal cost function}, which shows,
for each rate of generation $g$ what price $\l$ the generator should be
willing to supply at.
For our example the marginal cost function is given by
\begin{equation*}
C'(g) = 0.01~g + 9.3
\end{equation*}
\centering
\includegraphics[width=7cm]{marginal_cost_function}
\end{frame}
\begin{frame}{Net generator surplus}
The area under the curve is generator costs, which as the integral
of a derivative, just gives the cost function $C(g)$ again, up to a
constant.
The \alert{net generator surplus} is the profit the generator makes by
having costs below the electricity price.
\centering
\includegraphics[width=7cm]{generator_surplus}
\end{frame}
\begin{frame}{Limits to generation}
Note that it is quite common for generators to be limited by
e.g. their capacity $G$, which may become a \alert{binding constraint}, i.e. limiting factor before the price plays a role, e.g.
\begin{equation*}
h(g) = g \leq G \leftrightarrow \m
\end{equation*}
This constraint alters our KKT stationarity constraint for $g$ to
\begin{equation*}
0 = \frac{\d \cL}{\d g} = \frac{\d f}{\d g} - \m^* \frac{\d h}{\d g} = \l - C'(g^*) - \m^*
\end{equation*}
Now the \alert{shadow price} of the constraint is given by
\begin{equation*}
\m^* = \l - C'(g^*)
\end{equation*}
If it is binding, it tells us the benefit to our objective function of an incremental increase in capacity $G$.
\end{frame}
\begin{frame}{Limits to generation: Example}
Consider the constraint
\begin{equation*}
g \leq G \leftrightarrow \m
\end{equation*}
with capacity $G = $ 250~MW so that for our example it is binding
$g^* = G = $ 250~MW. $\m^* = \l - C'(g^*)$ can be marked on the
graph:
\centering
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=6.5cm]{generator_surplus-limited}};
\node[] at (2.45,3.55) {$\l$};
\node[] at (4.9,3.2) {$\}\m^* = \l - C'(g^*)$};
\end{tikzpicture}
\end{frame}
\begin{frame}{Consumer behaviour: Theory}
Suppose for some given period a consumer consumes electricity at a rate of
$d$~MW.
Their \alert{utility or value function} $U(d)$ in \euro/h is a
measure of their benefit for a given consumption rate $d$.
For a firm this could be the profit related to this electricity
consumption from manufacturing goods.
Typical the consumer has a higher utility for higher $d$, i.e. the
first derivative is positive $U'(d) > 0$. By assumption, the rate of
value increase with consumption decreases the higher the rate of
consumption, i.e. $U''(d) < 0$.
\end{frame}
\begin{frame}{Utility: Example}
A widget manufacturer has a utility function which depends on the
rate of electricity consumption $d$ [\euro/h] as
\begin{equation*}
U(d) = 0.0667~d^3 - 8~d^2 + 300~d
\end{equation*}
\centering
\includegraphics[width=6cm]{utility}
\raggedright
Note that the slope is always positive, but becomes less positive
for increasing $d$.
\end{frame}
\begin{frame}{Optimal consumer behaviour}
We assume that the consumer is a \alert{price-taker},
i.e. they cannot influence the price by changing the amount they
consume.
Suppose the market price is $\lambda$ \euro/MWh. The consumer should
adjust their consumption rate $d$ to maximise their \alert{net surplus}
\begin{equation*}
\max_d \left[U(d) - \l d \right]
\end{equation*}
This optimisation problem is optimised for $d=d^*$ where from KKT stationarity we now get
\begin{equation*}
U'(d^*) \equiv \frac{dU}{dd} (d^*) = \l
\end{equation*}
[Check units: $\frac{dU}{dd}$ has units $\frac{\textrm{\euro/h}}{\textrm{MW}} = $ \euro/MWh.]
I.e. the consumer increases their consumption until they make a net loss for any increase of consumption.
$U'(d)$ is known as the \alert{inverse demand curve} or \alert{marginal utility curve}, which shows,
for each rate of consumption $d$ what price $\l$ the consumer should be
willing to pay.
\end{frame}
\begin{frame}{Inverse demand function: Example}
For our example the inverse demand function is given by
\begin{equation*}
U'(d) = 0.2~d^2 - 16~d + 300
\end{equation*}
\centering
\includegraphics[width=6cm]{inverse_demand_function}
\raggedright
It's called the \emph{inverse} demand function, because the demand function is the function you get from reversing the axes.
\end{frame}
\begin{frame}{Inverse demand function: Example}
The \alert{demand function} $D(\l)$ gives the demand $d$ as a function of the price $\l$. $D(U'(d)) = d$.
For our example the demand function is given by
\begin{equation*}
D(\l) = -((\l+20 )/0.2)^{0.5} +40
\end{equation*}
\centering
\includegraphics[width=6cm]{demand_function}
\end{frame}
\begin{frame}{Gross consumer surplus}
The area under the inverse demand curve is the \alert{gross consumer surplus},
which as the integral of a derivative, just gives the utility
function $U(d^*)$ again, up to a constant.
\centering
\includegraphics[width=6cm]{gross_consumer_surplus}
\end{frame}
\begin{frame}{Net consumer surplus}
The more relevant \alert{net consumer surplus}, or just
\alert{consumer surplus} is the net gain the consumer makes by
having utility above the electricity price, i.e. $U(d^*) - \l d^*$.
\centering
\includegraphics[width=6cm]{net_consumer_surplus}
\end{frame}
\begin{frame}{Limits to consumption}
Note that it is quite common for consumption to be limited by other
factors before the electricity price becomes too expensive, e.g. due
to the size of electrical machinery. This gives an upper bound
\begin{equation*}
d \leq D \leftrightarrow \m
\end{equation*}
The \alert{shadow price} $\m$ indicates the benefit of relaxing the constraint. From KKT $\m^* = U'(d^*) - \l$.
In the following case the optimal consumption is at
$d^* = D =$ 10~MW.
\centering
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) { \includegraphics[width=6cm]{net_consumer_surplus-limited}};
\node[] at (2.6,1.82) {$\l$};
\node[] at (4.45,2) {$\Big\}\m^* = U'(d^*) - \l$};
\end{tikzpicture}
\end{frame}
\begin{frame}
\frametitle{Consumers can delay their consumption}
Besides changing the amount of electricity consumption, consumers
can also shift their consumption in time.
For example electric storage heaters use cheap electricity at night
to generate heat and then store it for daytime.
The LHC particle accelerator does not run in the winter,
when prices are higher (see
\url{http://home.cern/about/engineering/powering-cern}). Summer
demand: 200~MW, corresponds to a third of Geneva, equal to peak
demand of Rwanda (!); winter only 80~MW.
\centering
\includegraphics[width=5cm]{csm_1998_LHCUeberblick_CERN_02_ed178e98ea}
\source{CERN}
\end{frame}
\begin{frame}
\frametitle{Consumers can also move location}
Aluminium smelting is an electricity-intensive process. Aluminium
smelters will often move to locations with cheap and stable
electricity supplies, such as countries with lots of hydroelectric
power. For example, 73\% of Iceland's total power consumption in
2010 came from aluminium smelting.
Aluminium sells on world markets for around US\$ 1500/ tonne. %http://www.lme.com/metals/non-ferrous/aluminium/
Electricity consumption: 15 MWh/tonne.
At Germany consumer price of electricity of \euro 300 / MWh, this is \euro 4500 / tonne. Industrial consumers pay less.
If electricity is 50\% of cost, then need \$750/tonne to go on electricity $\Rightarrow$ 750/15 \$/MWh = 50 \$/MWh.
%https://arcticecon.wordpress.com/2012/02/15/aluminium-smelting-in-iceland-alcoa-rio-tinto-alcan-century-aluminum-corp/
%15.7 kWh of electricity to produce 1 kg of aluminium. Al203 (alumina) -> Al
% The Hall-Héroult electrolysis process is the major production route for primary aluminium.
%Due to the nature of the process, power outages have the potential
%to cause damage to production cells as the molten liquids could
%solidify in absence of adequate current. For this reason,
%production facilities need to be near secure and reliable sources
%of energy. step before smelting is bauxite -> alumina. Bauxite is
%gibbsite Al(OH)3, boehmite γ-AlO(OH), and diaspore α-AlO(OH).
%What is notable is that the aluminium industry’s total power usage
%amounted to roughly 73% of Iceland’s total power consumption in 2010.
%https://en.wikipedia.org/wiki/Economy_of_Iceland#Aluminium
%https://agmetalminer.com/2015/11/24/power-costs-the-production-primary-aluminum/
%making domestic electricity costs some 44% of the sales price of
%ingot and may explain why Chinese smelters combined with low
%capacity utilization due to reduced demand are widely reported
%http://www.crugroup.com/about-cru/cruinsight/Aluminium_Smelter_Power_Tariffs_Winners_and_Losers
%Power typically represents more than a third of an aluminium
%smelter's operating costs and is the single most important cost
%variant between smelting assets. As a result access to cheap power is
%one of the key sources of competitive advantage in primary aluminium
%smelting.
% https://en.wikipedia.org/wiki/List_of_aluminium_smelters
% THere are some in Germany
\end{frame}
\begin{frame}{Summary: Consumers and Generators}
{\bf Generators:} A generator has a \alert{cost} or \alert{supply function} $C(g)$ in \euro/h, which
gives the costs (of fuel, etc.) for a given rate of electricity
generation $g$~MW. If the market price is $\lambda$ \euro/MWh, the revenue is $\l g$ and the generator should adjust their
generation rate $g$ to maximise their \alert{net generation surplus}, i.e. their profit:
\begin{equation*}
\max_g \left[ \l g - C(g) \right]
\end{equation*}
{\bf Consumers:} Their \alert{utility} or \alert{value function} $U(d)$ in \euro/h is a
measure of their benefit for a given consumption rate $d$. For a given price $\lambda$ they adjust their consumption rate $d$ such that their \alert{net surplus} is maximised:
\begin{equation*}
\max_d \left[U(d) - \l d \right]
\end{equation*}
\end{frame}
\section{Supply and Demand at a Single Node}
\begin{frame}{Setting the quantity and price}
Now let's consider the case with \alert{many} consumers and generators. We build \alert{aggregated} marginal cost and marginal utility
curves from the individual curves.
Then we maximise \alert{total welfare}, the sum of net consumer and generator surplus of all actors.
If the price is also set from this point, then the individual
optimal actions of each actor will achieve this result in a perfect
decentralised market.
\centering
\includegraphics[width=7.5cm]{consumer_producer_surplus.pdf}
\end{frame}
\begin{frame}{The result of optimisation}
This is the result of maximising the \alert{total economic welfare}, the sum of the consumer and the producer surplus for consumers $b$ with consumption $d_b$ and generators $s$ generating with rate $g_s$:
\begin{align*}
\max_{\{d_b\}, \{g_s\}}\left[ \sum_b U_b (d_b) - \sum_s C_s (g_s) \right]
\end{align*}
subject to the supply equalling the demand in the balance constraint:
\begin{align*}
\sum_b d_b - \sum_s g_s = 0 \hspace{1cm} \leftrightarrow \hspace{1cm} \l
\end{align*}
and any other constraints (e.g. limits on generator capacity, etc.).
Market price $\l$ is the shadow price of the balance constraint,
i.e. the cost of supply an extra increment 1~MW of demand.
\end{frame}
\begin{frame}{Why decentralised markets work (in theory)}
We will now show our main result:
\alert{Welfare-maximisation through decentralised markets}
The welfare-maximising combination of production and consumption can be achieved by the decentralised profit-maximising decisions of producers and the utility-maximising decisions of consumers, provided that:
\begin{itemize}
\item The market price is equal to the shadow price of the overall supply-balance constraint in the welfare maximisation problem
\item All producers and consumers are price-takers
\end{itemize}
\end{frame}
\begin{frame}{KKT and Welfare Maximisation 1/2}
Apply KKT now to maximisation of total economic welfare:
\begin{align*}
\max_{\{d_b\}, \{g_s\}} f(\{d_b\}, \{g_s\}) = \left[ \sum_b U_b (d_b) - \sum_s C_s (g_s) \right]
\end{align*}
subject to the balance constraint:
\begin{align*}
g(\{d_b\}, \{g_s\}) = \sum_b d_b - \sum_s g_s = 0 \hspace{1cm} \leftrightarrow \hspace{1cm} \l
\end{align*}
and any other constraints (e.g. limits on generator capacity, etc.).
Our optimisation variables are $\{x\} = \{d_b\} \cup \{g_s\}$.
We get from KKT stationarity at the optimal point:
\begin{align*}
0 & = \frac{\d f}{\d d_b} - \sum_b \l^* \frac{\d g}{\d d_b} = U_b'(d_b^*) - \l^* = 0 \\
0 & = \frac{\d f}{\d g_s} - \sum_s \l^* \frac{\d g}{\d g_s} = -C_s'(g_s^*) + \l^* = 0
\end{align*}
\end{frame}
\begin{frame}{KKT and Welfare Maximisation 2/2}
So at the optimal point of maximal total economic welfare we get the
same result as if everyone maximises their own welfare separately based on the price $\l^*$:
\begin{align*}
U_b'(d_b^*) = \l^* \\
C_s'(g_s^*) = \l^*
\end{align*}
This is the CENTRAL result of microeconomics.
If we have further inequality constraints that are binding (e.g. capacity constraints), then
these equations will receive additions with $\m_i^* > 0$.
\end{frame}
\begin{frame}[fragile]
\frametitle{Power Production Real Example}
At \href{https://energy-charts.de/power_de.htm}{\bf\color{blue}\underline{energy-charts.de}} you can see the forecast of load, wind, solar and conventional generation right now in Germany, here's an old version:
\centering
\includegraphics[width=11cm]{strom-170531-14.png}
\end{frame}
\begin{frame}[fragile]
\frametitle{Supply-Demand Curve Real Example}
At \href{https://www.epexspot.com/en/market-data?market_area=AT&trading_date=2020-06-04&delivery_date=2020-06-05&underlying_year=&modality=Auction&sub_modality=DayAhead&product=60&data_mode=aggregated&period=}{\bf\color{blue}\underline{epexspot.com}} you can find the real supply-demand curves for every hour, here's an old example for Germany-Austria from 2017:
\centering
\includegraphics[width=9cm]{DEAT-170531-14}
\end{frame}
\end{document}