Update the microgrid component graph to v0.5.0 and make it configurable#1437
Open
shsms wants to merge 3 commits into
Open
Update the microgrid component graph to v0.5.0 and make it configurable#1437shsms wants to merge 3 commits into
shsms wants to merge 3 commits into
Conversation
The name clashes with the `ComponentGraphConfig` class of the component graph library, which a later commit re-exports from `frequenz.sdk.microgrid`. Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
The new version generates formulas that read from the components first and use the meter as the fallback. Some tests only sent meter values, so the formula engines never produced a value and the tests hung. These tests now also send component values. One test also asserts the exact formula string, which now has the new COALESCE order. Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
The new `component_graph_config` keyword argument takes a `ComponentGraphConfig` and is passed to the `ComponentGraph` constructor. When it is `None`, the library's default configuration is used. `ComponentGraphConfig` and `FormulaOverrides` are re-exported from `frequenz.sdk.microgrid`. Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
shsms
requested review from
ela-kotulska-frequenz
and removed request for
a team
July 17, 2026 14:51
shsms
force-pushed
the
component-graph-0.5
branch
from
July 17, 2026 15:03
4ece16b to
183c5ed
Compare
daniel-zullo-frequenz
left a comment
Contributor
There was a problem hiding this comment.
LGTM code-wise.
Should the release notes mention more explicit about the braking change described in the PR description?
Per-category formulas (battery, PV, CHP, EV charger, ...) now read the components first and use the meter as the fallback. Pass ComponentGraphConfig(prefer_meters_in_component_formulas=True) to
microgrid.initialize() to restore the old order.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The microgrid component graph library v0.5.0 changes the per-category
formulas to read the components first and use the meter as the fallback.
This PR upgrades the SDK to it and lets applications configure the
component graph from the top-level API.
Changes
frequenz-microgrid-component-graphto>= 0.5.0, < 0.6.component_graph_configkeyword argument tomicrogrid.initialize(). It takes aComponentGraphConfig, which ispassed to the
ComponentGraphconstructor.ComponentGraphConfigandFormulaOverridesare re-exported fromfrequenz.sdk.microgrid.meter values, so both the new component-first order and the meter
fallback are verified at runtime.
ComponentGraphConfigtoComponentGraphSpec,to avoid confusion with the re-exported library class.
Breaking
components first and use the meter as the fallback. Pass
ComponentGraphConfig(prefer_meters_in_component_formulas=True)tomicrogrid.initialize()to restore the old order.graph validation errors use the new
Graph validation failed:messageformat.