diff --git a/SLEW_Case1_Electromagnetic_Phenomena.ipynb b/SLEW_Case1_Electromagnetic_Phenomena.ipynb index 84fda7b16a71852b93692b2bb155ce5883960922..249b4ade4769d7d5ce1de858ea8665b58e5b3179 100644 --- a/SLEW_Case1_Electromagnetic_Phenomena.ipynb +++ b/SLEW_Case1_Electromagnetic_Phenomena.ipynb @@ -110,7 +110,7 @@ "from villas.dataprocessing.timeseries import *\n", "import matplotlib.pyplot as plt\n", "import scipy.io as sio\n", - "outputs = sio.loadmat('outputs/output.mat', simplify_cells=True)\n", + "outputs = sio.loadmat('outputs/case1_output.mat', simplify_cells=True)\n", "\n", "%matplotlib widget" ] diff --git a/SLEW_Case2_Electromechanical_Phenomena.ipynb b/SLEW_Case2_Electromechanical_Phenomena.ipynb index 72d8a55e126a4df7e39a04ba3ece86c291b180ec..69daee33bfbeabc0327c1d0e973d1c24f8d3a54e 100644 --- a/SLEW_Case2_Electromechanical_Phenomena.ipynb +++ b/SLEW_Case2_Electromechanical_Phenomena.ipynb @@ -10,7 +10,6 @@ "</div>\n", "\n", "# SLEW Case 2 - Electromechanical Dynamics: Small-signal Stability\n", - "***Note: This notebook is still under development!***\n", "\n", "## Theoretical background\n", "### The Linearized Swing Equation\n", @@ -44,7 +43,7 @@ "id": "40672b8b-585f-4448-9dac-523d4f33287c", "metadata": {}, "source": [ - "A $200 MVA$ round-rotor generator is connected to an infinite bus system of nominal frequency of $50 Hz$ through a step-up transformer with reactance of $0.13 p.u.$ and a transmission line with reactance of $0.17 p.u.$ . The generator’s reactance and transient reactance are $x_{d} = 0.5 p.u.$ $x'_{d} = 0.23 p.u.$, respectively. The inertia constant $H = 4 s$ and inertia coefficient $M = 8 p.u.$ . The synchoronous generator mechanical power is set to $0.6 p.u.$ and the steady-state emf $E = 1.1 p.u.$\n" + "A $200 MVA$ round-rotor generator is connected to an infinite bus system of nominal frequency of $50 Hz$ through a step-up transformer with reactance of $0.13 p.u.$ and a transmission line with reactance of $0.17 p.u.$ . The generator’s transient reactance is $x'_{d} = 0.23 p.u.$ and the inertia constant is $H = 4 s$. The synchoronous generator mechanical power is set to $0.6 p.u.$ and the steady-state emf $E = 1.1 p.u.$" ] }, { @@ -64,7 +63,7 @@ "metadata": {}, "source": [ "1. If at the given operating point the system eigen-values are as follows:\n", - "$$\\lambda_{1,2} = -0.0625 -+ 0.4943j $$\n", + "$$\\lambda_{1,2} = -0.06254 \\pm 8.8318j $$\n", " a.) Determine whether the system response following a small disturbance is overdamped, critically damped or underdamped.<br>\n", " b.) Verify you findings by calculating the damping coefficient of the synchronous generator and then applying the damping value in VILLASweb and generating the corresponding power and angle plots.<br>\n", " <br>\n", @@ -124,6 +123,8 @@ "from villas.dataprocessing.readtools import *\n", "from villas.dataprocessing.timeseries import *\n", "import matplotlib.pyplot as plt\n", + "import scipy.io as sio\n", + "outputs = sio.loadmat('outputs/case2_output.mat', simplify_cells=True)\n", "\n", "%matplotlib widget" ] @@ -134,7 +135,7 @@ "metadata": {}, "source": [ "### Subtask 1.b\n", - "To check your results, enter your solution for $D$ rounded to 3 digits behind the comma:\n" + "To check your results, enter your solution for $D$ rounded to 4 digits behind the comma:\n" ] }, { @@ -147,7 +148,7 @@ "outputs": [], "source": [ "D=input('D in Subtask 1.b:')\n", - "print('Your result is', 'correct!' if round(float(D),3)==round(outputs['D1'],3) else 'incorrect. You should double-check your calculations.')\n" + "print('Your result is', 'correct!' if round(float(D),4)==round(outputs['D_T1b'],4) else 'incorrect. You should double-check your calculations.')" ] }, { @@ -163,7 +164,8 @@ "id": "e70b8ccc-8d97-4827-ba45-251be9c6ac82", "metadata": {}, "source": [ - "Enter VILLASweb under https://slew.rwth-aachen.de/. Adjust the parameter $D$ and run a corresponding simulation. \n", + "Enter VILLASweb under https://slew.rwth-aachen.de/. \n", + "Adjust the parameter $D$ and run a corresponding simulation. \n", "Then, enter your code snippet for result download in the following cell:" ] }, @@ -195,7 +197,7 @@ "metadata": {}, "outputs": [], "source": [ - "results_file_name='EM_small_signal_JsonSyngenParams.csv'\n", + "results_file_name='SP_SynGenTrStab_SMIB_Fault_SlewCase2_JsonSyngenParams_SP.csv'\n", "\n", "# Get file by name\n", "f = r.get_file_by_name(results_file_name)\n", @@ -208,7 +210,7 @@ "f = f.download(dest=results_file_path)\n", "\n", "# Get time series object from csv\n", - "ts_res1 = read_timeseries_csv(results_file_path, print_status=False)\n", + "ts_res1 = read_timeseries_csv(results_file_path, print_status=True)\n", "\n", "# Plot the currents\n", "plt.figure(figsize=(8,12))\n", @@ -216,15 +218,15 @@ "plt.subplot(2,1,1)\n", "plt.ylabel(\"Angle (degree)\")\n", "plt.xlabel(\"time (s)\")\n", - "plt.plot(ts_res1[name].time, ts_res1[name].values, label='Rotor Angle task 1.b', color='C0')\n", - "plt.xlim([0, 1])\n", + "plt.plot(ts_res1['delta_r_gen'].time, ts_res1['delta_r_gen'].values, label='Rotor Angle task 1.b', color='C0')\n", + "plt.xlim([1, 30])\n", "plt.legend(loc='upper right')\n", " \n", "plt.subplot(2,1,2)\n", "plt.ylabel(\"Power (MW)\")\n", "plt.xlabel(\"time (s)\")\n", - "plt.plot(ts_res1[name].time, ts_res1[name].values/1e6, label='Output Power task 1.b', color='C0')\n", - "plt.xlim([0, 1])\n", + "plt.plot(ts_res1['P_elec'].time, ts_res1['P_elec'].values/1e6, label='Output Power task 1.b', color='C0')\n", + "plt.xlim([1, 30])\n", "plt.legend(loc='upper right')\n", "plt.show()" ] @@ -236,8 +238,8 @@ "tags": [] }, "source": [ - "### Subtask 2.b\n", - "To check your results, enter your solution for $D$ rounded to 3 digits behind the comma:" + "### Subtask 2.a\n", + "To check your results, enter your solution for $D$ rounded to 4 digits behind the comma:" ] }, { @@ -247,8 +249,18 @@ "metadata": {}, "outputs": [], "source": [ - "D=input('D in Subtask 2.b:')\n", - "print('Your result is', 'correct!' if round(float(D),3)==round(outputs['D2'],3) else 'incorrect. You should double-check your calculations.')" + "D=input('D in Subtask 2.a:')\n", + "print('Your result is', 'correct!' if round(float(D),4)==round(outputs['D_T2a'],4) else 'incorrect. You should double-check your calculations.')" + ] + }, + { + "cell_type": "markdown", + "id": "0848fc38-50ad-421a-8442-9f8b9c26a1e0", + "metadata": { + "tags": [] + }, + "source": [ + "### Subtask 2.b" ] }, { @@ -264,7 +276,8 @@ "id": "af0ec7ca-9cf7-4986-9ae9-ab762a792b5f", "metadata": {}, "source": [ - "Enter VILLASweb under https://slew.rwth-aachen.de/. Adjust the parameter $D$ and run a corresponding simulation. \n", + "Enter VILLASweb under https://slew.rwth-aachen.de/. \n", + "Adjust the parameter $D$ and run a corresponding simulation. \n", "Then, enter your code snippet for result download in the following cell:" ] }, @@ -294,7 +307,7 @@ "metadata": {}, "outputs": [], "source": [ - "results_file_name='EM_small_signal_JsonSyngenParams.csv'\n", + "results_file_name='SP_SynGenTrStab_SMIB_Fault_SlewCase2_JsonSyngenParams_SP.csv'\n", "\n", "# Get file by name\n", "f = r.get_file_by_name(results_file_name)\n", @@ -315,17 +328,17 @@ "plt.subplot(2,1,1)\n", "plt.ylabel(\"Angle (degree)\")\n", "plt.xlabel(\"time (s)\")\n", - "plt.plot(ts_res1[name].time, ts_res1[name].values, label='Rotor Angle task 1.b', color='C0')\n", - "plt.plot(ts_res2[name].time, ts_res2[name].values, label='Rotor Angle task 2.b', color='C1', linestyle=':')\n", - "plt.xlim([0, 1])\n", + "plt.plot(ts_res1['delta_r_gen'].time, ts_res1['delta_r_gen'].values, label='Rotor Angle task 1.b', color='C0')\n", + "plt.plot(ts_res2['delta_r_gen'].time, ts_res2['delta_r_gen'].values, label='Rotor Angle task 2.b', color='C1', linestyle=':')\n", + "plt.xlim([1, 30])\n", "plt.legend(loc='upper right')\n", " \n", "plt.subplot(2,1,2)\n", "plt.ylabel(\"Power (MW)\")\n", "plt.xlabel(\"time (s)\")\n", - "plt.plot(ts_res1[name].time, ts_res1[name].values/1e6, label='Output Power task 1.b', color='C0')\n", - "plt.plot(ts_res2[name].time, ts_res2[name].values/1e6, label='Output Power task 2.b', color='C1', linestyle=':') \n", - "plt.xlim([0, 1])\n", + "plt.plot(ts_res1['P_elec'].time, ts_res1['P_elec'].values/1e6, label='Output Power task 1.b', color='C0')\n", + "plt.plot(ts_res2['P_elec'].time, ts_res2['P_elec'].values/1e6, label='Output Power task 2.b', color='C1', linestyle=':') \n", + "plt.xlim([1, 30])\n", "plt.legend(loc='upper right')\n", "plt.show()" ] @@ -333,21 +346,11 @@ { "cell_type": "markdown", "id": "8e4f8736-d4a5-4d5b-8d56-fee4b7afb499", - "metadata": {}, - "source": [ - "### Subtask 2.c\n", - "To check your results, enter your solution for $D$ rounded to 3 digits behind the comma:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "059acad4-1ec4-4e56-aeab-491e149afe17", - "metadata": {}, - "outputs": [], + "metadata": { + "tags": [] + }, "source": [ - "D=input('D in Subtask 2.c:')\n", - "print('Your result is', 'correct!' if round(float(D),3)>round(outputs['D2'],3) else 'incorrect. You should double-check your calculations.')\n" + "### Subtask 2.c" ] }, { @@ -363,7 +366,8 @@ "id": "0740d062-5e8f-4eb9-88bc-a6eea0003391", "metadata": {}, "source": [ - "Enter VILLASweb under https://slew.rwth-aachen.de/. Adjust the parameter $D$ and run a corresponding simulation. \n", + "Enter VILLASweb under https://slew.rwth-aachen.de/. \n", + "Adjust the parameter $D$ and run a corresponding simulation. \n", "Then, enter your code snippet for result download in the following cell:" ] }, @@ -393,7 +397,7 @@ "metadata": {}, "outputs": [], "source": [ - "results_file_name='EM_small_signal_JsonSyngenParams.csv'\n", + "results_file_name='SP_SynGenTrStab_SMIB_Fault_SlewCase2_JsonSyngenParams_SP.csv'\n", "\n", "# Get file by name\n", "f = r.get_file_by_name(results_file_name)\n", @@ -414,17 +418,17 @@ "plt.subplot(2,1,1)\n", "plt.ylabel(\"Angle (degree)\")\n", "plt.xlabel(\"time (s)\")\n", - "plt.plot(ts_res2[name].time, ts_res2[name].values, label='Rotor Angle task 2.b', color='C1', linestyle=':')\n", - "plt.plot(ts_res3[name].time, ts_res3[name].values, label='Rotor Angle task 1.b', color='C2')\n", - "plt.xlim([0, 1])\n", + "plt.plot(ts_res2['delta_r_gen'].time, ts_res2['delta_r_gen'].values, label='Rotor Angle task 2.b', color='C1')\n", + "plt.plot(ts_res3['delta_r_gen'].time, ts_res3['delta_r_gen'].values, label='Rotor Angle task 2.c', color='C2', linestyle=':')\n", + "plt.xlim([1, 30])\n", "plt.legend(loc='upper right')\n", " \n", "plt.subplot(2,1,2)\n", "plt.ylabel(\"Power (MW)\")\n", "plt.xlabel(\"time (s)\")\n", - "plt.plot(ts_res2[name].time, ts_res2[name].values/1e6, label='Output Power task 2.b', color='C1', linestyle=':') \n", - "plt.plot(ts_res3[name].time, ts_res3[name].values/1e6, label='Output Power task 1.b', color='C2') \n", - "plt.xlim([0, 1])\n", + "plt.plot(ts_res2['P_elec'].time, ts_res2['P_elec'].values/1e6, label='Output Power task 2.b', color='C1') \n", + "plt.plot(ts_res3['P_elec'].time, ts_res3['P_elec'].values/1e6, label='Output Power task 2.c', color='C2', linestyle=':') \n", + "plt.xlim([1, 30])\n", "plt.legend(loc='upper right')\n", "plt.show()" ] diff --git a/outputs/output.mat b/outputs/case1_output.mat similarity index 100% rename from outputs/output.mat rename to outputs/case1_output.mat diff --git a/outputs/case2_output.mat b/outputs/case2_output.mat new file mode 100644 index 0000000000000000000000000000000000000000..1dd36115a03183b2ddede8814b3d9fd8ccdec257 Binary files /dev/null and b/outputs/case2_output.mat differ