diff --git a/src/oemof/tabular/examples/datapackages/investment/data/elements/storage.csv b/src/oemof/tabular/examples/datapackages/investment/data/elements/storage.csv index 8ce05207..44a25964 100644 --- a/src/oemof/tabular/examples/datapackages/investment/data/elements/storage.csv +++ b/src/oemof/tabular/examples/datapackages/investment/data/elements/storage.csv @@ -1,2 +1,2 @@ name;carrier;tech;storage_capacity;capacity;capacity_cost;invest_relation_output_capacity;invest_relation_input_output;expandable;type;bus;tech -el-storage;lithium;battery;;0;10;0.2;1;true;storage;bus0;battery +el-storage;lithium;battery;100;0;10;0.2;1;true;storage;bus0;battery diff --git a/src/oemof/tabular/examples/datapackages/investment/datapackage.json b/src/oemof/tabular/examples/datapackages/investment/datapackage.json index 6244fede..bb92947c 100644 --- a/src/oemof/tabular/examples/datapackages/investment/datapackage.json +++ b/src/oemof/tabular/examples/datapackages/investment/datapackage.json @@ -356,7 +356,7 @@ }, { "name": "storage_capacity", - "type": "string", + "type": "integer", "format": "default" }, { @@ -569,4 +569,4 @@ } } ] -} \ No newline at end of file +} diff --git a/src/oemof/tabular/facades.py b/src/oemof/tabular/facades.py index f8cd92e2..fbed41ba 100644 --- a/src/oemof/tabular/facades.py +++ b/src/oemof/tabular/facades.py @@ -98,46 +98,83 @@ def _nominal_value(self): return self.capacity def _investment(self): - if self.expandable is True: - if self.capacity_cost is None: - msg = ( - "If you set `expandable`to True you need to set " - "attribute `capacity_cost` of component {}!" + if not self.expandable: + self.investment = None + return self.investment + if self.capacity_cost is None: + msg = ( + "If you set `expandable`to True you need to set " + "attribute `capacity_cost` of component {}!" + ) + raise ValueError(msg.format(self.label)) + if isinstance(self, GenericStorage): + if self.storage_capacity_cost is not None: + self.investment = Investment( + ep_costs=self.storage_capacity_cost, + maximum=self._get_maximum_additional_invest( + "storage_capacity_potential", "storage_capacity" + ), + minimum=getattr( + self, "minimum_storage_capacity", 0 + ), + existing=getattr(self, "storage_capacity", 0), ) - raise ValueError(msg.format(self.label)) else: - if isinstance(self, GenericStorage): - if self.storage_capacity_cost is not None: - self.investment = Investment( - ep_costs=self.storage_capacity_cost, - maximum=getattr( - self, - "storage_capacity_potential", - float("+inf"), - ), - minimum=getattr( - self, "minimum_storage_capacity", 0 - ), - existing=getattr(self, "storage_capacity", 0), - ) - else: - self.investment = Investment() - else: - self.investment = Investment( - ep_costs=self.capacity_cost, - maximum=getattr( - self, "capacity_potential", float("+inf") - ), - minimum=getattr( - self, "capacity_minimum", 0 - ), - existing=getattr(self, "capacity", 0), - ) + self.investment = Investment( + maximum=self._get_maximum_additional_invest( + "storage_capacity_potential", "storage_capacity" + ), + minimum=getattr( + self, "minimum_storage_capacity", 0 + ), + existing=getattr(self, "storage_capacity", 0), + ) else: - self.investment = None - + self.investment = Investment( + ep_costs=self.capacity_cost, + maximum=self._get_maximum_additional_invest( + "capacity_potential", "capacity" + ), + minimum=getattr( + self, "capacity_minimum", 0 + ), + existing=getattr(self, "capacity", 0), + ) return self.investment + def _get_maximum_additional_invest(self, attr_potential, attr_existing): + r""" + Calculates maximum additional investment by + substracting existing from potential. + + Throws an error if existing is larger than potential. + """ + _potential = getattr( + self, + attr_potential, + float("+inf"), + ) + _existing = getattr( + self, + attr_existing, + 0, + ) + + if _existing is None: + _existing = 0 + + if _potential is None: + _potential = float("+inf") + + maximum = _potential - _existing + + if maximum < 0: + raise ValueError( + f"Existing {attr_existing}={_existing} is larger" + f" than {attr_potential}={_potential}.") + + return maximum + def update(self): self.build_solph_components() @@ -374,7 +411,9 @@ def __init__(self, *args, **kwargs): self.capacity = kwargs.get("capacity") - self.capacity_potential = kwargs.get("capacity_potential") + self.capacity_potential = kwargs.get( + "capacity_potential", float("+inf") + ) self.marginal_cost = kwargs.get("marginal_cost", 0) @@ -496,7 +535,10 @@ def __init__(self, *args, **kwargs): self.capacity = kwargs.get("capacity") - self.capacity_potential = kwargs.get("capacity_potential") + self.capacity_potential = kwargs.get( + "capacity_potential", + float("+inf") + ) self.capacity_minimum = kwargs.get("capacity_minimum") @@ -931,7 +973,10 @@ def __init__(self, *args, **kwargs): self.carrier_cost = kwargs.get("carrier_cost", 0) - self.capacity_potential = kwargs.get("capacity_potential") + self.capacity_potential = kwargs.get( + "capacity_potential", + float("+inf") + ) self.capacity_minimum = kwargs.get("capacity_minimum") @@ -995,7 +1040,7 @@ class HeatPump(Transformer, Facade): expandable: boolean or numeric (binary) True, if capacity can be expanded within optimization. Default: False. capacity_potential: numeric - Maximum invest capacity in unit of output capacity. + Maximum invest capacity in unit of output capacity. Default: +inf. low_temperature_parameters: dict (optional) Set parameters on the input edge of the heat pump unit (see oemof.solph for more information on possible parameters) @@ -1068,7 +1113,10 @@ def __init__(self, *args, **kwargs): self.expandable = bool(kwargs.get("expandable", False)) - self.capacity_potential = kwargs.get("capacity_potential") + self.capacity_potential = kwargs.get( + "capacity_potential", + float("+inf") + ) self.low_temperature_parameters = kwargs.get( "low_temperature_parameters", {} @@ -1202,9 +1250,9 @@ class Storage(GenericStorage, Facade): expandable: boolean True, if capacity can be expanded within optimization. Default: False. storage_capacity_potential: numeric - Potential of the investment for storage capacity in MWh + Potential of the investment for storage capacity in MWh. Default: +inf. capacity_potential: numeric - Potential of the investment for capacity in MW + Potential of the investment for capacity in MW. Default: +inf. input_parameters: dict (optional) Set parameters on the input edge of the storage (see oemof.solph for more information on possible parameters) @@ -1320,14 +1368,16 @@ def build_solph_components(self): fi = Flow( investment=Investment( ep_costs=self.capacity_cost, - maximum=self.capacity_potential, + maximum=self._get_maximum_additional_invest( + "capacity_potential", "capacity" + ), existing=self.capacity, ), **self.input_parameters ) # set investment, but no costs (as relation input / output = 1) fo = Flow( - investment=Investment(), + investment=Investment(existing=self.capacity), variable_costs=self.marginal_cost, **self.output_parameters ) diff --git a/tests/_files/lp_files/storage_investment_brown_field.lp b/tests/_files/lp_files/storage_investment_brown_field.lp new file mode 100644 index 00000000..98f64687 --- /dev/null +++ b/tests/_files/lp_files/storage_investment_brown_field.lp @@ -0,0 +1,123 @@ +\* Source Pyomo model name=Model *\ + +min +objective: ++1300 GenericInvestmentStorageBlock_invest(storage) ++240 InvestmentFlow_invest(electricity_storage) + +s.t. + +c_e_Bus_balance(electricity_0)_: +-1 flow(electricity_storage_0) ++1 flow(storage_electricity_0) += 0 + +c_e_Bus_balance(electricity_1)_: +-1 flow(electricity_storage_1) ++1 flow(storage_electricity_1) += 0 + +c_e_Bus_balance(electricity_2)_: +-1 flow(electricity_storage_2) ++1 flow(storage_electricity_2) += 0 + +c_u_InvestmentFlow_max(electricity_storage_0)_: +-1 InvestmentFlow_invest(electricity_storage) ++1 flow(electricity_storage_0) +<= 1 + +c_u_InvestmentFlow_max(electricity_storage_1)_: +-1 InvestmentFlow_invest(electricity_storage) ++1 flow(electricity_storage_1) +<= 1 + +c_u_InvestmentFlow_max(electricity_storage_2)_: +-1 InvestmentFlow_invest(electricity_storage) ++1 flow(electricity_storage_2) +<= 1 + +c_u_InvestmentFlow_max(storage_electricity_0)_: +-1 InvestmentFlow_invest(storage_electricity) ++1 flow(storage_electricity_0) +<= 1 + +c_u_InvestmentFlow_max(storage_electricity_1)_: +-1 InvestmentFlow_invest(storage_electricity) ++1 flow(storage_electricity_1) +<= 1 + +c_u_InvestmentFlow_max(storage_electricity_2)_: +-1 InvestmentFlow_invest(storage_electricity) ++1 flow(storage_electricity_2) +<= 1 + +c_u_GenericInvestmentStorageBlock_init_content_limit(storage)_: ++1 GenericInvestmentStorageBlock_init_content(storage) +-1 GenericInvestmentStorageBlock_invest(storage) +<= 2 + +c_e_GenericInvestmentStorageBlock_balance_first(storage)_: +-1 GenericInvestmentStorageBlock_init_content(storage) ++1 GenericInvestmentStorageBlock_storage_content(storage_0) +-0.90000000000000002 flow(electricity_storage_0) ++1.1111111111111112 flow(storage_electricity_0) += 0 + +c_e_GenericInvestmentStorageBlock_balance(storage_1)_: +-1 GenericInvestmentStorageBlock_storage_content(storage_0) ++1 GenericInvestmentStorageBlock_storage_content(storage_1) +-0.90000000000000002 flow(electricity_storage_1) ++1.1111111111111112 flow(storage_electricity_1) += 0 + +c_e_GenericInvestmentStorageBlock_balance(storage_2)_: +-1 GenericInvestmentStorageBlock_storage_content(storage_1) ++1 GenericInvestmentStorageBlock_storage_content(storage_2) +-0.90000000000000002 flow(electricity_storage_2) ++1.1111111111111112 flow(storage_electricity_2) += 0 + +c_e_GenericInvestmentStorageBlock_balanced_cstr(storage)_: +-1 GenericInvestmentStorageBlock_init_content(storage) ++1 GenericInvestmentStorageBlock_storage_content(storage_2) += 0 + +c_e_GenericInvestmentStorageBlock_power_coupled(storage)_: +-1 InvestmentFlow_invest(electricity_storage) ++1 InvestmentFlow_invest(storage_electricity) += 0 + +c_u_GenericInvestmentStorageBlock_max_storage_content(storage_0)_: +-1 GenericInvestmentStorageBlock_invest(storage) ++1 GenericInvestmentStorageBlock_storage_content(storage_0) +<= 2 + +c_u_GenericInvestmentStorageBlock_max_storage_content(storage_1)_: +-1 GenericInvestmentStorageBlock_invest(storage) ++1 GenericInvestmentStorageBlock_storage_content(storage_1) +<= 2 + +c_u_GenericInvestmentStorageBlock_max_storage_content(storage_2)_: +-1 GenericInvestmentStorageBlock_invest(storage) ++1 GenericInvestmentStorageBlock_storage_content(storage_2) +<= 2 + +c_e_ONE_VAR_CONSTANT: +ONE_VAR_CONSTANT = 1.0 + +bounds + 0 <= flow(electricity_storage_0) <= +inf + 0 <= flow(electricity_storage_1) <= +inf + 0 <= flow(electricity_storage_2) <= +inf + 0 <= flow(storage_electricity_0) <= +inf + 0 <= flow(storage_electricity_1) <= +inf + 0 <= flow(storage_electricity_2) <= +inf + 0 <= InvestmentFlow_invest(electricity_storage) <= 4 + 0 <= InvestmentFlow_invest(storage_electricity) <= +inf + 0 <= GenericInvestmentStorageBlock_storage_content(storage_0) <= +inf + 0 <= GenericInvestmentStorageBlock_storage_content(storage_1) <= +inf + 0 <= GenericInvestmentStorageBlock_storage_content(storage_2) <= +inf + 0 <= GenericInvestmentStorageBlock_invest(storage) <= 8 + 0 <= GenericInvestmentStorageBlock_init_content(storage) <= +inf +end diff --git a/tests/_files/lp_files/storage_investment_brown_field_no_storage_capacity_cost.lp b/tests/_files/lp_files/storage_investment_brown_field_no_storage_capacity_cost.lp new file mode 100644 index 00000000..75bac968 --- /dev/null +++ b/tests/_files/lp_files/storage_investment_brown_field_no_storage_capacity_cost.lp @@ -0,0 +1,122 @@ +\* Source Pyomo model name=Model *\ + +min +objective: ++240 InvestmentFlow_invest(electricity_storage) + +s.t. + +c_e_Bus_balance(electricity_0)_: +-1 flow(electricity_storage_0) ++1 flow(storage_electricity_0) += 0 + +c_e_Bus_balance(electricity_1)_: +-1 flow(electricity_storage_1) ++1 flow(storage_electricity_1) += 0 + +c_e_Bus_balance(electricity_2)_: +-1 flow(electricity_storage_2) ++1 flow(storage_electricity_2) += 0 + +c_u_InvestmentFlow_max(electricity_storage_0)_: +-1 InvestmentFlow_invest(electricity_storage) ++1 flow(electricity_storage_0) +<= 1 + +c_u_InvestmentFlow_max(electricity_storage_1)_: +-1 InvestmentFlow_invest(electricity_storage) ++1 flow(electricity_storage_1) +<= 1 + +c_u_InvestmentFlow_max(electricity_storage_2)_: +-1 InvestmentFlow_invest(electricity_storage) ++1 flow(electricity_storage_2) +<= 1 + +c_u_InvestmentFlow_max(storage_electricity_0)_: +-1 InvestmentFlow_invest(storage_electricity) ++1 flow(storage_electricity_0) +<= 1 + +c_u_InvestmentFlow_max(storage_electricity_1)_: +-1 InvestmentFlow_invest(storage_electricity) ++1 flow(storage_electricity_1) +<= 1 + +c_u_InvestmentFlow_max(storage_electricity_2)_: +-1 InvestmentFlow_invest(storage_electricity) ++1 flow(storage_electricity_2) +<= 1 + +c_u_GenericInvestmentStorageBlock_init_content_limit(storage)_: ++1 GenericInvestmentStorageBlock_init_content(storage) +-1 GenericInvestmentStorageBlock_invest(storage) +<= 2 + +c_e_GenericInvestmentStorageBlock_balance_first(storage)_: +-1 GenericInvestmentStorageBlock_init_content(storage) ++1 GenericInvestmentStorageBlock_storage_content(storage_0) +-0.90000000000000002 flow(electricity_storage_0) ++1.1111111111111112 flow(storage_electricity_0) += 0 + +c_e_GenericInvestmentStorageBlock_balance(storage_1)_: +-1 GenericInvestmentStorageBlock_storage_content(storage_0) ++1 GenericInvestmentStorageBlock_storage_content(storage_1) +-0.90000000000000002 flow(electricity_storage_1) ++1.1111111111111112 flow(storage_electricity_1) += 0 + +c_e_GenericInvestmentStorageBlock_balance(storage_2)_: +-1 GenericInvestmentStorageBlock_storage_content(storage_1) ++1 GenericInvestmentStorageBlock_storage_content(storage_2) +-0.90000000000000002 flow(electricity_storage_2) ++1.1111111111111112 flow(storage_electricity_2) += 0 + +c_e_GenericInvestmentStorageBlock_balanced_cstr(storage)_: +-1 GenericInvestmentStorageBlock_init_content(storage) ++1 GenericInvestmentStorageBlock_storage_content(storage_2) += 0 + +c_e_GenericInvestmentStorageBlock_power_coupled(storage)_: +-1 InvestmentFlow_invest(electricity_storage) ++1 InvestmentFlow_invest(storage_electricity) += 0 + +c_u_GenericInvestmentStorageBlock_max_storage_content(storage_0)_: +-1 GenericInvestmentStorageBlock_invest(storage) ++1 GenericInvestmentStorageBlock_storage_content(storage_0) +<= 2 + +c_u_GenericInvestmentStorageBlock_max_storage_content(storage_1)_: +-1 GenericInvestmentStorageBlock_invest(storage) ++1 GenericInvestmentStorageBlock_storage_content(storage_1) +<= 2 + +c_u_GenericInvestmentStorageBlock_max_storage_content(storage_2)_: +-1 GenericInvestmentStorageBlock_invest(storage) ++1 GenericInvestmentStorageBlock_storage_content(storage_2) +<= 2 + +c_e_ONE_VAR_CONSTANT: +ONE_VAR_CONSTANT = 1.0 + +bounds + 0 <= flow(electricity_storage_0) <= +inf + 0 <= flow(electricity_storage_1) <= +inf + 0 <= flow(electricity_storage_2) <= +inf + 0 <= flow(storage_electricity_0) <= +inf + 0 <= flow(storage_electricity_1) <= +inf + 0 <= flow(storage_electricity_2) <= +inf + 0 <= InvestmentFlow_invest(electricity_storage) <= 4 + 0 <= InvestmentFlow_invest(storage_electricity) <= +inf + 0 <= GenericInvestmentStorageBlock_storage_content(storage_0) <= +inf + 0 <= GenericInvestmentStorageBlock_storage_content(storage_1) <= +inf + 0 <= GenericInvestmentStorageBlock_storage_content(storage_2) <= +inf + 0 <= GenericInvestmentStorageBlock_invest(storage) <= 8 + 0 <= GenericInvestmentStorageBlock_init_content(storage) <= +inf +end diff --git a/tests/_files/lp_files/storage_investment_green_field.lp b/tests/_files/lp_files/storage_investment_green_field.lp new file mode 100644 index 00000000..c5b40f5a --- /dev/null +++ b/tests/_files/lp_files/storage_investment_green_field.lp @@ -0,0 +1,123 @@ +\* Source Pyomo model name=Model *\ + +min +objective: ++1300 GenericInvestmentStorageBlock_invest(storage) ++240 InvestmentFlow_invest(electricity_storage) + +s.t. + +c_e_Bus_balance(electricity_0)_: +-1 flow(electricity_storage_0) ++1 flow(storage_electricity_0) += 0 + +c_e_Bus_balance(electricity_1)_: +-1 flow(electricity_storage_1) ++1 flow(storage_electricity_1) += 0 + +c_e_Bus_balance(electricity_2)_: +-1 flow(electricity_storage_2) ++1 flow(storage_electricity_2) += 0 + +c_u_InvestmentFlow_max(electricity_storage_0)_: +-1 InvestmentFlow_invest(electricity_storage) ++1 flow(electricity_storage_0) +<= 0 + +c_u_InvestmentFlow_max(electricity_storage_1)_: +-1 InvestmentFlow_invest(electricity_storage) ++1 flow(electricity_storage_1) +<= 0 + +c_u_InvestmentFlow_max(electricity_storage_2)_: +-1 InvestmentFlow_invest(electricity_storage) ++1 flow(electricity_storage_2) +<= 0 + +c_u_InvestmentFlow_max(storage_electricity_0)_: +-1 InvestmentFlow_invest(storage_electricity) ++1 flow(storage_electricity_0) +<= 0 + +c_u_InvestmentFlow_max(storage_electricity_1)_: +-1 InvestmentFlow_invest(storage_electricity) ++1 flow(storage_electricity_1) +<= 0 + +c_u_InvestmentFlow_max(storage_electricity_2)_: +-1 InvestmentFlow_invest(storage_electricity) ++1 flow(storage_electricity_2) +<= 0 + +c_u_GenericInvestmentStorageBlock_init_content_limit(storage)_: ++1 GenericInvestmentStorageBlock_init_content(storage) +-1 GenericInvestmentStorageBlock_invest(storage) +<= 0 + +c_e_GenericInvestmentStorageBlock_balance_first(storage)_: +-1 GenericInvestmentStorageBlock_init_content(storage) ++1 GenericInvestmentStorageBlock_storage_content(storage_0) +-0.90000000000000002 flow(electricity_storage_0) ++1.1111111111111112 flow(storage_electricity_0) += 0 + +c_e_GenericInvestmentStorageBlock_balance(storage_1)_: +-1 GenericInvestmentStorageBlock_storage_content(storage_0) ++1 GenericInvestmentStorageBlock_storage_content(storage_1) +-0.90000000000000002 flow(electricity_storage_1) ++1.1111111111111112 flow(storage_electricity_1) += 0 + +c_e_GenericInvestmentStorageBlock_balance(storage_2)_: +-1 GenericInvestmentStorageBlock_storage_content(storage_1) ++1 GenericInvestmentStorageBlock_storage_content(storage_2) +-0.90000000000000002 flow(electricity_storage_2) ++1.1111111111111112 flow(storage_electricity_2) += 0 + +c_e_GenericInvestmentStorageBlock_balanced_cstr(storage)_: +-1 GenericInvestmentStorageBlock_init_content(storage) ++1 GenericInvestmentStorageBlock_storage_content(storage_2) += 0 + +c_e_GenericInvestmentStorageBlock_power_coupled(storage)_: +-1 InvestmentFlow_invest(electricity_storage) ++1 InvestmentFlow_invest(storage_electricity) += 0 + +c_u_GenericInvestmentStorageBlock_max_storage_content(storage_0)_: +-1 GenericInvestmentStorageBlock_invest(storage) ++1 GenericInvestmentStorageBlock_storage_content(storage_0) +<= 0 + +c_u_GenericInvestmentStorageBlock_max_storage_content(storage_1)_: +-1 GenericInvestmentStorageBlock_invest(storage) ++1 GenericInvestmentStorageBlock_storage_content(storage_1) +<= 0 + +c_u_GenericInvestmentStorageBlock_max_storage_content(storage_2)_: +-1 GenericInvestmentStorageBlock_invest(storage) ++1 GenericInvestmentStorageBlock_storage_content(storage_2) +<= 0 + +c_e_ONE_VAR_CONSTANT: +ONE_VAR_CONSTANT = 1.0 + +bounds + 0 <= flow(electricity_storage_0) <= +inf + 0 <= flow(electricity_storage_1) <= +inf + 0 <= flow(electricity_storage_2) <= +inf + 0 <= flow(storage_electricity_0) <= +inf + 0 <= flow(storage_electricity_1) <= +inf + 0 <= flow(storage_electricity_2) <= +inf + 0 <= InvestmentFlow_invest(electricity_storage) <= 3 + 0 <= InvestmentFlow_invest(storage_electricity) <= +inf + 0 <= GenericInvestmentStorageBlock_storage_content(storage_0) <= +inf + 0 <= GenericInvestmentStorageBlock_storage_content(storage_1) <= +inf + 0 <= GenericInvestmentStorageBlock_storage_content(storage_2) <= +inf + 0 <= GenericInvestmentStorageBlock_invest(storage) <= 10 + 0 <= GenericInvestmentStorageBlock_init_content(storage) <= +inf +end diff --git a/tests/test_constraints.py b/tests/test_constraints.py index b9e49c18..5cbdd2f3 100644 --- a/tests/test_constraints.py +++ b/tests/test_constraints.py @@ -9,7 +9,7 @@ from oemof.solph import helpers import oemof.solph as solph -from oemof.tabular.facades import BackpressureTurbine, ExtractionTurbine +from oemof.tabular.facades import BackpressureTurbine, ExtractionTurbine, Storage def chop_trailing_whitespace(lines): @@ -89,7 +89,8 @@ def setup(cls): def get_om(self): return solph.Model( - self.energysystem, timeindex=self.energysystem.timeindex + self.energysystem, + timeindex=self.energysystem.timeindex ) def compare_to_reference_lp(self, ref_filename, my_om=None): @@ -112,6 +113,75 @@ def compare_to_reference_lp(self, ref_filename, my_om=None): with open(ref_filepath) as ref_file: compare_lp_files(new_file, ref_file) + def test_storage_investment_green_field(self): + r""" + Storage investment without existing capacities. + """ + el_bus = solph.Bus(label="electricity") + + Storage( + label="storage", + carrier="electricity", + tech="storage", + bus=el_bus, + efficiency=0.9, + expandable=True, + storage_capacity=0, # No initially installed storage capacity + storage_capacity_potential=10, + storage_capacity_cost=1300, + capacity=0, # No initially installed capacity + capacity_cost=240, + capacity_potential=3, + ) + + self.compare_to_reference_lp("storage_investment_green_field.lp") + + def test_storage_investment_brown_field(self): + r""" + Storage investment with existing capacities. + """ + bus_el = solph.Bus(label="electricity") + + Storage( + label="storage", + carrier="electricity", + tech="storage", + bus=bus_el, + efficiency=0.9, + expandable=True, + storage_capacity=2, # Existing storage capacity + storage_capacity_potential=10, + storage_capacity_cost=1300, + capacity=1, # Existing capacity + capacity_cost=240, + capacity_potential=5, + ) + + self.compare_to_reference_lp("storage_investment_brown_field.lp") + + def test_storage_investment_brown_field_no_storage_capacity_cost(self): + r""" + Storage investment with existing capacities. No costs for storage capacity + (units of energy). + """ + bus_el = solph.Bus(label="electricity") + + Storage( + label="storage", + carrier="electricity", + tech="storage", + bus=bus_el, + efficiency=0.9, + expandable=True, + storage_capacity=2, # Existing storage capacity + storage_capacity_potential=10, + capacity=1, # Existing capacity + capacity_cost=240, + capacity_potential=5, + ) + + self.compare_to_reference_lp("storage_investment_brown_field_no_storage_capacity_cost.lp") + def test_backpressure_investment_green_field(self): r""" BackpressureTurbine investment without existing capacities. @@ -213,4 +283,3 @@ def test_extraction_investment_brown_field(self): ) self.compare_to_reference_lp("extraction_investment_brown_field.lp") -