Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
VILLASframework
VILLASdataprocessing
Commits
ffc5f207
Commit
ffc5f207
authored
Oct 03, 2018
by
Markus Mirz
Browse files
add freq shifting func to time series
parent
1316737c
Changes
2
Hide whitespace changes
Inline
Side-by-side
dataprocessing/dpsim.py
View file @
ffc5f207
from
dataprocessing.readtools
import
*
from
dataprocessing.timeseries
import
*
from
dataprocessing.plottools
import
*
def
get_node_voltage_phasors
(
dpsim_timeseries_list
):
"""Calculate voltage phasors of all nodes
...
...
@@ -24,7 +25,7 @@ def get_node_emt_voltages(timeseries_list, freq):
"""
voltages_list
=
{}
for
name
,
ts
in
timeseries_list
.
items
():
ts_emt
=
ts
.
dynphasor_shift_to_em
t
(
ts
.
name
,
freq
)
ts_emt
=
ts
.
frequency_shif
t
(
ts
.
name
,
freq
)
voltages_list
[
ts
.
name
]
=
ts_emt
return
voltages_list
dataprocessing/timeseries.py
View file @
ffc5f207
...
...
@@ -37,6 +37,31 @@ class TimeSeries:
ts_phase
=
TimeSeries
(
name
,
self
.
time
,
phase_values
)
return
ts_phase
def
phasor
(
self
,
name
):
"""Calculate phasor of complex time series and return dict with abs and phase.
"""
ts_abs
=
ts
.
abs
(
ts
.
name
+
'_abs'
)
ts_phase
=
ts
.
phase
(
ts
.
name
+
'_phase'
)
ts_phasor
=
{}
ts_phasor
[
'abs'
]
=
ts_abs
ts_phasor
[
'phase'
]
=
ts_phase
return
ts_phasor
@
staticmethod
def
frequency_shift_list
(
timeseries_list
,
freq
):
"""Calculate shifted frequency results of all time series
:param timeseries_list: timeseries list retrieved from dpsim results
:param freq: frequency by which the timeseries should be shifted
:return: list of shifted time series
"""
result_list
=
{}
for
name
,
ts
in
timeseries_list
.
items
():
ts_emt
=
ts
.
frequency_shift
(
ts
.
name
,
freq
)
result_list
[
ts
.
name
]
=
ts_emt
return
result_list
@
staticmethod
def
rmse
(
ts1
,
ts2
):
""" Calculate root mean square error between two time series
...
...
@@ -69,7 +94,7 @@ class TimeSeries:
ts_diff
=
TimeSeries
(
name
,
time
,
(
interp_vals_ts2
-
interp_vals_ts1
))
return
ts_diff
def
dynphasor_shift_to_em
t
(
self
,
name
,
freq
):
def
frequency_shif
t
(
self
,
name
,
freq
):
""" Shift dynamic phasor values to EMT by frequency freq.
Assumes the same time steps for both timeseries.
:param name: name of returned time series
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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