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

GSYE-568: Change hierarchy self consumption into percentage values #1800

Merged
merged 5 commits into from
Oct 7, 2024

Conversation

hannesdiedrich
Copy link
Member

Reason for the proposed changes

Please describe what we want to achieve and why.

Proposed changes

INTEGRATION_TESTS_BRANCH=master
GSY_FRAMEWORK_BRANCH=master

@hannesdiedrich hannesdiedrich requested a review from a team October 2, 2024 13:32
Copy link

codecov bot commented Oct 7, 2024

Codecov Report

Attention: Patch coverage is 82.35294% with 3 lines in your changes missing coverage. Please review.

Project coverage is 69.55%. Comparing base (d4ea7d7) to head (e7a8af6).
Report is 11 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1800      +/-   ##
==========================================
- Coverage   69.58%   69.55%   -0.03%     
==========================================
  Files         148      148              
  Lines       14039    14055      +16     
  Branches     2623     2622       -1     
==========================================
+ Hits         9769     9776       +7     
- Misses       3752     3760       +8     
- Partials      518      519       +1     

len(hierarchy_self_consumption) > 0
and hierarchy_self_consumption[next(iter(hierarchy_self_consumption))] == 0
):
# early return in case there is no self consumpton at all (in order to not devide by 0)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# early return in case there is no self consumpton at all (in order to not devide by 0)
# early return in case there is no self consumption at all (in order to not devide by 0)

Nit

Copy link
Member Author

Choose a reason for hiding this comment

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

Comment on lines +223 to +225
assert isclose(
sum(self.hierarchy_self_consumption_percent.values()), 100
), "Self consumption percentages do not sum up to 100%"
Copy link
Member

Choose a reason for hiding this comment

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

This is a great assert, it will always confirm that this feature is working as expected, thanks!


def _calc_hierarchy_stats(self, area: "AreaBase", level: int, results: Dict):
for level, self_consumption in hierarchy_self_consumption.items():
if level + 1 not in hierarchy_self_consumption:
Copy link
Member

Choose a reason for hiding this comment

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

Not that big of an issue, since it probably makes the solution simpler, however I think that hierarchy_self_consumption could be a list and not a dict, since the index / position in the list could be used as the level number. Regardless if you believe it is more explicit that way leave it as is.

Copy link
Member Author

Choose a reason for hiding this comment

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

I do not mind either way, so I changed it to be a list: 87ff961

spyrostz
spyrostz previously approved these changes Oct 7, 2024
Copy link
Member

@spyrostz spyrostz left a comment

Choose a reason for hiding this comment

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

2 minor comments, LGTM

Copy link
Contributor

@BigTava BigTava left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@spyrostz spyrostz left a comment

Choose a reason for hiding this comment

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

LGTM

@hannesdiedrich hannesdiedrich merged commit 58563a2 into master Oct 7, 2024
4 checks passed
@hannesdiedrich hannesdiedrich deleted the feature/GSYE-568-2 branch October 7, 2024 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants