"> **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 @@
...
@@ -435,7 +458,10 @@
"***\n",
"***\n",
"**(c) Now assume that there is a seasonal shift in the wind signal\n",
"**(c) Now assume that there is a seasonal shift in the wind signal\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)"
"**(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."
"**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",
"cell_type": "markdown",
"metadata": {},
"metadata": {},
"source": [
"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}$."
"> **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 @@
...
@@ -224,7 +225,10 @@
"***\n",
"***\n",
"**(c) Now assume that there is a seasonal shift in the wind signal\n",
"**(c) Now assume that there is a seasonal shift in the wind signal\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)"
"**(a) Compile the nodes list and the edge list.**\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 @@
...
@@ -137,7 +137,8 @@
},
},
"source": [
"source": [
"***\n",
"***\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 @@
...
@@ -208,7 +209,8 @@
},
},
"source": [
"source": [
"***\n",
"***\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 @@
...
@@ -269,7 +271,8 @@
},
},
"source": [
"source": [
"***\n",
"***\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 @@
...
@@ -316,7 +319,8 @@
},
},
"source": [
"source": [
"***\n",
"***\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 @@
...
@@ -395,7 +399,8 @@
},
},
"source": [
"source": [
"***\n",
"***\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 @@
...
@@ -418,9 +423,9 @@
},
},
"source": [
"source": [
"***\n",
"***\n",
"## Problem II.3\n",
"## Problem II.2\n",
"\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)"
"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$."
]
]
},
},
...
@@ -588,7 +593,7 @@
...
@@ -588,7 +593,7 @@
"source": [
"source": [
"***\n",
"***\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",
"**(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 @@
...
@@ -599,7 +604,8 @@
}
}
},
},
"source": [
"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$."
"**(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 @@
...
@@ -86,7 +87,8 @@
"metadata": {},
"metadata": {},
"source": [
"source": [
"***\n",
"***\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 @@
...
@@ -101,7 +103,8 @@
"metadata": {},
"metadata": {},
"source": [
"source": [
"***\n",
"***\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 @@
...
@@ -116,7 +119,8 @@
"metadata": {},
"metadata": {},
"source": [
"source": [
"***\n",
"***\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 @@
...
@@ -131,7 +135,8 @@
"metadata": {},
"metadata": {},
"source": [
"source": [
"***\n",
"***\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 @@
...
@@ -146,7 +151,7 @@
"metadata": {},
"metadata": {},
"source": [
"source": [
"***\n",
"***\n",
"## Problem II.3\n",
"## Problem II.2\n",
"\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). 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)"
"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$."
]
]
},
},
...
@@ -296,7 +301,7 @@
...
@@ -296,7 +301,7 @@
"source": [
"source": [
"***\n",
"***\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",
"**(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)."