Skip to content

Commit

Permalink
Change input parameters in case of no outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
SabineHaas committed Oct 29, 2024
1 parent 3c323a0 commit 6106256
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 6 additions & 0 deletions data_adapter_oemof/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,17 @@ def default_post_mapping_calculations(self, mapped_defaults):
-------
"""
if len(self.structure["outputs"]) == 0:
change_parameter = "input_parameters"
else:
change_parameter = "output_parameters"
# I:
if self.process_name[-1] == "0":
mapped_defaults = calculations.decommission(
process_name=self.process_name,
adapter_dict=mapped_defaults,
column="capacity",
input_output_parameters=change_parameter,
)

# II:
Expand All @@ -362,6 +367,7 @@ def default_post_mapping_calculations(self, mapped_defaults):
process_name=self.process_name,
adapter_dict=mapped_defaults,
column="amount",
input_output_parameters=change_parameter,
)

# III:
Expand Down
4 changes: 1 addition & 3 deletions data_adapter_oemof/calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def get_capacity_cost(overnight_cost, fixed_cost, lifetime, wacc):


def decommission(
process_name, adapter_dict: dict, column: str = "capacity", max_column: str = "max"
process_name, adapter_dict: dict, column: str = "capacity", max_column: str = "max", input_output_parameters: str = "output_parameters",
) -> dict:
"""
Expand Down Expand Up @@ -92,8 +92,6 @@ def decommission(
)
return adapter_dict

input_output_parameters = "output_parameters"

# I:
if max_column not in adapter_dict[input_output_parameters].keys():
adapter_dict[input_output_parameters][max_column] = list(adapter_dict[
Expand Down

0 comments on commit 6106256

Please sign in to comment.