From 7a04a5e35a486e67a011edc0939ecfd78e337500 Mon Sep 17 00:00:00 2001 From: pipeacosta Date: Thu, 9 Nov 2023 08:46:06 +0100 Subject: [PATCH] Improved the incorporation of dpsimpy to the path Signed-off-by: pipeacosta --- examples/Notebooks/MatDyn/Kundur2Areas.ipynb | 26 ++++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/examples/Notebooks/MatDyn/Kundur2Areas.ipynb b/examples/Notebooks/MatDyn/Kundur2Areas.ipynb index 9dff325d3b..f70c592d6f 100644 --- a/examples/Notebooks/MatDyn/Kundur2Areas.ipynb +++ b/examples/Notebooks/MatDyn/Kundur2Areas.ipynb @@ -30,10 +30,13 @@ "metadata": {}, "outputs": [], "source": [ - "import sys\n", - "sys.path.insert(0,'/home/mmo/git/ieee14/dpsim/python/src/dpsim')\n", - "sys.path.insert(0,'/home/mmo/git/ieee14/dpsim/build')\n", - "sys.path.remove('/home/mmo/git/lund-anm-control')\n", + "import sys, os\n", + "\n", + "notebook_dir = os.path.abspath('')\n", + "dpsim_root_dir = os.path.join(notebook_dir, \"../../..\")\n", + "\n", + "sys.path.insert(0, os.path.join(dpsim_root_dir, 'python/src/dpsim'))\n", + "sys.path.insert(0, os.path.join(dpsim_root_dir, 'build'))\n", "\n", "import matpower\n", "import dpsimpy\n", @@ -59,8 +62,8 @@ "outputs": [], "source": [ "# simulation files\n", - "path_static_file = '/home/mmo/git/ieee14/dpsim/examples/Notebooks/MatDyn/Kundur2Areas/Kundur2Areas.mat'\n", - "path_dynamic_file = '/home/mmo/git/ieee14/dpsim/examples/Notebooks/MatDyn/Kundur2Areas/Kundur2Areas_dyn.mat'" + "path_static_file = os.path.join(notebook_dir, 'Kundur2Areas/Kundur2Areas.mat')\n", + "path_dynamic_file = os.path.join(notebook_dir, 'Kundur2Areas/Kundur2Areas_dyn.mat')\n" ] }, { @@ -457,7 +460,7 @@ "\n", "#url = 'https://raw.githubusercontent.com/dpsim-simulator/reference-results/master/PSAT/SMIB-Fault/#PSAT_3OrderSyGen_SMIB_Fault_100mS_TS_1mS.out.txt'\n", "#local_file_3Order = 'reference-results/PSAT_3OrderSyGen_SMIB_Fault_100mS_TS_1mS.out'\n", - "local_file = '/home/mmo/git/ieee14/dpsim/examples/Notebooks/MatDyn/Kundur2Areas/PSAT_Kundur2Areas_Fault_TimeStep_100uS_Tol_1e-5.out'\n", + "local_file = os.path.join(notebook_dir, 'Kundur2Areas/PSAT_Kundur2Areas_Fault_TimeStep_100uS_Tol_1e-5.out')\n", "\n", "#urllib.request.urlretrieve(url, local_file_3Order) \n", "ts_psat = read_timeseries_dpsim(local_file)" @@ -820,6 +823,13 @@ "nominal_voltage = 230000\n", "plot_node_volt_abs(varname_dpsim, varname_psat, ts_dpsim_sp, ts_dpsim_dp, ts_dpsim_emt, ts_dpsim_sp_low_inertia, ts_dpsim_dp_low_inertia, ts_dpsim_emt_low_inertia, ts_psat, nominal_voltage)" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -838,7 +848,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.10.11" }, "tests": { "skip": true