88
99from power_grid_model_ds ._core .model .arrays import (
1010 LineArray ,
11- LinkArray ,
1211 NodeArray ,
1312 SourceArray ,
1413 SymLoadArray ,
1514 ThreeWindingTransformerArray ,
16- TransformerArray ,
1715)
1816from power_grid_model_ds ._core .model .enums .nodes import NodeType
1917from power_grid_model_ds ._core .model .grids .base import Grid
@@ -44,18 +42,18 @@ def build_basic_grid(grid: T) -> T:
4442 # ***
4543
4644 # Add Substations
47- substation = NodeArray (id = [101 ], u_rated = [10_500.0 ], node_type = [NodeType .SUBSTATION_NODE .value ])
45+ substation = grid . node . __class__ (id = [101 ], u_rated = [10_500.0 ], node_type = [NodeType .SUBSTATION_NODE .value ])
4846 grid .append (substation , check_max_id = False )
4947
5048 # Add Nodes
51- nodes = NodeArray (
49+ nodes = grid . node . __class__ (
5250 id = [102 , 103 , 104 , 105 , 106 ],
5351 u_rated = [10_500.0 ] * 4 + [400.0 ],
5452 )
5553 grid .append (nodes , check_max_id = False )
5654
5755 # Add Lines
58- lines = LineArray (
56+ lines = grid . line . __class__ (
5957 id = [201 , 202 , 203 , 204 ],
6058 from_status = [1 , 1 , 0 , 1 ],
6159 to_status = [1 , 1 , 0 , 1 ],
@@ -70,7 +68,7 @@ def build_basic_grid(grid: T) -> T:
7068 grid .append (lines , check_max_id = False )
7169
7270 # Add a transformer
73- transformer = TransformerArray .empty (1 )
71+ transformer = grid . transformer . __class__ .empty (1 )
7472 transformer .id = 301
7573 transformer .from_status = 1
7674 transformer .to_status = 1
@@ -80,7 +78,7 @@ def build_basic_grid(grid: T) -> T:
8078 grid .append (transformer , check_max_id = False )
8179
8280 # Add a link
83- link = LinkArray .empty (1 )
81+ link = grid . link . __class__ .empty (1 )
8482 link .id = 601
8583 link .from_status = 1
8684 link .to_status = 1
@@ -90,7 +88,7 @@ def build_basic_grid(grid: T) -> T:
9088 grid .append (link , check_max_id = False )
9189
9290 # Loads
93- loads = SymLoadArray (
91+ loads = grid . sym_load . __class__ (
9492 id = [401 , 402 , 403 , 404 ],
9593 node = [102 , 103 , 104 , 105 ],
9694 type = [1 ] * 4 ,
@@ -101,7 +99,7 @@ def build_basic_grid(grid: T) -> T:
10199 grid .append (loads , check_max_id = False )
102100
103101 # Add Source
104- source = SourceArray (id = [501 ], node = [101 ], status = [1 ], u_ref = [0.0 ])
102+ source = grid . source . __class__ (id = [501 ], node = [101 ], status = [1 ], u_ref = [0.0 ])
105103 grid .append (source , check_max_id = False )
106104 grid .check_ids ()
107105
0 commit comments