Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amend deficit calculation in the power distributor #577

Conversation

daniel-zullo-frequenz
Copy link
Contributor

This is an internal refactoring for the power distribution algorithm maintaining its functionality, so release notes don't need to be updated.

Fixes #572

The comparison of the max excess `take_from[1]` and `deficit` against
zero was initially done using absolute tolerance. However, as both
values are then compared against each other and known to be away from
zero, the absolute tolerance becomes unnecessary. The relative tolerance,
which is defined by default as 1e-09, is sufficient for this comparison.

Signed-off-by: Daniel Zullo <[email protected]>
Originally, deficit updates were introduced as part of
adding support for exclusion bounds in the power distribution
algorithm. However, it was primarily for reasoning purposes,
and these updates have no actual effects.
Only the distributed_power requires updating and the
deficit updates were safely removed.

Signed-off-by: Daniel Zullo <[email protected]>
Merge the two separate for-loops that iterated over
the deficits items in `_distribute_power()`. It was
determined that iterating twice over the deficits items
is unnecessary. As a result, the two loops have been now
consolidated into a single loop maintaining its functionality.

Signed-off-by: Daniel Zullo <[email protected]>
@daniel-zullo-frequenz daniel-zullo-frequenz requested a review from a team as a code owner August 10, 2023 09:19
@github-actions github-actions bot added the part:power-management Affects the management of battery power and distribution label Aug 10, 2023
@daniel-zullo-frequenz daniel-zullo-frequenz added cmd:skip-release-notes It is not necessary to update release notes for this PR and removed part:power-management Affects the management of battery power and distribution labels Aug 10, 2023
@daniel-zullo-frequenz daniel-zullo-frequenz self-assigned this Aug 10, 2023
@daniel-zullo-frequenz daniel-zullo-frequenz added part:power-management Affects the management of battery power and distribution priority:low This should be addressed only if there is nothing else on the table labels Aug 10, 2023
@matthias-wende-frequenz matthias-wende-frequenz added this to the v0.25.0 milestone Aug 10, 2023
@llucax llucax removed this from the v0.25.0 milestone Aug 10, 2023
@daniel-zullo-frequenz daniel-zullo-frequenz added this pull request to the merge queue Aug 10, 2023
Merged via the queue into frequenz-floss:v0.x.x with commit 78d8d4c Aug 10, 2023
12 of 13 checks passed
@daniel-zullo-frequenz daniel-zullo-frequenz deleted the refactor/deficit-power-distribution branch August 10, 2023 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmd:skip-release-notes It is not necessary to update release notes for this PR part:power-management Affects the management of battery power and distribution priority:low This should be addressed only if there is nothing else on the table
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor deficit calculation in the power distributor
3 participants