Skip to content

Commit

Permalink
GSYE-568: Return early in case if there is no self consumption
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesdiedrich committed Oct 2, 2024
1 parent 6562b69 commit b55266d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/gsy_e/gsy_e_core/sim_results/endpoint_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ def create_hierarchy_stats(self, area: "AreaBase"):
for level, consumption_list in hierarchy_self_consumption_list.items():
if len(consumption_list):
hierarchy_self_consumption[level] = sum(consumption_list) / len(consumption_list)

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

for level, self_consumption in hierarchy_self_consumption.items():
if level + 1 not in hierarchy_self_consumption:
# lowest level case:
Expand Down

0 comments on commit b55266d

Please sign in to comment.