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
7be81b5f
Commit
7be81b5f
authored
Nov 08, 2018
by
Markus Mirz
Browse files
add python load function to network
parent
67d5a704
Changes
1
Hide whitespace changes
Inline
Side-by-side
acs/state_estimation/network.py
View file @
7be81b5f
import
numpy
as
np
class
Node
():
def
__init__
(
self
,
name
,
uuid
,
pInjection
,
qInjection
,
index
):
self
.
name
=
''
self
.
uuid
=
''
self
.
pInjection
=
0.0
self
.
qInjection
=
0.0
self
.
index
=
None
def
__init__
(
self
,
name
,
uuid
,
v_mag
,
v_phase
,
p
,
q
,
index
):
self
.
index
=
index
self
.
name
=
name
self
.
uuid
=
uuid
self
.
power
=
complex
(
p
,
q
)
self
.
voltage
=
v_mag
*
np
.
cos
(
v_phase
)
+
1j
*
v_mag
*
np
.
sin
(
v_phase
)
class
Branch
():
def
__init__
(
self
,
r
,
x
,
b
start
,
b
end
):
self
.
r
=
0.0
self
.
x
=
0.0
self
.
start
N
ode
=
b
start
self
.
end
N
ode
=
bend
def
__init__
(
self
,
r
,
x
,
start
_node
,
end
_node
):
self
.
r
=
r
self
.
x
=
x
self
.
start
_n
ode
=
start
_node
self
.
end
_n
ode
=
end_node
class
System
():
def
__init__
(
self
,
res
):
self
.
node
=
[]
self
.
branch
=
[]
class
System
():
def
__init__
(
self
):
self
.
node
s
=
[]
self
.
branch
es
=
[]
self
.
bR
=
[]
self
.
bX
=
[]
self
.
P
=
[]
self
.
Q
=
[]
def
load_cim_data
(
res
):
#this function is used to fill the vectors node, branch, bR, bX, P and Q
for
key
,
value
in
res
.
items
():
if
value
.
__class__
.
__name__
==
"TopologicalNode"
:
...
...
@@ -46,3 +49,19 @@ class System():
self
.
branch
.
append
(
Branch
(
value
.
primaryConnection
.
r
,
value
.
primaryConnection
.
x
,
startNode
,
endNode
))
else
:
continue
def
load_python_data
(
nodes
,
branches
):
system
=
System
()
for
node_idx
in
range
(
0
,
nodes
.
num
):
if
node_idx
==
0
:
system
.
nodes
.
append
(
Node
(
''
,
''
,
nodes
.
P2
[
0
],
nodes
.
Q2
[
0
],
0
,
0
,
node_idx
))
else
:
system
.
nodes
.
append
(
Node
(
''
,
''
,
0
,
0
,
nodes
.
P2
[
node_idx
],
nodes
.
Q2
[
node_idx
],
node_idx
))
for
branch_idx
in
range
(
0
,
branches
.
num
):
system
.
branches
.
append
(
Branch
(
branches
.
R
[
branch_idx
],
branches
.
X
[
branch_idx
],
system
.
nodes
[
branches
.
start
[
branch_idx
]
-
1
],
system
.
nodes
[
branches
.
end
[
branch_idx
]
-
1
]))
return
system
\ 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