% 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 10}
%\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{Cost Recovery in Long-Term Equilibrium}

\begin{frame}{Cost recovery in the long-term equilibrium}

  We will demonstrate that all players in the power network
  (generators, storage and network operators) \alert{recover their
    costs} in theory with perfect markets in long-term equilibrium and
  linear (actually convex) costs.

  If they didn't cover their costs, they would leave the market.

  If they made a profit, others would join the market and competition would reduce the profit.

  This is a direct consequence of the investment equations we considered in Lecture 9.

  We will discuss at the end why this \alert{does not work in real life}, i.e. the consequences of imperfect markets, frictions  and non-convexities.
\end{frame}

\begin{frame}{Single node with optimised capacities and dispatch}

  Suppose we have generators labelled by $s$ at a single node with \alert{marginal costs} $o_s$ arising from each unit of
  production $g_{s,t}$ and \alert{capital costs} $c_s$ that arise from fixed costs
  regardless of the rate of production (such as the investment in building
  capacity $G_s$).   For a variety of demand values $d_t$ in representative situation $t$ we optimise the total annual system costs
  \begin{equation*}
    \min_{\{g_{s,t}\},\{G_s\}}  \left[\sum_{s}c_s G_s +  \sum_{s,t} o_{s} g_{s,t} \right]
  \end{equation*}
  such that
  \begin{align*}
    \sum_s g_{s,t} & = d_t  \hspace{1cm}\leftrightarrow\hspace{1cm} \l_t \\
    - g_{s,t}  & \leq  0  \hspace{1cm}\leftrightarrow\hspace{1cm} \ubar{\m}_{s,t} \\
    g_{s,t} - G_s  & \leq 0  \hspace{1cm}\leftrightarrow\hspace{1cm} \bar{\m}_{s,t}
  \end{align*}

  We will now show using KKT that every generator exactly recovers their costs if the market price is set by $\l_t^*$, the \alert{no/zero profit rule}.
\end{frame}

\begin{frame}{Single node with optimised capacities and dispatch}

  Take the costs of generator $s$ at the optimal point:
  \begin{align*}
    c_s G_s^* +  \sum_{t}  o_{s} g_{s,t}^*
  \end{align*}

  Use stationarity for $g_{s,t}^*$
  \begin{align*}
        0 = \frac{\d \cL}{\d g_{s,t}}  = o_s - \l_t^* - \bar{\m}^*_{s,t} + \ubar{\m}^*_{s,t}
  \end{align*}
  to substitute for $o_s$ in the costs:
  \begin{align*}
    c_s G_s^* +  o_{s} \sum_{t}  g_{s,t}^* & =  c_s G_s^* + \sum_{t}( \l_t^* + \bar{\m}^*_{s,t} - \ubar{\m}^*_{s,t}) g_{s,t}^*
  \end{align*}
\end{frame}

\begin{frame}{Single node with optimised capacities and dispatch}

  Next use complementarity
  \begin{align*}
    \bar{\m}^*_{s,t}(g_{s,t}^* - G_s^*) & = 0 \\
    \ubar{\m}^*_{s,t}g_{s,t}^* & = 0
  \end{align*}
  to substitute for the terms $\m^*g_{s,t}^*$
  \begin{align*}
    c_s G_s^* +  o_{s} \sum_{t}  g_{s,t}^* & =  c_s G_s^* + \sum_{t}( \l_t^* + \bar{\m}^*_{s,t} - \ubar{\m}^*_{s,t}) g_{s,t}^* \\
    & = c_s G_s^* +  \sum_{t} \l_t^* g_{s,t}^* + \sum_t  \bar{\m}^*_{s,t} G_s^*
  \end{align*}
  Finally use stationarity for the capacity $G_s^*$
    \begin{align*}
        0 = \frac{\d \cL}{\d G_{s}}  = c_s + \sum_t \bar{\m}^*_{s,t}
  \end{align*}
  to get \alert{full cost recovery} from the market price:
  \begin{align*}
    c_s G_s^* +  o_{s} \sum_{t}  g_{s,t}^* =  \sum_{t} \l_t^* g_{s,t}^*
  \end{align*}

\end{frame}

\begin{frame}{Network of nodes with optimised capacities and dispatch}

  Suppose now we have a network of nodes $i$ connected by lines $\ell$.

  Our investment problem is now:
    \begin{equation*}
    \min_{\{g_{i,s,t}\},\{G_{i,s}\}, f_{\ell,t}, F_\ell}  \left[\sum_{i,s}c_s G_{i,s} +  \sum_{i,s,t} o_{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} \l_{i,t} \\
    - g_{i,s,t}  & \leq  0  \hspace{1cm}\leftrightarrow\hspace{1cm} \ubar{\m}_{i,s,t} \\
    g_{i,s,t} - G_{i,s}  & \leq 0  \hspace{1cm}\leftrightarrow\hspace{1cm} \bar{\m}_{i,s,t} \\
    f_{\ell,t} - F_\ell & \leq 0  \hspace{1cm}\leftrightarrow\hspace{1cm} \bar{\m}_{\ell,t} \\
        - f_{\ell,t} - F_\ell & \leq 0  \hspace{1cm}\leftrightarrow\hspace{1cm} \ubar{\m}_{\ell,t}
  \end{align*}

\end{frame}

\begin{frame}{Network of nodes with optimised capacities and dispatch}

  The cost recovery of the generators follows through exactly as before.

  What about the costs $c_\ell F_\ell^*$ of each transmission line?

  Use stationarity for the capacity $F_{\ell}^*$:
    \begin{align*}
        0 = \frac{\d \cL}{\d F_{\ell}}  = c_\ell   +\sum_t \bar{\m}^*_{\ell,t}  + \sum_t \ubar{\m}^*_{\ell,t}
    \end{align*}
    to get
    \begin{align*}
      c_\ell F_\ell^* = - F_\ell^* \sum_t \left[ \ubar{\m}^*_{\ell,t} +  \bar{\m}^*_{\ell,t} \right]
    \end{align*}
   `At the optimal point, fixed costs equal the sum of marginal
    benefits of expanding the line at each time.'

  Next use complementarity for the flows $\bar{\m}_{\ell,t}^* ( f_{\ell,t}^* - F_\ell^*) = 0$ and $\ubar{\m}_{\ell,t}^* ( - f_{\ell,t}^* - F_\ell^*) = 0$ to get
    \begin{align*}
      c_\ell F_\ell^* =  -\sum_t \left[ \bar{\m}^*_{\ell,t} -  \ubar{\m}^*_{\ell,t} \right] f_{\ell,t}^*
    \end{align*}

\end{frame}

\begin{frame}{Network of nodes with optimised capacities and dispatch}

  Finally use stationarity for each $f_{\ell,t}^*$:
    \begin{align*}
        0 = \frac{\d \cL}{\d f_{\ell,t}}  = \sum_i \l_{i,t}^*K_{i\ell}  - \bar{\m}^*_{\ell,t} + \ubar{\m}^*_{\ell,t}
  \end{align*}
    to substitute for the $\m^*$:
    \begin{align*}
      c_\ell F_\ell^*  &=  -\sum_t \left[ \bar{\m}^*_{\ell,t} -  \ubar{\m}^*_{\ell,t}   \right] f_{\ell,t}^* \\
      & =-\sum_t \sum_i \l_{i,t}^*K_{i\ell} f_{\ell,t}^*
    \end{align*}
    $ -\sum_i \l_{i,t}^*K_{i\ell} f_{\ell,t}^*$ is nothing other than
    the \alert{congestion rent} on line $\ell$ at time $t$, i.e. the flow $f_{\ell,t}^*$ multiplied by the price difference across the line $\sum_i \l_{i,t}^*K_{i\ell}$.

    At the long-term equilibrium, the network operator covers the costs of the line exactly with the congestion rent. The optimum requires congestion at least some of the time!
\end{frame}

\begin{frame}{Storage cost recovery}

  The proof for storage is a bit grizzly, but you can find it in \href{https://arxiv.org/abs/2002.05209}{\bf\color{blue}\underline{this paper}}.

  The result is for storage unit $r$ at node $i$:
    \begin{align*}
      & c_{r,\textrm{discharge}} G_{i,r,\textrm{discharge}}^* +        c_{r,\textrm{charge}} G_{i,r,\textrm{charge}}^* +  c_{r,\textrm{energy}}  E^*_{i,r} \\
      & = \sum_t \lambda_t^* g_{i,r,t,\textrm{discharge}}^* - \sum_t \lambda_t^* g_{i,r,t,\textrm{charge}}^*
    \end{align*}

    All the costs, including the costs of the electricity to charge the storage, are recovered when the storage discharges, thereby selling its electricity to the market.

    At the equilibrium, the profits from arbitrage in the market (`buy low, sell high') exactly cover the investment costs.

    From KKT we can deduce the optimal levels at which storage should bid into the market as demand or offer as supply (more later maybe).

\end{frame}

\begin{frame}{Adding a CO2 constraint for a single node}

If we add a constraint on the total \co2 emissions
\begin{equation*}
  \sum_{s,t} \frac{\varepsilon_s}{\eta_{s}} g_{s,t} \leq \textrm{CAP}  \leftrightarrow \m_{CO2}
\end{equation*}
where $\varepsilon_s$ are the specific \co2 emissions of technology $s$ per fuel
thermal energy and $\eta_s$ is the efficiency of the generator
(i.e. the ratio between thermal energy and electrical energy). CAP
could correspond to e.g. political targets for \co2 reduction.

All that changes is stationarity for the generator
\begin{align*}
  0 =     \frac{\d \cL}{\d g_{s,t}} =   o_{s}-\l_t^* + \ubar{\m}^*_{s,t} - \bar{\m}^*_{s,t} - \m_{CO2}^* \frac{\varepsilon_s}{\eta_{s}}
\end{align*}
and now for each generator cost recovery becomes
\begin{align*}
  c_s G_s^* +  o_{s}\sum_{t} g_{s,t}^*
  & = \sum_{t} \l_t^* g_{s,t} +\m_{CO2}^* \sum_{t}  \frac{\varepsilon_s}{\eta_{s}} g_{s,t}^*
\end{align*}

This shows nicely the duality for exchanging the CO2 constraint for a CO2 price $o_{s} \to o_{s} - \m^*_{CO2} \frac{\varepsilon_s}{\eta_{s}} $ (remember $\m^*_{CO2} \leq 0$ for minimisation problems).

\end{frame}

\begin{frame}{Introduction to Lagrangian Relaxation}

  This switching between costs and constraints is a special case of \alert{Lagrangian relaxation}.

  Consider the optimisation problem:
  \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_0(x) & \leq d_0  \hspace{1cm}\leftrightarrow\hspace{1cm} \m_0 \\
  h_j(x) & \leq d_j \hspace{1cm}\leftrightarrow\hspace{1cm} \m_j \hspace{1cm} j = 1,\dots m
\end{align*}

\end{frame}

\begin{frame}{Introduction to Lagrangian Relaxation}

  Now consider the related problem where $\tilde\mu_0$ is fixed to a constant:
  \begin{equation*}
  \max_{x} f(x) - \tilde\mu_0 (h_0(x) - d_0)
\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*}

We have \alert{relaxed} the problem by removing one of the constraints.

You can show that the new problem has the same solution as the old $(x^*,\l^*,\m^*)$ if we fix the constant $\tilde\mu_0 = \mu_0^*$ by comparing the KKT stationarity constraints of the two problems.

We have lifted the constraint into the objective function, where it penalises solutions with $h_0(x) > d_0$.

In general, if we don't know $\mu_0^*$ beforehand, we can iteratively solve to find it.

Often it can be easier to solve the relaxed problem.

\end{frame}

\begin{frame}{Fundamental Welfare Theorem is Lagrangian Relaxation}

  Consider the maximisation of total 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*}
  Now let's relax the constraint:
  \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) - \tilde\lambda ( \sum_b d_b -  \sum_s g_s) \right]
  \end{align*}
  This problem is \alert{separable} and \alert{decomposes} into separate problems for each $d_b$:
  \begin{equation*}
    \max_{d_b} \left[ U_b(d_b) - \tilde\lambda d_b\right]
  \end{equation*}
  and for each $g_s$:
  \begin{equation*}
    \max_{g_s} \left[ \tilde\lambda g_s  -  C_s(g_s)\right]
  \end{equation*}

\end{frame}

\begin{frame}{Grit in the machine for generation 1/2}

  Several factors make this theoretical picture quite different in reality:
  \begin{itemize}
  \item Generation investment is \alert{lumpy} i.e. you can often only
    build power stations in e.g. 500~MW blocks, not at any size.
  \item Some older generators have \alert{sunk costs}, i.e. costs which have been incurred once and cannot be recovered, which alters their behaviour (i.e. the capital cost term $c_s$ is not evenly distributed across all hours)
  \item Returns on scale in building plant are not taken into account (this would be a non-convexity; we did everything linear)
  \item Site-specific concerns ignored (e.g. lignite might need to be near a mine and have limited capacity)
  \item Variability of production for wind/solar ignored
    \item There is considerable  uncertainty given load/weather conditions during a year, which makes investment risky; economic downturns reduce electricity demand
  \end{itemize}

\end{frame}

\begin{frame}{Grit in the machine for generation 2/2}

  Several factors make this theoretical picture quite different in reality:
  \begin{itemize}
    \item Fuel cost fluctuations, building delays which cost money
  \item Risks from third-parties:  Changing costs of other generators, political risks (\co2 taxes,  Atomausstieg, subsidies for renewables, price caps)
  \item Political or administrative constraints on wholesale energy
    prices may prevent prices from rising high enough for long enough
    to justify generation investment (``Missing Money Problem'')
  \item  Lead-in time for planning and building, behaviour of others, boom-and-bust investment cycles resulting from periods of under- and over-investment in capacity
    \item Exercise of \alert{market power}
  \end{itemize}

\end{frame}

\begin{frame}{Episodes of High Prices are an Essential Part of an Energy-Only Market}

  In an energy-only market (in which generators are only compensated
  for the energy they produce), the wholesale spot price must at times
  be higher than the variable cost of the highest-variable-cost
  generating unit in the market. Episodes of high prices and/ or price
  spikes are not in themselves evidence of market power or evidence of
  market failure.

  However, there may be political or administrative restrictions on
  prices going to very high levels (i.e. consumer protection, concerns about market abuse).

\end{frame}

\begin{frame}{Today's market does not have episodes of very high prices}

  This makes it hard for e.g. gas generators to make back their
  costs. Day ahead spot market prices in 2016 in Germany-Austria bidding zone:

  \centering
  \includegraphics[width=8cm]{germany-2016-price-duration}

  \raggedright
  Gas generators can bid into other markets, such as the intra-day or
  reserve power markets, or provide redispatch services.

\end{frame}

\begin{frame}{Market prices from highly renewable simulations}

  In our simulations for high renewable penetrations, the theory does
  however work:

  \centering
  \includegraphics[width=8.5cm]{europe-future-price-duration}

  \raggedright
  Prices are zero around a quarter of the time, but spike above 10,000 \euro/MWh in some hours.

\end{frame}

\begin{frame}{Price cap}

  Some markets implement a maximum market price cap (MPC), which may be below the Value of Lost Load (VoLL)
  ($V$ for the inelastic case).

  In the Eastern Australian National Electricity Market (NEM), a MPC
  of A\$15,000/MWh (\euro~9,300/MWh) for the 2020-2021 financial year
  is set, corresponding to the price automatically triggered when AEMO
  directs network service providers to interrupt customer supply in
  order to keep supply and demand in the system in balance.

  \centering

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

  \includegraphics[width=6.5cm]{price-cap}
\end{column}
\begin{column}{5cm}

  The Electric Reliability Council of Texas (ERCOT) has an energy only market with an MPC of \$9000/MWh.

  \vspace{.5cm}

  MPC can introduce distortions which make it difficult for some generators to recover costs.

\end{column}

\end{columns}

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

\begin{frame}{Europe: Capacity Markets in Some Countries}

  CRM = Capacity Remuneration Mechanisms (CRM): status June 2014
  \centering
  \includegraphics[width=10.5cm]{cap_markets.png}

  \source{\href{http://www.mdpi.com/1996-1073/8/6/5198metrics}{Ellenbeck et al, 2014}}

\end{frame}

\begin{frame}{Features of Transmission Investment 1/2}

  \begin{enumerate}
  \item \alert{Rationale for transmission}: Load and generation do not coincide in location at all times, so electricity must be transported for some of the time.
  \item \alert{Transmission is a natural monopoly}: Like railways or water provision, it is unlikely that a parallel electricity network would be built, given cost and limits on installing infrastructure due to space and public acceptance. Natural monopolies require \alert{regulation}.
  \item \alert{Transmission is a capital-intensive business}:
    Transmitting electric power securely and efficiently over long
    distances requires large amounts of equipment (lines,
    transformers, etc.) which dominate costs compared to the operating
    costs of the grid. Making good investment decisions is thus the
    most important aspect of running a transmission company.
  \end{enumerate}

\end{frame}

\begin{frame}{Features of Transmission Investment 2/2}

  \begin{enumerate}
  \item \alert{Transmission assets have a long life}: Most
    transmission equipment is designed for an expected life ranging
    from 20 to 40 years or even longer (up to 60-80 years). A lot can
    change over this time, such as load behaviour and generation costs
    and composition.
  \item \alert{Transmission investments are irreversible}: Once a transmission line has been built, it
  cannot be redeployed in another location where it could be used more profitably.
  \item \alert{Transmission investments are lumpy}: Manufacturers sell transmission equipment in
    only a small number of standardized voltage and MVA ratings. It is therefore often not
    possible to build a transmission facility whose rating exactly matches the need.
    \item \alert{Economies of scale}: Transmission investment more
      proportional to length (costs of rights of way, terrain, towers,
      which dominate costs) than to power rating (which depends only
      on conductoring, which is cheap).

  \end{enumerate}

\end{frame}

\section{Integrating Renewables in Power Markets}

\begin{frame}{Characteristics of Renewables}

  \begin{itemize}
  \item \alert{Variability}: Their production depends on weather (wind speeds for wind, insolation for solar and precipitation for hydroelectricity)
  \item \alert{No Upwards Controllability}: Variable Renewable Energy (VRE) like wind and solar can only reduce their output; raising is hard
  \item \alert{No Long-Term Forecastability}: Although short-term forecasting is improving steadily
  \item \alert{Low Marginal Cost} (no fuel costs)
  \item \alert{High Capital Cost}
  \item \alert{No Direct Carbon Dioxide Emissions} (but some indirect ones from manufacturing)
  \item \alert{Small unit size} (onshore wind turbine is 3-5~MW; coal/nuclear is 1000~MW)
  \item \alert{Somewhat Decentralised Distribution} for some VRE (e.g. solar panels on household rooves); offshore is however very centralised
    \item \alert{Provision of system services}: Increasing
  \end{itemize}

\end{frame}

\begin{frame}{RE Levelised Cost in 2019 USD/kWh  (already at/below fossil fuels)}

  \centering
      % left bottom right top
  \includegraphics[trim=2.6cm 2cm 0 0cm,width=11cm,clip=true]{irena-2020.jpg}

  \source{\href{https://www.irena.org/publications/2020/Jun/Renewable-Power-Costs-in-2019}{IRENA Renewable Generation Costs in 2019}}
\end{frame}

\begin{frame}{RE Forecasting}

  Just like the weather on which it depends, Variable RE (wind and
  solar) production can be forecast in advance.   (Shaded area is the uncertainty.)

  \centering
  \includegraphics[width=9.5cm]{wind_farm_forecast_2}
\end{frame}

\begin{frame}{RE Forecasting}

  Like the weather, the forecast in the short-term (e.g. day ahead) is
  fairly reliable, particularly for wind, but for several days ahead
  it is less useful. In addition, it is subject to more uncertainty
  than the load. For example, fog and mist is very local, hard to
  predict, and has a big impact on solar power production.

  This makes scheduling more challenging and has led to the introduction of
  more regular auctions in the intraday market.

  Forecasting has also become a big business.

\end{frame}

\begin{frame}{Effect on effective `residual' load curve}

  Since RE often have priority feed-in (i.e. network operators are obliged to take their power), we often subtract the RE production from the load to get the \alert{residual load}, plotted here as a demand-duration-curve.

  \centering
  \includegraphics[width=10cm]{residual-load}

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

\begin{frame}{Residual load curve and screening curve}

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

  \centering
    \begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=5.4cm]{residual-screening_curve-clean}};
\draw (0.3,4.9) node{$c_2$};
\draw (0.3,6.5) node{$c_1$};
  \end{tikzpicture}

\end{column}
\begin{column}{6cm}

  The residual load must be met by conventional generators.

  The changed duration curve interacts differently with the screening curve, so that we may require less baseload generation and peaking plant and more load shedding, depending on the shape of the curve.

  In some markets, there is increased demand for medium-peaking plant.

\end{column}

\end{columns}

  \centering

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

\begin{frame}
  \frametitle{Effect of varying renewables: fixed demand, no wind}

  \centering
  \includegraphics[width=9cm]{demand-supply-no_wind}

\end{frame}

\begin{frame}
  \frametitle{Effect of varying renewables: fixed demand, 35~GW wind}

  \centering
  \includegraphics[width=9cm]{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 and
    hard coal are the most flexible and produce the \emph{lowest} \co2
    per MWh
  \item It also reduces the profits that nuclear and brown coal 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}

\begin{frame}{Market value}

  VRE have the property that they cannibalise their own market, by
  pushing down prices when lots of other VRE are producing.

  We define the \alert{market value} of a technology by the average
  market price it receives when it produces, i.e.

  \begin{equation*}
    MV_s = \frac{\sum_{t} \l^*_t g_{s,t}}{\sum_{t} g_{s,t}}
  \end{equation*}

  We can compare this to the average market price,
    defined either as the simple average $\frac{1}{T} \sum_t \l^*_t$ or the demand-weighted average $ \frac{\sum_{t} \l^*_td_t}{\sum_{t}d_t}$.

\end{frame}

\begin{frame}{Historic market values in Germany}

  \centering

  \includegraphics[width=11cm]{market_value-historical}

  \source{\href{https://doi.org/10.1016/j.eneco.2013.02.004}{Lion Hirth, 2013}}
\end{frame}

\begin{frame}{Market value at higher shares}

  At low shares of VRE the market value may be higher than the average market price (because for example, PV produces a midday when prices are higher than average), but as VRE share increases the market value goes down.

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

  \centering

  \includegraphics[width=6cm]{market_value_us}

\end{column}
\begin{column}{4cm}

  The effect is particularly severe for PV, since the production is highly correlated; for wind smoothing prevents a steeper drop off. The bigger the catchment area, the longer wind preserves its market value.

  \source{Mills \& Wiser, 2014}
\end{column}

\end{columns}

\end{frame}

\begin{frame}{Market value mitigation}

To halt the drop in market value (and hence revenue for wind and
solar) we can use networks to do price arbitrage in space, storage to
do arbitrage in time, or introduce CO2 prices that push up the prices in times when fossil fuel
plants are running.

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

  \centering

  \includegraphics[width=5cm]{market_value-networks}

\end{column}
\begin{column}{5.5cm}

  \centering

  \includegraphics[width=5cm]{market_value-storage}
\end{column}

\end{columns}

  \source{\href{https://doi.org/10.1016/j.eneco.2013.02.004}{Lion Hirth, 2013}}

\end{frame}

\begin{frame}
  \frametitle{Market value from our 95\% renewable simulations}
  \begin{columns}[T]
    \begin{column}{8.3cm}
      \vspace{1cm}
\centering
  \includegraphics[width=8.3cm]{pre-7-market_value}
  %\includegraphics[width=6cm]{pre-2-costs_de_storage}
\end{column}
\begin{column}{4cm}
  \begin{itemize}
%\item   %Big reduction in curtailment
  \item Storage charges at low market prices and dispatches at high
    prices.
  \item Dispatchable power sources take advantage of high prices.
  \item Variable renewables get lower prices, but saved by storage, networks and high CO2 price.
  \end{itemize}
\end{column}
\end{columns}

\end{frame}

\begin{frame}
  \frametitle{Relation of LCOE to market value}

  From the first section we had for a perfect market in long-term equilibrium that all costs are recovered from market revenue:
  \begin{align*}
    c_s G_s^* +  o_{s} \sum_{t}  g_{s,t}^* =  \sum_{t} \l_t^* g_{s,t}^*
  \end{align*}
  If we divide both sides by the total yearly generation $\sum_{t} g_{s,t}^*$ then we get:
  \begin{align*}
    \frac{c_s G_s^* +  o_{s} \sum_{t}  g_{s,t}^*}{\sum_{t} g_{s,t}^*} =  \frac{\sum_{t} \l_t^* g_{s,t}^*}{\sum_{t} g_{s,t}^*}
  \end{align*}
  This is none other than the identity between the LCOE and market value:
  \begin{align*}
    LCOE = MV
  \end{align*}
  This \emph{only} holds in a perfect equilibrium. I.e. the
  equilibrium is found by increasing the penetration until the market
  value equals the LCOE.

  In reality the market is far from equilibrium: subsidies support
  technologies (with a longer-term view of pushing them down the
  learning curve), there are sunk costs for existing plants, excess
  capacity supported outside the energy-only market, etc.
\end{frame}

\begin{frame}{Market value: more details}

  For more details on market value, the zero profit rule and how market value is affected by CO$_2$ prices and VRE subsidies, see the paper

  \href{https://arxiv.org/abs/2002.05209}{\bf\color{blue}\underline{Decreasing market value of variable renewables is a result of policy, not variability}} (2020)

  This paper examines how to maintain market value even at high shares of wind and solar.

\end{frame}

\section{Networks Versus Storage for Highly-Renewable European Electricity System}

\begin{frame}
  \frametitle{Warm-up: Determine optimal electricity system}

\begin{columns}[T]
\begin{column}{7cm}
  \begin{itemize}
  \item Meet all electricity demand.
  \item Reduce \co2{} by 95\% compared to 1990.
  \item \alert{Generation} (where potentials allow): onshore and offshore
    wind, solar, hydroelectricity, backup from natural gas.
  \item \alert{Storage}: batteries for short term, electrolyse hydrogen gas for long term.
  \item \alert{Grid expansion}: simulate everything from no grid expansion (like a \alert{decentralised solution}) to optimal grid expansion (with significant \alert{cross-border trade}).
  \end{itemize}
\end{column}
\begin{column}{6.5cm}

  \vspace{0.3cm}
\centering

\includegraphics[width=7cm]{europe_map}

\end{column}
\end{columns}

\source{PyPSA-Eur, based on ENTSO-E map}
\end{frame}

\begin{frame}
  \frametitle{Linear optimisation problem}

  Objective is the minimisation of \alert{total annual system costs}, composed of \alert{capital costs} $c_*$ (investment costs) and \alert{operating costs} $o_*$ (fuel ,etc.):
  \begin{equation*}
\min    f(F_\ell, f_{\ell,t}, G_{i,s},  g_{i,s,t}) =  \sum_{\ell} c_l F_\ell + \sum_{i,s} c_{i,s} G_{i,s} + \sum_{i,s,t} w_t o_{i,s} g_{i,s,t}
  \end{equation*}
  We optimise for $i$ nodes, representative times $t$ and transmission lines $l$:
  \begin{itemize}
  \item the transmission capacity $F_\ell$ of all the lines $\ell$
  \item the flows $f_{\ell,t}$ on each line $\ell$ at each time $t$
  \item the generation and storage capacities $G_{i,s}$ of all technologies (wind/solar/gas etc.) $s$ at each node $i$
  \item the dispatch $g_{i,s,t}$ of each generator and storage unit at each point in time $t$
  \end{itemize}

  Representative time points are weighted $w_t$ such that $\sum_t w_t = 365*24$ and the capital costs $c_*$ are annualised, so that the objective function represents the annual system cost.

\end{frame}

\begin{frame}
  \frametitle{Constraints 1/6: Nodal energy balance}

  Demand $d_{i,t}$ at each node $i$ and time $t$ is always met by
  generation/storage units $g_{i,s,t}$ at the node or from transmission
  flows $f_{\ell,t}$ on lines attached at the node (Kirchhoff's Current Law):
    \begin{equation*}
      \sum_{s} g_{i,s,t} - d_{i,t} =  \sum_{\ell } K_{i\ell} f_{\ell,t}  \hspace{1cm}\leftrightarrow\hspace{1cm} \l_{i,t}
    \end{equation*}

    Nodes are shown as thick busbars connected by transmission lines (thin lines):

\centering
\begin{circuitikz}
  \draw (1.5,14.5) to [short,i^=$f_1$] (1.5,13);
  \draw [ultra thick] (0,13) node[anchor=south]{i} -- (4,13);
  \draw(2.5,13) |- +(0,0.5) to [short,i^=$f_2$] +(5,0.5) |- +(0,-0.5);
  \draw [ultra thick] (6,13) node[anchor=south]{j} -- +(4,0);
  \draw (8.5,14.5) to [short,i^=$f_3$] +(0,-1.5);
  \draw (0,-0.5) ;
  \draw (0.5,13) -- +(0,-0.5) node[sground]{};
  \draw (2,12) node[vsourcesinshape, rotate=270](V2){}
  (V2.left) -- +(0,0.6);
  \draw (3.5,12) node[vsourcesinshape, rotate=270](V2){}
  (V2.left) -- +(0,0.6);
  \draw (0.5,11) node{$d_i$};
  \draw (2,11) node{$g_{i,w}$};
  \draw (3.5,11) node{$g_{i,s}$};
  \draw (2,10.3) node{$ g_{i,w} + g_{i,s} - d_i = f_2 -f_1$};
  \draw (6.5,13) -- +(0,-0.5) node[sground]{};
  \draw (8,12) node[vsourcesinshape, rotate=270](V2){}
  (V2.left) -- +(0,0.6);
  \draw (9.5,12) node[vsourcesinshape, rotate=270](V2){}
  (V2.left) -- +(0,0.6);
  \draw (6.5,11) node{$d_j$};
  \draw (8,11) node{$g_{j,w}$};
  \draw (9.5,11) node{$g_{j,s}$};
  \draw (8,10.3) node{$ g_{j,w} + g_{j,s} - d_{j} = -f_2 - f_3$};

\end{circuitikz}

\end{frame}

\begin{frame}
  \frametitle{Constraints 2/6: Generation availability}
  Generator/storage dispatch $g_{i,s,t}$ cannot exceed availability $G_{i,s,t}\cdot G_{i,s}$, made up of per unit availability $0 \leq G_{i,s,t} \leq 1$ multiplied by the capacity $G_{i,s}$. The capacity is bounded by the installable potential $\hat{G}_{i,s}$.
    \begin{equation*}
      0 \leq g_{i,s,t} \leq G_{i,s,t}\cdot G_{i,s} \leq  G_{i,s} \leq  \hat{G}_{i,s}
    \end{equation*}

    \centering
        \begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=10.5cm]{scigrid-curtailment}};
\draw (3,2.85) node[text=blue]{$g_{i,s,t}$};
\draw (3,3.6) node[text=red]{$G_{i,s,t}\cdot G_{i,s}$};
\draw (3,4.95) node[text=cyan]{$G_{i,s}$};
  \end{tikzpicture}

\end{frame}

\begin{frame}
  \frametitle{Installation potentials limited by geography}

  Expansion potentials are limited by \alert{land usage} and
  \alert{conservation areas}; potential yearly energy yield at each site
  limited by \alert{weather conditions}:

  \centering
  \includegraphics[width=14.5cm]{average_power_density_potential-eps-converted-to.pdf}
\end{frame}

\begin{frame}
  \frametitle{Constraints 3/6: Storage consistency}

  Storage units such as batteries or hydrogen storage can work in both
  storage and dispatch mode. This has to be consistent with the state
  of charge $e_{i,s,t}$:
  \begin{align*}
    e_{i,s,t} = \eta_0e_{i,s,t-1} + \eta_1g_{i,s,t,\textrm{store}} -  \eta_2^{-1} g_{i,s,t,\textrm{dispatch}}
  \end{align*}

  The state of charge is limited by the energy capacity $E_{i,s}$:
  \begin{align*}
    0 \leq e_{i,s,t} \leq E_{i,s} \quad \forall i,s,t
  \end{align*}

  There are efficiency losses $\eta$; hydroelectric dams can also have a river inflow.

\end{frame}

\begin{frame}
  \frametitle{Constraints 4/6: Kirchoff's Laws for Physical Flow}

  The linearised \alert{power flows} $f_\ell$ for each line $\ell \in
  \{1,\dots L\}$ in an AC network are determined by the
  \alert{reactances} $x_\ell$ of the transmission lines and the
  \alert{net power injection} at each node $p_i$ for $i\in\{1,\dots
  N\}$.

  We have to satisfy Kirchoff's Laws, which can be compactly expressed
  using the \alert{incidence matrix} $K \in \R^{N\times L}$ (boundary
  operator in homology theory) of the graph and the \alert{cycle
    basis} $C \in \R^{L\times(L-N+1)}$ (kernel of $K$)

  \begin{itemize}
  \item  Kirchoff's Current Law: $p_i = \sum_{\ell} K_{i\ell} f_\ell$
  \item  Kirchoff's Voltage Law: $\sum_\ell C_{\ell c} x_\ell f_\ell = 0$
  \end{itemize}

\end{frame}

\begin{frame}
  \frametitle{Constraints 5/6: Transmission Line Thermal Limits}

    Transmission flows cannot exceed the thermal capacities of the transmission lines (otherwise they sag and hit buildings/trees):
    \begin{equation*}
      | f_{\ell,t} | \leq  F_\ell
    \end{equation*}

\end{frame}

\begin{frame}
  \frametitle{Constraints 6/6: Global constraints on \co2 and transmission volumes}
  CO${}_2$ limits are respected, given emissions $\varepsilon_{i,s}$ for each fuel source $s$:
    \begin{equation*}
      \sum_{i,s,t}  g_{i,s,t} \frac{\varepsilon_{i,s}}{\eta_{s}} \leq \textrm{CAP}_{\textrm{CO}_2} \hspace{1cm} \leftrightarrow \hspace{1cm} \m_{\textrm{CO}_2}
    \end{equation*}
    We enforce a reduction of \co2 emissions by 95\% compared to 1990
    levels, in line with German and EU targets for 2050.

    Transmission volume limits are respected, given length $d_\ell$ and capacity $F_\ell$ of each line:
    \begin{equation*}
      \sum_{\ell} d_\ell   F_\ell \leq \textrm{CAP}_{\textrm{trans}} \hspace{1cm} \leftrightarrow \hspace{1cm} \m_{\textrm{trans}}
    \end{equation*}
    We  successively change the transmission limit, to assess the costs of balancing power in time (i.e. storage) versus space (i.e. transmission networks).

\end{frame}

\begin{frame}
\frametitle{Model Inputs and Outputs}

\begin{columns}
  \begin{column}{6cm}

    \begin{table}[!t]
	\centering
	\begin{tabular}{@{}p{1.15cm}p{4.54cm}@{}}
\toprule
\alert{Inputs} & Description \\
\midrule
$d_{i,t}$ & Demand (inelastic) \\
$G_{i,s,t}$ & Per unit availability for wind and solar \\
$\hat{G}_{i,s}$ & Generator installable potentials \\
various & Existing hydro data \\
various & Grid topology \\
$\eta_*$ & Storage efficiencies \\
$c_{i,s}$ & Generator capital costs \\
$o_{i,s,t}$ & Generator marginal costs \\
$c_\ell$ & Line costs \\
\bottomrule
	\end{tabular}
\end{table}
  \end{column}
    \begin{column}{1cm}

      \vspace{1cm}

      $\to$

    \end{column}
  \begin{column}{6cm}

    \begin{table}[!t]
	\centering
	\begin{tabular}{@{}p{1.15cm}p{4.54cm}@{}}
\toprule
\alert{Outputs} & Description \\
\midrule
$G_{i,s}$ &  Generator capacities \\
$g_{i,s,t}$ & Generator dispatch \\
$F_\ell$ & Line capacities \\
$f_{\ell,t}$ & Line flows \\
$\lambda_*,\mu_*$ & Lagrange/KKT multipliers of all constraints \\
f & Total system costs \\
\bottomrule
	\end{tabular}
\end{table}
  \end{column}

\end{columns}
\end{frame}

\begin{frame}
  \frametitle{Costs and assumptions for the electricity sector (projections for 2030)}

  \begin{table}
\centering
\begin{tabular}{@{}lrlrr@{}}
\toprule
Quantity                &Overnight  Cost [\euro]  &Unit & FOM [\%/a] & Lifetime [a] \\
\midrule
Wind onshore    &1182   &kW\el &3 & 20   \\
Wind offshore  &2506   &kW\el  &3& 20  \\
Solar PV           &600   &kW\el &4 & 20   \\
Gas             &400    &kW\el  &4& 30  \\
%Gas marginal            &75     &\euro{}/MWh$_{\textrm{e}}$    \\
Battery storage         &1275   &kW\el  & 3 & 20 \\
Hydrogen storage        &2070   &kW\el  & 1.7 &20 \\
Transmission line       &400    &MWkm & 2 & 40\\
\bottomrule
\end{tabular}
\end{table}
  Interest rate of 7\%, storage efficiency losses, only gas has \co2 emissions, gas marginal costs.

  Batteries can store for 6 hours at maximal rating (efficiency $0.9\times 0.9$), hydrogen storage for 168 hours (efficiency $0.75\times 0.58$).
\end{frame}

\begin{frame}
  \frametitle{Costs: No interconnecting transmission allowed}

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

  Technology~by~energy:
  % left bottom right top
  \begin{tabular}{cc}
    \includegraphics[trim=0 0cm 0 0cm,width=3.2cm,clip=true]{total-pie-0-0} &
  \end{tabular}

  Average~cost~\alert{\euro 86/MWh}:

  \includegraphics[width=3.6cm]{total-costs-joint-1}

  \end{column}

  \begin{column}{9cm}
    % left bottom right top
    \centering
    \includegraphics[trim=0 4cm 0 4cm,width=8cm,clip=true]{euro-pie-0-0}

    \raggedright
    Countries must be self-sufficient at all times; lots of storage and some gas to deal with fluctuations of wind and solar.
  \end{column}

\end{columns}
\end{frame}

\begin{frame}
  \frametitle{Dispatch with no interconnecting transmission}

  For Great Britain with no interconnecting transmission, excess wind is either stored as hydrogen or curtailed:

  \centering
  \includegraphics[width=13cm]{GB-0}
\end{frame}

\begin{frame}
  \frametitle{Costs: Cost-optimal expansion of interconnecting transmission}

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

  Technology~by~energy:
  % left bottom right top
    \begin{tabular}{cc}
    \includegraphics[trim=0 0cm 0 0cm,width=3.2cm,clip=true]{total-pie-0-5} &
  \end{tabular}

  Average~cost~\alert{\euro 64/MWh}:

  \includegraphics[width=4.7cm]{total-costs-joint-2}

  \end{column}

  \begin{column}{9cm}
    % left bottom right top
    \centering
    \includegraphics[trim=0 4cm 0 4cm,width=8cm,clip=true]{euro-pie-0-5}

    \raggedright
    Large transmission expansion; onshore wind dominates. This optimal solution may run into public acceptance problems.
  \end{column}

\end{columns}

\end{frame}

\begin{frame}
  \frametitle{Dispatch with cost-optimal interconnecting transmission}

  Almost all excess wind can be now be exported:

  \centering
  \includegraphics[width=13cm]{GB-1}
\end{frame}

\begin{frame}
  \frametitle{Electricity Only Costs Comparison}

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

    \vspace{0.5cm}
  \includegraphics[width=9cm]{opteu_paper2-elec_only-costs-curve}

  \end{column}

  \begin{column}{5cm}
    \begin{itemize}
    \item Average total system costs can be as low as \euro~64/MWh
     \item Energy is dominated by wind (64\% for the cost-optimal system), followed
       by hydro (15\%) and solar (17\%)
     \item Restricting transmission results in more storage to deal with variability, driving up the costs by up to 34\%
     \item Many benefits already locked in at a few multiples of today's grid
    \end{itemize}

  \end{column}

\end{columns}
\end{frame}

\begin{frame}
  \frametitle{Grid expansion CAP shadow price $\m_{\textrm{trans}}$ as CAP relaxed}

\begin{columns}[T]
\begin{column}{9cm}
\centering
  \includegraphics[width=9cm]{shadow_price_LV_N1_5_diw2030_solar1_7-eps-converted-to}
  %\includegraphics[width=6cm]{pre-2-costs_de_storage}
\end{column}
\begin{column}{4cm}
  \begin{itemize}
%\item   %Big reduction in curtailment
  \item With overhead lines the optimal system has around 7 times today's transmission volume
  \item With underground cables (5-8 times more expensive) the optimal system has around 3 times today's transmission volume
  \end{itemize}
\end{column}
\end{columns}

\end{frame}

\begin{frame}
  \frametitle{Distribution of costs}

  As transmission volumes increase, costs become more unequally distributed...

  \centering
  \includegraphics[width=13cm]{costs_ct_N1_5_HFOM-diw2030_solar1_7-LVs_0-0_0-25_Opt-eps-converted-to.pdf}

\end{frame}

\begin{frame}
  \frametitle{Distribution of prices}

  ...while market prices converge.

  \centering

  \includegraphics[width=13cm]{local_marginal_price_ct_N1_5-diw2030_solar1_7_angles-LVs_0-0_0-25_Opt-eps-converted-to.pdf}

\end{frame}

\begin{frame}
  \frametitle{Different flexibility options have difference temporal scales}

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

    \vspace{0.5cm}
  \includegraphics[width=11cm]{soc_series_LV0-25_H2_hydro_diw2030_solar1_7-eps-converted-to.pdf}

  \end{column}

  \begin{column}{3cm}
    \vspace{1cm}
    \begin{itemize}
    \item Hydro reservoirs are \alert{seasonal}
    \item Hydrogen storage is \alert{synoptic}
    \end{itemize}

  \end{column}

\end{columns}
\end{frame}

\begin{frame}
  \frametitle{Different flexibility options have difference temporal scales}

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

    \vspace{0.5cm}
  \includegraphics[width=11cm]{soc_series_LV0-25_all_2011-08_diw2030_solar1_7-eps-converted-to.pdf}

  \end{column}

  \begin{column}{3cm}
        \vspace{2cm}
    \begin{itemize}
    \item Pumped hydro and battery storage are \alert{daily}
    \end{itemize}

  \end{column}

\end{columns}
\end{frame}

\begin{frame}
  \frametitle{You Try}

  For more details, see the paper \href{https://arxiv.org/abs/1704.05492}{\bf\color{blue}\underline{The Benefits of Cooperation}} (2017).

  The basic result (benefit of European interconnection versus national balancing) can also be seen using the online toy model:

  \vspace{.5cm}
  \centering
  \url{https://model.energy/}
  \vspace{.5cm}

  \raggedright
  Look at the differences of wind and solar feed-in and optimal storage solutions for:
  \begin{itemize}
  \item \alert{City: Karlsruhe}
  \item \alert{Country: Germany}
    \item \alert{Continent: Europe}
  \end{itemize}

\end{frame}

\end{document}


\documentclass[10pt]{article}
\usepackage{geometry}
\geometry{a4paper}
\pagestyle{myheadings}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{fancyhdr} % Required for custom headers
\usepackage{lastpage} % Required to determine the last page for the footer
\usepackage{extramarks} % Required for headers and footers
\usepackage{graphicx} % Required to insert images
\usepackage{listings} % Required for insertion of code
\usepackage{courier} % Required for the courier font
\usepackage{caption}
\usepackage{subcaption}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{epstopdf}
\usepackage{placeins}
\usepackage{fancyvrb}
\usepackage[numbered]{bookmark}
\usepackage{pgfplots}
\usepackage{ifthen}
\usepackage{enumitem}
\usepackage{setspace}
\usepackage{placeins} % for FloatBarrier
\usepackage[makeroom]{cancel}
\usepackage[absolute,overlay]{textpos}
\usetikzlibrary{calc, angles,quotes}
\usetikzlibrary{pgfplots.fillbetween, backgrounds}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows}
\usetikzlibrary{pgfplots.groupplots}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{plotmarks}
\usetikzlibrary{decorations.markings}

\usepgfplotslibrary{groupplots}
\pgfplotsset{compat=newest}

\DeclareGraphicsExtensions{.pdf,.png,.jpg}
\graphicspath{{../figs/}}

\definecolor{blue2}{RGB}{51, 105, 232}
\definecolor{red2}{RGB}{213, 15, 37}
\definecolor{green2}{RGB}{0, 153, 37}

\input{preamble.tex}

%%%%%%%%%%%%% SOLUTIONS %%%%%%%%%%%%%%%%%
\def\SOLUTIONS{0} % change to 1 to produce solutions
\def\SolutionsColor{red2}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Header
\if\SOLUTIONS1
	\markboth{\em \color{\SolutionsColor} \textbf{EE264: Final exam solutions}}{\em \color{\SolutionsColor} \textbf{EE264: Final exam solutions}}
    \title{EE 264 Final exam solutions}
\else
	\markboth{\em EE264: Final Exam, Summer 2018}{\em EE264: Final Exam, Summer 2018}
    \title{EE 264 Final}
\fi

% Document
\begin{document}
\input{cover.tex}
\pagebreak

\section*{Problem 1: Hearing aid (60 points)}

Figure~\ref{fig:hearing_aid_diagram} shows the block diagram of a hearing aid device. The signal recorded by the microphone is low-pass filtered by the anti-aliasing filter $H_{aa}(j\Omega)$, and then converted to digital domain by the ADC. A digital filter $H(z)$ corrects for the patient's hearing loss by boosting the signal at particular frequencies or band of frequencies. Once the signal has been filtered, it is converted back to the analog domain using a DAC, which will then drive a speaker that is placed inside the patient's hearing canal.

\FloatBarrier
\begin{figure}[h!]
	\centering
	\resizebox{\textwidth}{!}{\input{figs/hearing_aid_diagram.tex}}
	\caption{Block diagram of a digital hearing aid device.}
	\label{fig:hearing_aid_diagram}
\end{figure}
\FloatBarrier

\FloatBarrier
\begin{figure}[h!]
	\centering
	\resizebox{0.7\textwidth}{!}{\input{figs/audiogram.tex}}
	\caption{Audiogram of patient.}
	\label{fig:audiogram}
\end{figure}
\FloatBarrier

Figure~\ref{fig:audiogram} shows the \textit{audiogram} of a given patient. This plot shows the patient's hearing loss at particular frequencies. For instance, a hearing loss of 0 dB means that no correction needs to be done at that frequency. However, this patient has a hearing loss of 50 dB at 10 kHz. Hence, the system must provide a gain of nearly 50 dB at 10 kHz. The data from this plot is available in the file \texttt{hearing\_aid.m}.

For the following questions assume that the sampling rate of the ADC is $1/T = 22.05$ kHz, and the same sampling rate is used for reconstruction.
\begin{enumerate}[label=(\alph*)]
	\item (5 points) Plot the desired filter specification $|H_d(e^{j\omega})|$ that would compensate for the patient's hearing loss. The $x$-axis of your plot should be the normalized frequency $\omega$ or $\omega/\pi$, while the $y$-axis should be the magnitude $20\log_{10}(|H_d(e^{j\omega})|)$ in dB.

	\if\SOLUTIONS1
	{\color{\SolutionsColor} The filter specification is simply the inverse of the patient's hearing loss.

		\FloatBarrier
		\begin{figure}[h!]
			\centering
			\includegraphics[scale=0.6]{figs/hearing_aid_spec.eps}
			\caption{Filter specification for correction of the patient's hearing loss.}
		\end{figure}
		\FloatBarrier
	}
	\fi

	\item (5 points) The reconstruction filter of the DAC is a linear interpolator. This filter has a continuous-time frequency response given by
	\begin{equation}
	H_{DAC}(j\Omega) = \mathrm{sinc}^2\Big(\frac{\Omega}{2\pi}T\Big), \quad |\Omega| \leq \frac{\pi}{T}.
	\end{equation}
	As a result, the reconstruction filter will cause some undesired attenuation in the band of interest from 0 to 10 kHz. Adjust the filter specification $|H_d(e^{j\omega})|$ calculated in part (a) so that the filter $H(z)$ would also compensate for the attenuation introduced by the DAC. Plot the adjusted specification. Once again, the $x$-axis of your plot should be normalized frequency $\omega$ or $\omega/\pi$, while the $y$-axis should be the magnitude $20\log_{10}(|H_d(e^{j\omega})|)$ in dB.

	\noindent\textit{Note:} In the DSP literature, pre-compensating for a filter response is called \textit{pre-emphasis}. In this question, you're performing pre-emphasis to compensate for the patient's hearing loss and also for the non-ideal reconstruction filter.

	\if\SOLUTIONS1
	{\color{\SolutionsColor} The corrected filter specification is given by
		\begin{equation*}
		|H_d(e^{j\omega})| = \frac{1}{|A(e^{j\omega})|\mathrm{sinc}^2(\frac{\omega}{2\pi})},
		\end{equation*}
		where $|A(e^{j\omega})|$ is patient's audiogram response. At the highest frequencies, the DAC causes about 8 dB of additional attenuation.

		\FloatBarrier
		\begin{figure}[h!]
			\centering
			\includegraphics[scale=0.6]{figs/hearing_aid_corrected_spec.eps}
			\caption{Corrected filter specification that accounts for the DAC attenuation.}
		\end{figure}
		\FloatBarrier
	}
	\fi

	\item (15 points) Using your specification from part (b), design a generalized \underline{linear-phase} filter $H(z)$ that will approximate $|H_d(e^{j\omega})|$. Select the filter order so that the error between the desired response $H_d(e^{j\omega})$ and your design is \underline{at most} 1 dB at all frequencies. Plot $20\log_{10}(|H_d(e^{j\omega})|/|H(e^{j\omega})|)$ to show that your filter meets this specification. Additionally, plot the magnitude and phase response of your filter.

	\if\SOLUTIONS1
	{\color{\SolutionsColor} Using the least-squares method, the filter that meets the specification to within 1 dB has order $M = 37$. Other answers obtained through the least-squares or Parks-McClellan method are accepted as long as the error is smaller than 1 dB at all frequencies.

		\FloatBarrier
		\begin{figure}[h!]
			\centering
			\includegraphics[scale=0.6]{figs/hearing_aid_filter_error.eps}
			\caption{Magnitude difference between the designed FIR filter and the specification from part (b). The error is smaller than 1 dB at all given frequencies. The filter order is $M = 37$.}
		\end{figure}
		\FloatBarrier

		The frequency and phase response of filter is shown below
		\FloatBarrier
		\begin{figure}
			\centering
			\begin{subfigure}[h!]{0.5\textwidth}
				\includegraphics[scale=0.55]{figs/hearing_aid_filter_mag.eps}
				\caption{Magnitude}
			\end{subfigure}~\begin{subfigure}[h!]{0.5\textwidth}
				\includegraphics[scale=0.55]{figs/hearing_aid_filter_phase.eps}
				\caption{Phase}
			\end{subfigure}
			\caption{(a) magnitude and (b) phase of FIR filter of order $M = 37$ designed by the least-squares algorithm.}
		\end{figure}
		\FloatBarrier
	}
	\fi

	\item (5 points) Assuming that your filter is the only cause of delay in the system, what is the time difference between the time that the sound is recorded by the microphone and the time it is outputted by the speaker. Give your answers in samples and in seconds.

	\if\SOLUTIONS1 {\color{\SolutionsColor} Since the filter is linear phase, it has equal group delay at all frequencies. The group delay is
		\begin{equation*}
		n_g = \frac{M}{2} = 18.5~\text{samples} \implies \tau_g = Tn_g = 0.839~\text{ms}
		\end{equation*}
	}\fi

	\item (10 points) Considering only quantization noise from the ADC, specify the minimum ADC resolution (in bits) so that the quantization noise average power \underline{after} $H(z)$ is at most $-30$ dBm (or 1 $\mu$W). Assume that the dynamic range of the quantizer is $\Delta X = 2$.

	\if\SOLUTIONS1 {\color{\SolutionsColor} Quantization noise has average power given by
		\begin{equation*}
		\sigma_Q^2 = \frac{\Delta^2}{12}, \quad \Delta = \frac{\Delta X}{2^B}
		\end{equation*}

		However, quantization noise is shaped by the filter $H(z)$. The noise average power after filtering is given by
		\begin{equation*}
		\sigma^2_{Q, out} = \sigma_Q^2\sum_{n = 0}^{M}|h[n]|^2 \tag{quantization noise shaping}
		\end{equation*}

		The output noise average power is smaller than $-30$ dBm (or $1 \mu$W) when $B = 18$, as can be verified in the plot below

		\FloatBarrier
		\begin{figure}[h!]
			\centering
			\includegraphics[scale=0.6]{figs/hearing_aid_quant_noise_var.eps}
			\caption{Average power of output quantization noise as a function of the resolution of the quantizer.}
		\end{figure}
		\FloatBarrier

		Slightly different results may be obtained for different filters.
	}\fi

	\item (10 points) Now include round-off noise from the filter implementation and determine the minimum ADC resolution (in bits) so that the \underline{total noise power} after $H(z)$ is at most $-30$ dBm (or 1 $\mu$W). Assume that the filter is implemented using the direct form I, and calculations are performed in two's complement using Q($B-1$) representation, where $B$ is the resolution of the ADC quantizer. Assume further that the result of multiplications is quantized \underline{immediately before} any additions are done. For the roundoff noise calculations assume that $X_m = 1$.

	\noindent\textit{Note:} Recall that in linear-phase implementations not all the coefficients need to be multiplied because of the symmetry in the impulse response.

	\if\SOLUTIONS1 {\color{\SolutionsColor} The number of required multiplications in a linear phase FIR filter is $\lfloor \frac{M}{2} + 1 \rfloor$. Therefore, the round-off noise resulting from rounding off the numbers immediately before additions is given by
		\begin{equation*}
		\sigma_{roundoff}^2 = \Big\lfloor \frac{M}{2} + 1 \Big\rfloor\frac{\Delta^2}{12}, \quad\Delta = \frac{X_m}{2^{B-1}}
		\end{equation*}
		Note that we use $B-1$ because the problem statement instructs us to use the Q($B-1$) representation, where $B$ is the number of bits of the ADC. In the lecture notes of roundoff noise, the quantizer had $B+1$ bits and we used the Q$B$ representation for numbers in the $[-1, 1]$ interval.

		The roundoff noise is not shaped by the filter, hence the total noise average power after the $H(z)$ is given by
		\begin{equation*}
		\sigma^2_{total} = \sigma_Q^2\sum_{n = 0}^{M}|h[n]|^2 + \sigma_{roundoff}^2
		\end{equation*}

		The total noise average power after $H(z)$ is smaller than $-30$ dBm (or $1 \mu$W) when $B = 18$, as can be verified in the plot below

		\FloatBarrier
		\begin{figure}[h!]
			\centering
			\includegraphics[scale=0.6]{figs/hearing_aid_total_noise_var.eps}
			\caption{Total noise average power after $H(z)$ as a function of the resolution of the quantizer.}
		\end{figure}
		\FloatBarrier

		Slightly different results may be obtained for different filters.
	}\fi

	\item (10 points) Now perform simulations to check whether your noise calculations are correct. In your simulations, you should include one white noise source to model quantization noise, and another white noise source to model round-off noise. These noise sources have to be \underline{zero mean} and have the appropriate \underline{average power}. Using any technique you prefer, estimate the PSD of the \underline{total noise} at the output of $H(z)$. On the same graph, plot the theoretical PSD and the estimated PSD. Use your result to estimate the average power of the noise and discuss whether it agrees with your theoretical estimates of part (e).

	\noindent\textit{Note:} Use the function \texttt{rand} to generate a white uniformly distributed noise, and use \texttt{filter} to filter the noise. Make sure that your noise sources are \underline{zero mean} and have the correct \underline{average power}.

	\if\SOLUTIONS1 {\color{\SolutionsColor}
		For the quantization noise, we need to generate an uniformly distributed zero-mean white noise signal with average power $\sigma_Q^2$, as calculated in part (e). For the roundoff noise, we need to generate an uniformly distributed zero-mean white noise signal with average power $\sigma_{roundoff}^2$, as calculated in part (f). The total noise will be given by
		\begin{equation}
		y[n] = h[n]\ast q[n] + r[n],
		\end{equation}
		where $q[n]$ is the quantization noise and $r[n]$ is the roundoff noise. Once we obtain the output noise $y[n]$ we can use Welch's method or the Blackman-Tukey method to estimate the PSD. These solutions assume the Blackman-Tukey method with Bartlett window of length $L = 2047$. See code for more details. The estimated PSD is plotted below

		\FloatBarrier
		\begin{figure}[h!]
			\centering
			\includegraphics[scale=0.6]{figs/hearing_aid_psd.eps}
			\caption{Theoretical and estimated PSD. The PSD was estimated using the Blackman-Tukey method.}
		\end{figure}
		\FloatBarrier

		Note the error of the estimated PSD at small frequencies. To improve the accuracy we would need more samples. However, this error is not important, since the estimated power is nearly identical to the theoretical power. The estimated power is $-35.4977$. Hence, this design meets the specifications.
	}\fi

\end{enumerate}

\if\SOLUTIONS1
\subsection*{Code for Problem 1}
\input{tex/hearing_aid_sols.tex}
\fi

\newpage

\section*{Problem 2: Nonlinear plant identification (60 points)}

As discussed in class, we can use adaptive filters to model unknown plants. In many practical applications, however, the plant may exhibit some nonlinear characteristic that cannot be accurately modeled by linear filtering alone. In this question, you'll design and compare linear and nonlinear adaptive filters to model a given nonlinear plant.

The typical block diagram of plant identification problems is shown in Figure~\ref{fig:block-diagram}. An input signal $r[n]$ is presented to the plant and to the adaptive filter. The output of the plant $d[n]$ is the desired response that we use to compute the error $e[n]$. As usual, the output of the adaptive filter $y[n]$ is expressed as the inner product of an input vector $X_n$ and the weight vector $W$. In a linear adaptive filter, the input vector depends only on linear or affine terms of the input $r[n]$, whereas in a nonlinear adaptive filter, the input vector also contains some nonlinear terms of the input $r[n]$.

\begin{figure}[h!]
	\flushleft
	\resizebox{\linewidth}{!}{\input{figs/block-diagram.tex}}
	\caption{Block diagram for nonlinear plant identification problems. } \label{fig:block-diagram}
\end{figure}

Throughout this question, we'll assume that the nonlinear plant has the structure shown in Figure 1. It has an input linear filter $H_1(z)$ followed by some nonlinear operation $g(\cdot)$, followed by another linear filter $H_2(z)$. We'll also assume that
\begin{equation}
H_1(z) = H_2(z) = -0.0078 + 0.0645z^{-1} +  0.4433z^{-2} + 0.4433z^{-3}+ 0.0645z^{-4} -0.0078z^{-5}
\end{equation}
\begin{equation}
g(u) = \exp(u/2) - 1.
\end{equation}

The nonlinear plant is provided to you in the Matlab function \texttt{nonlinear\_plant.m}. To calculate the plant output to an input signal \texttt{r}, you can simply call \texttt{d = nonlinear\_plant(r)}.

We'll consider two types of adaptive filters. In the first part of this question, the adaptive filter consists of a finite impulse response (FIR) filter $F(z) = w_1 + w_2z^{-1}+\ldots+w_{L+1}z^{-L}$, and a bias weight $w_0$. Thus, we have a \underline{total of $L+2$ weights}. A FIR filter is the typical transversal filter you have encountered many times throughout the course. The bias weight is simply a weight whose input is always $+1$. The bias weight is necessary because the plant nonlinearity $g(u)$ is not symmetric about $u = 0$. Therefore, the plant output may have non-zero mean even when the plant input signal is zero mean. Hence, the sole purpose of $w_0$ is to track the mean of the desired response $\E(d[n])$.

In the second part of this question, the adaptive filter consists of a nonlinear filter based on the truncated discrete-time Volterra series\footnote{\normalsize You can think of Volterra series as a Taylor series with memory. In other words, the output depends not only on the input at present time $x[n]$, but it also depends on the input at past times $x[n-1], \ldots, x[n-L]$. The series used here is causal and it is truncated in time by $L$ past samples, and it is truncated on the number of cross products of the input $p = 1, 2$. Interestingly, it can be shown that Volterra series can model any dynamic nonlinear system with arbitrarily small error, provided that $L$ and $p$ are large enough.} shown below:
\begin{align} \nonumber \label{eq:volterra}
y[n] &= w_0 + \sum_{p = 1}^{2}\sum_{l_1 = 0}^L\sum_{l_2 = l_1}^L w_{p}(l_1, l_2)\prod_{j = p}^2x[n-l_j] \\
& = w_0 + \sum_{l = 0}^Lw_2(l)x[n-l] + \sum_{l = 0}^Lw_1(l)x^2[n-l] + \sum_{l_1 = 0}^{L-1}\sum_{l_2 = l_1+1}^L w_{1}(l_1, l_2)x(n-l_1)x(n-l_2),
\end{align}
where $x[n]$ is the input signal and $y[n]$ is the output signal.  $w_p(l_1, l_2)$ is commonly referred to as discrete-time Volterra kernel, but for our purposes, it will be weights of the adaptive filter. Note that we have abbreviated the notation by writing $w_1(l)$ and $w_2(l)$. Formally, $w_1(l) = w_1(l, l)$ and $w_2(l) = \sum_{m = 0}^{l}w_2(m, l)$. Following this convention, $w_0, w_2(l), w_1(l)$, and $w_1(l_1, l_2)$ with $l_1\neq l_2$ are the weights of the adaptive nonlinear filter.

As an example, Figure~\ref{fig:volterra-diagram} shows the block diagram of a nonlinear filter based on Volterra series for $L = 2$. Inspecting \eqref{eq:volterra} and Figure~\ref{fig:volterra-diagram}, we see that, as before, we have a bias weight $w_0$, and we have the weights $w_2(l), l = 0, \ldots, L$, which weigh the input $x[n], \ldots, x[n-L]$. But now we also have the weights $w_1(l), l = 0, \ldots, L$, which weigh the input squared $x^2[n],\ldots,x^2[n-L]$, and the weights $w_1(l_1, l_2), l_1\neq l_2$, which weigh the cross-products of the input at different times $x[n]x[n-1],\ldots,x[n-L+1]x[n-L]$. Thus, we have a total of $1 + (L+1) + (L+1) + \binom{L+1}{2}$ weights.

\FloatBarrier
\begin{figure}[h!]
	\centering
	\resizebox{0.9\linewidth}{!}{\input{figs/volterra-filter-diagram.tex}}
	\caption{Block diagram of a nonlinear filter based on truncated Volterra series for $L = 2$.} \label{fig:volterra-diagram}
\end{figure}
\FloatBarrier

This is a nonlinear filter because its output depends on nonlinear terms of the input. Nevertheless, the output is a linear function of the weights and consequently the performance surface is a hyper-paraboloid whose gradient is a linear function of the weights. Therefore, we can still use the LMS algorithm to calculate the weights of the Volterra series. In fact, the LMS algorithm will find the weights that best fit the data ($x[n], y[n]$) in the least squares sense.

Based on the given information, please answer the following questions. You may use the Matlab files \texttt{part1\_template.m} and \texttt{part2\_template.m} as templates to develop your answers. These files also contain some Matlab hints that you may find useful while developing the two types of adaptive filters. Please include your code in your solutions file.

\subsection*{Part I. Linear adaptive filter}
Let's start by modeling the nonlinear plant using a linear adaptive filter that consists of a FIR filter with the addition of a bias weight. With the LMS algorithm, train the adaptive filter using a white and uniformly distributed signal $r[n]$ with zero mean and variance $\sigma_r^2 = 4$. Assume that $L = 9$, so that the adaptive filter has a total of $L+2 = 11$ weights, including the bias weight. Let the number of training iterations be 2000. Assume the adaptation constant $\mu = 0.01\mu_{max}$, where $\mu_{max} = 1/\mathrm{tr}(R)$.

\begin{enumerate}[label=(\alph*)]
	\item (5 points) What is the value of $\mu$? Remember to include the bias weight input when calculating $\mathrm{trace}(R)$.

	\if\SOLUTIONS1 {\color{\SolutionsColor}
		Since the input signal $r[n]$ is white, the $R$ matrix only has non-zero entries in its main diagonal:

		\begin{equation}
		R = \mathrm{diag}([1, \sigma^2_r, \ldots, \sigma^2_r]) \implies \mathrm{tr}(R) = (L+1)\sigma^2_r + 1,
		\end{equation}
		where the first entry is 1 because the bias weight input is always $+1$. Therefore,
		\begin{equation}
		\mu = 0.01\frac{1}{\mathrm{tr}(R)} = \frac{0.01}{(L+1)\sigma^2_r + 1} = 2.439\times 10^{-4}.
		\end{equation}
	}
	\fi

	\item (15 points) Plot the experimental learning curve averaged over 100 independent runs. On a separate graph, plot the converged weight vector you obtained at the last iteration of the last run.

	Note: for each independent run, generate a new $r[n]$ but initialize the weights to the same value.

	\if\SOLUTIONS1 {\color{\SolutionsColor}

		The Matlab code to calculate the learning curve is included below. Figure~\ref{fig:part1-learning-curve} shows the learning curve averaged over 100 independent input realizations, and  Figure~\ref{fig:part1-weights} shows the converged weight vector. Note that the bias weight value is very significant.

		\FloatBarrier
		\begin{figure}[h!]
			\centering
			\includegraphics[scale=0.8]{figs/part1_learning_curve.eps}
			\caption{Experimental learning curve for nonlinear plant indemnification using a linear filter. The learning curve was averaged 100 times.}
			\label{fig:part1-learning-curve}
		\end{figure}
		\FloatBarrier

		\FloatBarrier
		\begin{figure}[h!]
			\centering
			\includegraphics[scale=0.8]{figs/part1_weights.eps}
			\caption{Weight vector after convergence.}
			\label{fig:part1-weights}
		\end{figure}
		\FloatBarrier
	}
	\fi

	\item (5 points) Use the last 200 samples of the averaged learning curve to estimate the minimum mean square error (MMSE) and report its value.

	\if\SOLUTIONS1 {\color{\SolutionsColor}
		As shown in Figure~\ref{fig:part1-learning-curve}, the MMSE estimated using the last 200 samples was equal to $\approx 0.051$.
	}
	\fi

	\item (5 points) Apply the test signal $x_{test}[n] = 2\cos\big(\frac{\pi}{10} n\big), n = 0, 1,\ldots, 50$ to the plant and to the converged adaptive filter and plot their outputs on the same graph. Explain any discrepancies. As in part (b), you should use the weights obtained at the last iteration of the last run. Note that you trained the adaptive filter with a random signal, and now you're testing it with a deterministic sinusoidal signal.

	Note: During testing you should treat the adaptive filter as a fixed filter whose coefficients are the coefficients you plotted in part (b).

	\if\SOLUTIONS1 {\color{\SolutionsColor}
		The Matlab code is the same as for part (b) and it is shown below. The output of the plant is compared to the output of the adaptive filter in Figure~\ref{fig:part1-test}.

		\FloatBarrier
		\begin{figure}[h!]
			\centering
			\includegraphics[scale=0.8]{figs/part1_test.eps}
			\caption{Test of the adaptive filter after convergence with a sinusoidal signal. During the first $L+1$ samples, the filter was being initialized.}
			\label{fig:part1-test}
		\end{figure}
		\FloatBarrier
	}
	\fi

	\if\SOLUTIONS1
	\textbf{Matlab code for part 1}
	\input{tex/part1.tex}
	\fi

\end{enumerate}

\subsection*{Part II. Nonlinear adaptive filter}

Now let's model the plant using the nonlinear adaptive filter based on the truncated Volterra series. Similarly to part I, assume that $L = 9$, but now we have a total of $2(L+1) + \binom{L+1}{2} + 1 = 66$ weights.

\begin{enumerate}[label=(\alph*)]
	\item (10 points) Describe how we can use the LMS algorithm to adapt the weights. Specifically, what should be the input vector $X_n$ and the weight vector $W$ in the LMS weight update equation? Your answers should be in terms of the input signal $r[n], \ldots, r_[n-L]$, and the weights $w_0, w_1(l), w_2(l), l = 0, \ldots, L$, and $w_1(l_1, l_2), l_1\neq l_2$.

	\if\SOLUTIONS1 {\color{\SolutionsColor}
		The input vector $X_n$ and the weight vector $W$ must be such that their inner product $X_n^TW$ is equivalent to \eqref{eq:volterra}. By inspection,

		\begin{equation}
		X_n = \begin{bmatrix}
		1 \\
		r[n] \\
		r[n-1] \\
		\vdots \\
		r[n-L] \\
		r[n]^2 \\
		r[n-1]^2 \\
		\vdots \\
		r[n-L]^2 \\
		r[n]r[n-1] \\
		r[n]r[n-2] \\
		\vdots \\
		r[n-L+1]r[n-L]
		\end{bmatrix} \qquad W = \begin{bmatrix}
		w_0 \\
		w_2(0) \\
		w_2(1) \\
		\vdots \\
		w_2(L) \\
		w_1(0) \\
		w_1(1) \\
		\vdots \\
		w_1(L) \\
		w_1(0, 1) \\
		w_1(0, 2) \\
		\vdots \\
		w_1(L-1, L)
		\end{bmatrix}.
		\end{equation}

		This way the output of the linear combiner $X_n^TW$ is equal to \eqref{eq:volterra}. And we can use the LMS update equations as usual
		\begin{align}
		W \leftarrow W + 2\mu e[n]X_n \\
		\epsilon[n] = d[n] - X_n^TW
		\end{align}
	}
	\fi

	\item (10 points) Implement your method from part (a) and train the adaptive filter using a white and uniformly distributed input signal $r[n]$ with zero mean and variance $\sigma_r^2 = 4$. Assume $\mu = 4\times 10^{-4}$ and adapt over 2000 iterations. Plot the learning curve averaged over 100 independent input realizations. On a separate graph, plot the converged weight vector obtained at the last iteration of the last  run.

	\if\SOLUTIONS1 {\color{\SolutionsColor}
		The Matlab code to calculate the learning curve is included below. Figure~\ref{fig:part2-learning-curve} shows the learning curve averaged over 100 independent input realizations, and  Figure~\ref{fig:part2-weights} shows the converged weight vector.

		Note that the learning curve converged to a much smaller MMSE. Note further that the bias weight is practically negligible now, and some of the weights corresponding to the squared inputs and to the cross-products are significant.

		\FloatBarrier
		\begin{figure}[h!]
			\centering
			\includegraphics[scale=0.8]{figs/part2_learning_curve.eps}
			\caption{Experimental learning curve for nonlinear plant identification using a nonlinear filter based on Volterra series. The learning curve was averaged 100 times. The training signal had variance $\sigma_r^2 = 4$.}
			\label{fig:part2-learning-curve}
		\end{figure}
		\FloatBarrier

		\FloatBarrier
		\begin{figure}[h!]
			\centering
			\includegraphics[scale=0.8]{figs/part2_weights.eps}
			\caption{Weight vector after convergence.}
			\label{fig:part2-weights}
		\end{figure}
		\FloatBarrier
	}
	\fi

	\item (5 points) Use the last 200 samples of the averaged learning curve to estimate the MMSE. Compare this result to what you obtained in Part I(c).

	\if\SOLUTIONS1 {\color{\SolutionsColor}
		As shown in Figure~\ref{fig:part2-learning-curve}, the MMSE estimated using the last 200 samples was equal to $\approx 0.0046$.
	}
	\fi

	\item (5 points) Apply the test signal $x_{test}[n] = 2\cos\big(\frac{\pi}{10} n\big), n = 0, 1,\ldots, 50$ to the plant and to the converged adaptive filter and plot their outputs on the same graph. As before, use the weights obtained at the last iteration of the last run. Was there any improvement compared to Part 1(e)?

	\if\SOLUTIONS1 {\color{\SolutionsColor}
	The Matlab code is included in the appendix. The output of the plant is compared to the output of the adaptive filter in Figure~\ref{fig:part2-test}.

	The adaptive filter was trained with random signal, but it can almost perfectly track the plant output to a sinusoidal input. The same cannot be accomplished when the adaptive filter is linear as in part 1.E.

		\FloatBarrier
		\begin{figure}[h!]
			\centering
			\includegraphics[scale=0.8]{figs/part2_test.eps}
			\caption{Test of the adaptive filter after convergence with a sinusoidal signal. During the first $L+1$ samples, the filter was being initialized.}
			\label{fig:part2-test}
		\end{figure}
		\FloatBarrier
	}
	\fi

\end{enumerate}

\if\SOLUTIONS1
\textbf{Matlab code for part 2}
\input{tex/part2.tex}
\fi

\end{document}


\documentclass[margin,line]{res}
\usepackage{multicol}
\usepackage[bottom=.65in,top=.65in]{geometry}
\usepackage{amsmath}
\usepackage{url}
\usepackage{enumitem}
\usepackage{etaremune}

\oddsidemargin -.5in
\evensidemargin -.5in
\textwidth=6.0in
\itemsep=0in
\parsep=0in

\newenvironment{list1}{
  \begin{list}{\ding{113}}{%
      \setlength{\itemsep}{0in}
      \setlength{\parsep}{0in} \setlength{\parskip}{0in}
      \setlength{\topsep}{0in} \setlength{\partopsep}{0in}
      \setlength{\leftmargin}{0.17in}}}{\end{list}}
\newenvironment{list2}{
  \begin{list}{$\bullet$}{%
      \setlength{\itemsep}{0in}
      \setlength{\parsep}{0in} \setlength{\parskip}{0in}
      \setlength{\topsep}{0in} \setlength{\partopsep}{0in}
      \setlength{\leftmargin}{0.2in}}}{\end{list}}

\begin{document}

\name{Samantha C. Tyner, PhD \vspace*{.1in}}

\begin{resume}
\section{\sc Contact}
\vspace{.05in}
{{\it Phone:}  630.346.3539 $\quad$ {\it E-mail:} sctyner90@gmail.com $\quad$ {\it Website:} \urlstyle{same}\url{sctyner.github.io} }
%\begin{tabular}{@{}p{2in}p{4in}}
%207 Todd Circle  & {\it Phone:}  630.346.3539 \\
%Ames, Iowa USA 50011  &  {\it E-mail:} sctyner@iastate.edu\\
%& {\it Website:} \urlstyle{same} \url{sctyner.github.io}
%\end{tabular}

\section{\sc Education}
{\bf Iowa State University}, Ames, Iowa, USA\\
\vspace*{-.1in}
\begin{list1}
\item[] {\bf Postdocoral Research Associate, CSAFE} \hfill {\bf December 2017 - Present}
\item[] $\quad$ Principal Investigator: Alicia Carriquiry
\item[] {\bf Ph.D., Statistics}  \hfill {\bf December 2017}
\item[] $\quad$ Advisor: Heike Hofmann
\item[] $\quad$ Dissertation: \textit{Graphical discovery in stochastic actor-oriented models \\  \phantom{AAAAAAAA} for social network analysis}
\item[] {\bf M.S., Statistics}  \hfill {\bf May 2015}
% \item[]Cumulative GPA: 3.63/4.00
\end{list1}
\vspace{-.1in}

{\bf Augustana College}, Rock Island, Illinois, USA\\
%{\em Department of Mathematics}
\vspace*{-.1in}
\begin{list1}
\item[] {\bf B.A. Mathematics, Economics, and French}, \textit{summa cum laude} \hfill {\bf May 2012}
%\item[]Cumulative GPA: 3.93/4.00
\end{list1}

%\vspace*{-2.5mm}
%NSF Vertical Integration of Research and Education in Statistics and
%Mathematical Sciences\\ (VIGRE) teaching fellowship.
%
%\vspace*{-2.5mm}
%Carleton College: graduated Magna Cum Laude, Honors in Biology, Phi Beta Kappa, 1993

\section{\sc Computing \\ Skills}

\textbf{Expertise:} R/RStudio, Shiny, Markdown,  Git/Github, HTML/CSS,  \LaTeX \\
\textbf{Familiarity:} Python, Julia, C/C++, SAS, JAGS/WinBugs, Maple, Mathematica

\vspace{-.2cm}

\section{\sc Professional \\ Experience}
{\em Center for Statistics \& Applications in Forensic Evidence (CSAFE)}, \\
{\em Iowa State University}, Ames, Iowa USA

\vspace{-.3cm}

{\bf Postdoctoral Research Associate } \hfill {\bf December 2017 - Present}\\
\vspace{-.3cm}
\begin{itemize}
\setlength\itemsep{0em}
\item Author educational materials for legal professionals on the use of statistics in forensic science
\item Conduct research relating to human factors, statistical computing in forensic science
\item Mentor graduate students on their research projects
\item Coordinate the summer research experience for undergraduates (REU) from partner schools
\end{itemize}
\vspace{-.3cm}

{\bf Research Assistant} \hfill {\bf August 2015 - December 2017}\\
\vspace{-.3cm}
\begin{itemize}
\setlength\itemsep{0em}
\item Author educational materials for legal professionals on the use of statistics in forensic science
\item Conduct research relating to human factors, statistical computing in forensic science
\end{itemize}

\vspace{-.3cm}

{\bf REU Graduate Student Advisor} \hfill {\bf May 2017 - August 2017}\\
\vspace{-.3cm}
\begin{itemize}
\setlength\itemsep{0em}
\item Instructed a group of ten students on R coding, statistics, and Github project management
\item Supervised research projects on automated shoeprint matching and steganalysis
\end{itemize}

{\em Social and Decision Analytics Laboratory, Biocomplexity Institute, \\ Virginia Polytechnic Institute and State University}, Arlington, VA, USA

\vspace{-.3cm}

{\bf Graduate Student Fellow} \hfill {\bf May 2016 - August 2016}\\
\vspace{-.3cm}
\begin{itemize}
\setlength\itemsep{0em}
\item Participated in the interdisciplinary Data Science for Public Good summer program
\item Led groups of undergraduate researchers on data-driven policy projects
\item Analyzed and combined data from a variety of administrative, census, and GIS sources
\item Consulted with county staff on projects to improve government services in Arlington, VA.
\end{itemize}

{\em NORC at the University of Chicago}, Chicago, IL, USA

\vspace{-.3cm}

{\bf Graduate Research Assistant} \hfill {\bf August 2015 - April 2016}\\
\vspace{-.3cm}
\begin{itemize}
\setlength\itemsep{0em}
\item Developed a dynamic reporting system to adapt to changes in Illinois' healthcare marketplace
\item Continued my summer internship work part time as a consultant.
\end{itemize}

{\bf Data Visualization Intern} \hfill {\bf May 2015 - August 2015}\\
\vspace{-.3cm}
\begin{itemize}
\setlength\itemsep{0em}
\item Created data visualizations for a variety of projects in the Statistics \& Methodology group
\item Designed a multi-use dashboard of education data in Washington state
\item Developed a web app with public health, GIS data to uncover potential epidemic regions
\item Led four hour-long internal seminars on the theory and best practices of data visualization.
\end{itemize}

\vspace{-.3cm}

{\em Department of Statistics, Iowa State University}, Ames, Iowa USA

\vspace{-.3cm}

{\bf Teaching Assistant} \hfill {\bf August 2014 - May 2015}\\
\vspace{-.3cm}
\begin{itemize}
\setlength\itemsep{0em}
\item Instructor for STAT 104: Introduction to Statistics
\item Taught weekly lectures and labs
\item Wrote and graded exams.
\end{itemize}

%{\em Graduate Student} \hfill {\bf August 2012 - Present}\\
%Masters and PhD level coursework.

{\em Kingland Systems Corporation}, Ames, Iowa USA

\vspace{-.3cm}

{\bf Statistical Analyst Intern} \hfill {\bf May 2014 - August 2014}\\
\vspace{-.3cm}
\begin{itemize}
\setlength\itemsep{0em}
\item Served as a member of the Process Management team
\item Performed data analysis on project and product data to refine internal processes and tools
\item Built predictive models used in planning and estimating time to complete sofware development
\item Produced graphs and reports to support internal visibility of projects, products, and portfolios.
\end{itemize}

\vspace{-.1cm}

{\em Institute for Transportation, Iowa State University}, Ames, Iowa USA

\vspace{-.3cm}

{\bf Research Assistant} \hfill {\bf August 2013 - August 2014}\\
\vspace{-.3cm}
\begin{itemize}
\setlength\itemsep{0em}
\item Modeled curve navigation on rural highways using large USDOT data sets.
\end{itemize}

\vspace{-.1cm}

{\em Department of Statistics, Iowa State University}, Ames, Iowa USA

\vspace{-.3cm}

{\bf Teaching Assistant} \hfill {\bf August 2012 - July 2013}\\
\vspace{-.3cm}
\begin{itemize}
\setlength\itemsep{0em}
\item Graded weekly homework assignments for STAT 104: Introduction to Statistics
\item Supervised lab sections twice weekly.
\end{itemize}

%\vspace{-.1cm}
%
%{\em Valparaiso Experience in Research by Undergraduate Mathematicians (VERUM) \\ Valparaiso University}, Valparaiso, Indiana USA \hfill {\bf May 2011 - July 2011}\\
%\vspace{-.3cm}
%\begin{itemize}
%\setlength\itemsep{0em}
%\item Participated in the VERUM summer program.
%\item Worked with Dr. Lara Pudwell on pattern avoidance in full binary tree graphs.
%\end{itemize}

%\clearpage

%{\bf NORC at the University of Chicago}, Chicago, IL, USA

%\vspace{-.3cm}

\section{\sc Publications}

\begin{etaremune}[start=5, itemindent = -1.25em]

\item \textbf{Tyner, S.}, Briatte, F.,  and Hofmann, H. ``Network Visualization with ggplot2". {\em The R Journal}, 9(1):27-59, June 2017.

\item \textbf{Tyner, S.} ``Using the R Package geomnet: Visualizing Trans-Atlantic Slave Trade of Africans, 1514-1866." \textit{CHANCE}.  Sep 2016. 29(3)

\item \textbf{Tyner, S.}, "The Joy of Clustering." \textit{Significance Magazine Online}. 11 Nov 2015 \urlstyle{same}\url{http://www.statslife.org.uk/culture/2553-the-joy-of-clustering}

\item Hallmark,S., \textbf{Tyner, S.},  Oneyear, N., Carney, C., and McGehee, D. ``Evaluation of driving behavior on rural 2-lane curves using the SHRP 2 naturalistic driving study data." \textit{Journal of Safety Research}, 54 (2015), p17-27.

\item Dairyko, M., Pudwell, L., \textbf{Tyner, S.}, and Wynn, C.  ``Non-Contiguous Pattern Avoidance in Binary Trees" \textit{Electronic Journal of Combinatorics} 19 (3) (2012), P22.

\end{etaremune}

\section{\sc Workshops Taught}

{\bf The Life-Changing Magic of Tidying Data}, Ames, Iowa, USA \hfill {\bf December 8, 2017}\\
Workshop on the principles and process of cleaning and tidying messy data sets with the R packages dplyr, tidyr, and others. Presented at Iowa State University, invited by the R-Ladies Ames group.

{\bf The Week of R}, Ames, Iowa, USA

\vspace{-.4cm}

{\em with Joe Papio, Haley Jeppson, and Heike Hofmann} \hfill {\bf June 12-15, 2017}\\
Intensive workshop on the basics of R, as well as data cleaning, webscraping, data visualization, and Shiny in R and RStudio. Presented at Iowa State University.

{\bf Webscraping with tidyverse Packages}, Ames, Iowa, USA \hfill {\bf February 9, 2017}\\
Workshop on the process of scraping data from the web using the R packages rvest, xml, and others. Presented at Iowa State University, invited by the R-Ladies Ames group.

{\bf Empowering Women with Self-defense Skills using R}, Charlotte, NC, USA

\vspace{-.4cm}

{\em with Heike Hofmann} \hfill {\bf October 22, 2016}\\
Workshop on data cleaning, webscraping, and data visualization in R. Presented at the 2016 Women in Statistics and Data Science conference.

\vspace{-.2cm}

\clearpage
{\bf The Week of R}, Ames, Iowa, USA

\vspace{-.4cm}

{\em with Eric Hare, Andee Kaplan, and Heike Hofmann} \hfill {\bf May 16-19, 2016}\\
Intensive workshop on the basics of R, as well as data cleaning, webscraping, data visualization, and Shiny in R and RStudio. Presented at Iowa State University.

%\section{\sc Conference Presentations}
%
%{\bf Joint Statistical Meetings}, Chicago, Illinois, USA
%
%\vspace{-.3cm}
%{\em Topic-Contributed Session} \hfill {\bf August 2016}\\
%``Visual Inference for Networks" with Hofmann, H..
%
%
%{\bf Annual Conference of the Royal Statistical Society}, Exeter, Devon, UK
%
%\vspace{-.3cm}
%{\em Invited Talk - Young Statisticians Section} \hfill {\bf September 2015}\\
%``The Joy of Clustering (with Bob Ross)"
%
%
%{\bf Joint Statistical Meetings}, Seattle, Washington, USA
%
%\vspace{-.3cm}
%{\em Contributed Session} \hfill {\bf August 2015}\\
%``Network Visualization in \texttt{ggplot2}: \texttt{geom\_net}" with Hofmann, H..
%
%{\bf Women in Statistics}, Cary, North Carolina, USA
%
%\vspace{-.3cm}
%{\em Poster Session} \hfill {\bf May 2014}\\
%``Using Change Point Models to Assess Drivers' Navigation of Rural Curves" with Hallmark, S.
%
%{\bf Joint Statistical Meetings}, Montr\'{e}al, Qu\'{e}bec, CAN
%
%\vspace{-.3cm}
%{\em Data Expo Poster Session} \hfill {\bf August 2013}\\
%``An Illustration of the Soul of the Community" with Grant, M.
%
%{\bf Joint Mathematics Meetings}, Boston, Massachusetts, USA
%
%\vspace{-.3cm}
%{\em Undergraduate Poster Session} \hfill {\bf January 2012}\\
%``Non-Contiguous Pattern Avoidance in Binary Trees" with Dairyko, M. and Wynn, C.
%
%{\bf Illinois Section of Mathematical Association of America}, Naperville, Illinois, USA
%
%\vspace{-.3cm}
%{\em Undergraduate Presentation Session} \hfill {\bf March 2011}\\
%``Logarithmic Regression and the Phillips Curve"
%

%\section{\sc Computer \\Skills}
%\textbf{Mathematical Computing}:  R, RStudio, SAS, Python, Julia, Mathematica, Maple, WinBugs \\
%\textbf{Other}: \LaTeX, \texttt{knitr}, Markdown, Microsoft Office

\section{\sc Leadership / Service}

{\em Iowa State University}, Ames, Iowa USA

\vspace{-.3cm}

{\bf Co-founder and co-organizer, R-Ladies Ames} \hfill {\bf December 2016 - Present}\\
Founded the Ames chapter of the global organization R-Ladies, which promotes gender parity among R users, R package authors, and members of the R foundation and board of directors.

\vspace{-.3cm}

{\bf Departmental Committees} \hfill {\bf August 2014 - May 2017}\\
Served alongside faculty and staff as the student member of departmental committees: the Social Committee (2014-15) and the Honors and Awards Committee (2015-16, 2016-17).

\vspace{-.3cm}

{\bf The Iowa STAT-ers Club} \hfill {\bf August 2012 - May 2016}\\
Led this Statistics Department graduate student organization in multiple executive positions: Secretary (2013-14), Social Chair (2014-15), and President (2015-16).

\section{\sc Honors \& \\Awards}
\begin{description}[itemindent = -2.75em]
\setlength\itemsep{-1em}
\item \textit{Winner, rOpenSci 2018 Fellowship} for proposal ``Open Forensic Science in R" \urlstyle{same}\url{ropensci.org}\\
\item \textit{Winner, Statistical Computing and Statistical Graphics Sections of the ASA 2016 Student Paper Competition} for ``Using the geomnet Package: Visualizing African Slave Trade, 1514 -
1866"\\
\item \textit{Runner up, 2015 Young Statisticians Writing Competition, by the Young Statisticians Section of the Royal Statistical Society} for ``The Joy of Clustering (with Bob Ross)"\\
\item \textit{Alumni Fellowship}, Dept. of Statistics, Iowa State University, Awarded Fall 2012\\
\item \textit{Phi Beta Kappa}, Inducted May 2012\\
\item \textit{Pi Mu Epsilon}, Inducted May 2011\\
\item \textit{Omicron Delta Kappa}, Inducted December 2011\\
\item \textit{Augustana College Dean's List}, all terms Fall 2008 - Spring 2012\\
\end{description}

\vspace{-.3cm}

\end{resume}
\end{document}


\chapter{Results With Data}
\label{observedresults}
\label{results}

The chapter presents the single top quark production cross section measured in nearly 1 fb$^{-1}$ of Tevatron RunII data. The cross section and the observed resolution is presented in Section~\ref{measured}. To measure the expected and observed significance psuedo-datasets with no signal contribution are created and the fraction of datasets with a measured cross section above the observed cross section is calculated. This value is the probability of a background-only fluctuation and can be converted to a Gaussian equivalent signal significance. This result is presented in Section~\ref{significance}.

%---------------------------------------------------------------------
\section{Measured Cross Section}
\label{measured}

Figure~\ref{meas-post-1d} shows the observed $tb$+$tqb$ posterior
without and with systematic uncertainties for all channels combined.

\begin{figure}[!h!tbp]
\includegraphics[width=0.49\textwidth]{eps/MatrixElement/posterior/nosys/limit_TBTQ_LeptonsCombined_JetsCombined_TagsCombined.eps}
\includegraphics[width=0.49\textwidth]{eps/MatrixElement/posterior/sys/limit_TBTQ_LeptonsCombined_JetsCombined_TagsCombined.eps}
\vspace{-0.1in}
\caption{Measured 1D posterior plots for the combined
$e$+$\mu$ $\geq$~1 $B$-tag channel with statistical uncertainties only
(left plot) and with systematic uncertainties as well (right plot).}
\label{meas-post-1d}
\end{figure}

Table~\ref{tab:measxsecs} shows the measured cross sections from various combinations of analysis channels.  The averaged relative uncertainties on the measured cross sections are shown in Table~\ref{meas-errors}.

\begin{table}[!h!tbp]
\begin{center}
\caption{Measured $tb$+$tqb$ cross sections, without and
with systematic uncertainties, for many combinations of the analysis
channels. The final result of this analysis is shown in the lower
right hand corner in bold type.}
\label{tab:measxsecs}
\begin{tabular}{l|cc|cc|cc|c}
%  \multicolumn{8}{c}{\hspace{0.5in}\underline{Measured $tb$+$tqb$ Cross Section}}\vspace{0.1in}\\
& \multicolumn{2}{c|}{1,2tags + 2,3jets}& \multicolumn{2}{c|}{$e$,$\mu$ + 2,3jets}
& \multicolumn{2}{c|}{$e$,$\mu$ + 1,2tags}& All \\
                 &  $e$-chan & $\mu$-chan& 1 tag & 2 tags& 2 jets& 3 jets&channels\\
\hline
Statistics only  &  $3.0^{+1.5}_{-1.4}$  & $4.5^{+1.8}_{-1.7}$ & $2.8^{+1.2}_{-1.2}$ & $7.9^{+3.3}_{-3.0}$ & $3.5^{+1.4}_{-1.3}$ & $3.9^{+2.3}_{-2.2}$ & $3.6^{+1.2}_{-1.1}$     \\
With systematics &  $3.1^{+2.2}_{-1.8}$  & $7.4^{+3.0}_{-2.5}$ & $4.5^{+2.0}_{-1.7}$ & $6.8^{+4.7}_{-3.8}$ & $4.7^{+2.0}_{-1.7}$ & $4.9^{+3.7}_{-3.1}$ & $\mathbf{4.6^{+1.8}_{-1.5}}$     \\
\end{tabular}
\vspace{-0.1in}
\end{center}
\end{table}

\begin{table}[!h!tbp]
\begin{center}
\caption{Relative uncertainties on the measured
$tb$+$tqb$ cross section, without and with systematic uncertainties,
for many combinations of the analysis channels. The best value from
all channels combined, with systematics, is shown in bold type.}
\label{meas-errors}
\begin{tabular}{l|cc|cc|cc|c}
%  \multicolumn{8}{c}{\hspace{0.5in}\underline{Relative Uncertainties on the Measured $tb$+$tqb$ Cross Section}}\vspace{0.1in}\\
& \multicolumn{2}{c|}{1,2tags + 2,3jets}& \multicolumn{2}{c|}{$e$,$\mu$ + 2,3jets}
& \multicolumn{2}{c|}{$e$,$\mu$ + 1,2tags}& All \\
                 &  $e$-chan & $\mu$-chan& 1 tag & 2 tags& 2 jets& 3 jets&channels\\
\hline
Statistics only  &  $50\%$  & $39\%$ & $44\%$ & $40\%$ &  $37\%$  & $57\%$ & $32\%$     \\
With systematics &  $64\%$  & $38\%$ & $41\%$ & $62\%$ &  $39\%$  & $70\%$ & $\mathbf{35\%}$     \\
\end{tabular}
\vspace{-0.1in}
\end{center}
\end{table}

The combined result with full systematics is
$$
\sigma\left({\ppbar}{\rargap}tb+tqb+X\right)
= 4.6 ^{+1.8}_{-1.5}~{\rm pb}.
$$

\noindent A breakdown of the uncertainties on the $tb$+$tqb$ cross section measurement is given in Table~\ref{tab:syst}. The systematic uncertainties were calculated using an ensemble containing 200 datasets generated with an input single top cross section of 4.6~pb. The cross section of each dataset was measured and the average posterior width (average of upper and lower 1$\sigma$ uncertainties) was calculated over all datasets for each source of systematic uncertainty independently. The systematic uncertainty for each source was estimated by subtracting in quadrature from the average posterior width obtained with a particular source of systematic, the average posterior width without systematic uncertainties. The total expected systematic uncertainty is estimated by adding in quadrature all the individual expected systematic uncertainties.  The statistical uncertainty of the measurement is estimated by subtracting in quadrature the total expected systematic uncertainty from the actual total uncertainty.

\vspace{0.1in}
\begin{table}[!h!tbp]
\begin{center}
\caption{Contribution of each systematic uncertainty to the
total systematic uncertainty on the $tb$+$tqb$ cross section.}
\label{tab:syst}
\begin{tabular}{lr@{ pb~~}}
%\multicolumn{2}{c}
%{Contributions to the Cross Section Uncertainty}\vspace{0.05in}\\
\hline
\multicolumn{2}{l}{Systematics components} \\
~~Luminosity               & 0.69	\\
~~{\ttbar} cross section   & 0.74	\\
~~Matrix method            & 0.84	\\
~~Trigger                  & 0.48	\\
~~Primary vertex           & 0.31	\\
~~Lepton ID                & 0.50	\\
~~Jet ID                   & 0.18	\\
~~Jet fragmentation        & 0.63	\\
~~Jet energy scale         & 0.57	\\
~~Tag-rate functions       & 0.60	\\
\hline
Combined systematics       & +1.34~~$-1.02$ \\
Statistics                 & +1.19~~$-1.13$ \\
\hline
Total uncertainty          & +1.79~~$-1.50$ \\
\end{tabular}
\vspace{-0.1in}
\end{center}
\end{table}

Figure~\ref{xsec-summary} shows the cross sections measured for
combined the $tb$+$tqb$ production in each independent analysis channel,
and the combined result.

\begin{figure}[!h!tbp]
\begin{center}
\includegraphics[width=1.00\textwidth]
{eps/MatrixElement/sintop_xsec_summary.eps}
\caption{Summary plot of the measured single top quark cross
sections showing the individual measurements and their combination.}
\label{xsec-summary}
\end{center}
\end{figure}

\section{Signal Significance and Standard Model Compatibility}
\label{significance}

The measured significance is defined as the fraction ensembles generated with zero input cross section that result in a measured cross section above the observed cross section of 4.6 pb. This quantity, known as the $p$-value, represents the probability that the background alone could fluctuate to mimic the single top quark signal. For the case of Standard Model single top the expected $p$-value is 3.7$\%$, which is equivalent to a 1.8$\sigma$ Gaussian significance of a deviation from a background fluctuation. The measured $p$-value of $0.21\%$ is equivalent to a $2.9\sigma$ significance indicating evidence for single top quark production in the dataset.

\begin{figure}[!h!tbp]
\begin{center}
\includegraphics[width=0.48\textwidth]
{eps/Limits/ZeroSignalEnsemple_Expected.eps}
\includegraphics[width=0.48\textwidth]
{eps/Limits/ZeroSignalEnsemple_Observed.eps}
\caption{Distribution of expected (left) and measured (right) cross sections from a zero-signal
ensemble with full systematics included. The probability that the background alone could have a measured cross section above 4.6 pb or above is 0.21$\%$ leading to a Gaussian equivalent signal significance of 2.9$\sigma$.}
\label{pValue}
\end{center}
\end{figure}

The probability of a Standard Model signal to have a measured cross section above $4.6$~pb can be estimated using the Standard Model ensemble dataset (i.e. $\sigma_{s+t}=2.9$~pb). Fig.~\ref{probsm} shows the measured cross section for 2,000 Standard Model pseudo-datasets. From this histogram there is a 20.5\% probability that a Standard Model signal could be measured at or above 4.6 pb.

\begin{figure}[!h!tbp]
\begin{center}
\includegraphics[width=1.0\textwidth]
{eps/Limits/prob_sm.eps}
\caption{Distribution of measured cross sections from a Standard Model
ensemble with full systematics included. The probability that a Standard Model signal could have a measured cross section of 4.6 pb or above is 20.5$\%$.}
\label{probsm}
\end{center}
\end{figure}


\documentclass{article}

\begin{document}

    \tableofcontents

    \section{Euclid's Algorithm}

    Just the basic Euclid Algorithm

\end{document}

Semester V/Algorithms/Sir Muhammad Waqas/Recorded Notes/Sep 2, 2020.tex