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
7201a3f3
Commit
7201a3f3
authored
7 years ago
by
Bichen Li
Browse files
Options
Downloads
Patches
Plain Diff
Simplified the read-in function, clean the code
parent
c85d8b6e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dataprocessing/readtools.py
+7
-12
7 additions, 12 deletions
dataprocessing/readtools.py
with
7 additions
and
12 deletions
dataprocessing/readtools.py
+
7
−
12
View file @
7201a3f3
...
...
@@ -161,13 +161,8 @@ def read_timeseries_dpsim_cmpl_separate(filename, timeseries_names=None):
print
(
result
.
name
)
return
timeseries_list
import
numpy
as
np
import
pandas
as
pd
from
dataprocessing.timeseries
import
*
import
re
import
cmath
def
read_timeseries_NEPLAN_loadflow
(
file_name
,
timeseries_names
=
None
,
is_regex
=
False
):
def
read_timeseries_NEPLAN_loadflow
1
(
file_name
,
timeseries_names
=
None
,
is_regex
=
False
):
str_tmp
=
open
(
file_name
,
"
r
"
)
# Read in files
low
=
0
high
=
0
...
...
@@ -175,7 +170,7 @@ def read_timeseries_NEPLAN_loadflow(file_name, timeseries_names = None, is_regex
seq
=
[]
value
=
[]
i
=
0
namelist
=
[
'
Vpp
'
,
'
Vangle
'
,
'
P
'
,
'
Q
'
,
'
I
'
,
'
Iangle
'
]
namelist
=
[
'
Vpp
'
,
'
Vangle
'
,
'
I
'
,
'
Iangle
'
]
timeseries
=
[]
isfloat
=
re
.
compile
(
r
'
^[-+]?[0-9]+\.[0-9]+$
'
)
for
line
in
str_tmp
.
readlines
():
...
...
@@ -205,18 +200,18 @@ def read_timeseries_NEPLAN_loadflow(file_name, timeseries_names = None, is_regex
timeseries
.
append
(
TimeSeries
(
value
[
1
]
+
'
.
'
+
namelist
[
m
],
0
,
value
[
m
+
6
]))
else
:
for
check
in
range
(
len
(
timeseries
)
-
1
):
if
timeseries
[
check
].
name
==
value
[
3
]
+
'
.
'
+
namelist
[
4
]:
if
timeseries
[
check
].
name
==
value
[
3
]
+
'
.
'
+
namelist
[
2
]:
check_pass
=
False
# Find current of the same component, Calculate the current using (r,tha)
result
=
cmath
.
rect
(
timeseries
[
check
].
values
,
timeseries
[
check
+
1
].
values
/
180
*
cmath
.
pi
)
+
cmath
.
rect
(
value
[
10
],
value
[
11
]
/
180
*
cmath
.
pi
)
(
timeseries
[
check
].
values
,
timeseries
[
check
+
1
].
values
)
=
cmath
.
polar
(
result
)
#timeseries[check + 1].values = timeseries[check + 1].values / cmath.pi * 180
timeseries
[
check
-
1
].
values
+=
value
[
9
]
timeseries
[
check
-
2
].
values
+=
value
[
8
]
#
timeseries[check - 1].values += value[9]
#
timeseries[check - 2].values += value[8]
if
check_pass
:
for
m
in
range
(
2
,
6
):
timeseries
.
append
(
TimeSeries
(
value
[
3
]
+
'
.
'
+
namelist
[
m
],
0
,
value
[
m
+
6
]))
for
m
in
range
(
2
,
4
):
timeseries
.
append
(
TimeSeries
(
value
[
3
]
+
'
.
'
+
namelist
[
m
],
0
,
value
[
m
+
8
]))
flag
=
False
str_tmp
.
close
()
line_del
=
[]
...
...
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