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
a4e03edf
Commit
a4e03edf
authored
6 years ago
by
Bichen Li
Browse files
Options
Downloads
Patches
Plain Diff
-Correct the file name, use comparison as function
parent
00cc7059
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
examples/CompareResults/compare_madelica_neplan.py
+0
-55
0 additions, 55 deletions
examples/CompareResults/compare_madelica_neplan.py
examples/CompareResults/compare_modelica_neplan.py
+56
-0
56 additions, 0 deletions
examples/CompareResults/compare_modelica_neplan.py
with
56 additions
and
55 deletions
examples/CompareResults/compare_madelica_neplan.py
deleted
100644 → 0
+
0
−
55
View file @
00cc7059
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import
re
from
dataprocessing.readtools
import
*
from
readin
import
read_timeseries_NEPLAN_loadflow1
# Read in original nepaln result file
file_Neplan
=
r
"
C:\Users\admin\Desktop\Slack_RxLine_PVNode\Slack_RxLine_PVNode.rlf
"
# Read in original Modeliac result file
file_Modelica
=
r
"
C:\Users\admin\Desktop\Slack_RxLine_PVNode\Slack_RxLine_PVNode.mat
"
result_neplan
=
read_timeseries_NEPLAN_loadflow1
(
file_Neplan
)
result_modelica
=
read_timeseries_Modelica
(
file_Modelica
)
# neplan result output
f_neplan
=
open
(
r
"
C:\Users\admin\Desktop\Slack_RxLine_PVNode\Slack_RxLine_PVNode_neplan.txt
"
,
"
w
"
)
# modelica result output
f_modelica
=
open
(
r
"
C:\Users\admin\Desktop\Slack_RxLine_PVNode\Slack_RxLine_PVNode_modelica.txt
"
,
"
w
"
)
# error result output
f_error
=
open
(
r
"
C:\Users\admin\Desktop\Slack_RxLine_PVNode\output_error_modelica-neplan.txt
"
,
"
w
"
)
list_del
=
[]
for
i
in
range
(
len
(
result_neplan
)):
result_neplan
[
i
].
name
=
result_neplan
[
i
].
name
.
replace
(
'
'
,
''
)
result_neplan
[
i
].
name
=
result_neplan
[
i
].
name
.
upper
()
if
'
ANGLE
'
in
result_neplan
[
i
].
name
:
pass
else
:
result_neplan
[
i
].
values
=
result_neplan
[
i
].
values
*
1000
# unification of the unit,which is kV/kA in neplan
f_neplan
.
write
(
'
%s is %s
\n
'
%
(
result_neplan
[
i
].
name
,
result_neplan
[
i
].
values
[
0
]))
# result as list of TimeSeries
for
i
in
range
(
len
(
result_modelica
)):
result_modelica
[
i
].
name
=
result_modelica
[
i
].
name
.
upper
()
if
'
ANGLE
'
in
result_modelica
[
i
].
name
:
result_modelica
[
i
].
values
=
result_modelica
[
i
].
values
/
cmath
.
pi
*
180
# unification of the unit
f_modelica
.
write
(
'
%s is %s
\n
'
%
(
result_modelica
[
i
].
name
,
result_modelica
[
i
].
values
[
1
]))
timeseries_error
=
[]
# list for error
len_limit
=
len
(
result_modelica
)
for
i
in
range
(
len
(
result_neplan
)):
flag_NOT_found
=
False
for
j
in
range
(
len_limit
):
if
result_neplan
[
i
].
name
==
result_modelica
[
j
].
name
:
# Find the same variable
timeseries_error
.
append
(
TimeSeries
(
result_neplan
[
i
].
name
,
result_modelica
[
j
].
time
,
TimeSeries
.
rmse
(
result_modelica
[
j
],
result_neplan
[
i
])))
j
=
len_limit
+
1
flag_NOT_found
=
True
if
not
flag_NOT_found
:
timeseries_error
.
append
(
TimeSeries
(
result_neplan
[
i
].
name
,
0
,
-
1
))
# No such variable in Modelica model, set the error to -1
f_error
.
write
(
'
Error of %s is %f
\n
Base value
'
'
of %s is %s
\n\n
'
%
(
timeseries_error
[
i
].
name
,
timeseries_error
[
i
].
values
,
timeseries_error
[
i
].
name
,
result_neplan
[
i
].
values
[
0
]))
This diff is collapsed.
Click to expand it.
examples/CompareResults/compare_modelica_neplan.py
0 → 100644
+
56
−
0
View file @
a4e03edf
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import
re
from
dataprocessing.readtools
import
*
def
compare_modelica_neplan
(
Net_Name
):
# Read in original nepaln result file
file_Neplan
=
os
.
path
.
abspath
(
"
C:/Users/admin/Desktop/
"
+
Net_Name
+
"
/
"
+
Net_Name
+
"
.rlf
"
)
# Read in original Modelica result file
file_Modelica
=
os
.
path
.
abspath
(
"
C:/Users/admin/Desktop/
"
+
Net_Name
+
"
/
"
+
Net_Name
+
"
.mat
"
)
result_neplan
=
read_timeseries_NEPLAN_loadflow
(
file_Neplan
)
result_modelica
=
read_timeseries_Modelica
(
file_Modelica
)
# neplan result output
f_neplan
=
open
(
os
.
path
.
abspath
(
"
C:/Users/admin/Desktop/
"
+
Net_Name
+
"
/
"
+
Net_Name
+
"
_neplan.txt
"
),
"
w
"
)
# modelica result output
f_modelica
=
open
(
os
.
path
.
abspath
(
"
C:/Users/admin/Desktop/
"
+
Net_Name
+
"
/
"
+
Net_Name
+
"
_modelica.txt
"
),
"
w
"
)
# error result output
f_error
=
open
(
os
.
path
.
abspath
(
"
C:/Users/admin/Desktop/
"
+
Net_Name
+
"
/
"
+
Net_Name
+
"
_error_modelica_neplan.txt
"
),
"
w
"
)
list_del
=
[]
for
i
in
range
(
len
(
result_neplan
)):
result_neplan
[
i
].
name
=
result_neplan
[
i
].
name
.
replace
(
'
'
,
''
)
result_neplan
[
i
].
name
=
result_neplan
[
i
].
name
.
upper
()
if
'
ANGLE
'
in
result_neplan
[
i
].
name
:
pass
else
:
result_neplan
[
i
].
values
=
result_neplan
[
i
].
values
*
1000
# unification of the unit,which is kV/kA in neplan
f_neplan
.
write
(
'
%s is %s
\n
'
%
(
result_neplan
[
i
].
name
,
result_neplan
[
i
].
values
[
0
]))
# result as list of TimeSeries
for
i
in
range
(
len
(
result_modelica
)):
result_modelica
[
i
].
name
=
result_modelica
[
i
].
name
.
upper
()
if
'
ANGLE
'
in
result_modelica
[
i
].
name
:
result_modelica
[
i
].
values
=
result_modelica
[
i
].
values
/
cmath
.
pi
*
180
# unification of the unit
f_modelica
.
write
(
'
%s is %s
\n
'
%
(
result_modelica
[
i
].
name
,
result_modelica
[
i
].
values
[
1
]))
timeseries_error
=
[]
# list for error
len_limit
=
len
(
result_modelica
)
for
i
in
range
(
len
(
result_neplan
)):
flag_NOT_found
=
False
for
j
in
range
(
len_limit
):
if
result_neplan
[
i
].
name
==
result_modelica
[
j
].
name
:
# Find the same variable
timeseries_error
.
append
(
TimeSeries
(
result_neplan
[
i
].
name
,
result_modelica
[
j
].
time
,
TimeSeries
.
rmse
(
result_modelica
[
j
],
result_neplan
[
i
])))
j
=
len_limit
+
1
flag_NOT_found
=
True
if
not
flag_NOT_found
:
timeseries_error
.
append
(
TimeSeries
(
result_neplan
[
i
].
name
,
0
,
-
1
))
# No such variable in Modelica model, set the error to -1
f_error
.
write
(
'
Error of %s is %f
\n
Base value
'
'
of %s is %s
\n\n
'
%
(
timeseries_error
[
i
].
name
,
timeseries_error
[
i
].
values
,
timeseries_error
[
i
].
name
,
result_neplan
[
i
].
values
[
0
]))
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