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.
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)]
\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 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, calculate the maximum, mean, and variance of the time series.
\item For all three regions, plot the time series \(W(t)\),
\item For all three regions, plot the time series \(W(t)\),
\(S(t)\),
\(S(t)\),
\(L(t)\) for a winter month (January) and a summer month (July).
\(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 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 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)$:
\item Apply a (Fast) Fourier Transform to the the three time series $X \in W(t), S(t), L(t)$:
\begin{equation*}
\begin{equation*}
\tilde{X}(\omega) = \int_0^T X(t) e^{\i\omega t}\,\ud t \, .
\tilde{X}(\omega) = \int_0^T X(t) e^{\i\omega t}\,\ud t \, .
\end{equation*}
\end{equation*}
For all three regions, plot the energy spectrum
For all three regions, plot the energy spectrum
$\left| \tilde{\Delta}(\omega)\right|^2$ as a function of
$\left| \tilde{\Delta}(\omega)\right|^2$ as a function of
$\omega$. Discuss the relationship of these results with the
$\omega$. Discuss the relationship of these results with the
findings obtained in (b)-(e).
findings obtained in (b)-(e).
\item Normalize the time series to one, so that \(\expect{W}=\expect{S}=\expect{L}=1\).
\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
Now, for all three regions, plot the mismatch time series
zooms through most basic general python control structures (only
zooms through most basic general python control structures (only
brush over it and stop reading early, i.e. if you read the word
brush over it and stop reading early, i.e. if you read the word
\verb+classes+ you already know too much).
\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\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.
\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}
\end{itemize}
Further reference material of help is:
Further reference material of help is:
\begin{itemize}
\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 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.
\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.
\foreach\from/\to in {n0/n1,n1/n2,n1/n4,n1/n5,n2/n4,n2/n3,n3/n4,n4/n5}
\foreach\from/\to in {n0/n1,n1/n2,n1/n4,n1/n5,n2/n4,n2/n3,n3/n4,n4/n5}
\draw (\from) -- (\to);
\draw (\from) -- (\to);
\end{tikzpicture}
\end{tikzpicture}
\caption{Simple Network}
\caption{Simple Network}
\label{fig:network}
\label{fig:network}
\end{wrapfigure}
\end{wrapfigure}
Consider the simple network shown ins Figure \ref{fig:network}. Calculate in Python or by hand:
Consider the simple network shown ins Figure \ref{fig:network}. Calculate in Python or by hand:
\begin{enumerate}[(a)]
\begin{enumerate}[(a)]
\item Compile the \textit{nodes list} and the \textit{edge list}.\\~\\
\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).
\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 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 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 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 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 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}.
\item Find the \textit{diameter} of the network by looking at Figure \ref{fig:network}.
\end{enumerate}
\end{enumerate}
...
@@ -128,32 +128,32 @@ If you map the nodes to countries like \texttt{0=DK, 1=DE, 2=CH, 3=IT, 4=AT,5=CZ
...
@@ -128,32 +128,32 @@ If you map the nodes to countries like \texttt{0=DK, 1=DE, 2=CH, 3=IT, 4=AT,5=CZ
is the weighted Laplacian. For simplicity, we assume identity reactance on all links $x_l =1$.
is the weighted Laplacian. For simplicity, we assume identity reactance on all links $x_l =1$.
\begin{enumerate}[(a)]
\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.\\~\\
\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}.
\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.
\item Determine the average flow on each link for 01-2017 and draw it as a directed network.
\caption{Diurnal and synoptic variations of wind and solar power generation
\caption{Diurnal and synoptic variations of wind and solar power generation
\(G_{N,w}(t)\)
\(G_{N,w}(t)\)
\autoref{figref:w} and \(G_{S,s}(t)\)
\autoref{figref:w} and \(G_{S,s}(t)\)
\autoref{figref:s}, and a constant load (all in per-unit) \(L(t)\)
\autoref{figref:s}, and a constant load (all in per-unit) \(L(t)\)
\autoref{figref:l}.}
\autoref{figref:l}.}
\label{fig:variations}
\label{fig:variations}
\end{wrapfigure}
\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$
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$
...
@@ -125,61 +125,61 @@ to feed their load $L_N$. Figure \ref{fig:variations} shows approximations to th
...
@@ -125,61 +125,61 @@ to feed their load $L_N$. Figure \ref{fig:variations} shows approximations to th
For now, assume the stores are lossless. Losses will be considered in III.2.
For now, assume the stores are lossless. Losses will be considered in III.2.
\begin{enumerate}[(a)]
\begin{enumerate}[(a)]
% (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?
\item How much wind capacity $G_{N,w}$ must be installed in the North and solar capacity $G_{S,s}$ in the South?
% (b)
% (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?
\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)
% (c)
\item What is the amount of energy capacity one needs in the North and in the South?
\item What is the amount of energy capacity one needs in the North and in the South?
\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 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.
\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}
\end{enumerate}
Now we lift the restriction against transmission and allow them to bridge their 500 km separation with a transmission line.
Now we lift the restriction against transmission and allow them to bridge their 500 km separation with a transmission line.
\begin{enumerate}[(e)]
\begin{enumerate}[(e)]
% (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?
\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}
\end{enumerate}
\begin{table}[]
\begin{table}[]
\centering
\centering
\label{tab:prices}
\label{tab:prices}
\begin{tabular}{@{}lrrrr@{}}
\begin{tabular}{@{}lrrrr@{}}
\toprule
\toprule
&\eur per kW &\eur per kWh &$\eta_{store}$&$\eta_{dispatch}$\\\midrule
&\eur per kW &\eur per kWh &$\eta_{store}$&$\eta_{dispatch}$\\\midrule
Battery & 300 & 200 & 0.9 & 0.9 \\
Battery & 300 & 200& 0.9 & 0.9 \\
Hydrogen & 750 & 10 & 0.75 & 0.58 \\
Hydrogen & 750 & 10& 0.75 & 0.58 \\
Solar & 600 &&&\\
Solar & 600 &&&\\
Wind & 1200 &&&\\
Wind & 1200 &&&\\
Transmission line (500 km) & 200 &&&\\\bottomrule
Transmission line (500 km) & 200 &&&\\\bottomrule
\end{tabular}
\end{tabular}
\caption{Investment costs of renewable energy infrastructure.}
\caption{Investment costs of renewable energy infrastructure.}
@@ -189,11 +189,11 @@ For now, assume the stores are lossless. Losses will be considered in III.2.
...
@@ -189,11 +189,11 @@ For now, assume the stores are lossless. Losses will be considered in III.2.
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.
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)]
\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 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 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 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 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)?
\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)?
\item Replace the approximated availability time-series of the wind and the solar generators with the ones from \texttt{availability.csv} computed from reanalysis weather data available on the course homepage\footnote{\url{https://nworbmot.org/courses/complex_renewable_energy_networks/}} and re-run the LOPF. Compare the results! Explain the differences by looking at the cumulative variations relative to the mean of the availability time-series!
\item Replace the approximated availability time-series of the wind and the solar generators with the ones from \texttt{availability.csv} computed from reanalysis weather data available on the course homepage\footnote{\url{https://nworbmot.org/courses/complex_renewable_energy_networks/}} and re-run the LOPF. Compare the results! Explain the differences by looking at the cumulative variations relative to the mean of the availability time-series!