Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VILLASdataprocessing
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ACS
Public
VILLASframework
VILLASdataprocessing
Commits
ffc5f207
Commit
ffc5f207
authored
6 years ago
by
Markus Mirz
Browse files
Options
Downloads
Patches
Plain Diff
add freq shifting func to time series
parent
1316737c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dataprocessing/dpsim.py
+2
-1
2 additions, 1 deletion
dataprocessing/dpsim.py
dataprocessing/timeseries.py
+26
-1
26 additions, 1 deletion
dataprocessing/timeseries.py
with
28 additions
and
2 deletions
dataprocessing/dpsim.py
+
2
−
1
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
This diff is collapsed.
Click to expand it.
dataprocessing/timeseries.py
+
26
−
1
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment