diff --git a/oemof/solph/components.py b/oemof/solph/components.py index b1ff77606..7bb3e444e 100644 --- a/oemof/solph/components.py +++ b/oemof/solph/components.py @@ -497,7 +497,7 @@ def _create(self, group=None): def _storage_investvar_bound_rule(block, n): """Rule definition to bound the invested storage capacity `invest`. """ - return 0, n.investment.maximum + return n.investment.minimum, n.investment.maximum self.invest = Var(self.INVESTSTORAGES, within=NonNegativeReals, bounds=_storage_investvar_bound_rule) diff --git a/tests/constraint_tests.py b/tests/constraint_tests.py index ad2f9358a..dc32ab74e 100644 --- a/tests/constraint_tests.py +++ b/tests/constraint_tests.py @@ -326,6 +326,21 @@ def test_storage_invest_6(self): investment=solph.Investment(ep_costs=145, existing=10000)) self.compare_lp_files('storage_invest_6.lp') + def test_storage_minimum_invest(self): + """All invest variables are coupled. The invest variables of the Flows + will be created during the initialisation of the storage e.g. battery + """ + bel = solph.Bus(label='electricityBus') + + solph.components.GenericStorage( + label='storage1', + inputs={bel: solph.Flow()}, + outputs={bel: solph.Flow()}, + investment=solph.Investment( + ep_costs=145, minimum=100, maximum=200)) + + self.compare_lp_files('storage_invest_minimum.lp') + def test_transformer(self): """Constraint test of a LinearN1Transformer without Investment. """ diff --git a/tests/lp_files/storage_invest_minimum.lp b/tests/lp_files/storage_invest_minimum.lp new file mode 100644 index 000000000..98f558dba --- /dev/null +++ b/tests/lp_files/storage_invest_minimum.lp @@ -0,0 +1,74 @@ +\* Source Pyomo model name=Model *\ + +min +objective: ++145 GenericInvestmentStorageBlock_invest(storage1) + +s.t. + +c_e_Bus_balance(electricityBus_0)_: +-1 flow(electricityBus_storage1_0) ++1 flow(storage1_electricityBus_0) += 0 + +c_e_Bus_balance(electricityBus_1)_: +-1 flow(electricityBus_storage1_1) ++1 flow(storage1_electricityBus_1) += 0 + +c_e_Bus_balance(electricityBus_2)_: +-1 flow(electricityBus_storage1_2) ++1 flow(storage1_electricityBus_2) += 0 + +c_e_GenericInvestmentStorageBlock_balance(storage1_0)_: ++1 GenericInvestmentStorageBlock_capacity(storage1_0) +-1 GenericInvestmentStorageBlock_capacity(storage1_2) +-1 flow(electricityBus_storage1_0) ++1 flow(storage1_electricityBus_0) += 0 + +c_e_GenericInvestmentStorageBlock_balance(storage1_1)_: +-1 GenericInvestmentStorageBlock_capacity(storage1_0) ++1 GenericInvestmentStorageBlock_capacity(storage1_1) +-1 flow(electricityBus_storage1_1) ++1 flow(storage1_electricityBus_1) += 0 + +c_e_GenericInvestmentStorageBlock_balance(storage1_2)_: +-1 GenericInvestmentStorageBlock_capacity(storage1_1) ++1 GenericInvestmentStorageBlock_capacity(storage1_2) +-1 flow(electricityBus_storage1_2) ++1 flow(storage1_electricityBus_2) += 0 + +c_u_GenericInvestmentStorageBlock_max_capacity(storage1_0)_: ++1 GenericInvestmentStorageBlock_capacity(storage1_0) +-1 GenericInvestmentStorageBlock_invest(storage1) +<= 0 + +c_u_GenericInvestmentStorageBlock_max_capacity(storage1_1)_: ++1 GenericInvestmentStorageBlock_capacity(storage1_1) +-1 GenericInvestmentStorageBlock_invest(storage1) +<= 0 + +c_u_GenericInvestmentStorageBlock_max_capacity(storage1_2)_: ++1 GenericInvestmentStorageBlock_capacity(storage1_2) +-1 GenericInvestmentStorageBlock_invest(storage1) +<= 0 + +c_e_ONE_VAR_CONSTANT: +ONE_VAR_CONSTANT = 1.0 + +bounds + 0 <= flow(electricityBus_storage1_0) <= +inf + 0 <= flow(electricityBus_storage1_1) <= +inf + 0 <= flow(electricityBus_storage1_2) <= +inf + 0 <= flow(storage1_electricityBus_0) <= +inf + 0 <= flow(storage1_electricityBus_1) <= +inf + 0 <= flow(storage1_electricityBus_2) <= +inf + 0 <= GenericInvestmentStorageBlock_capacity(storage1_0) <= +inf + 0 <= GenericInvestmentStorageBlock_capacity(storage1_1) <= +inf + 0 <= GenericInvestmentStorageBlock_capacity(storage1_2) <= +inf + 100 <= GenericInvestmentStorageBlock_invest(storage1) <= 200 +end