From c57ad65bc73be3076d43fca08864dd6cf81b9791 Mon Sep 17 00:00:00 2001 From: Sahas Subramanian Date: Tue, 31 Mar 2026 11:16:09 +0200 Subject: [PATCH 1/2] Hide unconnected breakers from component graph Signed-off-by: Sahas Subramanian --- src/frequenz/gridpool/_graph_generator.py | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/frequenz/gridpool/_graph_generator.py b/src/frequenz/gridpool/_graph_generator.py index b309ee3..185fea2 100644 --- a/src/frequenz/gridpool/_graph_generator.py +++ b/src/frequenz/gridpool/_graph_generator.py @@ -3,8 +3,11 @@ """Formula generation from assets API component/connection configurations.""" +import logging + from frequenz.client.assets import AssetsApiClient from frequenz.client.assets.electrical_component import ( + Breaker, ComponentConnection, ElectricalComponent, ) @@ -12,6 +15,8 @@ from frequenz.client.common.microgrid.electrical_components import ElectricalComponentId from frequenz.microgrid_component_graph import ComponentGraph +_logger = logging.getLogger(__name__) + class ComponentGraphGenerator: """Generates component graphs for microgrids using the Assets API.""" @@ -57,6 +62,26 @@ async def get_component_graph( if any(c is None for c in connections): raise ValueError("Failed to load all electrical component connections.") + breakers = [c for c in components if isinstance(c, Breaker)] + connected_breakers = [ + b + for b in breakers + if any( + b.id in (c.source, c.destination) for c in connections if c is not None + ) + ] + + if connected_breakers: + _logger.warning( + "The following breakers are connected to other components, " + + "which is not supported by the component graph generator and may " + + "lead to graph traversal issues: %s", + [b.id for b in connected_breakers], + ) + elif breakers: + _logger.debug("Dropping unconnected breakers: %s", [b.id for b in breakers]) + components = [c for c in components if not isinstance(c, Breaker)] + graph = ComponentGraph[ ElectricalComponent, ComponentConnection, ElectricalComponentId ](components, connections) From 8cf5bcc8500e65541f7efac77533917004e0230d Mon Sep 17 00:00:00 2001 From: Sahas Subramanian Date: Tue, 31 Mar 2026 11:20:34 +0200 Subject: [PATCH 2/2] Update release notes Signed-off-by: Sahas Subramanian --- RELEASE_NOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 6f30afe..4d0613b 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -10,7 +10,7 @@ ## New Features - +- If there are unconnected breakers at a site, they are now hidden from the component graph. If there are breakers with connections to other components, they are still sent to the component graph. This is a temporary measure until the graph traversal supports breakers. ## Bug Fixes