Commit 37a5aba0 authored by Jan Dinkelbach's avatar Jan Dinkelbach Committed by Markus Mirz
Browse files

add test notebook for emt examples with PF init

parent 48b32bc3
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# DP Simulation of topology with slack, line and PQ load"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
" %%bash\n",
"TOP=${TOP:-$(git rev-parse --show-toplevel)}\n",
"PATH=${TOP}/build/Examples/Cxx\n",
"\n",
"EMT_Slack_PiLine_PQLoad_with_PF_Init"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from villas.dataprocessing.readtools import *\n",
"from villas.dataprocessing.timeseries import *\n",
"import matplotlib.pyplot as plt\n",
"import re\n",
"\n",
"%matplotlib widget"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## PF results"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"modelName = 'EMT_Slack_PiLine_PQLoad_with_PF_Init_PF'\n",
"path = 'logs/' + modelName + '/'\n",
"dpsim_result_file = path + modelName + '.csv'\n",
"\n",
"ts_dpsim_pf = read_timeseries_csv(dpsim_result_file)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## EMT results"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"modelName = 'EMT_Slack_PiLine_PQLoad_with_PF_Init_EMT'\n",
"path = 'logs/' + modelName + '/'\n",
"dpsim_result_file = path + modelName + '.csv'\n",
"PEAK1PH_TO_RMS3PH = np.sqrt(3.0/2.0)\n",
"ts_dpsim = read_timeseries_csv(dpsim_result_file)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12,6))\n",
"for ts_name, ts_obj in ts_dpsim.items():\n",
" if '_0' in ts_name:\n",
" plt.plot(ts_obj.time, PEAK1PH_TO_RMS3PH*ts_obj.values, label=ts_name)\n",
"for ts_name, ts_obj in ts_dpsim_pf.items():\n",
" plt.plot(ts_obj.time, ts_obj.abs().values, label=ts_name+'_pf', linestyle=':')\n",
"plt.legend()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"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.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
%% Cell type:markdown id: tags:
# DP Simulation of topology with slack, line and PQ load
%% Cell type:code id: tags:
``` python
%%bash
TOP=${TOP:-$(git rev-parse --show-toplevel)}
PATH=${TOP}/build/Examples/Cxx
EMT_Slack_PiLine_PQLoad_with_PF_Init
```
%% Cell type:code id: tags:
``` python
from villas.dataprocessing.readtools import *
from villas.dataprocessing.timeseries import *
import matplotlib.pyplot as plt
import re
%matplotlib widget
```
%% Cell type:markdown id: tags:
## PF results
%% Cell type:code id: tags:
``` python
modelName = 'EMT_Slack_PiLine_PQLoad_with_PF_Init_PF'
path = 'logs/' + modelName + '/'
dpsim_result_file = path + modelName + '.csv'
ts_dpsim_pf = read_timeseries_csv(dpsim_result_file)
```
%% Cell type:markdown id: tags:
## EMT results
%% Cell type:code id: tags:
``` python
modelName = 'EMT_Slack_PiLine_PQLoad_with_PF_Init_EMT'
path = 'logs/' + modelName + '/'
dpsim_result_file = path + modelName + '.csv'
PEAK1PH_TO_RMS3PH = np.sqrt(3.0/2.0)
ts_dpsim = read_timeseries_csv(dpsim_result_file)
```
%% Cell type:code id: tags:
``` python
plt.figure(figsize=(12,6))
for ts_name, ts_obj in ts_dpsim.items():
if '_0' in ts_name:
plt.plot(ts_obj.time, PEAK1PH_TO_RMS3PH*ts_obj.values, label=ts_name)
for ts_name, ts_obj in ts_dpsim_pf.items():
plt.plot(ts_obj.time, ts_obj.abs().values, label=ts_name+'_pf', linestyle=':')
plt.legend()
plt.show()
```
%% Cell type:code id: tags:
``` python
```
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# DP Simulation of topology with slack, line and PQ load"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
" %%bash\n",
"TOP=${TOP:-$(git rev-parse --show-toplevel)}\n",
"PATH=${TOP}/build/Examples/Cxx\n",
"\n",
"EMT_Slack_PiLine_VSI_with_PF_Init"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from villas.dataprocessing.readtools import *\n",
"from villas.dataprocessing.timeseries import *\n",
"import matplotlib.pyplot as plt\n",
"import re\n",
"\n",
"%matplotlib widget"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## PF results"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"modelName = 'EMT_Slack_PiLine_VSI_with_PF_Init_PF'\n",
"path = 'logs/' + modelName + '/'\n",
"dpsim_result_file = path + modelName + '.csv'\n",
"\n",
"ts_dpsim_pf = read_timeseries_csv(dpsim_result_file)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## EMT results"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"modelName = 'EMT_Slack_PiLine_VSI_with_PF_Init_EMT'\n",
"path = 'logs/' + modelName + '/'\n",
"dpsim_result_file = path + modelName + '.csv'\n",
"PEAK1PH_TO_RMS3PH = np.sqrt(3.0/2.0)\n",
"ts_dpsim = read_timeseries_csv(dpsim_result_file)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12,6))\n",
"for ts_name, ts_obj in ts_dpsim.items():\n",
" if '_0' in ts_name:\n",
" plt.plot(ts_obj.time, PEAK1PH_TO_RMS3PH*ts_obj.values, label=ts_name)\n",
"for ts_name, ts_obj in ts_dpsim_pf.items():\n",
" plt.plot(ts_obj.time, ts_obj.abs().values, label=ts_name+'_pf', linestyle=':')\n",
"plt.legend()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"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.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
%% Cell type:markdown id: tags:
# DP Simulation of topology with slack, line and PQ load
%% Cell type:code id: tags:
``` python
%%bash
TOP=${TOP:-$(git rev-parse --show-toplevel)}
PATH=${TOP}/build/Examples/Cxx
EMT_Slack_PiLine_VSI_with_PF_Init
```
%% Cell type:code id: tags:
``` python
from villas.dataprocessing.readtools import *
from villas.dataprocessing.timeseries import *
import matplotlib.pyplot as plt
import re
%matplotlib widget
```
%% Cell type:markdown id: tags:
## PF results
%% Cell type:code id: tags:
``` python
modelName = 'EMT_Slack_PiLine_VSI_with_PF_Init_PF'
path = 'logs/' + modelName + '/'
dpsim_result_file = path + modelName + '.csv'
ts_dpsim_pf = read_timeseries_csv(dpsim_result_file)
```
%% Cell type:markdown id: tags:
## EMT results
%% Cell type:code id: tags:
``` python
modelName = 'EMT_Slack_PiLine_VSI_with_PF_Init_EMT'
path = 'logs/' + modelName + '/'
dpsim_result_file = path + modelName + '.csv'
PEAK1PH_TO_RMS3PH = np.sqrt(3.0/2.0)
ts_dpsim = read_timeseries_csv(dpsim_result_file)
```
%% Cell type:code id: tags:
``` python
plt.figure(figsize=(12,6))
for ts_name, ts_obj in ts_dpsim.items():
if '_0' in ts_name:
plt.plot(ts_obj.time, PEAK1PH_TO_RMS3PH*ts_obj.values, label=ts_name)
for ts_name, ts_obj in ts_dpsim_pf.items():
plt.plot(ts_obj.time, ts_obj.abs().values, label=ts_name+'_pf', linestyle=':')
plt.legend()
plt.show()
```
%% Cell type:code id: tags:
``` python
```
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment