From 71c00bf9fa27964ebf5e1563891f1108507c19b8 Mon Sep 17 00:00:00 2001 From: SabineHaas Date: Mon, 18 Nov 2024 13:44:54 +0100 Subject: [PATCH] Adapt InvestedCapacity and InvestedCapacityCosts for multi period results --- src/oemof/tabular/postprocessing/calculations.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/oemof/tabular/postprocessing/calculations.py b/src/oemof/tabular/postprocessing/calculations.py index a308f815..29a287cc 100644 --- a/src/oemof/tabular/postprocessing/calculations.py +++ b/src/oemof/tabular/postprocessing/calculations.py @@ -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): @@ -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: