Skip to content

Commit

Permalink
Adapt InvestedCapacity and InvestedCapacityCosts for multi period res…
Browse files Browse the repository at this point in the history
…ults
  • Loading branch information
SabineHaas committed Nov 18, 2024
1 parent d7005e2 commit 71c00bf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/oemof/tabular/postprocessing/calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ def calculate_result(self):
target_is_none = (
self.dependency("investment").index.get_level_values(1).isnull()
)
return self.dependency("investment").loc[~target_is_none]
invested_capacity = self.dependency("investment").loc[~target_is_none]
if self.calculator.is_multi_period:
invested_capacity = helper.get_value_by_year(invested_capacity.T)
return invested_capacity


class InvestedStorageCapacity(core.Calculation):
Expand Down Expand Up @@ -179,12 +182,12 @@ def calculate_result(self):
"costs per period"
)
invested_capacity_costs = helper.multiply_var_with_param(
self.dependency("invested_capacity").sum(axis=1),
self.dependency("invested_capacity"),
self.dependency("ep_costs"),
)
else:
invested_capacity_costs = helper.multiply_var_with_param(
self.dependency("invested_capacity"),
self.dependency("invested_capacity").sum(axis=1),
self.dependency("ep_costs"),
)
if invested_capacity_costs.empty:
Expand Down

0 comments on commit 71c00bf

Please sign in to comment.