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
3cbe1f66
Commit
3cbe1f66
authored
6 years ago
by
Jan Dinkelbach
Browse files
Options
Downloads
Patches
Plain Diff
correct merge mistake in readtools
parent
6311a6b0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dataprocessing/readtools.py
+67
-0
67 additions, 0 deletions
dataprocessing/readtools.py
with
67 additions
and
0 deletions
dataprocessing/readtools.py
+
67
−
0
View file @
3cbe1f66
...
...
@@ -271,3 +271,70 @@ def read_timeseries_NEPLAN_loadflow(file_name, timeseries_names=None, is_regex=F
for
num_to_del
in
range
(
len
(
line_del
)):
del
timeseries
[
line_del
[
len
(
line_del
)
-
num_to_del
-
1
]]
return
timeseries
def
read_timeseries_simulink_loadflow
(
file_name
,
timeseries_names
=
None
,
is_regex
=
False
):
"""
Read in simulink load-flow result from result file(.rep), the result is in angle notation, amplitude and angle are stored
separately.
A suffix is used to tag different data for a component:
.Arms/.IDegree for current/current angle,
.Vrms/.VDegree for voltage/voltage angle.
:param file_name:path of the .rep file for the loadflow result from simulink
:param timeseries_names: specific values to be read
:param is_regex: flag for using regular expression
:return: list of Timeseries objects
"""
str_tmp
=
open
(
file_name
,
'
r
'
,
encoding
=
'
latin-1
'
)
# Read in files, using latin-1 to decode /xb0
# Read in data from result file of neplan
name
=
[]
# list for data type names
value
=
[]
# list for data
timeseries
=
[]
line_del
=
[]
# a list for the value to be deleted
for
line
in
str_tmp
.
readlines
():
line
=
line
.
replace
(
"
°
"
,
""
)
del
value
[:]
del
name
[:]
# read in different data and start processing
if
len
(
line
)
>
37
:
if
line
[
31
:
35
]
==
'
--->
'
:
if
line
[
13
:
17
]
==
'
Arms
'
:
name
=
[
line
[
37
:
len
(
line
)].
rstrip
()
+
'
.Arms
'
,
line
[
37
:
len
(
line
)].
rstrip
()
+
'
.IDegree
'
]
elif
line
[
13
:
17
]
==
'
Vrms
'
:
name
=
[
line
[
37
:
len
(
line
)].
rstrip
()
+
'
.Vrms
'
,
line
[
37
:
len
(
line
)].
rstrip
()
+
'
.VDegree
'
]
value
=
[
float
(
line
[
0
:
13
]),
float
(
line
[
18
:
31
])]
timeseries
.
append
(
TimeSeries
(
name
[
0
],
np
.
array
([
0.
,
1.
]),
np
.
array
([
value
[
0
],
value
[
0
]])))
timeseries
.
append
(
TimeSeries
(
name
[
1
],
np
.
array
([
0.
,
1.
]),
np
.
array
([
value
[
1
],
value
[
1
]])))
# Read in variables which match with regex
if
is_regex
is
True
:
p
=
re
.
compile
(
timeseries_names
)
length
=
len
(
timeseries
)
for
rule_check
in
range
(
length
):
if
p
.
search
(
timeseries
[
rule_check
].
name
):
pass
else
:
line_del
.
append
(
rule_check
)
# Read in specified time series
elif
timeseries_names
is
not
None
:
length
=
len
(
timeseries
)
for
rule_check
in
range
(
length
):
if
timeseries_names
==
timeseries
[
rule_check
].
name
:
pass
else
:
line_del
.
append
(
rule_check
)
# delete those values that are not needed.
line_del
=
set
(
line_del
)
line_del
=
sorted
(
line_del
)
for
num_to_del
in
range
(
len
(
line_del
)):
del
timeseries
[
line_del
[
len
(
line_del
)
-
num_to_del
-
1
]]
return
timeseries
\ No newline at end of file
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