File tree Expand file tree Collapse file tree 1 file changed +19
-10
lines changed
power-grid-model-ds/solutions Expand file tree Collapse file tree 1 file changed +19
-10
lines changed Original file line number Diff line number Diff line change 1- from power_grid_model_ds import PowerGridModelInterface
2-
3- def check_for_capacity_issues (grid : Grid ) -> LineArray :
4- """Check for capacity issues on the grid.
5- Return the lines that with capacity issues.
1+ def build_new_substation (grid : Grid , location : tuple [float , float ]) -> NodeArray :
2+ """Build a new substation at the given location.
3+ Return the new substation.
64 """
7- pgm_interface = PowerGridModelInterface (grid )
8- pgm_interface .calculate_power_flow ()
9- pgm_interface .update_grid ()
5+ new_substation = MyNodeArray (
6+ node_type = [NodeType .SUBSTATION_NODE .value ],
7+ u_rated = [10500.0 ],
8+ x = [location [0 ]],
9+ y = [location [1 ]]
10+ )
11+ grid .append (new_substation )
1012
11- return grid .line [grid .line .is_overloaded ]
13+ new_source = SourceArray (
14+ node = [new_substation .id .item ()],
15+ status = [1 ],
16+ u_ref = [1 ],
17+ )
18+ grid .append (new_source )
19+ return new_substation
1220
13- print (check_for_capacity_issues (grid ))
21+ # 🏗️ Add a new substation at (400, 400)
22+ new_substation = build_new_substation (grid , (400 , 400 ))
You can’t perform that action at this time.
0 commit comments