Commit 5b02f941 authored by sp2668's avatar sp2668

Initial commit

parents
\documentclass[11pt,a4paper,fleqn]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[colorlinks=true, citecolor=blue, linkcolor=blue, filecolor=blue,urlcolor=blue]{hyperref}
\hypersetup{
colorlinks = true,
citecolor = gray
}
\usepackage{wrapfig}
\usepackage{caption}
\captionsetup{format=plain, indent=5pt, font=footnotesize, labelfont=bf}
\setkomafont{disposition}{\scshape\bfseries}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{bbm}
\usepackage{mathtools}
% \usepackage{epsfig}
% \usepackage{grffile}
%\usepackage{times}
\usepackage{palatino}
\usepackage{mathpazo}
\setlength\parindent{0pt}
%\usepackage{babel}
\usepackage{tikz}
\usepackage{paralist}
\usepackage{color}
\usepackage[top=3cm, bottom=2.5cm, left=2.5cm, right=3cm]{geometry}
%\setlength{\mathindent}{1ex}
% PGF
\usepackage{pgfplots}
\pgfplotsset{
compat=newest,
every axis/.append style={small, minor tick num=3}
}
%\usepackage[backend=biber,style=alphabetic,url=false,doi=false]{biblatex}
%\addbibresource{sheet01_biber.bib}
% \addbibresource{/home/coroa/papers/refs.bib}
\newcommand{\id}{\mathbbm{1}}
\newcommand{\NN}{{\mathbbm{N}}}
\newcommand{\ZZ}{{\mathbbm{Z}}}
\newcommand{\RR}{{\mathbbm{R}}}
\newcommand{\CC}{{\mathbbm{C}}}
\renewcommand{\vec}[1]{{\boldsymbol{#1}}}
\renewcommand{\i}{\mathrm{i}}
\newcommand{\expect}[1]{\langle\,#1\,\rangle}
\newcommand{\e}[1]{\ensuremath{\,\mathrm{#1}}}
\renewcommand{\O}{\mc{O}}
\newcommand{\veps}{\varepsilon}
\newcommand{\ud}[1]{\textup{d}#1\,}
\newcommand{\unclear}[1]{\color{green}#1}
\newcommand{\problem}[1]{\color{red}#1}
%=====================================================================
%=====================================================================
\begin{document}
\begin{center}
\textbf{\Large Energy System Modelling }\\
{SS 2018, Karlsruhe Institute of Technology}\\
{Institute of Automation and Applied Informatics}\\ [1em]
\textbf{\textsc{\Large Tutorial I: Time Series Analysis}}\\
\small Will be worked on in the exercise session on Wednesday, 11 July 2018.\\[1.5em]
\end{center}
\vspace{1em}
%=============== ======================================================
\paragraph{Problem I.1 \normalsize (data analysis).}~\\
%=====================================================================
The following data are made available to you on the course home
page\footnote{\url{https://nworbmot.org/courses/complex_renewable_energy_networks/}}:
\begin{verbatim}
de_data.csv, gb_data.csv, eu_data.csv, (wind.csv, solar.csv, load.csv).
\end{verbatim}
They describe (quasi-real) time series for wind power generation \(W(t)\), solar power generation \(S(t)\) and load \(L(t)\) in Great Britain (GB), Germany (DE) and Europe (EU). The time step is \(1\e{h}\) and the time series are several years long.
\begin{enumerate}[(a)]
\item Check that the wind and solar time series are normalized to 'per-unit of installed \mbox{capacity}', and that the load time series is normalized to MW.
\item For all three regions, calculate the maximum, mean, and variance of the time series.
\item For all three regions, plot the time series \(W(t)\),
\(S(t)\),
\(L(t)\) for a winter month (January) and a summer month (July).
\item For all three regions, plot the duration curve for \(W(t)\), \(S(t)\), \(L(t)\).
\item For all three regions, plot the probability density function of \(W(t)\), \(S(t)\), \(L(t)\).
\item Apply a (Fast) Fourier Transform to the the three time series $X \in W(t), S(t), L(t)$:
\begin{equation*}
\tilde{X}(\omega) = \int_0^T X(t) e^{\i \omega t} \,\ud t \, .
\end{equation*}
For all three regions, plot the energy spectrum
$\left| \tilde{\Delta}(\omega) \right|^2$ as a function of
$\omega$. Discuss the relationship of these results with the
findings obtained in (b)-(e).
\item Normalize the time series to one, so that \(\expect{W} = \expect{S} = \expect{L} = 1\).
Now, for all three regions, plot the mismatch time series
\begin{equation*}
\Delta(t) = \gamma \alpha W(t) + \gamma (1 - \alpha) S(t) - L(t)
\end{equation*}
for the same winter and summer months as in (c). Choose
\(\alpha \in \{0.0, 0.5, 0.75, 1.0\}\) with \(\gamma = 1\),
and $\gamma \in \{0.5, 0.75, 1.0, 1.25, 1.5\} $ with $\alpha = 0.75$.
\item For all three regions, repeat (b)-(f) for the mismatch time series.
\end{enumerate}
\pagebreak
%=====================================================================
\paragraph{Problem I.2 \normalsize (analytical).}~\\
%=====================================================================
\begin{wrapfigure}[11]{r}{0pt}
\begin{tikzpicture}
\begin{axis}[
domain=0:1, no markers, samples=200
% xlabel = $x$, ylabel = $f(x)$
]
\addplot+[dashed] {1 + 0.4 * cos(deg(2*pi*x))}; \label{figref:w}
\addplot+[densely dotted] {1 - 0.75 * cos(deg(2*pi*x))}; \label{figref:s}
\addplot+[solid] {1 + 0.1 * cos(deg(2*pi*x))}; \label{figref:l}
\addplot+[dotted] {1}; \label{figref:1}
\end{axis}
\end{tikzpicture}
\caption{Seasonal variations of wind and solar power generation
\(W(t)\)
\autoref{figref:w} and \(S(t)\)
\autoref{figref:s}, and load \(L(t)\)
\autoref{figref:l} around the mean \(1\) \ref{figref:1}.}
\label{fig:seasonalvariations}
\end{wrapfigure}
Figure \ref{fig:seasonalvariations} shows approximations to the
seasonal variations of wind and solar power generation \(W(t)\)
and \(S(t)\) and load \(L(t)\):
\begin{align*}
W(t) & = 1 + A_W \cos \omega t \\
S(t) & = 1 - A_S \cos \omega t \\
L(t) & = 1 + A_L \cos \omega t
\end{align*}
The time series are normalized to
\(\expect{W} = \expect{S} = \expect{L} := \frac{1}{T} \int_0^T L(t)
\ud t = 1\), and the constants have the values
\begin{align*}
\omega & = \frac{2\pi}{T} & T & = 1 \e{year} \\
A_W & = 0.4 & A_S & = 0.75 & A_L & = 0.1
\end{align*}
~\\
\begin{enumerate}[(a)]
\item What is the seasonal optimal mix \(\alpha\), which minimizes
\begin{equation*}
\expect{\left[ \alpha W(\cdot) + (1-\alpha) S(\cdot) - L(\cdot) \right]^2} = \frac1T \int_0^T \left[ \alpha W(t) + (1-\alpha) S(t) - L(t) \right]^2 \,\mathrm d t
,
\end{equation*}
\item How does the optimal mix change if we replace \(A_L \to -A_L\)?
\item Now assume that there is a seasonal shift in the wind signal
\begin{equation*}
W(t) = 1 + A_W \cos \left( \omega t - \phi \right)
.
\end{equation*}
Express the optimal mix \(\alpha\) as a function of \(\phi\).
\item A constant conventional power source \(C(t) = 1 - \gamma\) is now introduced. The mismatch then becomes
\begin{equation}
\Delta(t) = \gamma \left[ \alpha W(t) + (1-\alpha) S(t) \right] + C(t) - L(t)
.
\end{equation}
Analogously to (a), find the optimal mix \(\alpha\) as a function of \(0 \leq \gamma \leq 1\), which minimizes \(\expect{\Delta^2}\).
\end{enumerate}
\pagebreak
%=============== ======================================================
\paragraph{Remarks (Python pointers or where to start).}~\\
%=====================================================================
I found the python notebook based notes of Robert Johansson to be a
comprehensive kick starter\footnote{\url{http://nbviewer.jupyter.org/github/jrjohansson/scientific-python-lectures/tree/master/}}.
\begin{itemize}
\item
\href{http://nbviewer.jupyter.org/github/jrjohansson/scientific-python-lectures/blob/master/Lecture-0-Scientific-Computing-with-Python.ipynb}{Lecture~0} covers installation and getting ready.
\item
\href{http://nbviewer.jupyter.org/github/jrjohansson/scientific-python-lectures/blob/master/Lecture-1-Introduction-to-Python-Programming.ipynb}{Lecture~1}
zooms through most basic general python control structures (only
brush over it and stop reading early, i.e. if you read the word
\verb+classes+ you already know too much).
\item \href{http://nbviewer.jupyter.org/github/jrjohansson/scientific-python-lectures/blob/master/Lecture-2-Numpy.ipynb}{Lecture~2} is the most important and closely connected to the exercises.
\item You might as well stop now, but if you \emph{are} hooked, I recommend \href{http://nbviewer.jupyter.org/github/jrjohansson/scientific-python-lectures/blob/master/Lecture-3-Scipy.ipynb}{Lecture~3} for more physics and \href{http://nbviewer.jupyter.org/github/jrjohansson/scientific-python-lectures/blob/master/Lecture-4-Matplotlib.ipynb}{Lecture~4} for prettier graphs.
\end{itemize}
Further reference material of help is:
\begin{itemize}
\item The website-books \url{http://python-course.eu/} (english), \url{http://python-kurs.eu/} (german); especially if you only \emph{very} quickly skim over the \href{http://www.python-course.eu/course.php}{python2 tutorial} and switch over to the \href{http://www.python-course.eu/numerical_programming.php}{numerical python} stuff early; especially of interest might be the \href{http://www.python-course.eu/pandas.php}{pandas} bit in the end, which will make the exercises a breeze at the expense of yet another package to learn.
\item the exhaustive (overly so) official python tutorial\footnote{\url{https://docs.python.org/2/tutorial/}} available in \href{https://docs.python.org/2/tutorial/}{english} and \href{https://py-tutorial-de.readthedocs.org/de/python-3.3/index.html}{german}; which will NOT introduce you to numpy or scipy.
\end{itemize}
%\printbibliography
\end{document}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
\documentclass[11pt,a4paper,fleqn]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[colorlinks=true, citecolor=blue, linkcolor=blue, filecolor=blue,urlcolor=blue]{hyperref}
\hypersetup{
colorlinks = true,
citecolor = gray
}
\usepackage{wrapfig}
\usepackage{caption}
\captionsetup{format=plain, indent=5pt, font=footnotesize, labelfont=bf}
\setkomafont{disposition}{\scshape\bfseries}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{bbm}
\usepackage{mathtools}
\usepackage{epsfig}
\usepackage{grffile}
%\usepackage{times}
%\usepackage{babel}
\usepackage{tikz}
\usepackage{paralist}
\usepackage{color}
\usepackage[top=3cm, bottom=2.5cm, left=2.5cm, right=3cm]{geometry}
%\setlength{\mathindent}{1ex}
\usepackage{palatino}
\usepackage{mathpazo}
\setlength\parindent{0pt}
% PGF
\usepackage{pgfplots}
\pgfplotsset{
compat=newest,
every axis/.append style={small, minor tick num=3}
}
\usepackage{natbib}
%\usepackage[backend=biber,style=alphabetic,url=false,doi=false]{biblatex}
%\addbibresource{sheet01_biber.bib}
% \addbibresource{/home/coroa/papers/refs.bib}
\newcommand{\id}{\mathbbm{1}}
\newcommand{\NN}{{\mathbbm{N}}}
\newcommand{\ZZ}{{\mathbbm{Z}}}
\newcommand{\RR}{{\mathbbm{R}}}
\newcommand{\CC}{{\mathbbm{C}}}
\renewcommand{\vec}[1]{{\boldsymbol{#1}}}
\renewcommand{\i}{\mathrm{i}}
\newcommand{\expect}[1]{\langle\,#1\,\rangle}
\newcommand{\e}[1]{\ensuremath{\,\mathrm{#1}}}
\renewcommand{\O}{\mc{O}}
\newcommand{\veps}{\varepsilon}
\newcommand{\ud}[1]{\textup{d}#1\,}
\newcommand{\unclear}[1]{\color{green}#1}
\newcommand{\problem}[1]{\color{red}#1}
%=====================================================================
%=====================================================================
\begin{document}
\begin{center}
\textbf{\Large Energy System Modelling }\\
{SS 2018, Karlsruhe Institute of Technology}\\
{Institute of Automation and Applied Informatics}\\ [1em]
\textbf{\textsc{\Large Tutorial II: Network Theory and Power Flow}}\\
\small Will be worked on in the exercise session on Friday, 13 July 2018.\\[1.5em]
\end{center}
\vspace{1em}
%=====================================================================
\paragraph{Problem II.1 \normalsize (network theory basics).}~\\
%=====================================================================
\begin{wrapfigure}[10]{r}{0pt}
\centering
\begin{tikzpicture}
[scale=.81,auto=left,every node/.style={circle,fill=gray!20}]
\node (n0) at (2,14) {0};
\node (n1) at (2,8) {1};
\node (n2) at (0,4) {2};
\node (n3) at (3,0) {3};
\node (n4) at (4,4) {4};
\node (n5) at (5,7) {5};
\foreach \from/\to in {n0/n1,n1/n2,n1/n4,n1/n5,n2/n4,n2/n3,n3/n4,n4/n5}
\draw (\from) -- (\to);
\end{tikzpicture}
\caption{Simple Network}
\label{fig:network}
\end{wrapfigure}
Consider the simple network shown ins Figure \ref{fig:network}. Calculate in Python or by hand:
\begin{enumerate}[(a)]
\item Compile the \textit{nodes list} and the \textit{edge list}.\\~\\
\textbf{Remark:} While graph-theoretically both lists are unordered sets, let's agree on an ordering now which can serve as basis for the matrices in the following exercises: we sort everything in ascending numerical order, i.e.\ node 1 before node 2 and edge (1,2) before (1,4) before (2,3).
\item Determine the \textit{order} and the \textit{size} of the network.
\item Compute the\textit{ adjacency matrix} $A$ and check that it is symmetric.
\item Find the \textit{degree} $k_n$ of each node $n$ and compute the \textit{average degree} of the network.
\item Determine the \textit{incidence matrix} $K$ by assuming the links are always directed from smaller-numbered node to larger-numbered node, i.e.\ from node 2 to node 3, instead of from 3 to 2.
\item Compute the \textit{Laplacian} $L$ of the network using $k_n$ and $A$. Remember that the Laplacian can also be computed as $L=KK^T$ and check that the two definitions agree.
\item Find the \textit{diameter} of the network by looking at Figure \ref{fig:network}.
\end{enumerate}
\pagebreak
%=====================================================================
\paragraph{Problem II.2 \normalsize (linear power flow).}~\\
%=====================================================================
If you map the nodes to countries like \texttt{0=DK, 1=DE, 2=CH, 3=IT, 4=AT,5=CZ} the network in Figure \ref{fig:network} represents a small part of the European electricity network (albeit very simplified). On the course homepage\footnote{\url{https://nworbmot.org/courses/complex_renewable_energy_networks/}}, you can find the \textit{power imbalance} time series for the six countries for January 2017 in hourly MW in the file \texttt{imbalance.csv}. They have been derived from physical flows as published by ENTSO-E.\footnote{\url{https://transparency.entsoe.eu/transmission-domain/physicalFlow/show}}\\
The linear power flow is given by
\begin{equation}
p_i = \sum_j \tilde{L}_{i,j}\theta_j \qquad \text{and} \qquad f_l = \frac{1}{x_l} \sum_i K_{i,l}\theta_i, \qquad \text{where} \qquad \tilde{L}_{i,j}= \sum_l = K_{i,l}\frac{1}{x_l} K_{j,l}
\end{equation}
is the weighted Laplacian. For simplicity, we assume identity reactance on all links $x_l = 1$.
\begin{enumerate}[(a)]
\item Compute the \textit{voltage angles }$\theta_j$ and \textit{flows} $f_l$ for the first hour in the dataset with the convention of $\theta_0 = 0$; i.e.\ the slack bus is at node 0.\\~\\
\textbf{Remark:} Linear equation systems are solved efficiently using \texttt{numpy.linalg.solve}.
\item Determine the average flow on each link for 01-2017 and draw it as a directed network.
\end{enumerate}
\begin{figure}[h]
\centering
\begin{tikzpicture}
[scale=.7,auto=left,every node/.style={circle,fill=gray!20}]
\node (n0) at (2,14) {DK};
\node (n1) at (2,8) {DE};
\node (n2) at (0,4) {CH};
\node (n3) at (3,0) {IT};
\node (n4) at (4,4) {AT};
\node (n5) at (5,7) {CZ};
\foreach \from/\to in {n0/n1,n1/n2,n1/n4,n1/n5,n2/n4,n2/n3,n3/n4,n4/n5}
\draw (\from) -- (\to);
\end{tikzpicture}
\caption{Simple Network}
\label{fig:network}
\end{figure}
%\bibliographystyle{unsrt}
%\bibliography{sheet02}
%\printbibliography
\end{document}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
\relax
\providecommand\hyper@newdestlabel[2]{}
\providecommand*\new@tpo@label[2]{}
\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument}
\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined
\global\let\oldcontentsline\contentsline
\gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}}
\global\let\oldnewlabel\newlabel
\gdef\newlabel#1#2{\newlabelxx{#1}#2}
\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}}
\AtEndDocument{\ifx\hyper@anchor\@undefined
\let\contentsline\oldcontentsline
\let\newlabel\oldnewlabel
\fi}
\fi}
\global\let\hyper@last\relax
\gdef\HyperFirstAtBeginDocument#1{#1}
\providecommand\HyField@AuxAddToFields[1]{}
\providecommand\HyField@AuxAddToCoFields[2]{}
\expandafter \gdef \csname pgfplots@labelstyle@figref:w\endcsname {blue={\pgfkeysnovalue },every mark/.append style={fill=blue!80!black},mark={*},dashed={\pgfkeysnovalue },/utils/exec={\if 0\pgfplotsplothandlermesh@matrixinput \pgfkeysalso {/pgfplots/mesh input=lattice}\fi },mark={none}}
\expandafter \gdef \csname pgfplots@show@ref@figref:w\endcsname {\begingroup \def \pgfplots@draw@image {\def \tikz@plot@handler {\pgfkeys {/pgf/plots/@handler options/.cd, start=\relax , end macro=\relax , point macro=\pgfutil@gobble , jump macro=\relax , special macro=\pgfutil@gobble , point macro=\pgf@plot@line@handler , jump=\global \let \pgf@plotstreampoint \pgf@plot@line@handler@move }\begingroup \escapechar =-1 \edef \pgfplotsplothandlername {\string \pgfplothandlerlineto }\pgfmath@smuggleone \pgfplotsplothandlername \endgroup \def \pgfplotsplothandlerLUAfactory {function(axis, pointmetainputhandler) return pgfplots.GenericPlothandler.new("\pgfplotsplothandlername ", axis,pointmetainputhandler) end}\def \pgfplotsplothandlerLUAvisualizerfactory {pgfplots.defaultPlotVisualizerFactory}}\pgfkeysdef {/pgfplots/legend image code}{\draw [/pgfplots/mesh=false,bar width=3pt,bar shift=0pt,mark repeat=2,mark phase=2,] plot coordinates { (0cm,0cm) (0.3cm,0cm) (0.6cm,0cm)};}\pgfkeysdef {/pgfplots/every legend image post}{}\pgfkeyssetvalue {/pgfplots/mark list fill}{.!80!black}\pgfkeysdef {/pgfplots/every crossref picture}{\pgfkeysalso {baseline,yshift=0.3em}}\pgfplots@show@small@legendplots {blue={\pgfkeysnovalue },every mark/.append style={fill=blue!80!black},mark={*},dashed={\pgfkeysnovalue },/utils/exec={\if 0\pgfplotsplothandlermesh@matrixinput \pgfkeysalso {/pgfplots/mesh input=lattice}\fi },mark={none}}{}}\ifpgfpicture \scope [/pgfplots/every crossref picture]\pgfplots@draw@image \endscope \else \expandafter \ifx \csname tikzappendtofigurename\endcsname \relax \else \begingroup \tikzappendtofigurename {_crossref}\fi \tikz [/pgfplots/every crossref picture]{\pgfplots@draw@image }\expandafter \ifx \csname tikzappendtofigurename\endcsname \relax \else \endgroup \fi \fi \endgroup }
\expandafter \gdef \csname pgfplots@labelstyle@figref:s\endcsname {red={\pgfkeysnovalue },every mark/.append style={fill=red!80!black},mark={square*},densely dotted={\pgfkeysnovalue },/utils/exec={\if 0\pgfplotsplothandlermesh@matrixinput \pgfkeysalso {/pgfplots/mesh input=lattice}\fi },mark={none}}
\expandafter \gdef \csname pgfplots@show@ref@figref:s\endcsname {\begingroup \def \pgfplots@draw@image {\def \tikz@plot@handler {\pgfkeys {/pgf/plots/@handler options/.cd, start=\relax , end macro=\relax , point macro=\pgfutil@gobble , jump macro=\relax , special macro=\pgfutil@gobble , point macro=\pgf@plot@line@handler , jump=\global \let \pgf@plotstreampoint \pgf@plot@line@handler@move }\begingroup \escapechar =-1 \edef \pgfplotsplothandlername {\string \pgfplothandlerlineto }\pgfmath@smuggleone \pgfplotsplothandlername \endgroup \def \pgfplotsplothandlerLUAfactory {function(axis, pointmetainputhandler) return pgfplots.GenericPlothandler.new("\pgfplotsplothandlername ", axis,pointmetainputhandler) end}\def \pgfplotsplothandlerLUAvisualizerfactory {pgfplots.defaultPlotVisualizerFactory}}\pgfkeysdef {/pgfplots/legend image code}{\draw [/pgfplots/mesh=false,bar width=3pt,bar shift=0pt,mark repeat=2,mark phase=2,] plot coordinates { (0cm,0cm) (0.3cm,0cm) (0.6cm,0cm)};}\pgfkeysdef {/pgfplots/every legend image post}{}\pgfkeyssetvalue {/pgfplots/mark list fill}{.!80!black}\pgfkeysdef {/pgfplots/every crossref picture}{\pgfkeysalso {baseline,yshift=0.3em}}\pgfplots@show@small@legendplots {red={\pgfkeysnovalue },every mark/.append style={fill=red!80!black},mark={square*},densely dotted={\pgfkeysnovalue },/utils/exec={\if 0\pgfplotsplothandlermesh@matrixinput \pgfkeysalso {/pgfplots/mesh input=lattice}\fi },mark={none}}{}}\ifpgfpicture \scope [/pgfplots/every crossref picture]\pgfplots@draw@image \endscope \else \expandafter \ifx \csname tikzappendtofigurename\endcsname \relax \else \begingroup \tikzappendtofigurename {_crossref}\fi \tikz [/pgfplots/every crossref picture]{\pgfplots@draw@image }\expandafter \ifx \csname tikzappendtofigurename\endcsname \relax \else \endgroup \fi \fi \endgroup }
\expandafter \gdef \csname pgfplots@labelstyle@figref:l\endcsname {brown!60!black={\pgfkeysnovalue },every mark/.append style={fill=brown!80!black},mark={otimes*},solid={\pgfkeysnovalue },/utils/exec={\if 0\pgfplotsplothandlermesh@matrixinput \pgfkeysalso {/pgfplots/mesh input=lattice}\fi },mark={none}}
\expandafter \gdef \csname pgfplots@show@ref@figref:l\endcsname {\begingroup \def \pgfplots@draw@image {\def \tikz@plot@handler {\pgfkeys {/pgf/plots/@handler options/.cd, start=\relax , end macro=\relax , point macro=\pgfutil@gobble , jump macro=\relax , special macro=\pgfutil@gobble , point macro=\pgf@plot@line@handler , jump=\global \let \pgf@plotstreampoint \pgf@plot@line@handler@move }\begingroup \escapechar =-1 \edef \pgfplotsplothandlername {\string \pgfplothandlerlineto }\pgfmath@smuggleone \pgfplotsplothandlername \endgroup \def \pgfplotsplothandlerLUAfactory {function(axis, pointmetainputhandler) return pgfplots.GenericPlothandler.new("\pgfplotsplothandlername ", axis,pointmetainputhandler) end}\def \pgfplotsplothandlerLUAvisualizerfactory {pgfplots.defaultPlotVisualizerFactory}}\pgfkeysdef {/pgfplots/legend image code}{\draw [/pgfplots/mesh=false,bar width=3pt,bar shift=0pt,mark repeat=2,mark phase=2,] plot coordinates { (0cm,0cm) (0.3cm,0cm) (0.6cm,0cm)};}\pgfkeysdef {/pgfplots/every legend image post}{}\pgfkeyssetvalue {/pgfplots/mark list fill}{.!80!black}\pgfkeysdef {/pgfplots/every crossref picture}{\pgfkeysalso {baseline,yshift=0.3em}}\pgfplots@show@small@legendplots {brown!60!black={\pgfkeysnovalue },every mark/.append style={fill=brown!80!black},mark={otimes*},solid={\pgfkeysnovalue },/utils/exec={\if 0\pgfplotsplothandlermesh@matrixinput \pgfkeysalso {/pgfplots/mesh input=lattice}\fi },mark={none}}{}}\ifpgfpicture \scope [/pgfplots/every crossref picture]\pgfplots@draw@image \endscope \else \expandafter \ifx \csname tikzappendtofigurename\endcsname \relax \else \begingroup \tikzappendtofigurename {_crossref}\fi \tikz [/pgfplots/every crossref picture]{\pgfplots@draw@image }\expandafter \ifx \csname tikzappendtofigurename\endcsname \relax \else \endgroup \fi \fi \endgroup }
\@writefile{toc}{\contentsline {paragraph}{\nonumberline Problem III.1 \relax \fontsize {10.95}{13.6}\selectfont \abovedisplayskip 11\p@ plus3\p@ minus6\p@ \abovedisplayshortskip \z@ plus3\p@ \belowdisplayshortskip 6.5\p@ plus3.5\p@ minus3\p@ \belowdisplayskip \abovedisplayskip \let \leftmargin \leftmargini \parsep 4.5\p@ plus2\p@ minus\p@ \topsep 9\p@ plus3\p@ minus5\p@ \itemsep 4.5\p@ plus2\p@ minus\p@ \leftmargin \leftmargini \parsep 4.5\p@ plus2\p@ minus\p@ \topsep 9\p@ plus3\p@ minus5\p@ \itemsep 4.5\p@ plus2\p@ minus\p@ (storage adequacy).}{1}{section*.1}}
\providecommand*\caption@xref[2]{\@setref\relax\@undefined{#1}}
\newlabel{figref:w}{{\expandafter\protect\csname pgfplots@show@ref@figref:w\endcsname}{1}{Problem III.1 \normalsize (storage adequacy)}{pgfplotslink.0.0}{}}
\newlabel{figref:s}{{\expandafter\protect\csname pgfplots@show@ref@figref:s\endcsname}{1}{Problem III.1 \normalsize (storage adequacy)}{pgfplotslink.0.1}{}}
\newlabel{figref:l}{{\expandafter\protect\csname pgfplots@show@ref@figref:l\endcsname}{1}{Problem III.1 \normalsize (storage adequacy)}{pgfplotslink.0.2}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Diurnal and synoptic variations of wind and solar power generation \(G_{N,w}(t)\) \autoref {figref:w} and \(G_{S,s}(t)\) \autoref {figref:s}, and a constant load (all in per-unit) \(L(t)\) \autoref {figref:l}.\relax }}{1}{figure.caption.2}}
\newlabel{fig:variations}{{1}{1}{Diurnal and synoptic variations of wind and solar power generation \(G_{N,w}(t)\) \autoref {figref:w} and \(G_{S,s}(t)\) \autoref {figref:s}, and a constant load (all in per-unit) \(L(t)\) \autoref {figref:l}.\relax }{figure.caption.2}{}}
\newlabel{tab:prices}{{\caption@xref {tab:prices}{ on input line 172}}{2}{Problem III.1 \normalsize (storage adequacy)}{table.caption.3}{}}
\@writefile{lot}{\contentsline {table}{\numberline {1}{\ignorespaces Investment costs of renewable energy infrastructure.\relax }}{2}{table.caption.3}}
\@writefile{toc}{\contentsline {paragraph}{\nonumberline Problem III.2 \relax \fontsize {10.95}{13.6}\selectfont \abovedisplayskip 11\p@ plus3\p@ minus6\p@ \abovedisplayshortskip \z@ plus3\p@ \belowdisplayshortskip 6.5\p@ plus3.5\p@ minus3\p@ \belowdisplayskip \abovedisplayskip \let \leftmargin \leftmargini \parsep 4.5\p@ plus2\p@ minus\p@ \topsep 9\p@ plus3\p@ minus5\p@ \itemsep 4.5\p@ plus2\p@ minus\p@ \leftmargin \leftmargini \parsep 4.5\p@ plus2\p@ minus\p@ \topsep 9\p@ plus3\p@ minus5\p@ \itemsep 4.5\p@ plus2\p@ minus\p@ (storage optimization with PyPSA).}{2}{section*.4}}
This diff is collapsed.
\documentclass[11pt,a4paper,fleqn]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[colorlinks=true, citecolor=blue, linkcolor=blue, filecolor=blue,urlcolor=blue]{hyperref}
\hypersetup{
colorlinks = true,
citecolor = gray
}
\usepackage{wrapfig}
\usepackage{caption}
\captionsetup{format=plain, indent=5pt, font=footnotesize, labelfont=bf}
\setkomafont{disposition}{\scshape\bfseries}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{bbm}
\usepackage{mathtools}
% \usepackage{epsfig}
% \usepackage{grffile}
%\usepackage{times}
%\usepackage{babel}
\usepackage{tikz}
\usepackage{paralist}
\usepackage{color}
\usepackage[top=3cm, bottom=2.5cm, left=2.5cm, right=3cm]{geometry}
%\setlength{\mathindent}{1ex}
% PGF
\usepackage{pgfplots}
\usepackage{pgf}
\usepackage{siunitx}
\usepackage{xfrac}
\usepackage{calculator}
\usepackage{calculus}
\usepackage{eurosym}
\usepackage{booktabs}
%\sisetup{per-mode=fraction,%
% fraction-function=\sfrac}
%\newcommand{\eur}[1]{\EUR{#1}\si{\per\kilo\meter}}
\pgfplotsset{
compat=newest,
every axis/.append style={small, minor tick num=3}
}
%\usepackage[backend=biber,style=alphabetic,url=false,doi=false]{biblatex}
%\addbibresource{sheet01_biber.bib}
% \addbibresource{/home/coroa/papers/refs.bib}
\newcommand{\id}{\mathbbm{1}}
\newcommand{\NN}{{\mathbbm{N}}}
\newcommand{\ZZ}{{\mathbbm{Z}}}
\newcommand{\RR}{{\mathbbm{R}}}
\newcommand{\CC}{{\mathbbm{C}}}
\renewcommand{\vec}[1]{{\boldsymbol{#1}}}
\renewcommand{\i}{\mathrm{i}}
\newcommand{\expect}[1]{\langle\,#1\,\rangle}
\newcommand{\e}[1]{\ensuremath{\,\mathrm{#1}}}
\renewcommand{\O}{\mc{O}}
\newcommand{\veps}{\varepsilon}
\newcommand{\ud}[1]{\textup{d}#1\,}
\newcommand{\unclear}[1]{\color{green}#1}
\newcommand{\problem}[1]{\color{red}#1}
\newcommand{\rd}[1]{\num[round-mode=places,round-precision=1]{#1}}
%\DeclareSIUnit{\euro}{\EUR}
\DeclareSIUnit{\dollar}{\$}
\newcommand{\eur}{\text{\EUR{}}}
\usepackage{palatino}
\usepackage{mathpazo}
\setlength\parindent{0pt}
\usepackage{xcolor}
\usepackage{framed}
\definecolor{shadecolor}{rgb}{.9,.9,.9}
%=====================================================================
%=====================================================================
\begin{document}
\begin{center}
\textbf{\Large Energy System Modelling }\\
{SS 2018, Karlsruhe Institute of Technology}\\
{Institute of Automation and Applied Informatics}\\ [1em]
\textbf{\textsc{\Large Tutorial III: Storage Optimisation}}\\
\small Will be worked on in the exercise session on Monday, 16 July 2018.\\[1.5em]
\end{center}
\vspace{.5em}
%=============== ======================================================
\paragraph{Problem III.1 \normalsize (storage adequacy).}~\\
%=====================================================================
\begin{wrapfigure}[11]{r}{0pt}
\begin{tikzpicture}
\begin{axis}[
domain=0:14, no markers, samples=200
% xlabel = $x$, ylabel = $f(x)$
]
\addplot+[dashed] {0.3 * (1 + 0.9 * sin(deg(2*pi*x/7)))}; \label{figref:w}
\addplot+[densely dotted] {0.12*(1 + sin(deg(2*pi*x))}; \label{figref:s}
\addplot+[solid] {1}; \label{figref:l}
\end{axis}
\end{tikzpicture}
\caption{Diurnal and synoptic variations of wind and solar power generation
\(G_{N,w}(t)\)
\autoref{figref:w} and \(G_{S,s}(t)\)
\autoref{figref:s}, and a constant load (all in per-unit) \(L(t)\)
\autoref{figref:l}.}
\label{fig:variations}
\end{wrapfigure}
Imagine a two-node Germany. The South can install solar panels with a capacity factor $Cf_s$ to cover its load $L_S$, while the North uses wind turbines that have a capacity factor $Cf_w$
to feed their load $L_N$. Figure \ref{fig:variations} shows approximations to the daily and synoptic variations of per-unit wind and solar power generation \(G_{N,w}(t)\) and \(G_{S,s}(t)\) and a constant load \(L_{N/S}(t)\):
\vspace{-0.5em}
\begin{align*}
G_{N,w}(t) &= Cf_w(1+A_w \sin \omega_w t), \\
G_{S,s}(t) &= Cf_s(1+A_s \sin \omega_s t), \\
L_{N/S}(t) &= A_{l,N/S}.
\end{align*}
The capacity factors and constants are
\vspace{-0.25em}
\begin{align*}
A_{l,N} &= 20 \si{\giga\watt}, &A_{l,S}&= 30 \si{\giga\watt},\\
Cf_w &= 0.3, &A_w &= 0.9, &\omega_w &= \frac{2\pi}{7 \text{d}}, \\
Cf_s &= 0.12, &A_s &= 1.0, &\omega_s &= \frac{2\pi}{1 \text{d}}. \\
\end{align*}
\vspace{-0.3em}
For now, assume the stores are lossless. Losses will be considered in III.2.
\begin{enumerate}[(a)]
% (a)
\item How much wind capacity $G_{N,w}$ must be installed in the North and solar capacity $G_{S,s}$ in the South?
% (b)
\item What is the amount of store and dispatch power capacity $G_{s,store}=\max(-g_s(t))$ and $G_{s,dispatch}= \max g_s(t)$ the storages must have in the North and in the South?
% (c)
\item What is the amount of energy capacity one needs in the North and in the South?
\begin{equation*}
E_s = \max_t e_s(t) = \max_t \int_{0}^{t} (-g_s(t')) \;\mathrm{d}t'
\end{equation*}
% (d)
\item Should they choose hydrogen or battery storages? And how much would it cost them with the prices in Table 1? Is the South or the North paying more for their energy?
\item What do you imagine would change if you considered the storage losses given in Table 1 in your results (a)-(d)? Support your statement with a graphical illustration.
\end{enumerate}
Now we lift the restriction against transmission and allow them to bridge their 500 km separation with a transmission line.
\begin{enumerate}[(e)]
% (e)
\item Estimate the cost-optimal technology mix by assuming wind energy in the North is only stored in the North and solar energy in the South is likewise only stored in the South! What would happen if you dropped that assumption?
\end{enumerate}
\begin{table}[]
\centering
\label{tab:prices}
\begin{tabular}{@{}lrrrr@{}}
\toprule
& \eur per kW & \eur per kWh & $\eta_{store}$ & $\eta_{dispatch}$ \\ \midrule
Battery & 300 & 200 & 0.9 & 0.9 \\
Hydrogen & 750 & 10 & 0.75 & 0.58 \\
Solar & 600 & & & \\
Wind & 1200 & & & \\
Transmission line (500 km) & 200 & & & \\ \bottomrule
\end{tabular}
\caption{Investment costs of renewable energy infrastructure.}
\end{table}
%=============== ======================================================
\paragraph{Problem III.2 \normalsize (storage optimization with PyPSA).}~\\
%=====================================================================
Python for Power System Analysis (PyPSA) is a free software toolbox for optimising modern power systems that include features such as variable wind and solar generation, storage units, etc\.. Use the toolbox to extend on your findings in Problem III.1.
\begin{enumerate}[(a)]
\item Build a network in PyPSA with the two buses North and South and attach the load at each bus and attach the wind and solar generators with availability according to $G_{N,w}(t) = Cf_w(1+A_w\sin \omega_w t)$ and $G_{S,s}(t) = Cf_s(1+A_s\sin \omega_s t)$ for a year (you have to call \texttt{set\_snapshots} for the year) and with \texttt{p\_nom\_extendable} set to True. As help you should have a look at the minimal LOPF example\footnote{\url{https://www.pypsa.org/examples/minimal_example_lopf.html}}, understand what the components documentation\footnote{\url{https://pypsa.org/doc/components.html}} of PyPSA gives you and that you can find the underlying objective function and constraints in the LOPF documentation\footnote{\url{https://pypsa.org/doc/optimal_power_flow.html\#linear-optimal-power-flow}}.
\item Attach extendable storages at the North and the South! The storages have to be modelled as an \texttt{H2-bus} (a bus with \texttt{carrier='H2'}) linked to the \texttt{AC-bus} North with a \texttt{Link} where \texttt{p\_nom\_extendable=True} with the \texttt{capital\_cost} of the power capacity and an also extendable \texttt{Store} with the \texttt{capital\_cost} of the energy capacity, for instance. The losses can be set on the links as \texttt{efficiency}.
\item Run an investment optimization by calling the \texttt{lopf} function.
\item How do your results \texttt{objective} and \texttt{{generators,stores,links}.p\_nom\_opt} compare with the results of III.1(d)?
\item Now lift the restriction against transmission and allow North and South to bridge their 500 km separation with a transmission line. How does the cost optimal technology mix change compared to III.1(f)?