Skip to content

Update the microgrid component graph to v0.5.0 and make it configurable#1437

Merged
shsms merged 4 commits into
frequenz-floss:v1.x.xfrom
shsms:component-graph-0.5
Jul 20, 2026
Merged

Update the microgrid component graph to v0.5.0 and make it configurable#1437
shsms merged 4 commits into
frequenz-floss:v1.x.xfrom
shsms:component-graph-0.5

Conversation

@shsms

@shsms shsms commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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

  • Update frequenz-microgrid-component-graph to >= 0.5.0, < 0.6.
  • Add a component_graph_config keyword argument to
    microgrid.initialize(). It takes a ComponentGraphConfig, which is
    passed to the ComponentGraph constructor. ComponentGraphConfig and
    FormulaOverrides are re-exported from frequenz.sdk.microgrid.
  • Update the formula tests to send component values that differ from the
    meter values, so both the new component-first order and the meter
    fallback are verified at runtime.
  • Rename the test helper ComponentGraphConfig to ComponentGraphSpec,
    to avoid confusion with the re-exported library class.

Breaking

  • 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.
  • Generated formula strings can differ from the previous release, and
    graph validation errors use the new Graph validation failed: message
    format.

shsms added 2 commits July 17, 2026 14:24
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
shsms requested a review from a team as a code owner July 17, 2026 14:51
@shsms
shsms requested review from ela-kotulska-frequenz and removed request for a team July 17, 2026 14:51
@github-actions github-actions Bot added part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests part:tooling Affects the development tooling (CI, deployment, dependency management, etc.) part:microgrid Affects the interactions with the microgrid labels Jul 17, 2026
@shsms
shsms force-pushed the component-graph-0.5 branch from 4ece16b to 183c5ed Compare July 17, 2026 15:03

@daniel-zullo-frequenz daniel-zullo-frequenz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@shsms
shsms force-pushed the component-graph-0.5 branch from 183c5ed to 892e734 Compare July 20, 2026 08:51
@shsms

shsms commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Should the release notes mention more explicit about the braking change described in the PR description?

that makes sense, done.

shsms added 2 commits July 20, 2026 08:55
The release notes were not reset after the v1.0.0-rc2209 release, so
they still listed the changes of that release.  Copy the template
over them again.

Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
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>
@shsms
shsms force-pushed the component-graph-0.5 branch 2 times, most recently from 8191640 to 96faca3 Compare July 20, 2026 08:57
@github-project-automation github-project-automation Bot moved this from To do to Review approved in Python SDK Roadmap Jul 20, 2026
@shsms
shsms added this pull request to the merge queue Jul 20, 2026
Merged via the queue into frequenz-floss:v1.x.x with commit 11cb1ce Jul 20, 2026
9 checks passed
@shsms
shsms deleted the component-graph-0.5 branch July 20, 2026 09:10
@github-project-automation github-project-automation Bot moved this from Review approved to Done in Python SDK Roadmap Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:docs Affects the documentation part:microgrid Affects the interactions with the microgrid part:tests Affects the unit, integration and performance (benchmarks) tests part:tooling Affects the development tooling (CI, deployment, dependency management, etc.)

Projects

Development

Successfully merging this pull request may close these issues.

2 participants