Skip to content

Commit 20203ca

Browse files
Remove requirement for inverters to have successors (#88)
This is a quick fix to allow PV inverters to be present in the graph. This will be partially reverted later by expecting battery inverters to still have graph successors.
2 parents cbf336a + 7be892c commit 20203ca

File tree

3 files changed

+9
-24
lines changed

3 files changed

+9
-24
lines changed

RELEASE_NOTES.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,13 @@
1010

1111
## New Features
1212

13-
<!-- Here goes the main new features and examples or instructions on how to use them -->
13+
- A logical meter implementation that can apply formulas on resampled component
14+
data streams.
1415

1516
## Bug Fixes
1617

17-
<!-- Here goes notable bug fixes that are worth a special mention or explanation -->
18+
- The component graph expected inverters to always have successors, and so
19+
wasn't able to support PV inverters, which don't have component successors.
20+
This is resolved by temporarily removing the requirement for inverters to have
21+
successors. This will be partially reverted later by expecting just battery
22+
inverters to have graph successors.

src/frequenz/sdk/microgrid/_graph.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -485,18 +485,6 @@ def _validate_intermediary_components(self) -> None:
485485
f"{missing_predecessors}"
486486
)
487487

488-
missing_successors = list(
489-
filter(
490-
lambda c: sum(1 for _ in self.successors(c.component_id)) == 0,
491-
intermediary_components,
492-
)
493-
)
494-
if len(missing_successors) > 0:
495-
raise InvalidGraphError(
496-
"Intermediary components without graph successors: "
497-
f"{missing_successors}"
498-
)
499-
500488
def _validate_junctions(self) -> None:
501489
"""Check that junctions are configured correctly in the graph.
502490

tests/microgrid/test_graph.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,11 +1118,7 @@ def test__validate_intermediary_components(self) -> None:
11181118
]
11191119
)
11201120
graph._graph.add_edges_from([(1, 3)])
1121-
with pytest.raises(
1122-
gr.InvalidGraphError,
1123-
match="Intermediary components without graph successors",
1124-
):
1125-
graph._validate_intermediary_components()
1121+
graph._validate_intermediary_components()
11261122

11271123
graph._graph.clear()
11281124

@@ -1134,11 +1130,7 @@ def test__validate_intermediary_components(self) -> None:
11341130
]
11351131
)
11361132
graph._graph.add_edges_from([(1, 2), (2, 3)])
1137-
with pytest.raises(
1138-
gr.InvalidGraphError,
1139-
match="Intermediary components without graph successors",
1140-
):
1141-
graph._validate_intermediary_components()
1133+
graph._validate_intermediary_components()
11421134

11431135
# all intermediary nodes have at least one predecessor
11441136
# and at least one successor

0 commit comments

Comments
 (0)