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
2743eece
Commit
2743eece
authored
7 years ago
by
Markus Mirz
Browse files
Options
Downloads
Patches
Plain Diff
update
parent
8e077c15
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
+7
-0
7 additions, 0 deletions
dataprocessing/calc.py
dataprocessing/plotdpsim.py
+7
-2
7 additions, 2 deletions
dataprocessing/plotdpsim.py
dataprocessing/plottools.py
+0
-9
0 additions, 9 deletions
dataprocessing/plottools.py
with
14 additions
and
11 deletions
dataprocessing/calc.py
+
7
−
0
View file @
2743eece
...
...
@@ -9,6 +9,13 @@ def diff(name, ts1, ts2):
ts_diff
=
TimeSeries
(
name
,
ts1
.
time
,
(
ts1
.
values
-
ts2
.
values
))
return
ts_diff
def
scale_ts
(
name
,
ts
,
factor
):
"""
Scale timeseries.
Assumes the same time steps for both timeseries.
"""
ts_scaled
=
TimeSeries
(
name
,
ts
.
time
,
ts
.
values
*
factor
)
return
ts_scaled
def
complex_abs
(
name
,
real
,
imag
):
"""
Calculate absolute value of complex variable.
Assumes the same time steps for both timeseries.
...
...
This diff is collapsed.
Click to expand it.
dataprocessing/plotdpsim.py
+
7
−
2
View file @
2743eece
...
...
@@ -22,22 +22,27 @@ def plot_dpsim_abs_diff(filename1, node1, filename2, node2):
# this assumes same timestep for both simulations
ts_abs1
=
complex_abs
(
'
node
'
+
str
(
node1
)
+
'
abs
'
,
ts_dpsim1
[
node1
],
ts_dpsim1
[
node1
+
im_offset1
])
ts_abs1
=
scale_ts
(
ts_abs1
.
name
,
ts_abs1
,
0.001
)
ts_abs1
.
label
=
'
reference
'
ts_abs2
=
complex_abs
(
'
node
'
+
str
(
node2
)
+
'
abs
'
,
ts_dpsim2
[
node1
],
ts_dpsim2
[
node1
+
im_offset2
])
ts_abs2
=
scale_ts
(
ts_abs2
.
name
,
ts_abs2
,
0.001
)
ts_abs2
.
label
=
'
local co-sim
'
ts_diff
=
diff
(
'
diff
'
,
ts_abs1
,
ts_abs2
)
ts_diff
.
label
=
'
difference
'
figure_id
=
1
plt
.
figure
(
figure_id
)
#plt.figure(figure_id)
plt
.
figure
(
figure_id
,
figsize
=
(
12
/
2.54
,
6
/
2.54
),
facecolor
=
'
w
'
,
edgecolor
=
'
k
'
)
plot_single_ts
(
figure_id
,
ts_abs1
)
plot_single_ts
(
figure_id
,
ts_abs2
)
plot_single_ts
(
figure_id
,
ts_diff
)
plt
.
xlabel
(
'
Time [s]
'
)
plt
.
ylabel
(
'
Voltage [V]
'
)
plt
.
ylabel
(
'
Voltage [
k
V]
'
)
plt
.
grid
(
True
)
plt
.
tight_layout
()
plt
.
show
()
def
plot_dpsim_abs_single
(
filename
,
node
):
ts_dpsim
=
read_time_series_DPsim
(
filename
)
...
...
This diff is collapsed.
Click to expand it.
dataprocessing/plottools.py
+
0
−
9
View file @
2743eece
...
...
@@ -17,15 +17,6 @@ def plot_in_subplots(figure_id, time_series, plt_linestyle='-'):
plt
.
gca
().
autoscale
(
axis
=
'
x
'
,
tight
=
True
)
plt
.
legend
()
def
plot_in_oneplot
(
figure_id
,
time_series
,
plt_linestyle
=
'
-
'
):
plt
.
figure
(
figure_id
)
for
ts
in
time_series
:
plt
.
subplot
(
len
(
time_series
),
1
,
time_series
.
index
(
ts
)
+
1
)
plt
.
plot
(
ts
.
time
,
ts
.
values
,
linestyle
=
plt_linestyle
,
label
=
ts
.
label
)
plt
.
gca
().
autoscale
(
axis
=
'
x
'
,
tight
=
True
)
plt
.
legend
()
def
set_time_series_labels
(
time_series
,
time_series_labels
):
for
ts
in
time_series
:
ts
.
label
=
time_series_labels
[
time_series
.
index
(
ts
)]
\ 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