Skip to content

Conversation

@shsms
Copy link
Contributor

@shsms shsms commented Aug 29, 2025

Without this, when 10 kW is distributed to 3 batteries, 2 of them
attached to a single inverter, the debug log displayed the same power
for the two batteries, totalling to higher than what was requested,
which is misleading (formatted for readability):

Distributing power 10 kW between the batteries {
    ComponentId(1005): Power(value=6720.751321413104, exponent=0),
    ComponentId(1004): Power(value=6720.751321413104, exponent=0),
    ComponentId(1001): Power(value=3279.248678586895, exponent=0)
}

With this change, the log looks like this:

Distributing power 10 kW between the batteries: (CID1004, CID1005): 6.72 kW, CID1001: 3.28 kW

Also improved the formatting.

shsms added 2 commits August 29, 2025 14:12
This makes it possible to specialize `battery_distribution` to be more
suitable for logging.

Signed-off-by: Sahas Subramanian <[email protected]>
Without this, when 10 kW is distributed to 3 batteries, 2 of them
attached to a single inverter, the debug log displayed the same power
for the two batteries, totalling to higher than what was requested,
which is misleading (formatted for readability):

    Distributing power 10 kW between the batteries {
        ComponentId(1005): Power(value=6720.751321413104, exponent=0),
        ComponentId(1004): Power(value=6720.751321413104, exponent=0),
        ComponentId(1001): Power(value=3279.248678586895, exponent=0)
    }

With this change, the log looks like this:

    Distributing power 10 kW between the batteries: (CID1004, CID1005): 6.72 kW, CID1001: 3.28 kW

Also improved the formatting.

Signed-off-by: Sahas Subramanian <[email protected]>
@Copilot Copilot AI review requested due to automatic review settings August 29, 2025 12:38
@shsms shsms requested a review from a team as a code owner August 29, 2025 12:38
@shsms shsms requested review from llucax and removed request for a team August 29, 2025 12:38
@github-actions github-actions bot added the part:microgrid Affects the interactions with the microgrid label Aug 29, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a misleading debug log when multiple batteries are attached to a single inverter by properly grouping batteries and their power distribution. The change improves both the accuracy and readability of power distribution logging.

  • Corrected the logging to show combined power for batteries on the same inverter instead of duplicating power values
  • Enhanced log formatting to clearly show battery groupings and their respective power allocations
  • Fixed the tracking of battery IDs to use the actual battery set rather than distribution keys

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Signed-off-by: Sahas Subramanian <[email protected]>
@github-actions github-actions bot added the part:docs Affects the documentation label Aug 29, 2025
Copy link
Contributor

@llucax llucax left a comment

Choose a reason for hiding this comment

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

I don't understand the part:

This makes it possible to specialize battery_distribution to be more suitable for logging.

In the commit message, but besides that, LGTM.

@github-project-automation github-project-automation bot moved this from To do to Review approved in Python SDK Roadmap Aug 29, 2025
@shsms
Copy link
Contributor Author

shsms commented Aug 29, 2025

I don't understand the part:

This makes it possible to specialize battery_distribution to be more suitable for logging.

This is a description of the next commit, where we change the type of battery_distribution to be suitable for the logging requirement, without breaking anything, as it is not used elsewhere.

@shsms shsms added this pull request to the merge queue Aug 29, 2025
Merged via the queue into frequenz-floss:v1.x.x with commit d6ae10c Aug 29, 2025
5 checks passed
@shsms shsms deleted the better-power-dist-logs branch August 29, 2025 14:31
@github-project-automation github-project-automation bot moved this from Review approved to Done in Python SDK Roadmap Aug 29, 2025
@llucax llucax modified the milestones: v1.0.0-rc2200, v1.0.0-rc2101 Sep 2, 2025
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

Projects

Development

Successfully merging this pull request may close these issues.

2 participants