% 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}}

\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 9}
%\subtitle{---}
\author{
  {\bf Dr. Tom Brown}, \href{mailto:tom.brown@kit.edu}{tom.brown@kit.edu}, \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{Duration Curves and Capacity Factors: Examples from Germany in 2015}

\begin{frame}{Load curve}

  Here's the electrical demand (load) in Germany in 2015:

  \centering
  \includegraphics[width=11cm]{load-2015}

  \raggedright

  To understand this curve better and its implications for the market,
  it's useful to stack the hours of the year from left to right in
  order of the amount of load.

\end{frame}


\begin{frame}{Load duration curve}

  This re-ordering is called a \alert{duration curve}.\\
  For the load it's the \alert{load duration curve}.

  \centering
  \includegraphics[width=13cm]{load-duration-2015}

\end{frame}

\begin{frame}{Nuclear curve}

  Can do the same for nuclear output:

  \centering
  \includegraphics[width=10.5cm]{Nuclear-2015}

\end{frame}

\begin{frame}{Nuclear duration curve}

  Duration curve is pretty flat, because it is economic to run nuclear almost all the time as  \alert{baseload plant}:

  \centering
  \includegraphics[width=13cm]{Nuclear-duration-2015}

  \raggedright
  The equivalent fraction of time that the plants run at full capacity over the year is the \alert{capacity factor} - nuclear has a high capacity factor, usually around 70-90\%.
\end{frame}


\begin{frame}{Gas curve}

  Can do the same for gas output:

  \centering
  \includegraphics[width=13cm]{Gas-2015}

\end{frame}

\begin{frame}{Gas duration curve}

  Duration curve is partially flat (for heat-driven CHP) and partially peaked (for \alert{peaking plant}):

  \centering
  \includegraphics[width=12cm]{Gas-duration-2015}

  \raggedright
  The capacity factor for gas is much lower - more like 20\%.
\end{frame}

\begin{frame}{Price curve}

  Can do the same for price during the year:

  \centering
  \includegraphics[width=13cm]{price-2015}

\end{frame}

\begin{frame}{Price duration curve}

  By ordering we get the \alert{price duration curve}:

  \centering
  \includegraphics[width=13cm]{price-duration-2015}

\end{frame}



\begin{frame}{Question}



  Now we are in a position to consider the questions:

  \begin{itemize}
    \item What determines the distribution of investment in different generation technologies?
    \item How is it connected to variable costs, capital costs and capacity factors?
  \end{itemize}

  We will find the price and load duration curves very useful.
\end{frame}


\section{Investment Optimisation: Dispatchable Generation}

\begin{frame}[fragile]
  \frametitle{Investment optimisation}

 Now we also optimise \alert{investment} in the \alert{capacities} of generators,
  storage and network lines for the \alert{whole system} not just a single plant operator, to maximise \alert{long-run efficiency}.

  We will promote the capacities $G_{i,s}$, $G_{i,r,*}$, $E_{i,r}$ and
  $F_{\ell}$ to optimisation variables.

  For generation investment, we want to answer the following questions:
  \begin{itemize}
    \item What determines the distribution of investment in different generation technologies?
    \item How is it connected to variable costs, capital costs and capacity factors?
  \end{itemize}

  We will find price and load duration curves very useful.
\end{frame}


\begin{frame}{Definition of long-run efficiency}

  Up until now we have considered \alert{short-run} equilibria that
  ensure \alert{short-run} efficiency (static), i.e. they make the best use of
  presently available productive resources.

  \alert{Long-run} efficiency (dynamic) requires in addition the optimal
  investment in productive capacity.

  Concretely: given a set of options, costs and constraints for different
  generators (nuclear/gas/wind/solar) what is the optimal generation
  portfolio for maximising long-run welfare?

  From an individual generators' perspective: how best should I invest in extra capacity?

  We will show again that with perfect competition and no barriers to
  entry, the system-optimal situation can be reached by individuals
  following their own profit.

\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, cheap \alert{baseload} generation runs the whole time; more expensive \alert{peaking plant} covers the difference.

  \centering
  \includegraphics[width=8.5cm]{baseload-peaking}

  \source{Tom Brown}

\end{frame}




\begin{frame}{Different types of generators}

\ra{1.1}
\begin{table}[!t]
	\centering
	\begin{tabular}{@{}llllll@{}}
\toprule
Fuel/Prime  & Marginal & Capital & Controllable & Predictable & CO2 \\
mover & cost & cost & & days ahead & \\
\midrule
Oil & V. High & Low & Yes & Yes & Medium \\
Gas OCGT & High & Low & Yes & Yes & Medium \\
Gas CCGT & Medium & Medium & Yes & Yes & Medium \\
Hard Coal & Medium & Lowish & Yes & Yes & High \\
Brown Coal & Low & Medium & Partly & Yes & High \\
Nuclear & V. Low & High & Partly & Yes & Zero \\
Hydro dam & Zero & High & Yes & Yes & Zero \\
Wind/Solar & Zero & High & Down & Partly & Zero \\
\bottomrule
	\end{tabular}
\end{table}

\end{frame}


\begin{frame}{System-optimal dispatchable generator capacities and dispatch}

  Suppose we have generators labelled by $s$ at a single node with \alert{marginal costs} $o_s$ from each unit of
  production $g_{s,t}$ and \alert{specific capital costs} $c_s$ from fixed costs
  regardless of the rate of production (e.g. investment in building
  capacity $G_s$).   For a variety of demand values $d_t$ that occur with probability $p_t$ ($\sum_t p_t = 1$)   we optimise the total \alert{average hourly system costs}
  \begin{equation*}
    \min_{\{g_{s,t}\},\{G_s\}}  \left[\sum_{s}c_s G_s +  \sum_{s,t} p_t o_{s} g_{s,t} \right]
  \end{equation*}
  such that (rescaling the KKT multipliers by $p_t$ to simplify later formulae)
  \begin{align*}
    \sum_s g_{s,t} & = d_t  \hspace{1cm}\leftrightarrow\hspace{1cm} p_t \l_t \\
    - g_{s,t}  & \leq  0  \hspace{1cm}\leftrightarrow\hspace{1cm} p_t \ubar{\m}_{s,t} \\
    g_{s,t} - G_s  & \leq 0  \hspace{1cm}\leftrightarrow\hspace{1cm} p_t \bar{\m}_{s,t}
  \end{align*}

  Assume ordering $o_1 \leq o_2 \leq \cdots \leq o_S = v$ where $s=S$ is the generator for load-shedding,
  $o_S = v$ (Value of Lost Load), $c_S=0$ (the capacity to shed load
  is assumed cost-free).

\end{frame}



\begin{frame}{Beware units and scaling}

  We've chosen the units here so that the total objective function has units \euro{}h$^{-1}$, the \alert{average hourly system costs}.

  $\sum_{s,t} p_t o_{s} g_{s,t}$ is the expectation value of the hourly production costs. $g_{s,t}$ has units MW, $o_{s}$ has units \euro{}(MWh)$^{-1}$.

  $c_sG_s$ is the investment cost averaged over each hour, i.e. the annualised investment cost $a(r,T)I_0$ (like a mortgage - we'll cover how to get this next lecture from the investment cost $I_0$, interest rate $r$ and lifetime $T$ via the annuity $a(r,T)$) divided by 8760, $\frac{a(r,T)I_0}{8760}$ (we can also add the fixed O\&{}M costs $B$ to it). $G_s$ has units MW, $c_s$ has units
  \euro{}MW$^{-1}$h$^{-1}$.

  We could have instead optimised \alert{average yearly system costs}, then $c_s G_s$ would simply be the annuity, and instead of weighting with $p_t$ such that $\sum_t p_t = 1$, we replace it with a weighting $w_t$ such that $\sum_t w_t = 8760$. In this case, the total objective would have units \euro{}a$^{-1}$.

\end{frame}

\begin{frame}{System-optimal generator capacities and dispatch}

  Stationarity for $g_{s,t}$ gives us for each $s$ and $t$ the same equation we had without capacity optimisation:
  \begin{align*}
        0 = \frac{\d \cL}{\d g_{s,t}}  = p_t \left(o_s - \l_t^* - \bar{\m}^*_{s,t} + \ubar{\m}^*_{s,t} \right)
  \end{align*}
  and for the capacity $G_s$ for each $s$ it relates the capital cost $c_s$ to the KKT multipliers for the capacity constraint:
  \begin{align*}
        0 = \frac{\d \cL}{\d G_{s}}  = c_s + \sum_t p_t \bar{\m}^*_{s,t}
  \end{align*}
  and from complementarity we get
  \begin{align*}
    \bar{\m}^*_{s,t}(g_{s,t}^* - G_s^*) & = 0 \\
    \ubar{\m}^*_{s,t}g_{s,t}^* & = 0
  \end{align*}
  and dual feasibility (negative for minimisation) $ \bar{\m}^*_{s,t},  \ubar{\m}^*_{s,t} \leq 0$.
\end{frame}



\begin{frame}{System-optimal generator capacities and dispatch}

  The solution for the dispatch $g_{s,t}^*$ is exactly the same as
  without capacity optimisation. For each $t$, find the marginal generator $m$
  where the supply curve intersects with the demand $d_t$, i.e. the $m$
  where   $\sum_{s=1}^{m-1} G_s^* < d_t < \sum_{s=1}^{m} G_s^*$.

  The \alert{marginal generator will set the price} $\l^*_t = o_m$, like before.


  For $s < m$ we have $g_{s,t}^* = G_s^*$, $\ubar{\m}^*_{s,t} = 0$,
  $\bar{\m}^*_{s,t} = o_s - \l_t^* \leq 0$.

  For $s = m$ we have $g_{m,t}^* = d_t - \sum_{s=1}^{m-1} G_s^*$ to cover
  what's left of the demand. Since $0 < g_{m,t}^* < G_m$ we have
  $\ubar{\m}^*_{m,t} = \bar{\m}^*_{m,t} = 0$ and therefore $\l_t^* = o_m$.

  For $s > m$ we have $g_{s,t}^* = 0$,
  $\ubar{\m}^*_{s,t} = \l_t^*-o_s \leq 0 $, $\bar{\m}^*_{s,t} = 0$.

  What about the $G_s^*$?


\end{frame}



\begin{frame}{System-optimal generator capacities and dispatch}

  The $G_s^*$ are determined implicitly based on the interactions between costs and prices.

  From stationarity we had the relation
    \begin{align*}
      c_s  = - \sum_t p_t \bar{\m}^*_{s,t}
    \end{align*}
    The $\bar{\m}^*_{s,t}$ were only non-zero with $\l^*_{t} > o_s$ so we can re-write this as
    \begin{align*}
      c_s  = \sum_{t| \l^*_{t} > o_s} p_t (\l^*_{t} - o_s)
    \end{align*}

    This is the \alert{average profit the generator makes in the short-run market}.

  `Increase capacity until marginal increase in profit equals the cost of extra capacity.'

    Above this capacity  the generator makes less money from the market than its cost $\Rightarrow$ bad investment.
\end{frame}


\begin{frame}{Multiple price duration}

  The optimal mix of generation is where, for each generation type,
  the area under the price–duration curve and above the variable cost
  of that generation type is equal to the fixed cost of adding
  capacity of that generation type.

  \centering
    \begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=8.5cm]{multiple-price-duration-clean}};
\draw (0.6,1.8) node{$o_1$};
\draw (0.6,2.6) node{$o_2$};
\draw (0.6,3.4) node{$o_3$};
  \end{tikzpicture}

  \source{Biggar and Hesamzadeh, 2014}
\end{frame}




\begin{frame}{Multiple generators with linear costs and inelastic demand}

  Assume again we have $o_1 \leq o_2 \leq \cdots \leq o_S = v$ and $K_s = \sum_{p=1}^s G_p^*$
  then:
  \begin{equation*}
    \l_t = \left\{ \begin{array}{ll}
      v& \textrm{ for } d_t > K_{S-1} \\
      o_s & \textrm{ if } K_{s-1} < d_t \leq K_s, \hspace{1cm} \textrm{ for } s = 1, \dots S-1
    \end{array}\right.
  \end{equation*}

  Looking at the area under the price duration curve but above the
  variable cost, we then find:
  \begin{equation*}
    c_s = (v-o_s)P(d>K_{S-1}) + \sum_{j=s+1}^{S-1} (o_j-o_s) P(K_{j-1} < d \leq K_j)
  \end{equation*}


\end{frame}

\begin{frame}{Example with three generators plus load shedding}

\begin{columns}[T]
  \begin{column}{6cm}

\includegraphics[width=6.4cm]{stacked-3-gen-durations.pdf}

  \end{column}
  \begin{column}{8cm}
    Example for $S=4$ (3 generators plus load-shedding).

    \vspace{0.5cm}

    The upper graph is the load duration curve.

    The y-axis is marked with the summed capacities of the generators $K_s = \sum_{p=1}^s G_p^*$.
    These meet the curve at $\theta_s = P(d_t > K_s)$ (the definition of load duration curve).

    \vspace{1cm}

    The lower graph is the price duration curve.

    During the time when generator $s$ is price-setting, the price is $o_s$.

    When $d_t > G_1^* + G_2^* + G_3^*$ then we have load-shedding and the price is $v$.
  \end{column}

\end{columns}

\end{frame}


\begin{frame}{Example with three generators plus load shedding}

\begin{columns}[T]
  \begin{column}{6cm}

\includegraphics[width=6.4cm]{stacked-3-gen-durations-0.pdf}

  \end{column}
  \begin{column}{8cm}

    How is this related to the capital costs?

    \vspace{0.5cm}

    For generator 3, the capital cost $c_3$ is the area above the price duration curve when $\l_t^* > o_3$.

    This only happens when there is load-shedding and $\l_t^* = v$ when $d_t > K_3 = G_1^* + G_2^* + G_3^*$.

    The area is given by
    \begin{align*}
      c_3 &  = (v - o_3) \theta_3  \\
      & = (v - o_3)P(d_t > K_3)
    \end{align*}
  \end{column}

\end{columns}

\end{frame}


\begin{frame}{Example with three generators plus load shedding}

\begin{columns}[T]
  \begin{column}{6cm}

\includegraphics[width=6.4cm]{stacked-3-gen-durations-1.pdf}

  \end{column}
  \begin{column}{8cm}

    How is this related to the capital costs?

    \vspace{0.5cm}

    For generator 2, the capital cost $c_2$ is the area above the price duration curve when $\l_t^* > o_2$.

    This only happens when there is load-shedding or when generator 3 is price-setting.

    The area is given by
    \begin{align*}
      c_2 &  = (v - o_2) \theta_3 + (o_3 - o_2) (\theta_2 - \theta_3)  \\
      & = (v - o_2) P(d_t > K_3) \\
       & \hspace{1cm}+ (o_3 - o_2) \left(P(d_t > K_2) - P(d_t > K_3)\right) \\
      & = (v - o_2) P(d_t > K_3) + (o_3 - o_2) P(K_2 < d_t\leq K_3)
    \end{align*}
  \end{column}

\end{columns}

\end{frame}



\begin{frame}{Example with three generators plus load shedding}

\begin{columns}[T]
  \begin{column}{6cm}

\includegraphics[width=6.4cm]{stacked-3-gen-durations-2.pdf}

  \end{column}
  \begin{column}{8cm}

    How is this related to the capital costs?

    \vspace{0.5cm}

    Finally for generator 1, the capital cost $c_1$ is the area above the price duration curve when $\l_t^* > o_1$.

    This only happens when there is load-shedding or when generator 2 or 3 is price-setting.

    The area is given by
    \begin{align*}
      c_1 &  = (v - o_1) \theta_3 + (o_3 - o_1) (\theta_2 - \theta_3)  + (o_2 - o_1) (\theta_1 - \theta_2)  \\
      & = (v - o_1) P(d_t > K_3) \\
       & \hspace{1cm}+ (o_3 - o_1) \left(P(d_t > K_2) - P(d_t > K_3)\right) \\
       & \hspace{1cm}+ (o_2 - o_1) \left(P(d_t > K_1) - P(d_t > K_2)\right) \\
      & = (v - o_1) P(d_t > K_3) + (o_3 - o_1) P(K_2 < d_t\leq K_3) \\
       & \hspace{1cm}+ (o_2 - o_1) P(K_1 < d_t\leq K_2)
    \end{align*}
  \end{column}

\end{columns}

\end{frame}


\begin{frame}{Screening curve}

  These equations can be rewritten recursively using the substitution
  $\theta_s = P(d > K_s)$:
  \begin{align*}
    c_{S-1} + \theta_{S-1} o_{S-1} &= v\theta_{S-1} \\
    c_s + \theta_s o_s &= c_{s+1} + \theta_s o_{s+1} \hspace{1cm} \forall s = 1, \dots S-2
  \end{align*}
  The first equation can be solved to find $\theta_{S-1}$, then the other equations can be solved recursively to find the remaining $\theta_s$. The $\theta_s$ correspond to the optimal \alert{capacity factors} of each type of generator, which correspond to the fraction  of time the generator runs at full power.

\end{frame}


\begin{frame}{Screening curve}

  The costs $c_s + o_s\theta$ as a function of the capacity factors $\theta$ can be drawn
  together as a \alert{screening curve} (more expensive options are
  \emph{screened} from the optimal inner polygon).

  The intersection points determine which generators are optimal for which capacity factors.

\begin{columns}[T]
  \begin{column}{7cm}
    \includegraphics[width=7.5cm]{screening_basic.pdf}
  \end{column}

  \begin{column}{7cm}
    $c_s + o_s\theta $ is the cost per MW and per hour of delivering power for $\theta$ of the time.
    $c_s$ gives the intercept of the $y$ axis; $o_s$ gives the slope.

    \vspace{.3cm}

    In this example we have load shedding, a baseload generator 1 and a peaking generator 2.

    For a capacity factor between  0 and $\theta_2$, it is cheapest to shed load.

    Between $\theta_2$ and $\theta_1$ the peaking generator 2 is lowest cost.

    Above $\theta_1$ the baseload generator 1 is best.

  \end{column}
\end{columns}

\end{frame}



\begin{frame}{Relation to levelised cost of electricity (LCOE)}

\begin{columns}[T]
  \begin{column}{7cm}
    \includegraphics[width=7.5cm]{screening_LCOE.pdf}
  \end{column}

  \begin{column}{7cm}
    \begin{itemize}
    \item     $c_s + o_s\theta $ is the cost per MW and per hour of delivering power for $\theta$ of the time.
    \item To get the \alert{levelised cost of electricity (LCOE)}, the cost per delivered energy, we divide by $\theta$:
      \begin{equation*}
        \textrm{LCOE}_s = \frac{c_s}{\theta} + o_s
      \end{equation*}
    \item The intersection points $\theta_s$ are the same, but it's now harder to read the graph.
      \item For peaking generator 2 with low capital cost $c_2$ and high marginal cost $o_2$, LCOE$_2\to o_2$ as $\theta \to 1$.
    \end{itemize}
  \end{column}
\end{columns}
\end{frame}

\begin{frame}{Screening curve versus Load duration}

  \begin{columns}[T]
  \begin{column}{7cm}
  \centering
  \begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=6.5cm]{screening-load-duration-clean}};
\draw (1.9,4.2) node{$c_2$};
\draw (1.9,5.6) node{$c_1$};
\draw (2.7,3.5) node{$\theta_2$};
\draw (5.2,3.5) node{$\theta_1$};
\draw (2.7,0.2) node{$\theta_2$};
\draw (5.2,0.2) node{$\theta_1$};
  \end{tikzpicture}
  \end{column}
  \begin{column}{6cm}

      The screening curve allows us to read of the optimal generator capacities $G_p^*$ from the load duration curve.

    \begin{itemize}

    \item We match the intersection points $\theta_s$ to the load duration curve.
    \item The values of the load duration curve at $\theta_s$ tell us what the cumulative sums $K_s = \sum_{p=1}^s G_p^*$  of the generator capacities are.
      \item This allows us to deduce the generator capacities $G_p^*$.
    \end{itemize}

  \end{column}
  \end{columns}
  \source{Biggar and Hesamzadeh, 2014}
\end{frame}


\begin{frame}{Example: 2 generation technologies and load shedding}


Suppose that electrical demand is inelastic with a  load duration curve given by $d(\theta)=1000-1000\theta$ for $0\leq \theta \leq 1$. Suppose that there are two different types of generation with variable costs of 2 and 12~\euro/MWh respectively, together with load-shedding at a cost of 1012~\euro/MWh. The fixed costs of the two generation types are 15 and 10~\euro/MWh respectively. See the below table for a summary of the costs.



  \ra{1.1}
  \begin{table}[!h]
    \begin{tabular}{lrr}
      \toprule
      Generator & $o_s$ [\euro/MWh] &  $c_s$ [\euro/MW/h] \\
      \midrule
      1 & 2 & 15 \\
      2 & 12 & 10 \\
      LS & 1012 & 0 \\
      \bottomrule
    \end{tabular}
  \end{table}


\end{frame}

\begin{frame}{Example: 2 generation technologies and load shedding}
\begin{enumerate}
  \item What is the interpretation of the  load duration curve?
  \item Below which capacity factor $\theta_1$ is it cheaper to run Generator 2 rather than to run Generator 1?
  \item Below which capacity factor $\theta_2$ is it cheaper to shed load than to run Generator 2?
  \item Plot the costs as a function of
    $\theta$ and mark these intersection points on a screening curve.
  \item Find the optimal capacities of Generators 1 and 2 in this market.
\end{enumerate}
\end{frame}



\begin{frame}{Example: 2 generation technologies and load shedding}
  \begin{columns}[T]
  \begin{column}{6cm}

    \includegraphics[width=6.5cm]{screening-example.pdf}

  \end{column}
  \begin{column}{7cm}
    Procedure:
    \begin{itemize}
    \item Draw the screening curve and load duration curve $d(\theta)$.
    \item Determine the intersection points $\theta_s$ from the screening curve.
    \item Compute the cumulative generator capacity sums from the load duration curve $d(\theta_s) = K_s = \sum_{p=1}^s G_p^*$.
      \item Find the capacities $G_s^*$ from the cumulative sums $K_s$.
    \end{itemize}
  \end{column}
  \end{columns}

\end{frame}


\begin{frame}{Example: 2 generation technologies and load shedding}

  To find $\theta_1$, solve for the intersection of Generator 1's cost curve with Generator 2's cost curve as a function of capacity factor:
  \begin{equation*}
    c_1 + \theta_1 o_1 = c_2 + \theta_1 o_2 \hspace{1cm} \Rightarrow  \hspace{1cm} 15 + 2 \theta_1 = 10 + 12 \theta_1
  \end{equation*}
  This gives $\theta_1 = 0.5$. At this point the demand is $d(0.5) = 500$~MW therefore
  \begin{equation*}
    K_1 = G_1^* = 500\textrm{ MW}
  \end{equation*}

  To find $\theta_2$, solver for where Generator 2 crosses the load-shedding line:
  \begin{equation*}
    c_2 + \theta_2 o_2 = c_{LS} + \theta_2 o_{LS} \hspace{1cm} \Rightarrow  \hspace{1cm} 10 + 12 \theta_2 = 1012 \theta_2
  \end{equation*}
  This gives $\theta_2 = 0.01$. At this point the demand is $d(0.01) = 990$~MW so:
  \begin{equation*}
    K_2 =     G_1^* + G_2^* = 990\textrm{ MW}
  \end{equation*}
  i.e. $G_2^* = 490$ MW. The remaining load is shed, $G_{LS}^* = 10$ MW.

\end{frame}

\section{Investment Optimisation: Transmission}


\begin{frame}[fragile]
  \frametitle{Investment optimisation: transmission}

  As before, our approach to the question of \alert{``What is the
    optimal amount of transmission''} is determined by the most
  efficient long-term solution.    Promote $F_\ell$ to an optimisation variable with specific capital cost
   $c_\ell$. For nodes $i$ and transmission lines $\ell$ enforcing KCL but not KVL:
  \begin{equation*}
    \min_{\{g_{i,s,t}\},\{G_{i,s}\},\{f_{\ell,t}\},\{F_{\ell}\}}  \left[\sum_{s}c_{i,s} G_{i,s} +  \sum_{i,s,t} p_t o_{i,s} g_{i,s,t} + \sum_{\ell}c_\ell F_\ell \right]
  \end{equation*}
  such that
  \begin{align*}
    \sum_s g_{i,s,t} -  \sum_\ell K_{i\ell}f_{\ell,t} & = d_{i,t}  \hspace{1cm}\leftrightarrow\hspace{1cm} p_t \l_{i,t} \\
    - g_{i,s,t}  & \leq  0  \hspace{1cm}\leftrightarrow\hspace{1cm} p_t \ubar{\m}_{i,s,t} \\
    g_{i,s,t} - G_{i,s}  & \leq 0  \hspace{1cm}\leftrightarrow\hspace{1cm} p_t \bar{\m}_{i,s,t} \\
    f_{\ell,t} -  F_\ell & \leq 0  \hspace{1cm}\leftrightarrow\hspace{1cm} p_t\bar{\m}_{\ell,t} \\
        - f_{\ell,t} -  F_\ell & \leq 0  \hspace{1cm}\leftrightarrow\hspace{1cm} p_t\ubar{\m}_{\ell,t}
  \end{align*}

\end{frame}

\begin{frame}[fragile]
  \frametitle{Investment optimisation: transmission}

  From stationarity for $f_{\ell,t}$ we find
  \begin{equation*}
    0 = \frac{\d \cL}{\d f_{\ell,t}} = p_t \left(\sum_i K_{i\ell} \l_{i,t}^* - \bar{\mu}_{\ell,t}^* + \ubar{\mu}_{\ell,t}^* \right)
  \end{equation*}
  I.e. the KKT multipliers $\bar{\mu}_{\ell,t}^*$ or
  $\ubar{\mu}_{\ell,t}^*$ are non-zero when the line $\ell$ is congested (by definition), at which time one of them equals
  the price difference between the ends of the line.

  For the investment we find from stationarity $0 = \frac{\d \cL}{\d F_{\ell}}$
  \begin{equation*}
    c_\ell = - \sum_t p_t \left(\bar{\mu}_{\ell,t}^* + \ubar{\mu}_{\ell,t}^* \right)
  \end{equation*}
  Remember that $\bar{\mu}_{\ell,t}^*$ and $\ubar{\mu}_{\ell,t}^*$ are only non-zero when the line is congested.

  Exactly as with generation dispatch and investment, we
  continue to invest in transmission until the marginal benefit of
  extra transmission (i.e. extra congestion rent for extra capacity)
  is equal to the marginal cost of extra transmission. This determines
  the optimal investment level.


\end{frame}

\end{document}
