Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
#
# SPDX-License-Identifier: MPL-2.0

from power_grid_model_ds import PowerGridModelInterface

def check_for_capacity_issues(grid: Grid) -> LineArray:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>

SPDX-License-Identifier: MPL-2.0
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
#
# SPDX-License-Identifier: MPL-2.0

from power_grid_model_ds import PowerGridModelInterface

def check_for_capacity_issues(grid: Grid) -> LineArray:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>

SPDX-License-Identifier: MPL-2.0
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
#
# SPDX-License-Identifier: MPL-2.0

def get_all_congested_routes(grid: Grid) -> list[NodeArray]:
"""Get all nodes on routes that contain an overloaded line."""
grid.set_feeder_ids()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>

SPDX-License-Identifier: MPL-2.0
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
#
# SPDX-License-Identifier: MPL-2.0

def find_connection_point(route: NodeArray, new_substation: NodeArray) -> NodeArray:
"""Calculate the connection point for the new route.
This should be the geographically closest node to the new substation.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>

SPDX-License-Identifier: MPL-2.0
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
#
# SPDX-License-Identifier: MPL-2.0

def connect_to_route(grid: Grid, connection_point: NodeArray, new_substation: NodeArray) -> None:
"""Connect the new substation node to the connection point.
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>

SPDX-License-Identifier: MPL-2.0
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
#
# SPDX-License-Identifier: MPL-2.0

def optimize_route_transfer(grid: Grid, connection_point: NodeArray, new_substation: NodeArray) -> None:
"""Attempt to optimize the route transfer moving the naturally open point (NOP) upstream towards the old substation.
This way, the new substation will take over more nodes of the original route.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>

SPDX-License-Identifier: MPL-2.0
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
#
# SPDX-License-Identifier: MPL-2.0

class MyNodeArray(NodeArray):
_defaults = {"x": 0.0, "y": 0.0, "u": 0.0}
x: NDArray[np.float64]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>

SPDX-License-Identifier: MPL-2.0
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
#
# SPDX-License-Identifier: MPL-2.0

@dataclass
class ExtendedGrid(Grid):
node: MyNodeArray
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>

SPDX-License-Identifier: MPL-2.0
4 changes: 0 additions & 4 deletions power-grid-model-ds/solutions/introduction_1_3_grid_empty.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
# SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
#
# SPDX-License-Identifier: MPL-2.0

grid = ExtendedGrid.empty()
grid
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>

SPDX-License-Identifier: MPL-2.0
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
#
# SPDX-License-Identifier: MPL-2.0

print("Node 'u' field exists?", hasattr(grid.node, "u"))
print("Line 'i_from' field exists?", hasattr(grid.line, "i_from"))
print("Node array:", grid.node)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>

SPDX-License-Identifier: MPL-2.0
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
#
# SPDX-License-Identifier: MPL-2.0

# Create a substation node entry
substation_node = MyNodeArray(
id=[101],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>

SPDX-License-Identifier: MPL-2.0
4 changes: 0 additions & 4 deletions power-grid-model-ds/solutions/introduction_2_2_add_node.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
#
# SPDX-License-Identifier: MPL-2.0

# Create another node
load_node = MyNodeArray(
id=[102],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>

SPDX-License-Identifier: MPL-2.0
4 changes: 0 additions & 4 deletions power-grid-model-ds/solutions/introduction_2_3_add_line.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
#
# SPDX-License-Identifier: MPL-2.0

# Create a line between node 101 and 102
new_line = MyLineArray(
id=[201],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>

SPDX-License-Identifier: MPL-2.0
4 changes: 0 additions & 4 deletions power-grid-model-ds/solutions/introduction_2_4_add_load.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
#
# SPDX-License-Identifier: MPL-2.0

# Create a load at node 102
load = SymLoadArray(
id=[401],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>

SPDX-License-Identifier: MPL-2.0
4 changes: 0 additions & 4 deletions power-grid-model-ds/solutions/introduction_2_5_add_source.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
#
# SPDX-License-Identifier: MPL-2.0

# Create a source at node 101
source = SourceArray(
id=[501],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>

SPDX-License-Identifier: MPL-2.0
4 changes: 0 additions & 4 deletions power-grid-model-ds/solutions/introduction_2_6_check_ids.py
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
# SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>
#
# SPDX-License-Identifier: MPL-2.0

grid.check_ids()
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2025 Contributors to the Power Grid Model project <[email protected]>

SPDX-License-Identifier: MPL-2.0