Commit d09d7f7b authored by sp2668's avatar sp2668

corrections and additional remarks

parent 4992e412
No preview for this file type
......@@ -101,7 +101,7 @@ They describe (quasi-real) time series for wind power generation \(W(t)\), solar
\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
$\left| \tilde{X}(\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\).
......
This diff is collapsed.
......@@ -8,7 +8,29 @@
}
},
"source": [
"# Energy System Modelling - Solutions to Tutorial II.1"
"# Energy System Modelling - Solutions to Tutorial I.2"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"We use approximations to seasonal variations of wind and solar power generation $W(t)$\n",
"and $S(t)$ and load $L(t)$:\n",
"$$W(t) = 1 + A_W \\cos \\omega t$$\n",
"$$S(t) = 1 - A_S \\cos \\omega t$$\n",
"$$L(t) = 1 + A_L \\cos \\omega t$$\n",
"\n",
"The time series are normalized to $\\langle{W}\\rangle = \\langle{S}\\rangle = \\langle{L}\\rangle := \\frac{1}{T} \\int_0^T L(t)\n",
"d t = 1$, and the constants have the values\n",
"\n",
"$$\\omega = \\frac{2\\pi}{T} $$\n",
"$$T = 1 \\text{ year}$$\n",
"$$ A_W = 0.4 $$ $$ A_S = 0.75 $$ $$ A_L = 0.1 $$\n"
]
},
{
......@@ -313,7 +335,8 @@
"source": [
"***\n",
"**(a) What is the seasonal optimal mix $\\alpha$, which minimizes**\n",
"$$\\langle\\left[ \\alpha W(\\cdot) + (1-\\alpha) S(\\cdot) - L(\\cdot) \\right]^2 \\rangle = \\frac1T \\int_0^T \\left[ \\alpha W(t) + (1-\\alpha) S(t) - L(t) \\right]^2 \\,\\mathrm d t$$"
"$$\\langle\\left[ \\alpha W(\\cdot) + (1-\\alpha) S(\\cdot) - L(\\cdot) \\right]^2 \\rangle = \\frac1T \\int_0^T \\left[ \\alpha W(t) + (1-\\alpha) S(t) - L(t) \\right]^2 \\,\\mathrm d t$$\n",
"> **Hint:** You can use the function [`scipy.optimize.minimize`](https://docs.scipy.org/doc/scipy-1.0.0/reference/generated/scipy.optimize.minimize.html) and use e.g. [`method='nelder-mead'`](https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method)."
]
},
{
......@@ -435,7 +458,10 @@
"***\n",
"**(c) Now assume that there is a seasonal shift in the wind signal\n",
"$$ W(t) = 1 + A_W \\cos \\left( \\omega t - \\phi \\right).$$\n",
"Express the optimal mix $\\alpha$ as a function of $\\phi$.**"
"Express the optimal mix $\\alpha$ as a function of $\\phi$.**\n",
"> **Remark:** Note, that $\\alpha\\in [0,1]$ and you need to add this as bounds.\n",
"\n",
"> **Hint:** If you encounter problems (why?), try another optimisation algorithm [`method='TNC'`](https://en.wikipedia.org/wiki/Truncated_Newton_method)"
]
},
{
......
......@@ -447,7 +447,10 @@
"metadata": {},
"source": [
"***\n",
"**(d) For all three regions, plot the duration curve for $W(t)$, $S(t)$, $L(t)$.** "
"**(d) For all three regions, plot the duration curve for $W(t)$, $S(t)$, $L(t)$.** \n",
"> **Hint:** You might want to make use of the functions [`.sort_values`](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.sort_values.html) and [`.reset_index`](https://pandas.pydata.org/pandas-docs/version/0.23/generated/pandas.DataFrame.reset_index.html)\n",
"\n",
"> **Tip:** Go through the line `de['wind'].sort_values(ascending=False).reset_index(drop=True).plot()` dot by dot and note what happens to the output."
]
},
{
......@@ -551,21 +554,16 @@
"\n",
"$$\\tilde{X}(\\omega) = \\int_0^T X(t) \\;e^{i\\omega t} \\;\\mathrm{d}t.$$\n",
"\n",
"**For all three regions, plot the energy spectrum $\\|\\tilde{\\Delta}(\\omega)\\|^2$ as a function of $\\omega$. Discuss the relationship of these results with the findings obtained in (b)-(f).**"
"**For all three regions, plot the energy spectrum $\\|\\tilde{X}(\\omega)\\|^2$ as a function of $\\omega$. Discuss the relationship of these results with the findings obtained in (b)-(f).**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"> **Hint:** To determine the frequencies `rfffreq` can be used, the argument `d` indicates the distance between two data points, `1h` hour, which we specify as $\\frac{1}{8760} a$, so that the frequencies come out in the unit $\\frac{1}{a}$."
"> **Remark:** Use the function [`numpy.fft.rfft`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.rfft.html) and make sure you subtract the mean.\n",
"\n",
"> **Remark:** To determine the frequencies [`numpy.fft.rfffreq`](https://docs.scipy.org/doc/numpy-1.12.0/reference/generated/numpy.fft.rfftfreq.html) is used, the argument `d` indicates the distance between two data points, `1h` hour, which we specify as $\\frac{1}{8760} a$, so that the frequencies come out in the unit $\\frac{1}{a}$."
]
},
{
......
......@@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Energy System Modelling - Tutorial II.1"
"# Energy System Modelling - Tutorial I.2"
]
},
{
......@@ -29,40 +29,40 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Parameters"
"## Imports"
]
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"A_w = 0.4\n",
"A_s = 0.75\n",
"A_l = 0.1\n",
"T = 1\n",
"phi = 0"
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import scipy.integrate as integrate\n",
"from scipy.optimize import minimize\n",
"%matplotlib inline"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Imports"
"## Parameters"
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 30,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import scipy.integrate as integrate\n",
"from scipy.optimize import minimize\n",
"%matplotlib inline"
"A_w = 0.4\n",
"A_s = 0.75\n",
"A_l = 0.1\n",
"T = 1\n",
"phi = 0"
]
},
{
......@@ -192,7 +192,8 @@
"source": [
"***\n",
"**(a) What is the seasonal optimal mix $\\alpha$, which minimizes**\n",
"$$\\langle\\left[ \\alpha W(\\cdot) + (1-\\alpha) S(\\cdot) - L(\\cdot) \\right]^2 \\rangle = \\frac1T \\int_0^T \\left[ \\alpha W(t) + (1-\\alpha) S(t) - L(t) \\right]^2 \\,\\mathrm d t$$"
"$$\\langle\\left[ \\alpha W(\\cdot) + (1-\\alpha) S(\\cdot) - L(\\cdot) \\right]^2 \\rangle = \\frac1T \\int_0^T \\left[ \\alpha W(t) + (1-\\alpha) S(t) - L(t) \\right]^2 \\,\\mathrm d t$$\n",
"> **Hint:** You can use the function [`scipy.optimize.minimize`](https://docs.scipy.org/doc/scipy-1.0.0/reference/generated/scipy.optimize.minimize.html) and use e.g. [`method='nelder-mead'`](https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method)."
]
},
{
......@@ -224,7 +225,10 @@
"***\n",
"**(c) Now assume that there is a seasonal shift in the wind signal\n",
"$$ W(t) = 1 + A_W \\cos \\left( \\omega t - \\phi \\right).$$\n",
"Express the optimal mix $\\alpha$ as a function of $\\phi$.**"
"Express the optimal mix $\\alpha$ as a function of $\\phi$.**\n",
"> **Remark:** Note, that $\\alpha\\in [0,1]$ and you need to add this as bounds.\n",
"\n",
"> **Hint:** If you encounter problems (why?), try another optimisation algorithm [`method='TNC'`](https://en.wikipedia.org/wiki/Truncated_Newton_method)"
]
},
{
......
No preview for this file type
......@@ -128,7 +128,7 @@ If you map the nodes to countries like \texttt{0=DK, 1=DE, 2=CH, 3=IT, 4=AT,5=CZ
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}
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$.
......
......@@ -61,7 +61,7 @@
"source": [
"***\n",
"**(a) Compile the nodes list and the edge list.**\n",
"> **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)."
"> **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)."
]
},
{
......@@ -137,7 +137,8 @@
},
"source": [
"***\n",
"**(c) Compute the adjacency matrix $A$ and check that it is symmetric.**"
"**(c) Compute the adjacency matrix $A$ and check that it is symmetric.**\n",
"> In graph theory and computer science, an adjacency matrix is a square matrix used to represent a finite graph. The elements of the matrix indicate whether pairs of vertices are adjacent or not in the graph."
]
},
{
......@@ -208,7 +209,8 @@
},
"source": [
"***\n",
"**(d) Find the $k_n$ of each node $n$ and compute the average degree of the network.**"
"**(d) Find the degree $k_n$ of each node $n$ and compute the average degree of the network.**\n",
"> In graph theory, the degree (or valency) of a vertex of a graph is the number of edges incident to the vertex, with loops counted twice."
]
},
{
......@@ -269,7 +271,8 @@
},
"source": [
"***\n",
"**(e) Determine the 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.**"
"**(e) Determine the 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.**\n",
"> The unoriented incidence matrix (or simply incidence matrix) of an undirected graph is a $n \\times m$ matrix $B$, where n and m are the numbers of vertices and edges respectively, such that $B_{i,j} = 1$ if the vertex $v_i$ and edge $e_j$ are incident and 0 otherwise."
]
},
{
......@@ -316,7 +319,8 @@
},
"source": [
"***\n",
"**(f) Compute the 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.**"
"**(f) Compute the 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.**\n",
"> The **Laplacian** (also: admittance matrix, Kirchhoff matrix, discrete Laplacian) is a matrix representation of a graph. It is defined as the difference of degree matrix and adjacency matrix. The **degree matrix** is a diagonal matrix which contains information about the degree of each vertex."
]
},
{
......@@ -395,7 +399,8 @@
},
"source": [
"***\n",
"**(g) Find the diameter of the network by looking at the graph.**"
"**(g) Find the diameter of the network by looking at the graph.**\n",
"> The diameter of a network is the longest of all the calculated shortest paths in a network. It is the shortest distance between the two most distant nodes in the network. In other words, once the shortest path length from every node to all other nodes is calculated, the diameter is the longest of all the calculated path lengths. The diameter is representative of the linear size of a network. "
]
},
{
......@@ -418,9 +423,9 @@
},
"source": [
"***\n",
"## Problem II.3\n",
"## Problem II.2\n",
"\n",
"If you map the nodes to `0=DK, 1=DE, 2=CH, 3=IT, 4=AT,5=CZ` the network represents a small part of the European electricity network (albeit very simplified). On the [course homepage](https://nworbmot.org/courses/complex_renewable_energy_networks/), you can find the power imbalance time series for the six countries for January 2017 in hourly MW in the file `imbalance.csv`. They have been derived from physical flows as published by [ENTSO-E](https://transparency.entsoe.eu/transmission-domain/physicalFlow/show)"
"If you map the nodes to `0=DK, 1=DE, 2=CH, 3=IT, 4=AT,5=CZ` the network represents a small part of the European electricity network (albeit very simplified). In the repository, you can find the power imbalance time series for the six countries for January 2017 in hourly MW in the file `imbalance.csv`. They have been derived from physical flows as published by [ENTSO-E](https://transparency.entsoe.eu/transmission-domain/physicalFlow/show)"
]
},
{
......@@ -432,7 +437,7 @@
},
"source": [
"The linear power flow is given by\n",
"$$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}$$\n",
"$$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}$$\n",
"is the weighted Laplacian. For simplicity, we assume identity reactance on all links $x_l = 1$."
]
},
......@@ -588,7 +593,7 @@
"source": [
"***\n",
"**(a) Compute the voltage angles $\\theta_j$ and 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.**\n",
"> **Remark:** Linear equation systems are solved efficiently using `numpy.linalg.solve`."
"> **Remark:** Linear equation systems are solved efficiently using [`numpy.linalg.solve`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.solve.html)."
]
},
{
......@@ -599,7 +604,8 @@
}
},
"source": [
"Calculate the *voltage angles* first:"
"Calculate the *voltage angles* first.\n",
"> Note, that we define the node for Denmark as slack and therefore force $\\theta_{DK}=0$."
]
},
{
......
......@@ -71,7 +71,8 @@
"metadata": {},
"source": [
"***\n",
"**(c) Compute the adjacency matrix $A$ and check that it is symmetric.**"
"**(c) Compute the adjacency matrix $A$ and check that it is symmetric.**\n",
"> In graph theory and computer science, an adjacency matrix is a square matrix used to represent a finite graph. The elements of the matrix indicate whether pairs of vertices are adjacent or not in the graph."
]
},
{
......@@ -86,7 +87,8 @@
"metadata": {},
"source": [
"***\n",
"**(d) Find the $k_n$ of each node $n$ and compute the average degree of the network.**"
"**(d) Find the degree $k_n$ of each node $n$ and compute the average degree of the network.**\n",
"> In graph theory, the degree (or valency) of a vertex of a graph is the number of edges incident to the vertex, with loops counted twice."
]
},
{
......@@ -101,7 +103,8 @@
"metadata": {},
"source": [
"***\n",
"**(e) Determine the 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.**"
"**(e) Determine the 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.**\n",
"> The unoriented incidence matrix (or simply incidence matrix) of an undirected graph is a $n \\times m$ matrix $B$, where n and m are the numbers of vertices and edges respectively, such that $B_{i,j} = 1$ if the vertex $v_i$ and edge $e_j$ are incident and 0 otherwise."
]
},
{
......@@ -116,7 +119,8 @@
"metadata": {},
"source": [
"***\n",
"**(f) Compute the 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.**"
"**(f) Compute the 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.**\n",
"> The **Laplacian** (also: admittance matrix, Kirchhoff matrix, discrete Laplacian) is a matrix representation of a graph. It is defined as the difference of degree matrix and adjacency matrix. The **degree matrix** is a diagonal matrix which contains information about the degree of each vertex."
]
},
{
......@@ -131,7 +135,8 @@
"metadata": {},
"source": [
"***\n",
"**(g) Find the diameter of the network by looking at the graph.**"
"**(g) Find the diameter of the network by looking at the graph.**\n",
"> The diameter of a network is the longest of all the calculated shortest paths in a network. It is the shortest distance between the two most distant nodes in the network. In other words, once the shortest path length from every node to all other nodes is calculated, the diameter is the longest of all the calculated path lengths. The diameter is representative of the linear size of a network. "
]
},
{
......@@ -146,7 +151,7 @@
"metadata": {},
"source": [
"***\n",
"## Problem II.3\n",
"## Problem II.2\n",
"\n",
"If you map the nodes to `0=DK, 1=DE, 2=CH, 3=IT, 4=AT,5=CZ` the network represents a small part of the European electricity network (albeit very simplified). On the [course homepage](https://nworbmot.org/courses/complex_renewable_energy_networks/), you can find the power imbalance time series for the six countries for January 2017 in hourly MW in the file `imbalance.csv`. They have been derived from physical flows as published by [ENTSO-E](https://transparency.entsoe.eu/transmission-domain/physicalFlow/show)"
]
......@@ -156,7 +161,7 @@
"metadata": {},
"source": [
"The linear power flow is given by\n",
"$$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}$$\n",
"$$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}$$\n",
"is the weighted Laplacian. For simplicity, we assume identity reactance on all links $x_l = 1$."
]
},
......@@ -296,7 +301,7 @@
"source": [
"***\n",
"**(a) Compute the voltage angles $\\theta_j$ and 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.**\n",
"> **Remark:** Linear equation systems are solved efficiently using `numpy.linalg.solve`."
"> **Remark:** Linear equation systems are solved efficiently using [`numpy.linalg.solve`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.solve.html)."
]
},
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment