Commit 34405cf9 authored by Markus Mirz's avatar Markus Mirz
Browse files

update tlm comparison notebook

parent 8836e7c7
%% Cell type:markdown id: tags:
# Line Tests
%% Cell type:code id: tags:
``` python
import villas.dataprocessing.readtools as rt
from villas.dataprocessing.timeseries import TimeSeries as ts
import matplotlib.pyplot as plt
```
%% Cell type:markdown id: tags:
## PI-Line with RLC elements
%% Cell type:code id: tags:
``` python
%%bash
TOP=${TOP:-$(git rev-parse --show-toplevel)}
PATH=${TOP}/build/Examples/Cxx
DP_PiLine
```
%% Output
[16:13:56.812806 DP_PiLine_Elements_console info] Opening interfaces.
[16:13:56.812826 DP_PiLine_Elements_console info] Start simulation: DP_PiLine_Elements
[16:13:56.906627 DP_PiLine_Elements_console info] Simulation finished.
[16:13:56.909836 DP_PiLine_Component_console info] Opening interfaces.
[16:13:56.909851 DP_PiLine_Component_console info] Start simulation: DP_PiLine_Component
[16:13:57.004504 DP_PiLine_Component_console info] Simulation finished.
[16:13:57.006854 DP_PiLine_Diakoptics_console info] Opening interfaces.
[16:13:57.006869 DP_PiLine_Diakoptics_console info] Start simulation: DP_PiLine_Diakoptics
[16:13:57.160850 DP_PiLine_Diakoptics_console info] Simulation finished.
%% Cell type:code id: tags:
``` python
work_dir = 'logs/DP_PiLine_Elements/'
log_name = 'DP_PiLine_Elements'
print(work_dir + log_name + '.csv')
piline_elements = rt.read_timeseries_dpsim(work_dir + log_name + '.csv')
piline_elements_emt = ts.frequency_shift_list(piline_elements, 50)
```
%% Output
logs/DP_PiLine_Elements/DP_PiLine_Elements.csv
column number: 2
results length: 2001
real column names: []
complex column names: ['v1', 'v2']
%% Cell type:code id: tags:
``` python
plt.plot(piline_elements_emt['v1_shift'].time, piline_elements_emt['v1_shift'].values)
plt.plot(piline_elements_emt['v2_shift'].time, piline_elements_emt['v2_shift'].values)
#plt.xlim([0,0.02])
```
%% Output
[<matplotlib.lines.Line2D at 0x7ff483ac9ed0>]
%% Cell type:markdown id: tags:
## PI-Line model
%% Cell type:code id: tags:
``` python
work_dir = 'logs/DP_PiLine_Component/'
log_name = 'DP_PiLine_Component'
print(work_dir + log_name + '.csv')
piline_component = rt.read_timeseries_dpsim(work_dir + log_name + '.csv')
piline_component_emt = ts.frequency_shift_list(piline_component, 50)
```
%% Output
logs/DP_PiLine_Component/DP_PiLine_Component.csv
column number: 2
results length: 2001
real column names: []
complex column names: ['v1', 'v2']
%% Cell type:code id: tags:
``` python
plt.plot(piline_component_emt['v1_shift'].time, piline_component_emt['v1_shift'].values)
plt.plot(piline_component_emt['v2_shift'].time, piline_component_emt['v2_shift'].values)
#plt.xlim([0,0.02])
```
%% Output
[<matplotlib.lines.Line2D at 0x7ff4aa1fd610>]
%% Cell type:code id: tags:
``` python
plt.plot(piline_elements_emt['v2_shift'].time,
piline_elements_emt['v2_shift'].values - piline_component_emt['v2_shift'].values)
```
%% Output
[<matplotlib.lines.Line2D at 0x7ff4aa181350>]
%% Cell type:markdown id: tags:
## Diakotpics PI-Line
%% Cell type:code id: tags:
``` python
work_dir = 'logs/DP_PiLine_Diakoptics/'
log_name = 'DP_PiLine_Diakoptics'
print(work_dir + log_name + '.csv')
piline_diakoptics = rt.read_timeseries_dpsim(work_dir + log_name + '.csv')
piline_diakoptics_emt = ts.frequency_shift_list(piline_diakoptics, 50)
```
%% Output
logs/DP_PiLine_Diakoptics/DP_PiLine_Diakoptics.csv
column number: 2
results length: 2001
real column names: []
complex column names: ['v1', 'v2']
%% Cell type:code id: tags:
``` python
plt.plot(piline_diakoptics_emt['v1_shift'].time, piline_diakoptics_emt['v1_shift'].values)
plt.plot(piline_diakoptics_emt['v2_shift'].time, piline_diakoptics_emt['v2_shift'].values)
#plt.xlim([0,0.02])
```
%% Output
[<matplotlib.lines.Line2D at 0x7ff4aa138110>]
%% Cell type:markdown id: tags:
## Decoupling Line
%% Cell type:code id: tags:
``` python
%%bash
TOP=${TOP:-$(git rev-parse --show-toplevel)}
PATH=${TOP}/build/Examples/Cxx
DP_DecouplingLine
```
%% Output
[17:30:34.625624 DP_Decoupling_Elements_console info] Opening interfaces.
[17:30:34.625653 DP_Decoupling_Elements_console info] Start simulation: DP_Decoupling_Elements
[17:30:34.720685 DP_Decoupling_Elements_console info] Simulation finished.
[17:30:34.724201 DP_Decoupling_Wave_console info] Opening interfaces.
[17:30:34.724217 DP_Decoupling_Wave_console info] Start simulation: DP_Decoupling_Wave
[17:30:34.829536 DP_Decoupling_Wave_console info] Simulation finished.
[17:30:34.832487 EMT_Decoupling_Wave_console info] Opening interfaces.
[17:30:34.832501 EMT_Decoupling_Wave_console info] Start simulation: EMT_Decoupling_Wave
[17:30:34.904734 EMT_Decoupling_Wave_console info] Simulation finished.
[*** LOG ERROR ***] [2020-01-08 17:30:34] [Vsrc_emt] invalid type specifier
%% Cell type:code id: tags:
``` python
work_dir = 'logs/DP_Decoupling_Wave/'
log_name = 'DP_Decoupling_Wave'
print(work_dir + log_name + '.csv')
decoupling_wave = rt.read_timeseries_dpsim(work_dir + log_name + '.csv')
decoupling_wave_emt = ts.frequency_shift_list(decoupling_wave, 50)
```
%% Output
logs/DP_Decoupling_Wave/DP_Decoupling_Wave.csv
column number: 6
results length: 2001
real column names: []
complex column names: ['i1', 'i2', 'i_src1', 'i_src2', 'v1', 'v2']
%% Cell type:code id: tags:
``` python
plt.plot(decoupling_wave_emt['v1_shift'].time, decoupling_wave_emt['v1_shift'].values)
plt.plot(decoupling_wave_emt['v2_shift'].time, decoupling_wave_emt['v2_shift'].values)
#plt.xlim([0,0.02])
```
%% Output
[<matplotlib.lines.Line2D at 0x7fd9ef1368d0>]
[<matplotlib.lines.Line2D at 0x7fd9ecd497d0>]
%% Cell type:code id: tags:
``` python
plt.plot(decoupling_wave_emt['i1_shift'].time, decoupling_wave_emt['i1_shift'].values)
plt.plot(decoupling_wave_emt['i2_shift'].time, decoupling_wave_emt['i2_shift'].values)
#plt.xlim([0.02,0.1])
#plt.ylim([-20,20])
```
%% Output
[<matplotlib.lines.Line2D at 0x7fd9ef115ad0>]
[<matplotlib.lines.Line2D at 0x7fd9ecd398d0>]
%% Cell type:code id: tags:
``` python
plt.plot(decoupling_wave_emt['i_src1_shift'].time, decoupling_wave_emt['i_src1_shift'].values)
plt.plot(decoupling_wave_emt['i_src2_shift'].time, decoupling_wave_emt['i_src2_shift'].values)
#plt.xlim([0.02,0.1])
#plt.ylim([-20,20])
```
%% Output
[<matplotlib.lines.Line2D at 0x7fd9ef090650>]
[<matplotlib.lines.Line2D at 0x7fd9ecc9f750>]
%% Cell type:code id: tags:
``` python
i_src1_phasor = decoupling_wave['i_src1'].phasor()
i_src2_phasor = decoupling_wave['i_src2'].phasor()
plt.plot(i_src1_phasor['abs'].time, i_src1_phasor['abs'].values)
plt.plot(i_src2_phasor['abs'].time, i_src2_phasor['abs'].values)
#plt.xlim([0.04,0.06])
#plt.ylim([220,280])
```
%% Output
[<matplotlib.lines.Line2D at 0x7fd9ef30df50>]
[<matplotlib.lines.Line2D at 0x7fd9ecfd9cd0>]
%% Cell type:code id: tags:
``` python
work_dir = 'logs/EMT_Decoupling_Wave/'
log_name = 'EMT_Decoupling_Wave'
print(work_dir + log_name + '.csv')
emt_decoupling_wave = rt.read_timeseries_dpsim(work_dir + log_name + '.csv')
```
%% Output
logs/EMT_Decoupling_Wave/EMT_Decoupling_Wave.csv
column number: 6
results length: 2001
real column names: ['i1', 'i2', 'i_src1', 'i_src2', 'v1', 'v2']
complex column names: []
%% Cell type:code id: tags:
``` python
plt.plot(emt_decoupling_wave['v1'].time, emt_decoupling_wave['v1'].values)
plt.plot(emt_decoupling_wave['v2'].time, emt_decoupling_wave['v2'].values)
#plt.xlim([0,0.02])
```
%% Output
[<matplotlib.lines.Line2D at 0x7fd9ecf40790>]
[<matplotlib.lines.Line2D at 0x7fd9ecc00e90>]
%% Cell type:code id: tags:
``` python
plt.plot(emt_decoupling_wave['i_src1'].time, emt_decoupling_wave['i_src1'].values)
plt.plot(emt_decoupling_wave['i_src2'].time, emt_decoupling_wave['i_src2'].values)
#plt.xlim([0,0.02])
```
%% Output
[<matplotlib.lines.Line2D at 0x7fd9ece98bd0>]
[<matplotlib.lines.Line2D at 0x7fd9ecb5a350>]
%% Cell type:code id: tags:
``` python
plt.plot(emt_decoupling_wave['i1'].time, emt_decoupling_wave['i1'].values)
plt.plot(emt_decoupling_wave['i2'].time, emt_decoupling_wave['i2'].values)
#plt.xlim([0,0.02])
```
%% Output
[<matplotlib.lines.Line2D at 0x7fd9ece02310>]
[<matplotlib.lines.Line2D at 0x7fd9ecaca290>]
%% Cell type:code id: tags:
``` python
plt.plot(decoupling_wave_emt['i1_shift'].time, decoupling_wave_emt['i1_shift'].values)
plt.plot(decoupling_wave_emt['i2_shift'].time, decoupling_wave_emt['i2_shift'].values)
plt.plot(emt_decoupling_wave['i1'].time, emt_decoupling_wave['i1'].values)
plt.plot(emt_decoupling_wave['i2'].time, emt_decoupling_wave['i2'].values)
plt.plot(emt_decoupling_wave['i1'].time, emt_decoupling_wave['i1'].values, color = '#939393ff', label = 'i1_emt')
plt.plot(emt_decoupling_wave['i2'].time, emt_decoupling_wave['i2'].values, color = '#939393ff', label = 'i2_emt')
plt.plot(decoupling_wave_emt['i1_shift'].time, decoupling_wave_emt['i1_shift'].values, linestyle=':', color = '#0055ffff', label = 'i1_dp')
plt.plot(decoupling_wave_emt['i2_shift'].time, decoupling_wave_emt['i2_shift'].values, linestyle=':', color = '#d62728ff', label = 'i2_dp')
plt.legend()
plt.xlabel('time (s)')
plt.ylabel('current (A)')
#plt.xlim([0.02,0.1])
#plt.ylim([-20,20])
plt.savefig('tlm_dp_emt_current.pdf')
```
%% Output
[<matplotlib.lines.Line2D at 0x7fd9ecd996d0>]