Skip to content

Commit bb09ec8

Browse files
committed
Add basic versions of Node/Branch arrays
Signed-off-by: Thijs Baaijen <[email protected]>
1 parent a0104e3 commit bb09ec8

File tree

2 files changed

+31
-9
lines changed

2 files changed

+31
-9
lines changed

src/power_grid_model_ds/_core/model/dtypes/branches.py

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,18 @@
1111
from power_grid_model_ds._core.model.dtypes.id import Id
1212

1313

14-
class Branch(Id):
15-
"""Branch data type"""
14+
class BasicBranch(Id):
15+
"""Branch that matches the PGM Branch data type"""
1616

1717
from_node: NDArray[np.int32] # node id (from-side)
1818
to_node: NDArray[np.int32] # node id (to-side)
1919
from_status: NDArray[np.int8] # 1 = closed, 0 = open
2020
to_status: NDArray[np.int8] # 1 = closed, 0 = open
21+
22+
23+
class Branch(BasicBranch):
24+
"""PGM Branch with additional feeder information"""
25+
2126
feeder_branch_id: NDArray[np.int32] # branch id of the feeding branch
2227
feeder_node_id: NDArray[np.int32] # node id of the feeding node
2328
is_feeder: NDArray[np.bool_] # whether or not this branch is from the substation
@@ -29,12 +34,16 @@ class Branch(Id):
2934
}
3035

3136

37+
class BasicLink(BasicBranch):
38+
"""Basic Link data type"""
39+
40+
3241
class Link(Branch):
33-
"""Link data type"""
42+
"""Link data type including feeder information"""
3443

3544

36-
class Line(Branch):
37-
"""Line data type"""
45+
class BasicLine(BasicBranch):
46+
"""Basic Line data type"""
3847

3948
r1: NDArray[np.float64] # serial resistance
4049
x1: NDArray[np.float64] # serial reactance
@@ -43,8 +52,12 @@ class Line(Branch):
4352
i_n: NDArray[np.float64] # rated current
4453

4554

46-
class Transformer(Branch):
47-
"""Transformer data type"""
55+
class Line(Branch, BasicLine):
56+
"""Line data type including feeder information"""
57+
58+
59+
class BasicTransformer(BasicBranch):
60+
"""Basic Transformer data type"""
4861

4962
u1: NDArray[np.float64] # rated voltage (from-side)
5063
u2: NDArray[np.float64] # rated voltage (to-side)
@@ -64,6 +77,10 @@ class Transformer(Branch):
6477
tap_nom: NDArray[np.int8] # nominal position of tap changer
6578

6679

80+
class Transformer(Branch, BasicTransformer):
81+
"""Transformer including feeder information"""
82+
83+
6784
class Branch3(Id):
6885
"""Branch3 data type"""
6986

src/power_grid_model_ds/_core/model/dtypes/nodes.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,15 @@
1212
from power_grid_model_ds._core.model.enums.nodes import NodeType
1313

1414

15-
class Node(Id):
16-
"""Node data type"""
15+
class BasicNode(Id):
16+
"""Basic Node that matches the PGM Node data type"""
1717

1818
u_rated: NDArray[np.float64] # rated line-line voltage
19+
20+
21+
class Node(BasicNode):
22+
"""Node data type, including node type and feeder information"""
23+
1924
node_type: NDArray[np.int8]
2025
feeder_branch_id: NDArray[np.int32] # branch id of the feeder
2126
feeder_node_id: NDArray[np.int32] # node id of the first substation node

0 commit comments

Comments
 (0)