Skip to content

Commit

Permalink
update notebook for klu testing
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Dinkelbach <jdinkelbach@eonerc.rwth-aachen.de>
  • Loading branch information
dinkelbachjan committed Sep 8, 2023
1 parent f178bc0 commit 1c4f840
Showing 1 changed file with 60 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "a5bc84d9-327b-4cf9-943c-9c39278dd446",
"metadata": {},
"source": [
"# Testing KLU versus SparseLU in Fault Simulation "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "18ca391d-430d-4f34-98c5-de80cb90cd27",
"id": "bbce1a11-c744-42b8-bc38-a3ca6f7dba11",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -21,6 +29,14 @@
"%matplotlib widget"
]
},
{
"cell_type": "markdown",
"id": "84667f6f-937c-4378-94a6-b6eaf3888ad0",
"metadata": {},
"source": [
"## Configure Simulation Scenario"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -39,8 +55,9 @@
"sg_type = \"4\"\n",
"fault_bus_name = \"BUS6\"\n",
"log_dir = \"logs\"\n",
"model_syngens_as_norton = False\n",
"\n",
"log_level = dpsimpy.LogLevel.info\n",
"log_level = dpsimpy.LogLevel.trace\n",
"\n",
"def download_grid_data(name, url):\n",
" with open(name, 'wb') as out_file:\n",
Expand All @@ -58,14 +75,21 @@
"files = glob.glob(filename+'_*.xml')"
]
},
{
"cell_type": "markdown",
"id": "c59593b1-2746-47bd-a000-34d271875a33",
"metadata": {},
"source": [
"## Run Powerflow Simulation"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "42d1f218-ea41-4767-b1e4-485807eda01e",
"metadata": {},
"outputs": [],
"source": [
"## Powerflow Simulation\n",
"sim_name_pf = example_name + \"_PF\"\n",
"\n",
"dpsimpy.Logger.set_log_dir(log_dir+\"/\"+sim_name_pf)\n",
Expand All @@ -89,14 +113,21 @@
"sim_pf.run()"
]
},
{
"cell_type": "markdown",
"id": "e87ba677-069e-4672-8054-85f87b618a2e",
"metadata": {},
"source": [
"## Define Dynamic Simulation Function"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4b4193b9-5c4e-4334-bc47-b7d197254395",
"metadata": {},
"outputs": [],
"source": [
"## Dynamic Simulation\n",
"def run_simulation(sim_name, implementation):\n",
" \n",
" dpsimpy.Logger.set_log_dir(log_dir+\"/\"+sim_name)\n",
Expand Down Expand Up @@ -125,7 +156,7 @@
" if comp.__class__ == dpsimpy.dp.ph1.SynchronGenerator4OrderVBR:\n",
" gen_pf = system_pf.component(comp.name())\n",
" comp.get_terminal(index=0).set_power(- gen_pf.get_apparent_power())\n",
" comp.set_model_as_norton_source(False)\n",
" comp.set_model_as_norton_source(model_syngens_as_norton)\n",
"\n",
" logger = dpsimpy.Logger(sim_name)\n",
" for node in sys.nodes:\n",
Expand Down Expand Up @@ -157,6 +188,14 @@
" sim.run()"
]
},
{
"cell_type": "markdown",
"id": "8c763f3a-75cc-4e78-8e55-dac93dccbacd",
"metadata": {},
"source": [
"## Run Dynamic Simulation with SparseLU"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -170,6 +209,14 @@
"ts_dpsim_sparse = rt.read_timeseries_dpsim(dpsimpy.Logger.get_log_dir()+\"/\"+sim_name+\".csv\")"
]
},
{
"cell_type": "markdown",
"id": "1153c819-7dad-499a-9e81-9648a4c24f86",
"metadata": {},
"source": [
"## Run Dynamic Simulation with KLU"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -183,6 +230,14 @@
"ts_dpsim_klu = rt.read_timeseries_dpsim(dpsimpy.Logger.get_log_dir()+\"/\"+sim_name+\".csv\")"
]
},
{
"cell_type": "markdown",
"id": "40ed549b-3e55-4332-82bb-82b9d2bc73f6",
"metadata": {},
"source": [
"## Plot Comparison of G3 Torque"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down

0 comments on commit 1c4f840

Please sign in to comment.