Skip to content

Commit

Permalink
fixed bug in calculating lcoe
Browse files Browse the repository at this point in the history
  • Loading branch information
pvstorageoptimization committed Mar 11, 2024
1 parent 29a7830 commit afeca6b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions optibess_algorithm/financial_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ def get_lcoe(self, power_output=None, purchased_from_grid=None):

lcoe = sum([(costs[i] + power_costs[i]) / (1 + self._interest_rate) ** i for i in range(self._num_of_years)]) /\
sum([power_output[i].sum() / (1 + self._interest_rate) ** i for i in range(self._num_of_years)])
return lcoe
return lcoe if np.isfinite(lcoe) else 0

def get_lcoe_no_power_costs(self, power_output=None):
"""
Expand All @@ -794,7 +794,7 @@ def get_lcoe_no_power_costs(self, power_output=None):

lcoe = sum([costs[i] / (1 + self._interest_rate) ** i for i in range(self._num_of_years)]) / \
sum([power_output[i].sum() / (1 + self._interest_rate) ** i for i in range(self._num_of_years)])
return lcoe
return lcoe if np.isfinite(lcoe) else 0

def get_lcos(self):
"""
Expand Down

0 comments on commit afeca6b

Please sign in to comment.