Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
Power System Simulation and Optimization
DPsim
DPsim
Commits
3d02923f
Commit
3d02923f
authored
Oct 21, 2020
by
Jan Dinkelbach
Committed by
Markus Mirz
Nov 21, 2020
Browse files
update examples and notebooks for slack, piline and vsi
parent
cb5b1297
Changes
6
Hide whitespace changes
Inline
Side-by-side
Examples/Cxx/Circuits/DP_Slack_PiLine_VSI_with_PF_Init.cpp
View file @
3d02923f
...
...
@@ -121,6 +121,7 @@ int main(int argc, char* argv[]) {
auto
loggerDP
=
DataLogger
::
make
(
simNameDP
);
loggerDP
->
addAttribute
(
"v1"
,
n1DP
->
attribute
(
"v"
));
loggerDP
->
addAttribute
(
"v2"
,
n2DP
->
attribute
(
"v"
));
loggerDP
->
addAttribute
(
"i12"
,
lineDP
->
attribute
(
"i_intf"
));
Examples
::
CIGREMV
::
logPVDecomposedAttributes
(
loggerDP
,
pv
);
...
...
Examples/Cxx/Circuits/EMT_Slack_PiLine_PQLoad_with_PF_Init.cpp
View file @
3d02923f
...
...
@@ -67,6 +67,7 @@ int main(int argc, char* argv[]) {
auto
loggerPF
=
DataLogger
::
make
(
simNamePF
);
loggerPF
->
addAttribute
(
"v1"
,
n1PF
->
attribute
(
"v"
));
loggerPF
->
addAttribute
(
"v2"
,
n2PF
->
attribute
(
"v"
));
loggerPF
->
addAttribute
(
"i12"
,
linePF
->
attribute
(
"i_intf"
));
// Simulation
Simulation
simPF
(
simNamePF
,
Logger
::
Level
::
debug
);
...
...
@@ -113,6 +114,7 @@ int main(int argc, char* argv[]) {
auto
loggerEMT
=
DataLogger
::
make
(
simNameEMT
);
loggerEMT
->
addAttribute
(
"v1"
,
n1EMT
->
attribute
(
"v"
));
loggerEMT
->
addAttribute
(
"v2"
,
n2EMT
->
attribute
(
"v"
));
loggerEMT
->
addAttribute
(
"i12"
,
lineEMT
->
attribute
(
"i_intf"
));
// load step sized in absolute terms
// std::shared_ptr<SwitchEvent> loadStepEvent = Examples::createEventAddPowerConsumption("n2", 1-timeStepEMT, 100e3, systemEMT, Domain::EMT, loggerEMT);
...
...
Examples/Cxx/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init.cpp
View file @
3d02923f
...
...
@@ -26,8 +26,8 @@ int main(int argc, char* argv[]) {
Examples
::
SGIB
::
ScenarioConfig
scenario
;
// Real finalTime = 0.003;
Real
finalTime
=
10
;
Real
timeStep
=
0.001
;
Real
finalTime
=
2
;
Real
timeStep
=
0.00
0
1
;
CommandLineArgs
args
(
argc
,
argv
);
if
(
argc
>
1
)
{
timeStep
=
args
.
timeStep
;
...
...
@@ -119,6 +119,9 @@ int main(int argc, char* argv[]) {
auto
loggerEMT
=
DataLogger
::
make
(
simNameEMT
);
loggerEMT
->
addAttribute
(
"v1"
,
n1EMT
->
attribute
(
"v"
));
loggerEMT
->
addAttribute
(
"v2"
,
n2EMT
->
attribute
(
"v"
));
loggerEMT
->
addAttribute
(
"i12"
,
lineEMT
->
attribute
(
"i_intf"
));
Examples
::
CIGREMV
::
logPVDecomposedAttributes
(
loggerEMT
,
pv
);
// load step sized in absolute terms
// std::shared_ptr<SwitchEvent> loadStepEvent = Examples::createEventAddPowerConsumption("n2", 1-timeStepEMT, 100e3, systemEMT, Domain::EMT, loggerEMT);
...
...
Examples/Notebooks/Circuits/Compare_EMT_DP_Slack_PiLine_VSI.ipynb
0 → 100644
View file @
3d02923f
{
"cells": [
{
"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",
"TIMESTEP=0.1e-3\n",
"DURATION=0.1\n",
"\n",
"EMT_Slack_PiLine_VSI_with_PF_Init --timestep=${TIMESTEP} --duration=${DURATION}\n",
"DP_Slack_PiLine_VSI_with_PF_Init --timestep=${TIMESTEP} --duration=${DURATION}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from villas.dataprocessing.readtools import *\n",
"from villas.dataprocessing.timeseries import *\n",
"import re\n",
"\n",
"model_name = 'Slack_PiLine_VSI_with_PF_Init'\n",
"\n",
"path_DP = 'logs/' + 'DP_' + model_name + '_DP/'\n",
"dpsim_result_file_DP = path_DP + 'DP_' + model_name + '_DP.csv'\n",
"ts_dpsim_DP = read_timeseries_csv(dpsim_result_file_DP)\n",
"\n",
"path_EMT = 'logs/' + 'EMT_' + model_name + '_EMT/'\n",
"dpsim_result_file_EMT = path_EMT + 'EMT_' + model_name + '_EMT.csv'\n",
"ts_dpsim_EMT = read_timeseries_csv(dpsim_result_file_EMT)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Plot voltage of interest"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"\n",
"# %matplotlib widget\n",
"\n",
"var_name = 'i12'\n",
"plt.figure(figsize=(12,8))\n",
"plt.plot(ts_dpsim_EMT[var_name+'_0'].interpolate(50e-6).time, np.sqrt(3/2)*ts_dpsim_EMT[var_name+'_0'].interpolate(50e-6).values, label='EMT')\n",
"plt.plot(ts_dpsim_DP[var_name].interpolate(50e-6).time, ts_dpsim_DP[var_name].interpolate(50e-6).frequency_shift(50).values, label='DP backshift', linestyle='--')\n",
"plt.legend()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"var_name = 'v2'\n",
"plt.figure(figsize=(12,8))\n",
"plt.plot(ts_dpsim_EMT[var_name+'_0'].interpolate(50e-6).time, np.sqrt(3/2)*ts_dpsim_EMT[var_name+'_0'].interpolate(50e-6).values, label='EMT')\n",
"plt.plot(ts_dpsim_DP[var_name].interpolate(50e-6).time, ts_dpsim_DP[var_name].interpolate(50e-6).frequency_shift(50).values, label='DP backshift', linestyle='--')\n",
"plt.legend()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"var_name = 'pv_pll_output_0'\n",
"plt.figure(figsize=(12,8))\n",
"plt.plot(ts_dpsim_EMT[var_name].interpolate(50e-6).time, ts_dpsim_EMT[var_name].interpolate(50e-6).values, label='EMT')\n",
"plt.plot(ts_dpsim_DP[var_name].interpolate(50e-6).time, ts_dpsim_DP[var_name].interpolate(50e-6).values, label='DP', linestyle='--')\n",
"plt.legend()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"var_name = 'pv_pll_output_1'\n",
"plt.figure(figsize=(12,8))\n",
"plt.plot(ts_dpsim_EMT[var_name].interpolate(50e-6).time, ts_dpsim_EMT[var_name].interpolate(50e-6).values, label='EMT')\n",
"plt.plot(ts_dpsim_DP[var_name].interpolate(50e-6).time, ts_dpsim_DP[var_name].interpolate(50e-6).values, label='DP', linestyle='--')\n",
"plt.legend()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"var_name = 'pv_powerctrl_state_p'\n",
"plt.figure(figsize=(12,8))\n",
"plt.plot(ts_dpsim_EMT[var_name].interpolate(50e-6).time, ts_dpsim_EMT[var_name].interpolate(50e-6).values, label='EMT')\n",
"plt.plot(ts_dpsim_DP[var_name].interpolate(50e-6).time, ts_dpsim_DP[var_name].interpolate(50e-6).values, label='DP', linestyle='--')\n",
"plt.legend()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"var_name = 'pv_powerctrl_state_q'\n",
"plt.figure(figsize=(12,8))\n",
"plt.plot(ts_dpsim_EMT[var_name].interpolate(50e-6).time, ts_dpsim_EMT[var_name].interpolate(50e-6).values, label='EMT')\n",
"plt.plot(ts_dpsim_DP[var_name].interpolate(50e-6).time, ts_dpsim_DP[var_name].interpolate(50e-6).values, label='DP', linestyle='--')\n",
"plt.legend()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"var_name = 'pv_powerctrl_input_ircd'\n",
"plt.figure(figsize=(12,8))\n",
"plt.plot(ts_dpsim_EMT[var_name].interpolate(50e-6).time, ts_dpsim_EMT[var_name].interpolate(50e-6).values, label='EMT')\n",
"plt.plot(ts_dpsim_DP[var_name].interpolate(50e-6).time, ts_dpsim_DP[var_name].interpolate(50e-6).values, label='DP', linestyle='--')\n",
"plt.legend()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"var_name = 'pv_powerctrl_input_vcd'\n",
"plt.figure(figsize=(12,8))\n",
"plt.plot(ts_dpsim_EMT[var_name].interpolate(50e-6).time, ts_dpsim_EMT[var_name].interpolate(50e-6).values, label='EMT')\n",
"plt.plot(ts_dpsim_DP[var_name].interpolate(50e-6).time, ts_dpsim_DP[var_name].interpolate(50e-6).values, label='DP', linestyle='--')\n",
"plt.legend()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"var_name = 'pv_powerctrl_input_vcq'\n",
"plt.figure(figsize=(12,8))\n",
"plt.plot(ts_dpsim_EMT[var_name].interpolate(50e-6).time, ts_dpsim_EMT[var_name].interpolate(50e-6).values, label='EMT')\n",
"plt.plot(ts_dpsim_DP[var_name].interpolate(50e-6).time, ts_dpsim_DP[var_name].interpolate(50e-6).values, label='DP', 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:code id: tags:
```
python
%%
bash
TOP
=
$
{
TOP
:
-
$
(
git
rev
-
parse
--
show
-
toplevel
)}
PATH
=
$
{
TOP
}
/
build
/
Examples
/
Cxx
TIMESTEP
=
0.1e-3
DURATION
=
0.1
EMT_Slack_PiLine_VSI_with_PF_Init
--
timestep
=
$
{
TIMESTEP
}
--
duration
=
$
{
DURATION
}
DP_Slack_PiLine_VSI_with_PF_Init
--
timestep
=
$
{
TIMESTEP
}
--
duration
=
$
{
DURATION
}
```
%% Cell type:code id: tags:
```
python
from
villas.dataprocessing.readtools
import
*
from
villas.dataprocessing.timeseries
import
*
import
re
model_name
=
'Slack_PiLine_VSI_with_PF_Init'
path_DP
=
'logs/'
+
'DP_'
+
model_name
+
'_DP/'
dpsim_result_file_DP
=
path_DP
+
'DP_'
+
model_name
+
'_DP.csv'
ts_dpsim_DP
=
read_timeseries_csv
(
dpsim_result_file_DP
)
path_EMT
=
'logs/'
+
'EMT_'
+
model_name
+
'_EMT/'
dpsim_result_file_EMT
=
path_EMT
+
'EMT_'
+
model_name
+
'_EMT.csv'
ts_dpsim_EMT
=
read_timeseries_csv
(
dpsim_result_file_EMT
)
```
%% Cell type:markdown id: tags:
## Plot voltage of interest
%% Cell type:code id: tags:
```
python
import
matplotlib.pyplot
as
plt
# %matplotlib widget
var_name
=
'i12'
plt
.
figure
(
figsize
=
(
12
,
8
))
plt
.
plot
(
ts_dpsim_EMT
[
var_name
+
'_0'
].
interpolate
(
50e-6
).
time
,
np
.
sqrt
(
3
/
2
)
*
ts_dpsim_EMT
[
var_name
+
'_0'
].
interpolate
(
50e-6
).
values
,
label
=
'EMT'
)
plt
.
plot
(
ts_dpsim_DP
[
var_name
].
interpolate
(
50e-6
).
time
,
ts_dpsim_DP
[
var_name
].
interpolate
(
50e-6
).
frequency_shift
(
50
).
values
,
label
=
'DP backshift'
,
linestyle
=
'--'
)
plt
.
legend
()
plt
.
show
()
```
%% Cell type:code id: tags:
```
python
var_name
=
'v2'
plt
.
figure
(
figsize
=
(
12
,
8
))
plt
.
plot
(
ts_dpsim_EMT
[
var_name
+
'_0'
].
interpolate
(
50e-6
).
time
,
np
.
sqrt
(
3
/
2
)
*
ts_dpsim_EMT
[
var_name
+
'_0'
].
interpolate
(
50e-6
).
values
,
label
=
'EMT'
)
plt
.
plot
(
ts_dpsim_DP
[
var_name
].
interpolate
(
50e-6
).
time
,
ts_dpsim_DP
[
var_name
].
interpolate
(
50e-6
).
frequency_shift
(
50
).
values
,
label
=
'DP backshift'
,
linestyle
=
'--'
)
plt
.
legend
()
plt
.
show
()
```
%% Cell type:code id: tags:
```
python
var_name
=
'pv_pll_output_0'
plt
.
figure
(
figsize
=
(
12
,
8
))
plt
.
plot
(
ts_dpsim_EMT
[
var_name
].
interpolate
(
50e-6
).
time
,
ts_dpsim_EMT
[
var_name
].
interpolate
(
50e-6
).
values
,
label
=
'EMT'
)
plt
.
plot
(
ts_dpsim_DP
[
var_name
].
interpolate
(
50e-6
).
time
,
ts_dpsim_DP
[
var_name
].
interpolate
(
50e-6
).
values
,
label
=
'DP'
,
linestyle
=
'--'
)
plt
.
legend
()
plt
.
show
()
```
%% Cell type:code id: tags:
```
python
var_name
=
'pv_pll_output_1'
plt
.
figure
(
figsize
=
(
12
,
8
))
plt
.
plot
(
ts_dpsim_EMT
[
var_name
].
interpolate
(
50e-6
).
time
,
ts_dpsim_EMT
[
var_name
].
interpolate
(
50e-6
).
values
,
label
=
'EMT'
)
plt
.
plot
(
ts_dpsim_DP
[
var_name
].
interpolate
(
50e-6
).
time
,
ts_dpsim_DP
[
var_name
].
interpolate
(
50e-6
).
values
,
label
=
'DP'
,
linestyle
=
'--'
)
plt
.
legend
()
plt
.
show
()
```
%% Cell type:code id: tags:
```
python
var_name
=
'pv_powerctrl_state_p'
plt
.
figure
(
figsize
=
(
12
,
8
))
plt
.
plot
(
ts_dpsim_EMT
[
var_name
].
interpolate
(
50e-6
).
time
,
ts_dpsim_EMT
[
var_name
].
interpolate
(
50e-6
).
values
,
label
=
'EMT'
)
plt
.
plot
(
ts_dpsim_DP
[
var_name
].
interpolate
(
50e-6
).
time
,
ts_dpsim_DP
[
var_name
].
interpolate
(
50e-6
).
values
,
label
=
'DP'
,
linestyle
=
'--'
)
plt
.
legend
()
plt
.
show
()
```
%% Cell type:code id: tags:
```
python
var_name
=
'pv_powerctrl_state_q'
plt
.
figure
(
figsize
=
(
12
,
8
))
plt
.
plot
(
ts_dpsim_EMT
[
var_name
].
interpolate
(
50e-6
).
time
,
ts_dpsim_EMT
[
var_name
].
interpolate
(
50e-6
).
values
,
label
=
'EMT'
)
plt
.
plot
(
ts_dpsim_DP
[
var_name
].
interpolate
(
50e-6
).
time
,
ts_dpsim_DP
[
var_name
].
interpolate
(
50e-6
).
values
,
label
=
'DP'
,
linestyle
=
'--'
)
plt
.
legend
()
plt
.
show
()
```
%% Cell type:code id: tags:
```
python
var_name
=
'pv_powerctrl_input_ircd'
plt
.
figure
(
figsize
=
(
12
,
8
))
plt
.
plot
(
ts_dpsim_EMT
[
var_name
].
interpolate
(
50e-6
).
time
,
ts_dpsim_EMT
[
var_name
].
interpolate
(
50e-6
).
values
,
label
=
'EMT'
)
plt
.
plot
(
ts_dpsim_DP
[
var_name
].
interpolate
(
50e-6
).
time
,
ts_dpsim_DP
[
var_name
].
interpolate
(
50e-6
).
values
,
label
=
'DP'
,
linestyle
=
'--'
)
plt
.
legend
()
plt
.
show
()
```
%% Cell type:code id: tags:
```
python
var_name
=
'pv_powerctrl_input_vcd'
plt
.
figure
(
figsize
=
(
12
,
8
))
plt
.
plot
(
ts_dpsim_EMT
[
var_name
].
interpolate
(
50e-6
).
time
,
ts_dpsim_EMT
[
var_name
].
interpolate
(
50e-6
).
values
,
label
=
'EMT'
)
plt
.
plot
(
ts_dpsim_DP
[
var_name
].
interpolate
(
50e-6
).
time
,
ts_dpsim_DP
[
var_name
].
interpolate
(
50e-6
).
values
,
label
=
'DP'
,
linestyle
=
'--'
)
plt
.
legend
()
plt
.
show
()
```
%% Cell type:code id: tags:
```
python
var_name
=
'pv_powerctrl_input_vcq'
plt
.
figure
(
figsize
=
(
12
,
8
))
plt
.
plot
(
ts_dpsim_EMT
[
var_name
].
interpolate
(
50e-6
).
time
,
ts_dpsim_EMT
[
var_name
].
interpolate
(
50e-6
).
values
,
label
=
'EMT'
)
plt
.
plot
(
ts_dpsim_DP
[
var_name
].
interpolate
(
50e-6
).
time
,
ts_dpsim_DP
[
var_name
].
interpolate
(
50e-6
).
values
,
label
=
'DP'
,
linestyle
=
'--'
)
plt
.
legend
()
plt
.
show
()
```
%% Cell type:code id: tags:
```
python
```
Examples/Notebooks/Circuits/EMT_Slack_PiLine_PQLoad_with_PF_Init.ipynb
View file @
3d02923f
...
...
@@ -82,9 +82,27 @@
"source": [
"plt.figure(figsize=(12,6))\n",
"for ts_name, ts_obj in ts_dpsim.items():\n",
" if '_0' in ts_name:\n",
" if '_0' in
ts_name and 'v' 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",
" if 'v' in ts_name:\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": [
"plt.figure(figsize=(12,6))\n",
"for ts_name, ts_obj in ts_dpsim.items():\n",
" if '_0' in ts_name and 'i' 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",
" if 'i' in ts_name:\n",
" plt.plot(ts_obj.time, ts_obj.abs().values, label=ts_name+'_pf', linestyle=':')\n",
"plt.legend()\n",
"plt.show()"
...
...
%% 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
:
if
'_0'
in
ts_name
and
'v'
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
():
if
'v'
in
ts_name
:
plt
.
plot
(
ts_obj
.
time
,
ts_obj
.
abs
().
values
,
label
=
ts_name
+
'_pf'
,
linestyle
=
':'
)
plt
.
legend
()
plt
.
show
()
```
%% 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
and
'i'
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
():
if
'i'
in
ts_name
:
plt
.
plot
(
ts_obj
.
time
,
ts_obj
.
abs
().
values
,
label
=
ts_name
+
'_pf'
,
linestyle
=
':'
)
plt
.
legend
()
plt
.
show
()
```
%% Cell type:code id: tags:
```
python
```
...
...
Examples/Notebooks/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init.ipynb
View file @
3d02923f
...
...
@@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"#
DP
Simulation of topology with slack, line and
PQ load
"
"#
EMT
Simulation of topology with slack, line and
VSI
"
]
},
{
...
...
@@ -82,7 +82,7 @@
"source": [
"plt.figure(figsize=(12,6))\n",
"for ts_name, ts_obj in ts_dpsim.items():\n",
" if '_0' in ts_name:\n",
" if '_0' in
ts_name and 'pv_' not in ts_name and 'v' 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",
...
...
@@ -90,6 +90,35 @@
"plt.show()"
]
},
{
"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 and 'pv_' not in ts_name and 'i' in ts_name:\n",
" plt.plot(ts_obj.time, PEAK1PH_TO_RMS3PH*ts_obj.values, label=ts_name)\n",
"\n",
"plt.legend()\n",
"plt.show()"
]
},
{
"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 'pv_pll_output_0' in ts_name:\n",
" plt.plot(ts_obj.time, PEAK1PH_TO_RMS3PH*ts_obj.values, label=ts_name)\n",
"plt.legend()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
...
...
%% Cell type:markdown id: tags:
#
DP
Simulation of topology with slack, line and
PQ load
#
EMT
Simulation of topology with slack, line and
VSI
%% 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
:
if
'_0'
in
ts_name
and
'pv_'
not
in
ts_name
and
'v'
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
plt
.
figure
(
figsize
=
(
12
,
6
))
for
ts_name
,
ts_obj
in
ts_dpsim
.
items
():
if
'_0'
in
ts_name
and
'pv_'
not
in
ts_name
and
'i'
in
ts_name
:
plt
.
plot
(
ts_obj
.
time
,
PEAK1PH_TO_RMS3PH
*
ts_obj
.
values
,
label
=
ts_name
)
plt
.
legend
()
plt
.
show
()
```
%% Cell type:code id: tags:
```
python
plt
.
figure
(
figsize
=
(
12
,
6
))
for
ts_name
,
ts_obj
in
ts_dpsim
.
items
():
if
'pv_pll_output_0'
in
ts_name
:
plt
.
plot
(
ts_obj
.
time
,
PEAK1PH_TO_RMS3PH
*
ts_obj
.
values
,
label
=
ts_name
)
plt
.
legend
()
plt
.
show
()
```
%% Cell type:code id: tags:
```
python
```
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment