Amend deficit calculation in the power distributor #577
Merged
daniel-zullo-frequenz merged 3 commits intofrequenz-floss:v0.x.xfrom Aug 10, 2023
Merged
Conversation
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]>
matthias-wende-frequenz
approved these changes
Aug 10, 2023
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.
This is an internal refactoring for the power distribution algorithm maintaining its functionality, so release notes don't need to be updated.
Fixes #572