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
3568e0fd
Commit
3568e0fd
authored
7 years ago
by
Markus Mirz
Browse files
Options
Downloads
Patches
Plain Diff
added dpsim read and complex calc support
parent
68f82ceb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dataprocessing/calc.py
+9
-0
9 additions, 0 deletions
dataprocessing/calc.py
dataprocessing/readtools.py
+27
-10
27 additions, 10 deletions
dataprocessing/readtools.py
dataprocessing/timeseries.py
+8
-0
8 additions, 0 deletions
dataprocessing/timeseries.py
with
44 additions
and
10 deletions
dataprocessing/calc.py
0 → 100644
+
9
−
0
View file @
3568e0fd
import
matplotlib.pyplot
as
plt
import
numpy
as
np
from
.timeseries
import
*
def
complex_abs
(
name
,
real
,
imag
):
ts_abs
=
TimeSeries
(
name
,
real
.
time
,
np
.
sqrt
(
real
.
values
**
2
+
imag
.
values
**
2
))
return
ts_abs
This diff is collapsed.
Click to expand it.
dataprocessing/readtools.py
+
27
−
10
View file @
3568e0fd
import
numpy
as
np
from
modelicares
import
SimRes
import
pandas
as
pd
class
TimeSeries
:
def
__init__
(
self
,
name
,
time
,
values
,
label
=
""
):
self
.
time
=
np
.
array
(
time
)
self
.
values
=
np
.
array
(
values
)
self
.
name
=
name
self
.
label
=
name
from
.timeseries
import
*
def
read_time_series_Modelica
(
filename
,
time_series_names
=
None
):
from
modelicares
import
SimRes
sim
=
SimRes
(
filename
)
times_series
=
[]
if
time_series_names
is
None
:
...
...
@@ -36,4 +29,28 @@ def read_time_series_PLECS(filename, time_series_names=None):
# Read in specified time series
for
name
in
time_series_names
:
times_series
.
append
(
TimeSeries
(
name
,
pd_df
[
'
Time
'
].
values
,
pd_df
[
name
].
values
))
return
times_series
\ No newline at end of file
return
times_series
def
read_time_series_DPsim
(
filename
,
time_series_names
=
None
):
pd_df
=
pd
.
read_csv
(
filename
,
header
=
None
)
time_series
=
[]
if
time_series_names
is
None
:
# No trajectory names specified, thus read in all
column_names
=
list
(
pd_df
.
columns
.
values
)
column_names
.
remove
(
0
)
node_index
=
1
node_number
=
int
(
len
(
column_names
)
/
2
)
for
column
in
column_names
:
if
node_index
<=
node_number
:
node_name
=
node_index
time_series
.
append
(
TimeSeries
(
'
node
'
+
str
(
node_name
)
+
'
Re
'
,
pd_df
.
iloc
[:,
0
],
pd_df
.
iloc
[:,
column
]))
else
:
node_name
=
node_index
-
node_number
time_series
.
append
(
TimeSeries
(
'
node
'
+
str
(
node_name
)
+
'
Im
'
,
pd_df
.
iloc
[:,
0
],
pd_df
.
iloc
[:,
column
]))
node_index
=
node_index
+
1
else
:
# Read in specified time series
print
(
'
no column names specified yet
'
)
return
time_series
This diff is collapsed.
Click to expand it.
dataprocessing/timeseries.py
0 → 100644
+
8
−
0
View file @
3568e0fd
import
numpy
as
np
class
TimeSeries
:
def
__init__
(
self
,
name
,
time
,
values
,
label
=
""
):
self
.
time
=
np
.
array
(
time
)
self
.
values
=
np
.
array
(
values
)
self
.
name
=
name
self
.
label
=
name
\ 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