
\newcommand{\thistitle}{Lecture 3: Electricity Time Series}

\input{title.tex}


\section{Electricity Consumption}

\begin{frame}
  \frametitle{Why is electricity useful?}

  Electricity is a versatile form of energy carried by electrical
  charge which can be consumed in a wide variety of ways (with selected examples):
  \begin{itemize}
  \item Lighting (lightbulbs, halogen lamps, televisions)
  \item Mechanical work (hoovers, washing machines, electric vehicles)
  \item Heating (cooking, resistive room heating, heat pumps)
  \item Cooling (refrigerators, air conditioning)
  \item Electronics (computation, data storage, control systems)
  \item Industry (electrochemical processes)
  \end{itemize}

  Compare the convenience and versatility of electricity with another
  energy carrier: the chemical energy stored in coal,
  which can only be accessed by burning it.

\end{frame}




\begin{frame}
  \frametitle{Power: Examples of consumption}

  At full power, the following items consume:

  \ra{1.1}
  \begin{table}[!t]
    \begin{tabular}{lr}
      \toprule
      Item & Power\\
      \midrule
      New efficient lightbulb & 10 W \\
      Old-fashioned lightbulb & 70 W \\
      Single room air-conditioning & 1.5 kW \\
      Kettle & 2 kW \\
      Factory & $\sim$1-500 MW \\
      CERN & 200 MW \\
            Germany total demand & 35-80 GW \\
      \bottomrule
    \end{tabular}
  \end{table}

\end{frame}




\begin{frame}
  \frametitle{Electricity spot market: trading of energy}

  Energy is traded in MWh; before 2020, prices were 40-50~\euro/MWh. Sinking until 2016 thanks to renewables and the \alert{merit order effect}, but rising since 2016 due to rising \alert{CO$_2$ price}:

  \centering
  \includegraphics[width=11.4cm]{strompreis-2019.png}

  \source{\hrefc{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{Electricity spot market: crisis since 2021}

  \centering
  \includegraphics[height=7.4cm]{FPLtysXUYAgMH9w.jpeg}

\source{\hrefc{https://twitter.com/OliverRuhnau/status/1509532920725209096/}{Ruhnau et al, 2022}}
\end{frame}
\begin{frame}
  \frametitle{Consumption metering}

\begin{columns}[T]
\begin{column}{6.5cm}
\includegraphics[width=7.5cm,angle=270]{stromzaehler}
\end{column}
\begin{column}{4cm}

  \vspace{1cm}

  \begin{itemize}
  \item Look for your electricity meter at home
  \item Mine here shows 42470.3 kWh
  \item Check what the value is a week later
  \end{itemize}

\end{column}
\end{columns}


\end{frame}



\begin{frame}
  \frametitle{Electricity bill}

  My bill for 2014-5: 1900 kWh for a year, at a cost of \euro 570, which
  corresponds to 0.3 \euro/kWh or 300 \euro/MWh. But the spot market price averaged 30 \euro/MWh, so what's going on??

  \centering
  \includegraphics[width=10cm,angle=180]{bill}

\end{frame}



\begin{frame}
  \frametitle{Household price breakdown}

  Although the wholesale price is going down, other taxes, grid
  charges and renewables subsidy (EEG surcharge) have kept the price
  high.

  \centering
  \includegraphics[width=12cm]{electricity-residential-price-2019.png}

  \raggedright
  HOWEVER the EEG is only high because it is paying for solar panels
  bought at a time when they were still comparatively expensive; but
  through the German subsidy, production volumes were high and the
  learning curve has brought the costs down exponentially.

  \source{\hrefc{https://www.agora-energiewende.de/fileadmin2/Projekte/2019/Jahresauswertung_2019/AGORA_State_of_Affairs_German_Power_Sector_2019_Webinar_28012020.pdf}{Agora Energiewende, 2019}}

\end{frame}





\begin{frame}
  \frametitle{Discrete Consumers Aggregation}

  The discrete actions of individual consumers smooth out
  statistically if we aggregate over many consumers.

  \centering
  \includegraphics[width=10cm]{demand_smoothing}

\end{frame}


\begin{frame}
  \frametitle{Load curve properties}

  The Germany load curve (around 500 TWh/a) shows \alert{daily}, \alert{weekly} and
  \alert{seasonal} patterns; religious festivals are also visible.

  \centering
  \includegraphics[width=13cm]{DE-load-H}

\end{frame}



\begin{frame}
  \frametitle{Load duration curve}

  For some analysis it is useful to construct a \alert{duration curve}
  by stacking the hourly values from highest to lowest.

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

\end{frame}




\begin{frame}
  \frametitle{Load density function}

  Similarly we can also build the \alert{probability density function} $pdf(x)$, $\int dx \, pdf(x) = 1$:

  \centering
  \includegraphics[width=13cm]{DE-load-density}

\end{frame}



\begin{frame}
  \frametitle{Fourier transform to see spectrum}

\begin{columns}[T]
\begin{column}{6.5cm}
\includegraphics[width=7.5cm]{fourier.png}
\end{column}
\begin{column}{4cm}

  \vspace{1cm}

  \begin{itemize}
  \item Fourier analysis decomposes a \alert{periodic} signal into simpler sine waves
  \item Every periodic signal can be broken down into a sum of sine waves with different \alert{frequencies}
  \end{itemize}

\end{column}
\end{columns}


\end{frame}


\begin{frame}
  \frametitle{Fourier transform to see spectrum}

  Common examples of Fourier approximations using more and more terms with high frequencies:

  \centering
\includegraphics[width=10.5cm]{fourier-examples.png}

\source{\hrefc{https://mathworld.wolfram.com/FourierSeries.html}{MathWorld}}

\end{frame}


\begin{frame}
  \frametitle{Fourier transform to see spectrum}

  For a periodic, continuous, complex signal $f(t)$, we can decompose it in  frequency space to see which frequencies dominate the signal. This is called a \alert{Fourier transform/series}.

  For period $T$ (in our case a year) the function $f: [0,T] \rightarrow \mathbb{C}$ can be decomposed
  \begin{equation*}
     f(t) = \sum_{n=-\infty}^{n=\infty} a_n e^{-\frac{i2\pi nt}{T}}
  \end{equation*}

  To recover the values of the \alert{frequency amplitudes} $a_n$, integrate over $T$
  \begin{equation*}
     a_n = \frac{1}{T} \int_0^T dt \left[ f(t)  e^{\frac{i2\pi nt}{T}} \right]
  \end{equation*}


  For a real-valued function $f: [0,T] \rightarrow \mathbb{R}$, $a_{-n} = a_n^*$.

  For a periodic, \alert{discrete} signal $f_n$, the \alert{Fast Fourier Transform} (FFT) is a computationally advantageous algorithm and is implemented in many programming libraries (see tutorial).

\end{frame}

\begin{frame}
  \frametitle{Fourier transform: exercise}

  To remind yourself of how Fourier transforms work, check the formula for $a_n$ by inserting the expansion of $f(t)$ into the formula for $a_n$.

  First hint: remember Euler's formula:
  \begin{equation*}
    e^{i\theta} = \cos \theta + i \sin \theta
  \end{equation*}

  Second hint: think about integrating a periodic signal over its period:
  \begin{equation*}
    \frac{1}{T} \int_0^T dt \cos  \frac{2\pi nt}{T} =  \left\{
    \begin{array}{@{}ll@{}}
      1, & \text{if}\ n=0 \\
      0, & \text{otherwise}
        \end{array}\right.
  \end{equation*}



\end{frame}

\begin{frame}
  \frametitle{Load spectrum}

  If we Fourier transform, the \alert{seasonal}, \alert{weekly} and \alert{daily} frequencies are clearly visible.

  \centering
  \includegraphics[width=13cm]{DE-load-spectrum}

\end{frame}



\section{Electricity Generation}


\begin{frame}
  \frametitle{How is electricity generated?}

  \alert{Conservation of Energy}: Energy cannot be created or destroyed:
  it can only be converted from one form to another.

  There are several `primary' sources of energy which are converted
  into electrical energy in modern power systems:
  \begin{itemize}
  \item Chemical energy, accessed by combustion (coal, gas, oil, biomass)
  \item Nuclear energy, accessed by fission reactions, perhaps one day by fusion too
  \item Hydroelectric energy, allowing water to flow downhill (gravitational potential energy)
  \item Wind energy (kinetic energy of air)
  \item Solar energy (accessed with photovoltaic (PV) panels or
    concentrating solar thermal power (CSP))
  \item Geothermal energy
  \end{itemize}
  NB: The definition of `primary' is somewhat arbitrary.

\end{frame}



\begin{frame}
  \frametitle{Power: Examples of generation}

  At full power, the following items generate:

  \ra{1.1}
  \begin{table}[!t]
    \begin{tabular}{lr}
      \toprule
      Item & Power\\
      \midrule
      Solar panel on house roof & 15 kW \\
      Wind turbine & 3 MW \\
      Coal power station & 1 GW \\
      \bottomrule
    \end{tabular}
  \end{table}

\end{frame}



\begin{frame}
  \frametitle{Generators}

  With the exception of solar photovoltaic panels (and electrochemical
  energy and a few other minor exceptions), all generators convert to
  electrical energy via rotational kinetic energy and electromagnetic
  induction in an \emph{alternating current generator}.

  %https://en.wikipedia.org/wiki/Fossil-fuel_power_station#/media/File:Coal_fired_power_plant_diagram.svg

  \centering
  \includegraphics[width=10cm]{Coal_fired_power_plant_diagram}

  \source{Wikipedia}
%  https://de.wikipedia.org/wiki/Drehstrom-Synchronmaschine#/media/File:Walchenseekraftwerk-1_Turbinenhalle.jpg
% Walchenseekraftwerk-1_Turbinenhalle.jpg



\end{frame}


\begin{frame}
  \frametitle{Example of electricity generation across major EU countries in 2013}


  \centering
  \includegraphics[width=11cm]{european_countries-energy}


\end{frame}



\begin{frame}
  \frametitle{Renewables reached 40\% of electricity generation in Germany in 2019}

  \centering
    \includegraphics[width=11cm]{fig2-gross-power-production-germany-1990-2019.png}
\end{frame}





\section{Variable Renewable Energy (VRE)}



\begin{frame}
  \frametitle{Solar time series}

  Unlike the load, the solar feed-in is much more variable, dropping to zero and not reaching full output (when aggregated over all of Germany).


  \centering
  \includegraphics[width=13cm]{DE-solar-H}

\end{frame}


\begin{frame}
  \frametitle{How do we derive solar time series?}

  We take times series weather data for the solar radiation (also
  called irradiation or insolation) at each location in W/m$^2$.  This
  is often provided for a horizontal surface, so we need to convert
  for the angles of the solar panel to the horizontal, and account for
  factors that affect the energy conversion (losses, outside
  temperature). We have a software library \alert{atlite} that takes
  care of this. See \urlc{https://model.energy} or
  \urlc{https://renewables.ninja} for live examples.

  \centering
  \includegraphics[width=10cm]{figure5.png}

  \source{\hrefc{https://www.volker-quaschning.de/articles/fundamentals1/index.php}{Volker Quaschning}}


\end{frame}

\begin{frame}
  \frametitle{Solar time series: weekly}

  If we take a weekly average we see higher solar in the summer.

  \centering
  \includegraphics[width=13cm]{DE-solar-W}

\end{frame}



\begin{frame}
  \frametitle{Solar duration curve}



  \centering
  \includegraphics[width=13cm]{DE-solar-duration}

\end{frame}




\begin{frame}
  \frametitle{Solar density function}

  \centering
  \includegraphics[width=13cm]{DE-solar-density}

\end{frame}




\begin{frame}
  \frametitle{Solar spectrum}

  If we Fourier transform, the \alert{seasonal} and \alert{daily} patterns become visible.

  \centering
  \includegraphics[width=13cm]{DE-solar-spectrum}

\end{frame}



\begin{frame}
  \frametitle{Wind time series}

  Wind is variable, like solar, but the variations are on different time scales. It drops close to zero and rarely reaches full output (when aggregated over all of Germany).

  \centering
  \includegraphics[width=13cm]{DE-onwind-H}

\end{frame}



\begin{frame}
  \frametitle{How do we derive wind time series?}

  We take times series weather data for the wind speeds at hub height (e.g. 60-100m) at each
  location in ms$^{-1}$. In theory the power in the wind goes like
  $v^3$, but in practice high wind speeds are rare and it is not
  economic to build the generator so large.

  \centering
  \includegraphics[width=10cm]{1200px-Powercurve.png}

  \source{\hrefc{https://de.wikipedia.org/wiki/Datei:Powercurve.png}{Wikipedia}}


\end{frame}


\begin{frame}
  \frametitle{How do we derive wind time series?}

  Wind speeds are typically distributed according to a Weibull probability distribution.
  Although the wind speeds are clustered at the lower end, most of the energy is generated between 5 and 15 ms$^{-1}$.

  \centering
  \includegraphics[width=10cm]{Lee_Ranch_Wind_Speed_Frequency.png}

  \source{\hrefc{https://commons.wikimedia.org/wiki/File:Lee_Ranch_Wind_Speed_Frequency.svg}{Wikipedia}}


\end{frame}



\begin{frame}
  \frametitle{Wind time series: weekly}

  If we take a weekly average we see higher wind in the winter and
  some periodic patterns over 2-3 weeks (\alert{weekly or synoptic scale}).

  \centering
  \includegraphics[width=13cm]{DE-onwind-W}

\end{frame}




\begin{frame}
  \frametitle{Wind duration curve}



  \centering
  \includegraphics[width=13cm]{DE-onwind-duration}

\end{frame}




\begin{frame}
  \frametitle{Wind density function}

  \centering
  \includegraphics[width=13cm]{DE-onwind-density}

\end{frame}




\begin{frame}
  \frametitle{Wind spectrum}

  If we Fourier transform, the \alert{seasonal}, \alert{synoptic} (2-3 weeks) and \alert{daily} patterns become visible.

  \centering
  \includegraphics[width=13cm]{DE-onwind-spectrum}

\end{frame}





\begin{frame}
  \frametitle{What causes weekly variations?}
  \begin{columns}[T]
    \begin{column}{6cm}
            % left bottom right top
    \includegraphics[trim=0 0cm 0cm 0cm,width=6cm,clip=true]{Evolution-of-the-southern-edge-of-the-Rossby-waves-as-the-cold-air-mass-in-blue-moves_W640.jpg}
  \end{column}
  \begin{column}{8cm}
    \begin{itemize}
    \item  Large weather systems follow atmospheric \alert{Rossby waves}. Rossby waves are giant meanders in high-altitude winds that have a major influence on weather.
      \item Also found on other planets like Jupiter and Saturn (general feature of rotating fluids).
    \end{itemize}

    \vspace{0.5cm}

    \includegraphics[trim=0 0cm 0cm 0cm,height=3.5cm,clip=true]{jupiter.jpg}
    \includegraphics[trim=0 0cm 0cm 0cm,height=3.5cm,clip=true]{saturn.jpg}
  \end{column}
  \end{columns}

  \source{\hrefc{http://dx.doi.org/10.3934/environsci.2019.1.14}{Stuart et al, 2019}}

\end{frame}


\section{Balancing a Single Country}



\begin{frame}
  \frametitle{Power mismatch}

  Suppose we now try and cover the electrical demand with the
  generation from wind and solar.

  How much wind and solar do we need? We have three time series:
  \begin{itemize}
  \item $\{ d_t\}, d_t \in \R$ the load (varying between 35 GW and 80 GW)
  \item $\{ w_t\}, w_t \in [0,1]$ the wind availability (how much a 1 MW wind turbine produces)
  \item $\{ s_t\}, s_t \in [0,1]$ the solar availability  (how much a 1 MW solar turbine produces)
  \end{itemize}

  We try $W$ MW of wind and $S$ MW of solar. Now the effective \alert{residual load} or \alert{mismatch} is
  \begin{equation*}
    m_t = d_t - Ww_t - Ss_t
  \end{equation*}

  We choose $W$ and $S$ such that on \alert{average} we cover all the load
  \begin{equation*}
    \langle m_t \rangle = 0
  \end{equation*}
  and so that the 70\% of the energy comes from wind and 30\% from solar ($W = 147$ GW and $S = 135$ GW).

\end{frame}




\begin{frame}
  \frametitle{Mismatch time series}


  \centering
  \includegraphics[width=13cm]{DE-mismatch-H}

\end{frame}



\begin{frame}
  \frametitle{Mismatch duration curve}



  \centering
  \includegraphics[width=13cm]{DE-mismatch-duration}

\end{frame}




\begin{frame}
  \frametitle{Mismatch density function}

  \centering
  \includegraphics[width=13cm]{DE-mismatch-density}

\end{frame}




\begin{frame}
  \frametitle{Mismatch spectrum}

  If we Fourier transform, the synoptic (from wind) and daily patterns (from demand and solar) become visible. Seasonal variations appear to cancel out.

  \centering
  \includegraphics[width=13cm]{DE-mismatch-spectrum}

\end{frame}



\begin{frame}
  \frametitle{How to deal with the mismatch?}

  The problem is that
    \begin{equation*}
    \langle m_t \rangle = 0
  \end{equation*}
    is not good enough! We need to meet the demand in every single hour.

    This means:
    \begin{itemize}
      \item If $m_t > 0$, i.e. we have unmet demand, then we need
        backup generation from \alert{dispatchable} sources
        e.g. hydroelectricity reservoirs, fossil/biomass fuels.
      \item If $m_t < 0$, i.e. we have over-supply, then we have to
        shed / spill / \alert{curtail} the renewable energy.
    \end{itemize}


\end{frame}


\begin{frame}
  \frametitle{Mismatch}


  \centering
  \includegraphics[width=13cm]{mismatch-2011-03-01-2011-03-31}


\end{frame}

\begin{frame}
  \frametitle{Mismatch}


  \centering
  \includegraphics[width=13cm]{mismatch-2011-07-01-2011-07-31}


\end{frame}

\begin{frame}
  \frametitle{Mismatch}


  \centering
  \includegraphics[width=13cm]{mismatch-2011-12-01-2011-12-31}


\end{frame}



\begin{frame}
  \frametitle{Mismatch duration curve}


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


\end{frame}



\begin{frame}
  \frametitle{What to do?}

  Backup energy costs money and may also cause CO${}_2$ emissions.

  Curtailing renewable energy is also a waste.

  We'll look in the next lectures at \alert{four other solutions}:
  \begin{enumerate}
  \item \alert{Smoothing} stochastic variations of renewable feed-in \alert{over continental areas}, e.g. the whole of Europe.
  \item Using \alert{electricity storage} to shift energy from times of surplus to times of deficit.
  \item Shifting demand to different times, when renewables are abundant, i.e. \alert{demand-side management} (DSM).
    \item Consuming the electricity in \alert{other sectors}, e.g. transport or heating, where there are further possibilities for DSM (battery electric vehicles, heat pumps)  and cheap storage possibilities (e.g. thermal storage or power-to-gas as hydrogen or methane).
  \end{enumerate}



\end{frame}



\end{document}
