Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
Power System Automation and Monitoring
pyVolt
pyVolt
Commits
1f6ed4e7
Commit
1f6ed4e7
authored
Apr 28, 2019
by
martin.moraga
Browse files
updated CRIGRE examples
parent
f005ca76
Changes
2
Hide whitespace changes
Inline
Side-by-side
examples/CIGREMV_tests/comparison_dpsim_state_estimator.py
View file @
1f6ed4e7
import
numpy
as
np
import
math
import
sys
import
copy
import
logging
import
numpy
as
np
import
matplotlib.pyplot
as
plt
sys
.
path
.
append
(
"../../../cimpy"
)
import
cimpy
sys
.
path
.
append
(
"../../acs/state_estimation"
)
import
network
import
measurement
import
nv_state_estimator_cim
import
results
from
acs.state_estimation
import
network
from
acs.state_estimation
import
measurement
from
acs.state_estimation
import
nv_state_estimator_cim
from
acs.state_estimation
import
results
logging
.
basicConfig
(
filename
=
'CIGRE.log'
,
level
=
logging
.
INFO
,
filemode
=
'w'
)
...
...
@@ -25,10 +19,11 @@ cim_xml_files=[cim_xml_path + r"\Rootnet_FULL_NE_06J16h_DI.xml",
#read cim files and create new network.Systen object
res
=
cimpy
.
cimread
(
cim_xml_files
)
system
=
network
.
System
()
system
.
load_cim_data
(
res
)
base_apparent_power
=
25
#MW
system
.
load_cim_data
(
res
,
base_apparent_power
)
#read Input-Ergebnisdatei and store it in a results.Results object
loadflow_results_path
=
r
"
C:\Users\Martin\Desktop\hiwi\git
\reference-results\DPsim\StaticPhasor"
loadflow_results_path
=
r
"
..\..\..
\reference-results\DPsim\StaticPhasor"
loadflow_results_file
=
loadflow_results_path
+
r
"\CIGRE-MV-NoTap.csv"
powerflow_results
=
results
.
Results
(
system
)
powerflow_results
.
read_data_dpsim
(
loadflow_results_file
)
...
...
@@ -46,9 +41,9 @@ Pmu_phase_unc = 0
"""use all node voltages as measures"""
measurements_set
=
measurement
.
Measurents_set
()
for
node
in
powerflow_results
.
nodes
:
measurements_set
.
create_measurement
(
node
.
topology_node
,
nv_state_estimator_cim
.
ElemType
.
Node
,
nv_state_estimator_cim
.
MeasType
.
Vpmu_mag
,
np
.
absolute
(
node
.
voltage
),
Pmu_mag_unc
)
measurements_set
.
create_measurement
(
node
.
topology_node
,
measurement
.
ElemType
.
Node
,
measurement
.
MeasType
.
Vpmu_mag
,
np
.
absolute
(
node
.
voltage
),
Pmu_mag_unc
)
for
node
in
powerflow_results
.
nodes
:
measurements_set
.
create_measurement
(
node
.
topology_node
,
nv_state_estimator_cim
.
ElemType
.
Node
,
nv_state_estimator_cim
.
MeasType
.
Vpmu_phase
,
np
.
angle
(
node
.
voltage
),
Pmu_phase_unc
)
measurements_set
.
create_measurement
(
node
.
topology_node
,
measurement
.
ElemType
.
Node
,
measurement
.
MeasType
.
Vpmu_phase
,
np
.
angle
(
node
.
voltage
),
Pmu_phase_unc
)
measurements_set
.
meas_creation
()
# Perform state estimation
...
...
@@ -56,7 +51,7 @@ state_estimation_results_ideal = nv_state_estimator_cim.DsseCall(system, measure
# Show numerical comparison
Vest_ideal
=
state_estimation_results_ideal
.
get_voltages
()
Vtrue
=
powerflow_results
.
get_voltages
()
Vtrue
=
powerflow_results
.
get_voltages
(
pu
=
False
)
print
(
Vest_ideal
-
Vtrue
)
# --- State Estimation with Non-Ideal Measurements ---
...
...
@@ -67,9 +62,9 @@ Pmu_mag_unc = 1
"""use all node voltages as measures"""
measurements_set
=
measurement
.
Measurents_set
()
for
node
in
powerflow_results
.
nodes
:
measurements_set
.
create_measurement
(
node
.
topology_node
,
nv_state_estimator_cim
.
ElemType
.
Node
,
nv_state_estimator_cim
.
MeasType
.
Vpmu_mag
,
np
.
absolute
(
node
.
voltage
),
Pmu_mag_unc
)
measurements_set
.
create_measurement
(
node
.
topology_node
,
measurement
.
ElemType
.
Node
,
measurement
.
MeasType
.
Vpmu_mag
,
np
.
absolute
(
node
.
voltage
),
Pmu_mag_unc
)
for
node
in
powerflow_results
.
nodes
:
measurements_set
.
create_measurement
(
node
.
topology_node
,
nv_state_estimator_cim
.
ElemType
.
Node
,
nv_state_estimator_cim
.
MeasType
.
Vpmu_phase
,
np
.
angle
(
node
.
voltage
),
Pmu_phase_unc
)
measurements_set
.
create_measurement
(
node
.
topology_node
,
measurement
.
ElemType
.
Node
,
measurement
.
MeasType
.
Vpmu_phase
,
np
.
angle
(
node
.
voltage
),
Pmu_phase_unc
)
measurements_set
.
meas_creation
()
# Perform state estimation
...
...
examples/CIGREMV_tests/test_nv_powerflow_cim.py
View file @
1f6ed4e7
import
sys
import
logging
from
acs.state_estimation
import
network
from
acs.state_estimation
import
nv_powerflow_cim
from
acs.state_estimation
import
results
import
cimpy
logging
.
basicConfig
(
filename
=
'CIGRE.log'
,
level
=
logging
.
INFO
,
filemode
=
'w'
)
cim_xml_path
=
r
"
C:\Users\Martin\Desktop\hiwi\git
\cim-grid-data\CIGRE_MV\CIGRE_MV_no_tapchanger_With_LoadFlow_Results"
cim_xml_path
=
r
"
..\..\..
\cim-grid-data\CIGRE_MV\CIGRE_MV_no_tapchanger_With_LoadFlow_Results"
cim_xml_files
=
[
cim_xml_path
+
r
"\Rootnet_FULL_NE_06J16h_DI.xml"
,
cim_xml_path
+
r
"\Rootnet_FULL_NE_06J16h_EQ.xml"
,
cim_xml_path
+
r
"\Rootnet_FULL_NE_06J16h_SV.xml"
,
...
...
@@ -19,9 +19,23 @@ base_apparent_power = 25 #MW
system
.
load_cim_data
(
res
,
base_apparent_power
)
#Execute power flow analysis
results
,
num_iter_cim
=
nv_powerflow_cim
.
solve
(
system
)
results
_pf
,
num_iter_cim
=
nv_powerflow_cim
.
solve
(
system
)
#print node voltages
print
(
"results.voltages
(pu)
: "
)
for
node
in
results
.
nodes
:
print
(
"results
_pf
.voltages: "
)
for
node
in
results
_pf
.
nodes
:
print
(
'{}={}'
.
format
(
node
.
topology_node
.
uuid
,
node
.
voltage
))
print
(
"
\n\n\n
"
)
# Show numerical comparison
loadflow_results_path
=
r
"..\..\..\reference-results\DPsim\StaticPhasor"
loadflow_results_file
=
loadflow_results_path
+
r
"\CIGRE-MV-NoTap.csv"
results_dpsim
=
results
.
Results
(
system
)
results_dpsim
.
read_data_dpsim
(
file_name
=
loadflow_results_file
)
print
(
"numerical comparison : results_pf.voltages - results_dpsim.voltages "
)
for
pf_node
in
results_pf
.
nodes
:
dpsim_node
=
results_dpsim
.
get_node
(
uuid
=
pf_node
.
topology_node
.
uuid
)
diff
=
pf_node
.
voltage
-
dpsim_node
.
voltage
/
1000
print
(
'pf_node.{}-dpsim_node.{} = {}'
.
format
(
pf_node
.
topology_node
.
uuid
,
dpsim_node
.
topology_node
.
uuid
,
diff
))
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment