diff --git a/examples/Notebooks/Performance/WSCC_9bus_split.ipynb b/examples/Notebooks/Performance/WSCC_9bus_split.ipynb new file mode 100644 index 000000000..5ff94536b --- /dev/null +++ b/examples/Notebooks/Performance/WSCC_9bus_split.ipynb @@ -0,0 +1,165 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Run" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Split system in DP, using decoupling line" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%%bash\n", + "TOP=${TOP:-$(git rev-parse --show-toplevel)}\n", + "PATH=${TOP}/build/dpsim/examples/cxx\n", + "export CIMPATH=${TOP}/build/_deps/cim-data-src/WSCC-09/WSCC-09\n", + "\n", + "WSCC_9bus_split_decoupled" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Split System in EMT, using decoupling line" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%%bash\n", + "TOP=${TOP:-$(git rev-parse --show-toplevel)}\n", + "PATH=${TOP}/build/dpsim/examples/cxx\n", + "export CIMPATH=${TOP}/build/_deps/cim-data-src/WSCC-09/WSCC-09\n", + "\n", + "WSCC_9bus_split_decoupled_EMT" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Validate Results" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "import villas.dataprocessing.readtools as rt\n", + "import villas.dataprocessing.plottools as pt\n", + "from villas.dataprocessing.timeseries import TimeSeries as ts\n", + "import matplotlib.pyplot as plt\n", + "import numpy as np\n", + "import pandas as pd\n", + "#%matplotlib widget" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "path_split_dp = 'logs/WSCC_9bus_split_decoupled_DP_0_0/'\n", + "logName_split_dp = 'WSCC_9bus_split_decoupled_DP_0_0'\n", + "logFilename_split_dp = path_split_dp + logName_split_dp + '.csv'\n", + "print(logFilename_split_dp)\n", + "\n", + "path_split_emt = 'logs/WSCC_9bus_split_decoupled_EMT_0_0/'\n", + "logName_split_emt = 'WSCC_9bus_split_decoupled_EMT_0_0'\n", + "logFilename_split_emt = path_split_emt + logName_split_emt + '.csv'\n", + "print(logFilename_split_emt)\n", + "\n", + "path_mono_dp = 'logs/WSCC-9bus_monolithic_DP/'\n", + "logName_mono_dp = 'WSCC-9bus_monolithic_DP'\n", + "logFilename_mono_dp = path_mono_dp + logName_mono_dp + '.csv'\n", + "print(logFilename_mono_dp)\n", + "\n", + "path_mono_emt = 'logs/WSCC-9bus_monolithic_EMT/'\n", + "logName_mono_emt = 'WSCC-9bus_monolithic_EMT'\n", + "logFilename_mono_emt = path_mono_emt + logName_mono_emt + '.csv'\n", + "print(logFilename_mono_emt)\n", + "\n", + "decoupled_dp_split = rt.read_timeseries_dpsim(logFilename_split_dp)\n", + "mono_dp = rt.read_timeseries_dpsim(logFilename_mono_dp)\n", + "decoupled_emt_split = rt.read_timeseries_dpsim(logFilename_split_emt)\n", + "mono_emt = rt.read_timeseries_dpsim(logFilename_mono_emt)\n", + "\n", + "# for v in range(1, 10):\n", + "for i, v in enumerate([5]):\n", + " varname = 'v' + str(v)\n", + " pt.set_timeseries_labels(mono_dp[varname], varname + ' Monolithic, DP')\n", + " pt.plot_timeseries('decoupled', mono_dp[varname])\n", + " pt.set_timeseries_labels(decoupled_dp_split[varname], varname + ' DP')\n", + " pt.plot_timeseries('decoupled', decoupled_dp_split[varname], '--')\n", + " plt.title('WSCC-09 with 3 lines replaced by decoupling equivalents')\n", + " plt.xlabel('Time [s]')\n", + " plt.ylabel('Voltage [V]')\n", + "\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "decoupled_emt_split = rt.read_timeseries_dpsim(logFilename_split_emt)\n", + "\n", + "for i, v in enumerate([5]):\n", + " varname_emt = 'v' + str(v) + '_0'\n", + " pt.set_timeseries_labels(mono_emt[varname_emt], varname_emt + ' EMT')\n", + " pt.plot_timeseries('decoupled, shifted', mono_emt[varname_emt])\n", + " pt.set_timeseries_labels(decoupled_emt_split[varname_emt], varname_emt + ' EMT')\n", + " pt.plot_timeseries('decoupled, shifted', decoupled_emt_split[varname_emt], '--')\n", + " plt.title('WSCC-09 with 3 lines replaced by decoupling equivalents')\n", + " plt.xlabel('Time [s]')\n", + " plt.ylabel('Voltage [V]')\n", + "\n", + "plt.show()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.11" + }, + "tests": { + "skip": true + } + }, + "nbformat": 4, + "nbformat_minor": 4 +}