From a213d2ea17c5dab6932df4dd5d1bf15f87ea67dc Mon Sep 17 00:00:00 2001 From: Johannes Kochems Date: Fri, 4 Aug 2023 18:13:39 +0200 Subject: [PATCH 01/16] Explicitly define storage level for very first time step of optimization run --- src/oemof/solph/components/_generic_storage.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/oemof/solph/components/_generic_storage.py b/src/oemof/solph/components/_generic_storage.py index f9c5aa8b2..1c34269ad 100644 --- a/src/oemof/solph/components/_generic_storage.py +++ b/src/oemof/solph/components/_generic_storage.py @@ -1312,6 +1312,22 @@ def _old_storage_capacity_rule(block): self.old_rule_build = BuildAction(rule=_old_storage_capacity_rule) + def _initially_empty_rule(block): + """Ensure storage to be empty initially""" + for n in self.INVESTSTORAGES: + for t in m.TIMESTEPS: + if t == 0: + expr = self.storage_content[n, 0] == 0 + self.initially_empty.add((n, t), expr) + + self.initially_empty = Constraint( + self.INVESTSTORAGES, m.TIMESTEPS, noruleinit=True + ) + + self.initially_empty_build = BuildAction( + rule=_initially_empty_rule + ) + # Standard storage implementation for discrete time points else: From 0db730b5ddcb858045e545ecbcceb9f31ae042ae Mon Sep 17 00:00:00 2001 From: Johannes Kochems Date: Fri, 4 Aug 2023 18:27:23 +0200 Subject: [PATCH 02/16] Adjust multi-period constraint tests --- .../connect_investment_multi_period.lp | 380 +++++++++--------- tests/lp_files/periodical_investment_limit.lp | 202 +++++----- .../lp_files/storage_invest_1_multi_period.lp | 8 +- .../lp_files/storage_invest_2_multi_period.lp | 8 +- .../lp_files/storage_invest_3_multi_period.lp | 176 ++++---- .../lp_files/storage_invest_4_multi_period.lp | 8 +- .../lp_files/storage_invest_5_multi_period.lp | 172 ++++---- .../lp_files/storage_invest_6_multi_period.lp | 8 +- ...orage_invest_all_nonconvex_multi_period.lp | 244 +++++------ .../storage_invest_minimum_multi_period.lp | 8 +- tests/lp_files/storage_invest_multi_period.lp | 8 +- ...storage_invest_with_offset_multi_period.lp | 8 +- ...rage_invest_without_offset_multi_period.lp | 8 +- 13 files changed, 641 insertions(+), 597 deletions(-) diff --git a/tests/lp_files/connect_investment_multi_period.lp b/tests/lp_files/connect_investment_multi_period.lp index 9fb2ea73f..cc22c48bc 100644 --- a/tests/lp_files/connect_investment_multi_period.lp +++ b/tests/lp_files/connect_investment_multi_period.lp @@ -2,12 +2,12 @@ min objective: -+520.1320088877258 InvestmentFlowBlock_invest(Bus1_Sink_0) -+509.93334204678996 InvestmentFlowBlock_invest(Bus1_Sink_1) -+499.9346490654803 InvestmentFlowBlock_invest(Bus1_Sink_2) +127.95247418638057 InvestmentFlowBlock_invest(Source_Bus1_0) +125.44360214351036 InvestmentFlowBlock_invest(Source_Bus1_1) +122.9839236701082 InvestmentFlowBlock_invest(Source_Bus1_2) ++520.1320088877258 InvestmentFlowBlock_invest(Bus1_Sink_0) ++509.93334204678996 InvestmentFlowBlock_invest(Bus1_Sink_1) ++499.9346490654803 InvestmentFlowBlock_invest(Bus1_Sink_2) +150.83828257744048 GenericInvestmentStorageBlock_invest(storage_0) +147.8806691935691 GenericInvestmentStorageBlock_invest(storage_1) +144.9810482289893 GenericInvestmentStorageBlock_invest(storage_2) @@ -15,8 +15,8 @@ objective: s.t. c_e__equate_InvestmentFlowBlock_invest(Source_Bus1_0)_InvestmentFlowBlock_invest(Bus1_Sink_0)__: --1 InvestmentFlowBlock_invest(Bus1_Sink_0) +2 InvestmentFlowBlock_invest(Source_Bus1_0) +-1 InvestmentFlowBlock_invest(Bus1_Sink_0) = 0 c_e__equate_InvestmentFlowBlock_invest(Source_Bus1_0)_GenericInvestmentStorageBlock_invest(storage_0)__: @@ -25,85 +25,47 @@ c_e__equate_InvestmentFlowBlock_invest(Source_Bus1_0)_GenericInvestmentStorageBl = 0 c_e_BusBlock_balance(Bus1_0_0)_: -+1 flow(Source_Bus1_0_0) +1 flow(storage_Bus1_0_0) ++1 flow(Source_Bus1_0_0) -1 flow(Bus1_storage_0_0) -1 flow(Bus1_Sink_0_0) = 0 c_e_BusBlock_balance(Bus1_0_1)_: -+1 flow(Source_Bus1_0_1) +1 flow(storage_Bus1_0_1) ++1 flow(Source_Bus1_0_1) -1 flow(Bus1_storage_0_1) -1 flow(Bus1_Sink_0_1) = 0 c_e_BusBlock_balance(Bus1_1_2)_: -+1 flow(Source_Bus1_1_2) +1 flow(storage_Bus1_1_2) ++1 flow(Source_Bus1_1_2) -1 flow(Bus1_storage_1_2) -1 flow(Bus1_Sink_1_2) = 0 c_e_BusBlock_balance(Bus1_1_3)_: -+1 flow(Source_Bus1_1_3) +1 flow(storage_Bus1_1_3) ++1 flow(Source_Bus1_1_3) -1 flow(Bus1_storage_1_3) -1 flow(Bus1_Sink_1_3) = 0 c_e_BusBlock_balance(Bus1_2_4)_: -+1 flow(Source_Bus1_2_4) +1 flow(storage_Bus1_2_4) ++1 flow(Source_Bus1_2_4) -1 flow(Bus1_storage_2_4) -1 flow(Bus1_Sink_2_4) = 0 c_e_BusBlock_balance(Bus1_2_5)_: -+1 flow(Source_Bus1_2_5) +1 flow(storage_Bus1_2_5) ++1 flow(Source_Bus1_2_5) -1 flow(Bus1_storage_2_5) -1 flow(Bus1_Sink_2_5) = 0 -c_e_InvestmentFlowBlock_total_rule(storage_Bus1_0)_: -+1 InvestmentFlowBlock_total(storage_Bus1_0) --1 InvestmentFlowBlock_invest(storage_Bus1_0) -= 0 - -c_e_InvestmentFlowBlock_total_rule(storage_Bus1_1)_: --1 InvestmentFlowBlock_total(storage_Bus1_0) -+1 InvestmentFlowBlock_total(storage_Bus1_1) --1 InvestmentFlowBlock_invest(storage_Bus1_1) -+1 InvestmentFlowBlock_old(storage_Bus1_1) -= 0 - -c_e_InvestmentFlowBlock_total_rule(storage_Bus1_2)_: --1 InvestmentFlowBlock_total(storage_Bus1_1) -+1 InvestmentFlowBlock_total(storage_Bus1_2) --1 InvestmentFlowBlock_invest(storage_Bus1_2) -+1 InvestmentFlowBlock_old(storage_Bus1_2) -= 0 - -c_e_InvestmentFlowBlock_total_rule(Bus1_Sink_0)_: --1 InvestmentFlowBlock_invest(Bus1_Sink_0) -+1 InvestmentFlowBlock_total(Bus1_Sink_0) -= 0 - -c_e_InvestmentFlowBlock_total_rule(Bus1_Sink_1)_: --1 InvestmentFlowBlock_invest(Bus1_Sink_1) --1 InvestmentFlowBlock_total(Bus1_Sink_0) -+1 InvestmentFlowBlock_total(Bus1_Sink_1) -+1 InvestmentFlowBlock_old(Bus1_Sink_1) -= 0 - -c_e_InvestmentFlowBlock_total_rule(Bus1_Sink_2)_: --1 InvestmentFlowBlock_invest(Bus1_Sink_2) --1 InvestmentFlowBlock_total(Bus1_Sink_1) -+1 InvestmentFlowBlock_total(Bus1_Sink_2) -+1 InvestmentFlowBlock_old(Bus1_Sink_2) -= 0 - c_e_InvestmentFlowBlock_total_rule(Source_Bus1_0)_: -1 InvestmentFlowBlock_invest(Source_Bus1_0) +1 InvestmentFlowBlock_total(Source_Bus1_0) @@ -142,28 +104,42 @@ c_e_InvestmentFlowBlock_total_rule(Bus1_storage_2)_: +1 InvestmentFlowBlock_old(Bus1_storage_2) = 0 -c_e_InvestmentFlowBlock_old_rule_end(storage_Bus1_0)_: -+1 InvestmentFlowBlock_old_end(storage_Bus1_0) +c_e_InvestmentFlowBlock_total_rule(Bus1_Sink_0)_: +-1 InvestmentFlowBlock_invest(Bus1_Sink_0) ++1 InvestmentFlowBlock_total(Bus1_Sink_0) = 0 -c_e_InvestmentFlowBlock_old_rule_end(storage_Bus1_1)_: -+1 InvestmentFlowBlock_old_end(storage_Bus1_1) +c_e_InvestmentFlowBlock_total_rule(Bus1_Sink_1)_: +-1 InvestmentFlowBlock_invest(Bus1_Sink_1) +-1 InvestmentFlowBlock_total(Bus1_Sink_0) ++1 InvestmentFlowBlock_total(Bus1_Sink_1) ++1 InvestmentFlowBlock_old(Bus1_Sink_1) = 0 -c_e_InvestmentFlowBlock_old_rule_end(storage_Bus1_2)_: -+1 InvestmentFlowBlock_old_end(storage_Bus1_2) +c_e_InvestmentFlowBlock_total_rule(Bus1_Sink_2)_: +-1 InvestmentFlowBlock_invest(Bus1_Sink_2) +-1 InvestmentFlowBlock_total(Bus1_Sink_1) ++1 InvestmentFlowBlock_total(Bus1_Sink_2) ++1 InvestmentFlowBlock_old(Bus1_Sink_2) = 0 -c_e_InvestmentFlowBlock_old_rule_end(Bus1_Sink_0)_: -+1 InvestmentFlowBlock_old_end(Bus1_Sink_0) +c_e_InvestmentFlowBlock_total_rule(storage_Bus1_0)_: ++1 InvestmentFlowBlock_total(storage_Bus1_0) +-1 InvestmentFlowBlock_invest(storage_Bus1_0) = 0 -c_e_InvestmentFlowBlock_old_rule_end(Bus1_Sink_1)_: -+1 InvestmentFlowBlock_old_end(Bus1_Sink_1) +c_e_InvestmentFlowBlock_total_rule(storage_Bus1_1)_: +-1 InvestmentFlowBlock_total(storage_Bus1_0) ++1 InvestmentFlowBlock_total(storage_Bus1_1) +-1 InvestmentFlowBlock_invest(storage_Bus1_1) ++1 InvestmentFlowBlock_old(storage_Bus1_1) = 0 -c_e_InvestmentFlowBlock_old_rule_end(Bus1_Sink_2)_: -+1 InvestmentFlowBlock_old_end(Bus1_Sink_2) +c_e_InvestmentFlowBlock_total_rule(storage_Bus1_2)_: +-1 InvestmentFlowBlock_total(storage_Bus1_1) ++1 InvestmentFlowBlock_total(storage_Bus1_2) +-1 InvestmentFlowBlock_invest(storage_Bus1_2) ++1 InvestmentFlowBlock_old(storage_Bus1_2) = 0 c_e_InvestmentFlowBlock_old_rule_end(Source_Bus1_0)_: @@ -190,28 +166,28 @@ c_e_InvestmentFlowBlock_old_rule_end(Bus1_storage_2)_: +1 InvestmentFlowBlock_old_end(Bus1_storage_2) = 0 -c_e_InvestmentFlowBlock_old_rule_exo(storage_Bus1_0)_: -+1 InvestmentFlowBlock_old_exo(storage_Bus1_0) +c_e_InvestmentFlowBlock_old_rule_end(Bus1_Sink_0)_: ++1 InvestmentFlowBlock_old_end(Bus1_Sink_0) = 0 -c_e_InvestmentFlowBlock_old_rule_exo(storage_Bus1_1)_: -+1 InvestmentFlowBlock_old_exo(storage_Bus1_1) +c_e_InvestmentFlowBlock_old_rule_end(Bus1_Sink_1)_: ++1 InvestmentFlowBlock_old_end(Bus1_Sink_1) = 0 -c_e_InvestmentFlowBlock_old_rule_exo(storage_Bus1_2)_: -+1 InvestmentFlowBlock_old_exo(storage_Bus1_2) +c_e_InvestmentFlowBlock_old_rule_end(Bus1_Sink_2)_: ++1 InvestmentFlowBlock_old_end(Bus1_Sink_2) = 0 -c_e_InvestmentFlowBlock_old_rule_exo(Bus1_Sink_0)_: -+1 InvestmentFlowBlock_old_exo(Bus1_Sink_0) +c_e_InvestmentFlowBlock_old_rule_end(storage_Bus1_0)_: ++1 InvestmentFlowBlock_old_end(storage_Bus1_0) = 0 -c_e_InvestmentFlowBlock_old_rule_exo(Bus1_Sink_1)_: -+1 InvestmentFlowBlock_old_exo(Bus1_Sink_1) +c_e_InvestmentFlowBlock_old_rule_end(storage_Bus1_1)_: ++1 InvestmentFlowBlock_old_end(storage_Bus1_1) = 0 -c_e_InvestmentFlowBlock_old_rule_exo(Bus1_Sink_2)_: -+1 InvestmentFlowBlock_old_exo(Bus1_Sink_2) +c_e_InvestmentFlowBlock_old_rule_end(storage_Bus1_2)_: ++1 InvestmentFlowBlock_old_end(storage_Bus1_2) = 0 c_e_InvestmentFlowBlock_old_rule_exo(Source_Bus1_0)_: @@ -238,40 +214,28 @@ c_e_InvestmentFlowBlock_old_rule_exo(Bus1_storage_2)_: +1 InvestmentFlowBlock_old_exo(Bus1_storage_2) = 0 -c_e_InvestmentFlowBlock_old_rule(storage_Bus1_0)_: --1 InvestmentFlowBlock_old_end(storage_Bus1_0) --1 InvestmentFlowBlock_old_exo(storage_Bus1_0) -+1 InvestmentFlowBlock_old(storage_Bus1_0) +c_e_InvestmentFlowBlock_old_rule_exo(Bus1_Sink_0)_: ++1 InvestmentFlowBlock_old_exo(Bus1_Sink_0) = 0 -c_e_InvestmentFlowBlock_old_rule(storage_Bus1_1)_: -+1 InvestmentFlowBlock_old(storage_Bus1_1) --1 InvestmentFlowBlock_old_end(storage_Bus1_1) --1 InvestmentFlowBlock_old_exo(storage_Bus1_1) +c_e_InvestmentFlowBlock_old_rule_exo(Bus1_Sink_1)_: ++1 InvestmentFlowBlock_old_exo(Bus1_Sink_1) = 0 -c_e_InvestmentFlowBlock_old_rule(storage_Bus1_2)_: -+1 InvestmentFlowBlock_old(storage_Bus1_2) --1 InvestmentFlowBlock_old_end(storage_Bus1_2) --1 InvestmentFlowBlock_old_exo(storage_Bus1_2) +c_e_InvestmentFlowBlock_old_rule_exo(Bus1_Sink_2)_: ++1 InvestmentFlowBlock_old_exo(Bus1_Sink_2) = 0 -c_e_InvestmentFlowBlock_old_rule(Bus1_Sink_0)_: --1 InvestmentFlowBlock_old_end(Bus1_Sink_0) --1 InvestmentFlowBlock_old_exo(Bus1_Sink_0) -+1 InvestmentFlowBlock_old(Bus1_Sink_0) +c_e_InvestmentFlowBlock_old_rule_exo(storage_Bus1_0)_: ++1 InvestmentFlowBlock_old_exo(storage_Bus1_0) = 0 -c_e_InvestmentFlowBlock_old_rule(Bus1_Sink_1)_: -+1 InvestmentFlowBlock_old(Bus1_Sink_1) --1 InvestmentFlowBlock_old_end(Bus1_Sink_1) --1 InvestmentFlowBlock_old_exo(Bus1_Sink_1) +c_e_InvestmentFlowBlock_old_rule_exo(storage_Bus1_1)_: ++1 InvestmentFlowBlock_old_exo(storage_Bus1_1) = 0 -c_e_InvestmentFlowBlock_old_rule(Bus1_Sink_2)_: -+1 InvestmentFlowBlock_old(Bus1_Sink_2) --1 InvestmentFlowBlock_old_end(Bus1_Sink_2) --1 InvestmentFlowBlock_old_exo(Bus1_Sink_2) +c_e_InvestmentFlowBlock_old_rule_exo(storage_Bus1_2)_: ++1 InvestmentFlowBlock_old_exo(storage_Bus1_2) = 0 c_e_InvestmentFlowBlock_old_rule(Source_Bus1_0)_: @@ -310,65 +274,41 @@ c_e_InvestmentFlowBlock_old_rule(Bus1_storage_2)_: -1 InvestmentFlowBlock_old_exo(Bus1_storage_2) = 0 -c_u_InvestmentFlowBlock_max(storage_Bus1_0_0)_: -+1 flow(storage_Bus1_0_0) --1 InvestmentFlowBlock_total(storage_Bus1_0) -<= 0 - -c_u_InvestmentFlowBlock_max(storage_Bus1_0_1)_: -+1 flow(storage_Bus1_0_1) --1 InvestmentFlowBlock_total(storage_Bus1_0) -<= 0 - -c_u_InvestmentFlowBlock_max(storage_Bus1_1_2)_: -+1 flow(storage_Bus1_1_2) --1 InvestmentFlowBlock_total(storage_Bus1_1) -<= 0 - -c_u_InvestmentFlowBlock_max(storage_Bus1_1_3)_: -+1 flow(storage_Bus1_1_3) --1 InvestmentFlowBlock_total(storage_Bus1_1) -<= 0 - -c_u_InvestmentFlowBlock_max(storage_Bus1_2_4)_: -+1 flow(storage_Bus1_2_4) --1 InvestmentFlowBlock_total(storage_Bus1_2) -<= 0 - -c_u_InvestmentFlowBlock_max(storage_Bus1_2_5)_: -+1 flow(storage_Bus1_2_5) --1 InvestmentFlowBlock_total(storage_Bus1_2) -<= 0 - -c_u_InvestmentFlowBlock_max(Bus1_Sink_0_0)_: -+1 flow(Bus1_Sink_0_0) --1 InvestmentFlowBlock_total(Bus1_Sink_0) -<= 0 +c_e_InvestmentFlowBlock_old_rule(Bus1_Sink_0)_: +-1 InvestmentFlowBlock_old_end(Bus1_Sink_0) +-1 InvestmentFlowBlock_old_exo(Bus1_Sink_0) ++1 InvestmentFlowBlock_old(Bus1_Sink_0) += 0 -c_u_InvestmentFlowBlock_max(Bus1_Sink_0_1)_: -+1 flow(Bus1_Sink_0_1) --1 InvestmentFlowBlock_total(Bus1_Sink_0) -<= 0 +c_e_InvestmentFlowBlock_old_rule(Bus1_Sink_1)_: ++1 InvestmentFlowBlock_old(Bus1_Sink_1) +-1 InvestmentFlowBlock_old_end(Bus1_Sink_1) +-1 InvestmentFlowBlock_old_exo(Bus1_Sink_1) += 0 -c_u_InvestmentFlowBlock_max(Bus1_Sink_1_2)_: -+1 flow(Bus1_Sink_1_2) --1 InvestmentFlowBlock_total(Bus1_Sink_1) -<= 0 +c_e_InvestmentFlowBlock_old_rule(Bus1_Sink_2)_: ++1 InvestmentFlowBlock_old(Bus1_Sink_2) +-1 InvestmentFlowBlock_old_end(Bus1_Sink_2) +-1 InvestmentFlowBlock_old_exo(Bus1_Sink_2) += 0 -c_u_InvestmentFlowBlock_max(Bus1_Sink_1_3)_: -+1 flow(Bus1_Sink_1_3) --1 InvestmentFlowBlock_total(Bus1_Sink_1) -<= 0 +c_e_InvestmentFlowBlock_old_rule(storage_Bus1_0)_: +-1 InvestmentFlowBlock_old_end(storage_Bus1_0) +-1 InvestmentFlowBlock_old_exo(storage_Bus1_0) ++1 InvestmentFlowBlock_old(storage_Bus1_0) += 0 -c_u_InvestmentFlowBlock_max(Bus1_Sink_2_4)_: -+1 flow(Bus1_Sink_2_4) --1 InvestmentFlowBlock_total(Bus1_Sink_2) -<= 0 +c_e_InvestmentFlowBlock_old_rule(storage_Bus1_1)_: ++1 InvestmentFlowBlock_old(storage_Bus1_1) +-1 InvestmentFlowBlock_old_end(storage_Bus1_1) +-1 InvestmentFlowBlock_old_exo(storage_Bus1_1) += 0 -c_u_InvestmentFlowBlock_max(Bus1_Sink_2_5)_: -+1 flow(Bus1_Sink_2_5) --1 InvestmentFlowBlock_total(Bus1_Sink_2) -<= 0 +c_e_InvestmentFlowBlock_old_rule(storage_Bus1_2)_: ++1 InvestmentFlowBlock_old(storage_Bus1_2) +-1 InvestmentFlowBlock_old_end(storage_Bus1_2) +-1 InvestmentFlowBlock_old_exo(storage_Bus1_2) += 0 c_u_InvestmentFlowBlock_max(Source_Bus1_0_0)_: +1 flow(Source_Bus1_0_0) @@ -430,6 +370,66 @@ c_u_InvestmentFlowBlock_max(Bus1_storage_2_5)_: -1 InvestmentFlowBlock_total(Bus1_storage_2) <= 0 +c_u_InvestmentFlowBlock_max(Bus1_Sink_0_0)_: ++1 flow(Bus1_Sink_0_0) +-1 InvestmentFlowBlock_total(Bus1_Sink_0) +<= 0 + +c_u_InvestmentFlowBlock_max(Bus1_Sink_0_1)_: ++1 flow(Bus1_Sink_0_1) +-1 InvestmentFlowBlock_total(Bus1_Sink_0) +<= 0 + +c_u_InvestmentFlowBlock_max(Bus1_Sink_1_2)_: ++1 flow(Bus1_Sink_1_2) +-1 InvestmentFlowBlock_total(Bus1_Sink_1) +<= 0 + +c_u_InvestmentFlowBlock_max(Bus1_Sink_1_3)_: ++1 flow(Bus1_Sink_1_3) +-1 InvestmentFlowBlock_total(Bus1_Sink_1) +<= 0 + +c_u_InvestmentFlowBlock_max(Bus1_Sink_2_4)_: ++1 flow(Bus1_Sink_2_4) +-1 InvestmentFlowBlock_total(Bus1_Sink_2) +<= 0 + +c_u_InvestmentFlowBlock_max(Bus1_Sink_2_5)_: ++1 flow(Bus1_Sink_2_5) +-1 InvestmentFlowBlock_total(Bus1_Sink_2) +<= 0 + +c_u_InvestmentFlowBlock_max(storage_Bus1_0_0)_: ++1 flow(storage_Bus1_0_0) +-1 InvestmentFlowBlock_total(storage_Bus1_0) +<= 0 + +c_u_InvestmentFlowBlock_max(storage_Bus1_0_1)_: ++1 flow(storage_Bus1_0_1) +-1 InvestmentFlowBlock_total(storage_Bus1_0) +<= 0 + +c_u_InvestmentFlowBlock_max(storage_Bus1_1_2)_: ++1 flow(storage_Bus1_1_2) +-1 InvestmentFlowBlock_total(storage_Bus1_1) +<= 0 + +c_u_InvestmentFlowBlock_max(storage_Bus1_1_3)_: ++1 flow(storage_Bus1_1_3) +-1 InvestmentFlowBlock_total(storage_Bus1_1) +<= 0 + +c_u_InvestmentFlowBlock_max(storage_Bus1_2_4)_: ++1 flow(storage_Bus1_2_4) +-1 InvestmentFlowBlock_total(storage_Bus1_2) +<= 0 + +c_u_InvestmentFlowBlock_max(storage_Bus1_2_5)_: ++1 flow(storage_Bus1_2_5) +-1 InvestmentFlowBlock_total(storage_Bus1_2) +<= 0 + c_e_GenericInvestmentStorageBlock_total_storage_rule(storage_0)_: -1 GenericInvestmentStorageBlock_invest(storage_0) +1 GenericInvestmentStorageBlock_total(storage_0) @@ -491,11 +491,15 @@ c_e_GenericInvestmentStorageBlock_old_rule(storage_2)_: -1 GenericInvestmentStorageBlock_old_exo(storage_2) = 0 +c_e_GenericInvestmentStorageBlock_initially_empty(storage_0)_: ++1 GenericInvestmentStorageBlock_storage_content(storage_0) += 0 + c_e_GenericInvestmentStorageBlock_balance(storage_0_1)_: +1 flow(storage_Bus1_0_1) -1 flow(Bus1_storage_0_1) -+1 GenericInvestmentStorageBlock_storage_content(storage_1) -1 GenericInvestmentStorageBlock_storage_content(storage_0) ++1 GenericInvestmentStorageBlock_storage_content(storage_1) = 0 c_e_GenericInvestmentStorageBlock_balance(storage_1_2)_: @@ -587,52 +591,39 @@ c_u_GenericInvestmentStorageBlock_max_storage_content(storage_2_5)_: <= 0 bounds - 0 <= InvestmentFlowBlock_invest(Bus1_Sink_0) <= +inf - 0 <= InvestmentFlowBlock_invest(Bus1_Sink_1) <= +inf - 0 <= InvestmentFlowBlock_invest(Bus1_Sink_2) <= +inf 0 <= InvestmentFlowBlock_invest(Source_Bus1_0) <= +inf 0 <= InvestmentFlowBlock_invest(Source_Bus1_1) <= +inf 0 <= InvestmentFlowBlock_invest(Source_Bus1_2) <= +inf + 0 <= InvestmentFlowBlock_invest(Bus1_Sink_0) <= +inf + 0 <= InvestmentFlowBlock_invest(Bus1_Sink_1) <= +inf + 0 <= InvestmentFlowBlock_invest(Bus1_Sink_2) <= +inf 0 <= GenericInvestmentStorageBlock_invest(storage_0) <= +inf 0 <= GenericInvestmentStorageBlock_invest(storage_1) <= +inf 0 <= GenericInvestmentStorageBlock_invest(storage_2) <= +inf - 0 <= flow(Source_Bus1_0_0) <= +inf 0 <= flow(storage_Bus1_0_0) <= +inf + 0 <= flow(Source_Bus1_0_0) <= +inf 0 <= flow(Bus1_storage_0_0) <= +inf 0 <= flow(Bus1_Sink_0_0) <= +inf - 0 <= flow(Source_Bus1_0_1) <= +inf 0 <= flow(storage_Bus1_0_1) <= +inf + 0 <= flow(Source_Bus1_0_1) <= +inf 0 <= flow(Bus1_storage_0_1) <= +inf 0 <= flow(Bus1_Sink_0_1) <= +inf - 0 <= flow(Source_Bus1_1_2) <= +inf 0 <= flow(storage_Bus1_1_2) <= +inf + 0 <= flow(Source_Bus1_1_2) <= +inf 0 <= flow(Bus1_storage_1_2) <= +inf 0 <= flow(Bus1_Sink_1_2) <= +inf - 0 <= flow(Source_Bus1_1_3) <= +inf 0 <= flow(storage_Bus1_1_3) <= +inf + 0 <= flow(Source_Bus1_1_3) <= +inf 0 <= flow(Bus1_storage_1_3) <= +inf 0 <= flow(Bus1_Sink_1_3) <= +inf - 0 <= flow(Source_Bus1_2_4) <= +inf 0 <= flow(storage_Bus1_2_4) <= +inf + 0 <= flow(Source_Bus1_2_4) <= +inf 0 <= flow(Bus1_storage_2_4) <= +inf 0 <= flow(Bus1_Sink_2_4) <= +inf - 0 <= flow(Source_Bus1_2_5) <= +inf 0 <= flow(storage_Bus1_2_5) <= +inf + 0 <= flow(Source_Bus1_2_5) <= +inf 0 <= flow(Bus1_storage_2_5) <= +inf 0 <= flow(Bus1_Sink_2_5) <= +inf - 0 <= InvestmentFlowBlock_total(storage_Bus1_0) <= +inf - 0 <= InvestmentFlowBlock_invest(storage_Bus1_0) <= +inf - 0 <= InvestmentFlowBlock_total(storage_Bus1_1) <= +inf - 0 <= InvestmentFlowBlock_invest(storage_Bus1_1) <= +inf - 0 <= InvestmentFlowBlock_old(storage_Bus1_1) <= +inf - 0 <= InvestmentFlowBlock_total(storage_Bus1_2) <= +inf - 0 <= InvestmentFlowBlock_invest(storage_Bus1_2) <= +inf - 0 <= InvestmentFlowBlock_old(storage_Bus1_2) <= +inf - 0 <= InvestmentFlowBlock_total(Bus1_Sink_0) <= +inf - 0 <= InvestmentFlowBlock_total(Bus1_Sink_1) <= +inf - 0 <= InvestmentFlowBlock_old(Bus1_Sink_1) <= +inf - 0 <= InvestmentFlowBlock_total(Bus1_Sink_2) <= +inf - 0 <= InvestmentFlowBlock_old(Bus1_Sink_2) <= +inf 0 <= InvestmentFlowBlock_total(Source_Bus1_0) <= +inf 0 <= InvestmentFlowBlock_total(Source_Bus1_1) <= +inf 0 <= InvestmentFlowBlock_old(Source_Bus1_1) <= +inf @@ -646,34 +637,47 @@ bounds 0 <= InvestmentFlowBlock_total(Bus1_storage_2) <= +inf 0 <= InvestmentFlowBlock_invest(Bus1_storage_2) <= +inf 0 <= InvestmentFlowBlock_old(Bus1_storage_2) <= +inf - 0 <= InvestmentFlowBlock_old_end(storage_Bus1_0) <= +inf - 0 <= InvestmentFlowBlock_old_end(storage_Bus1_1) <= +inf - 0 <= InvestmentFlowBlock_old_end(storage_Bus1_2) <= +inf - 0 <= InvestmentFlowBlock_old_end(Bus1_Sink_0) <= +inf - 0 <= InvestmentFlowBlock_old_end(Bus1_Sink_1) <= +inf - 0 <= InvestmentFlowBlock_old_end(Bus1_Sink_2) <= +inf + 0 <= InvestmentFlowBlock_total(Bus1_Sink_0) <= +inf + 0 <= InvestmentFlowBlock_total(Bus1_Sink_1) <= +inf + 0 <= InvestmentFlowBlock_old(Bus1_Sink_1) <= +inf + 0 <= InvestmentFlowBlock_total(Bus1_Sink_2) <= +inf + 0 <= InvestmentFlowBlock_old(Bus1_Sink_2) <= +inf + 0 <= InvestmentFlowBlock_total(storage_Bus1_0) <= +inf + 0 <= InvestmentFlowBlock_invest(storage_Bus1_0) <= +inf + 0 <= InvestmentFlowBlock_total(storage_Bus1_1) <= +inf + 0 <= InvestmentFlowBlock_invest(storage_Bus1_1) <= +inf + 0 <= InvestmentFlowBlock_old(storage_Bus1_1) <= +inf + 0 <= InvestmentFlowBlock_total(storage_Bus1_2) <= +inf + 0 <= InvestmentFlowBlock_invest(storage_Bus1_2) <= +inf + 0 <= InvestmentFlowBlock_old(storage_Bus1_2) <= +inf 0 <= InvestmentFlowBlock_old_end(Source_Bus1_0) <= +inf 0 <= InvestmentFlowBlock_old_end(Source_Bus1_1) <= +inf 0 <= InvestmentFlowBlock_old_end(Source_Bus1_2) <= +inf 0 <= InvestmentFlowBlock_old_end(Bus1_storage_0) <= +inf 0 <= InvestmentFlowBlock_old_end(Bus1_storage_1) <= +inf 0 <= InvestmentFlowBlock_old_end(Bus1_storage_2) <= +inf - 0 <= InvestmentFlowBlock_old_exo(storage_Bus1_0) <= +inf - 0 <= InvestmentFlowBlock_old_exo(storage_Bus1_1) <= +inf - 0 <= InvestmentFlowBlock_old_exo(storage_Bus1_2) <= +inf - 0 <= InvestmentFlowBlock_old_exo(Bus1_Sink_0) <= +inf - 0 <= InvestmentFlowBlock_old_exo(Bus1_Sink_1) <= +inf - 0 <= InvestmentFlowBlock_old_exo(Bus1_Sink_2) <= +inf + 0 <= InvestmentFlowBlock_old_end(Bus1_Sink_0) <= +inf + 0 <= InvestmentFlowBlock_old_end(Bus1_Sink_1) <= +inf + 0 <= InvestmentFlowBlock_old_end(Bus1_Sink_2) <= +inf + 0 <= InvestmentFlowBlock_old_end(storage_Bus1_0) <= +inf + 0 <= InvestmentFlowBlock_old_end(storage_Bus1_1) <= +inf + 0 <= InvestmentFlowBlock_old_end(storage_Bus1_2) <= +inf 0 <= InvestmentFlowBlock_old_exo(Source_Bus1_0) <= +inf 0 <= InvestmentFlowBlock_old_exo(Source_Bus1_1) <= +inf 0 <= InvestmentFlowBlock_old_exo(Source_Bus1_2) <= +inf 0 <= InvestmentFlowBlock_old_exo(Bus1_storage_0) <= +inf 0 <= InvestmentFlowBlock_old_exo(Bus1_storage_1) <= +inf 0 <= InvestmentFlowBlock_old_exo(Bus1_storage_2) <= +inf - 0 <= InvestmentFlowBlock_old(storage_Bus1_0) <= +inf - 0 <= InvestmentFlowBlock_old(Bus1_Sink_0) <= +inf + 0 <= InvestmentFlowBlock_old_exo(Bus1_Sink_0) <= +inf + 0 <= InvestmentFlowBlock_old_exo(Bus1_Sink_1) <= +inf + 0 <= InvestmentFlowBlock_old_exo(Bus1_Sink_2) <= +inf + 0 <= InvestmentFlowBlock_old_exo(storage_Bus1_0) <= +inf + 0 <= InvestmentFlowBlock_old_exo(storage_Bus1_1) <= +inf + 0 <= InvestmentFlowBlock_old_exo(storage_Bus1_2) <= +inf 0 <= InvestmentFlowBlock_old(Source_Bus1_0) <= +inf 0 <= InvestmentFlowBlock_old(Bus1_storage_0) <= +inf + 0 <= InvestmentFlowBlock_old(Bus1_Sink_0) <= +inf + 0 <= InvestmentFlowBlock_old(storage_Bus1_0) <= +inf 0 <= GenericInvestmentStorageBlock_total(storage_0) <= +inf 0 <= GenericInvestmentStorageBlock_total(storage_1) <= +inf 0 <= GenericInvestmentStorageBlock_old(storage_1) <= +inf @@ -686,8 +690,8 @@ bounds 0 <= GenericInvestmentStorageBlock_old_exo(storage_1) <= +inf 0 <= GenericInvestmentStorageBlock_old_exo(storage_2) <= +inf 0 <= GenericInvestmentStorageBlock_old(storage_0) <= +inf - 0 <= GenericInvestmentStorageBlock_storage_content(storage_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage_0) <= +inf + 0 <= GenericInvestmentStorageBlock_storage_content(storage_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage_2) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage_3) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage_4) <= +inf diff --git a/tests/lp_files/periodical_investment_limit.lp b/tests/lp_files/periodical_investment_limit.lp index 99a8eb737..b6c76060f 100644 --- a/tests/lp_files/periodical_investment_limit.lp +++ b/tests/lp_files/periodical_investment_limit.lp @@ -27,60 +27,41 @@ c_u_investment_limit_per_period(2)_: <= 300 c_e_BusBlock_balance(Bus1_0_0)_: -+1 flow(Source_Bus1_0_0) +1 flow(storage_invest_limit_Bus1_0_0) ++1 flow(Source_Bus1_0_0) -1 flow(Bus1_storage_invest_limit_0_0) = 0 c_e_BusBlock_balance(Bus1_0_1)_: -+1 flow(Source_Bus1_0_1) +1 flow(storage_invest_limit_Bus1_0_1) ++1 flow(Source_Bus1_0_1) -1 flow(Bus1_storage_invest_limit_0_1) = 0 c_e_BusBlock_balance(Bus1_1_2)_: -+1 flow(Source_Bus1_1_2) +1 flow(storage_invest_limit_Bus1_1_2) ++1 flow(Source_Bus1_1_2) -1 flow(Bus1_storage_invest_limit_1_2) = 0 c_e_BusBlock_balance(Bus1_1_3)_: -+1 flow(Source_Bus1_1_3) +1 flow(storage_invest_limit_Bus1_1_3) ++1 flow(Source_Bus1_1_3) -1 flow(Bus1_storage_invest_limit_1_3) = 0 c_e_BusBlock_balance(Bus1_2_4)_: -+1 flow(Source_Bus1_2_4) +1 flow(storage_invest_limit_Bus1_2_4) ++1 flow(Source_Bus1_2_4) -1 flow(Bus1_storage_invest_limit_2_4) = 0 c_e_BusBlock_balance(Bus1_2_5)_: -+1 flow(Source_Bus1_2_5) +1 flow(storage_invest_limit_Bus1_2_5) ++1 flow(Source_Bus1_2_5) -1 flow(Bus1_storage_invest_limit_2_5) = 0 -c_e_InvestmentFlowBlock_total_rule(Bus1_storage_invest_limit_0)_: -+1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_0) --1 InvestmentFlowBlock_invest(Bus1_storage_invest_limit_0) -= 0 - -c_e_InvestmentFlowBlock_total_rule(Bus1_storage_invest_limit_1)_: --1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_0) -+1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_1) --1 InvestmentFlowBlock_invest(Bus1_storage_invest_limit_1) -+1 InvestmentFlowBlock_old(Bus1_storage_invest_limit_1) -= 0 - -c_e_InvestmentFlowBlock_total_rule(Bus1_storage_invest_limit_2)_: --1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_1) -+1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_2) --1 InvestmentFlowBlock_invest(Bus1_storage_invest_limit_2) -+1 InvestmentFlowBlock_old(Bus1_storage_invest_limit_2) -= 0 - c_e_InvestmentFlowBlock_total_rule(storage_invest_limit_Bus1_0)_: +1 InvestmentFlowBlock_total(storage_invest_limit_Bus1_0) -1 InvestmentFlowBlock_invest(storage_invest_limit_Bus1_0) @@ -119,16 +100,23 @@ c_e_InvestmentFlowBlock_total_rule(Source_Bus1_2)_: +1 InvestmentFlowBlock_old(Source_Bus1_2) = 0 -c_e_InvestmentFlowBlock_old_rule_end(Bus1_storage_invest_limit_0)_: -+1 InvestmentFlowBlock_old_end(Bus1_storage_invest_limit_0) +c_e_InvestmentFlowBlock_total_rule(Bus1_storage_invest_limit_0)_: ++1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_0) +-1 InvestmentFlowBlock_invest(Bus1_storage_invest_limit_0) = 0 -c_e_InvestmentFlowBlock_old_rule_end(Bus1_storage_invest_limit_1)_: -+1 InvestmentFlowBlock_old_end(Bus1_storage_invest_limit_1) +c_e_InvestmentFlowBlock_total_rule(Bus1_storage_invest_limit_1)_: +-1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_0) ++1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_1) +-1 InvestmentFlowBlock_invest(Bus1_storage_invest_limit_1) ++1 InvestmentFlowBlock_old(Bus1_storage_invest_limit_1) = 0 -c_e_InvestmentFlowBlock_old_rule_end(Bus1_storage_invest_limit_2)_: -+1 InvestmentFlowBlock_old_end(Bus1_storage_invest_limit_2) +c_e_InvestmentFlowBlock_total_rule(Bus1_storage_invest_limit_2)_: +-1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_1) ++1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_2) +-1 InvestmentFlowBlock_invest(Bus1_storage_invest_limit_2) ++1 InvestmentFlowBlock_old(Bus1_storage_invest_limit_2) = 0 c_e_InvestmentFlowBlock_old_rule_end(storage_invest_limit_Bus1_0)_: @@ -155,16 +143,16 @@ c_e_InvestmentFlowBlock_old_rule_end(Source_Bus1_2)_: +1 InvestmentFlowBlock_old_end(Source_Bus1_2) = 0 -c_e_InvestmentFlowBlock_old_rule_exo(Bus1_storage_invest_limit_0)_: -+1 InvestmentFlowBlock_old_exo(Bus1_storage_invest_limit_0) +c_e_InvestmentFlowBlock_old_rule_end(Bus1_storage_invest_limit_0)_: ++1 InvestmentFlowBlock_old_end(Bus1_storage_invest_limit_0) = 0 -c_e_InvestmentFlowBlock_old_rule_exo(Bus1_storage_invest_limit_1)_: -+1 InvestmentFlowBlock_old_exo(Bus1_storage_invest_limit_1) +c_e_InvestmentFlowBlock_old_rule_end(Bus1_storage_invest_limit_1)_: ++1 InvestmentFlowBlock_old_end(Bus1_storage_invest_limit_1) = 0 -c_e_InvestmentFlowBlock_old_rule_exo(Bus1_storage_invest_limit_2)_: -+1 InvestmentFlowBlock_old_exo(Bus1_storage_invest_limit_2) +c_e_InvestmentFlowBlock_old_rule_end(Bus1_storage_invest_limit_2)_: ++1 InvestmentFlowBlock_old_end(Bus1_storage_invest_limit_2) = 0 c_e_InvestmentFlowBlock_old_rule_exo(storage_invest_limit_Bus1_0)_: @@ -191,22 +179,16 @@ c_e_InvestmentFlowBlock_old_rule_exo(Source_Bus1_2)_: +1 InvestmentFlowBlock_old_exo(Source_Bus1_2) = 0 -c_e_InvestmentFlowBlock_old_rule(Bus1_storage_invest_limit_0)_: --1 InvestmentFlowBlock_old_end(Bus1_storage_invest_limit_0) --1 InvestmentFlowBlock_old_exo(Bus1_storage_invest_limit_0) -+1 InvestmentFlowBlock_old(Bus1_storage_invest_limit_0) +c_e_InvestmentFlowBlock_old_rule_exo(Bus1_storage_invest_limit_0)_: ++1 InvestmentFlowBlock_old_exo(Bus1_storage_invest_limit_0) = 0 -c_e_InvestmentFlowBlock_old_rule(Bus1_storage_invest_limit_1)_: -+1 InvestmentFlowBlock_old(Bus1_storage_invest_limit_1) --1 InvestmentFlowBlock_old_end(Bus1_storage_invest_limit_1) --1 InvestmentFlowBlock_old_exo(Bus1_storage_invest_limit_1) +c_e_InvestmentFlowBlock_old_rule_exo(Bus1_storage_invest_limit_1)_: ++1 InvestmentFlowBlock_old_exo(Bus1_storage_invest_limit_1) = 0 -c_e_InvestmentFlowBlock_old_rule(Bus1_storage_invest_limit_2)_: -+1 InvestmentFlowBlock_old(Bus1_storage_invest_limit_2) --1 InvestmentFlowBlock_old_end(Bus1_storage_invest_limit_2) --1 InvestmentFlowBlock_old_exo(Bus1_storage_invest_limit_2) +c_e_InvestmentFlowBlock_old_rule_exo(Bus1_storage_invest_limit_2)_: ++1 InvestmentFlowBlock_old_exo(Bus1_storage_invest_limit_2) = 0 c_e_InvestmentFlowBlock_old_rule(storage_invest_limit_Bus1_0)_: @@ -245,35 +227,23 @@ c_e_InvestmentFlowBlock_old_rule(Source_Bus1_2)_: -1 InvestmentFlowBlock_old_exo(Source_Bus1_2) = 0 -c_u_InvestmentFlowBlock_max(Bus1_storage_invest_limit_0_0)_: -+1 flow(Bus1_storage_invest_limit_0_0) --1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_0) -<= 0 - -c_u_InvestmentFlowBlock_max(Bus1_storage_invest_limit_0_1)_: -+1 flow(Bus1_storage_invest_limit_0_1) --1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_0) -<= 0 - -c_u_InvestmentFlowBlock_max(Bus1_storage_invest_limit_1_2)_: -+1 flow(Bus1_storage_invest_limit_1_2) --1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_1) -<= 0 - -c_u_InvestmentFlowBlock_max(Bus1_storage_invest_limit_1_3)_: -+1 flow(Bus1_storage_invest_limit_1_3) --1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_1) -<= 0 +c_e_InvestmentFlowBlock_old_rule(Bus1_storage_invest_limit_0)_: +-1 InvestmentFlowBlock_old_end(Bus1_storage_invest_limit_0) +-1 InvestmentFlowBlock_old_exo(Bus1_storage_invest_limit_0) ++1 InvestmentFlowBlock_old(Bus1_storage_invest_limit_0) += 0 -c_u_InvestmentFlowBlock_max(Bus1_storage_invest_limit_2_4)_: -+1 flow(Bus1_storage_invest_limit_2_4) --1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_2) -<= 0 +c_e_InvestmentFlowBlock_old_rule(Bus1_storage_invest_limit_1)_: ++1 InvestmentFlowBlock_old(Bus1_storage_invest_limit_1) +-1 InvestmentFlowBlock_old_end(Bus1_storage_invest_limit_1) +-1 InvestmentFlowBlock_old_exo(Bus1_storage_invest_limit_1) += 0 -c_u_InvestmentFlowBlock_max(Bus1_storage_invest_limit_2_5)_: -+1 flow(Bus1_storage_invest_limit_2_5) --1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_2) -<= 0 +c_e_InvestmentFlowBlock_old_rule(Bus1_storage_invest_limit_2)_: ++1 InvestmentFlowBlock_old(Bus1_storage_invest_limit_2) +-1 InvestmentFlowBlock_old_end(Bus1_storage_invest_limit_2) +-1 InvestmentFlowBlock_old_exo(Bus1_storage_invest_limit_2) += 0 c_u_InvestmentFlowBlock_max(storage_invest_limit_Bus1_0_0)_: +1 flow(storage_invest_limit_Bus1_0_0) @@ -335,6 +305,36 @@ c_u_InvestmentFlowBlock_max(Source_Bus1_2_5)_: -1 InvestmentFlowBlock_total(Source_Bus1_2) <= 0 +c_u_InvestmentFlowBlock_max(Bus1_storage_invest_limit_0_0)_: ++1 flow(Bus1_storage_invest_limit_0_0) +-1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_0) +<= 0 + +c_u_InvestmentFlowBlock_max(Bus1_storage_invest_limit_0_1)_: ++1 flow(Bus1_storage_invest_limit_0_1) +-1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_0) +<= 0 + +c_u_InvestmentFlowBlock_max(Bus1_storage_invest_limit_1_2)_: ++1 flow(Bus1_storage_invest_limit_1_2) +-1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_1) +<= 0 + +c_u_InvestmentFlowBlock_max(Bus1_storage_invest_limit_1_3)_: ++1 flow(Bus1_storage_invest_limit_1_3) +-1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_1) +<= 0 + +c_u_InvestmentFlowBlock_max(Bus1_storage_invest_limit_2_4)_: ++1 flow(Bus1_storage_invest_limit_2_4) +-1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_2) +<= 0 + +c_u_InvestmentFlowBlock_max(Bus1_storage_invest_limit_2_5)_: ++1 flow(Bus1_storage_invest_limit_2_5) +-1 InvestmentFlowBlock_total(Bus1_storage_invest_limit_2) +<= 0 + c_e_GenericInvestmentStorageBlock_total_storage_rule(storage_invest_limit_0)_: -1 GenericInvestmentStorageBlock_invest(storage_invest_limit_0) +1 GenericInvestmentStorageBlock_total(storage_invest_limit_0) @@ -396,11 +396,15 @@ c_e_GenericInvestmentStorageBlock_old_rule(storage_invest_limit_2)_: -1 GenericInvestmentStorageBlock_old_exo(storage_invest_limit_2) = 0 +c_e_GenericInvestmentStorageBlock_initially_empty(storage_invest_limit_0)_: ++1 GenericInvestmentStorageBlock_storage_content(storage_invest_limit_0) += 0 + c_e_GenericInvestmentStorageBlock_balance(storage_invest_limit_0_1)_: +1 flow(storage_invest_limit_Bus1_0_1) -1 flow(Bus1_storage_invest_limit_0_1) -+1 GenericInvestmentStorageBlock_storage_content(storage_invest_limit_1) -1 GenericInvestmentStorageBlock_storage_content(storage_invest_limit_0) ++1 GenericInvestmentStorageBlock_storage_content(storage_invest_limit_1) = 0 c_e_GenericInvestmentStorageBlock_balance(storage_invest_limit_1_2)_: @@ -498,32 +502,24 @@ bounds 0 <= GenericInvestmentStorageBlock_invest(storage_invest_limit_0) <= +inf 0 <= GenericInvestmentStorageBlock_invest(storage_invest_limit_1) <= +inf 0 <= GenericInvestmentStorageBlock_invest(storage_invest_limit_2) <= +inf - 0 <= flow(Source_Bus1_0_0) <= +inf 0 <= flow(storage_invest_limit_Bus1_0_0) <= +inf + 0 <= flow(Source_Bus1_0_0) <= +inf 0 <= flow(Bus1_storage_invest_limit_0_0) <= +inf - 0 <= flow(Source_Bus1_0_1) <= +inf 0 <= flow(storage_invest_limit_Bus1_0_1) <= +inf + 0 <= flow(Source_Bus1_0_1) <= +inf 0 <= flow(Bus1_storage_invest_limit_0_1) <= +inf - 0 <= flow(Source_Bus1_1_2) <= +inf 0 <= flow(storage_invest_limit_Bus1_1_2) <= +inf + 0 <= flow(Source_Bus1_1_2) <= +inf 0 <= flow(Bus1_storage_invest_limit_1_2) <= +inf - 0 <= flow(Source_Bus1_1_3) <= +inf 0 <= flow(storage_invest_limit_Bus1_1_3) <= +inf + 0 <= flow(Source_Bus1_1_3) <= +inf 0 <= flow(Bus1_storage_invest_limit_1_3) <= +inf - 0 <= flow(Source_Bus1_2_4) <= +inf 0 <= flow(storage_invest_limit_Bus1_2_4) <= +inf + 0 <= flow(Source_Bus1_2_4) <= +inf 0 <= flow(Bus1_storage_invest_limit_2_4) <= +inf - 0 <= flow(Source_Bus1_2_5) <= +inf 0 <= flow(storage_invest_limit_Bus1_2_5) <= +inf + 0 <= flow(Source_Bus1_2_5) <= +inf 0 <= flow(Bus1_storage_invest_limit_2_5) <= +inf - 0 <= InvestmentFlowBlock_total(Bus1_storage_invest_limit_0) <= +inf - 0 <= InvestmentFlowBlock_invest(Bus1_storage_invest_limit_0) <= +inf - 0 <= InvestmentFlowBlock_total(Bus1_storage_invest_limit_1) <= +inf - 0 <= InvestmentFlowBlock_invest(Bus1_storage_invest_limit_1) <= +inf - 0 <= InvestmentFlowBlock_old(Bus1_storage_invest_limit_1) <= +inf - 0 <= InvestmentFlowBlock_total(Bus1_storage_invest_limit_2) <= +inf - 0 <= InvestmentFlowBlock_invest(Bus1_storage_invest_limit_2) <= +inf - 0 <= InvestmentFlowBlock_old(Bus1_storage_invest_limit_2) <= +inf 0 <= InvestmentFlowBlock_total(storage_invest_limit_Bus1_0) <= +inf 0 <= InvestmentFlowBlock_invest(storage_invest_limit_Bus1_0) <= +inf 0 <= InvestmentFlowBlock_total(storage_invest_limit_Bus1_1) <= +inf @@ -537,27 +533,35 @@ bounds 0 <= InvestmentFlowBlock_old(Source_Bus1_1) <= +inf 0 <= InvestmentFlowBlock_total(Source_Bus1_2) <= +inf 0 <= InvestmentFlowBlock_old(Source_Bus1_2) <= +inf - 0 <= InvestmentFlowBlock_old_end(Bus1_storage_invest_limit_0) <= +inf - 0 <= InvestmentFlowBlock_old_end(Bus1_storage_invest_limit_1) <= +inf - 0 <= InvestmentFlowBlock_old_end(Bus1_storage_invest_limit_2) <= +inf + 0 <= InvestmentFlowBlock_total(Bus1_storage_invest_limit_0) <= +inf + 0 <= InvestmentFlowBlock_invest(Bus1_storage_invest_limit_0) <= +inf + 0 <= InvestmentFlowBlock_total(Bus1_storage_invest_limit_1) <= +inf + 0 <= InvestmentFlowBlock_invest(Bus1_storage_invest_limit_1) <= +inf + 0 <= InvestmentFlowBlock_old(Bus1_storage_invest_limit_1) <= +inf + 0 <= InvestmentFlowBlock_total(Bus1_storage_invest_limit_2) <= +inf + 0 <= InvestmentFlowBlock_invest(Bus1_storage_invest_limit_2) <= +inf + 0 <= InvestmentFlowBlock_old(Bus1_storage_invest_limit_2) <= +inf 0 <= InvestmentFlowBlock_old_end(storage_invest_limit_Bus1_0) <= +inf 0 <= InvestmentFlowBlock_old_end(storage_invest_limit_Bus1_1) <= +inf 0 <= InvestmentFlowBlock_old_end(storage_invest_limit_Bus1_2) <= +inf 0 <= InvestmentFlowBlock_old_end(Source_Bus1_0) <= +inf 0 <= InvestmentFlowBlock_old_end(Source_Bus1_1) <= +inf 0 <= InvestmentFlowBlock_old_end(Source_Bus1_2) <= +inf - 0 <= InvestmentFlowBlock_old_exo(Bus1_storage_invest_limit_0) <= +inf - 0 <= InvestmentFlowBlock_old_exo(Bus1_storage_invest_limit_1) <= +inf - 0 <= InvestmentFlowBlock_old_exo(Bus1_storage_invest_limit_2) <= +inf + 0 <= InvestmentFlowBlock_old_end(Bus1_storage_invest_limit_0) <= +inf + 0 <= InvestmentFlowBlock_old_end(Bus1_storage_invest_limit_1) <= +inf + 0 <= InvestmentFlowBlock_old_end(Bus1_storage_invest_limit_2) <= +inf 0 <= InvestmentFlowBlock_old_exo(storage_invest_limit_Bus1_0) <= +inf 0 <= InvestmentFlowBlock_old_exo(storage_invest_limit_Bus1_1) <= +inf 0 <= InvestmentFlowBlock_old_exo(storage_invest_limit_Bus1_2) <= +inf 0 <= InvestmentFlowBlock_old_exo(Source_Bus1_0) <= +inf 0 <= InvestmentFlowBlock_old_exo(Source_Bus1_1) <= +inf 0 <= InvestmentFlowBlock_old_exo(Source_Bus1_2) <= +inf - 0 <= InvestmentFlowBlock_old(Bus1_storage_invest_limit_0) <= +inf + 0 <= InvestmentFlowBlock_old_exo(Bus1_storage_invest_limit_0) <= +inf + 0 <= InvestmentFlowBlock_old_exo(Bus1_storage_invest_limit_1) <= +inf + 0 <= InvestmentFlowBlock_old_exo(Bus1_storage_invest_limit_2) <= +inf 0 <= InvestmentFlowBlock_old(storage_invest_limit_Bus1_0) <= +inf 0 <= InvestmentFlowBlock_old(Source_Bus1_0) <= +inf + 0 <= InvestmentFlowBlock_old(Bus1_storage_invest_limit_0) <= +inf 0 <= GenericInvestmentStorageBlock_total(storage_invest_limit_0) <= +inf 0 <= GenericInvestmentStorageBlock_total(storage_invest_limit_1) <= +inf 0 <= GenericInvestmentStorageBlock_old(storage_invest_limit_1) <= +inf @@ -570,8 +574,8 @@ bounds 0 <= GenericInvestmentStorageBlock_old_exo(storage_invest_limit_1) <= +inf 0 <= GenericInvestmentStorageBlock_old_exo(storage_invest_limit_2) <= +inf 0 <= GenericInvestmentStorageBlock_old(storage_invest_limit_0) <= +inf - 0 <= GenericInvestmentStorageBlock_storage_content(storage_invest_limit_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage_invest_limit_0) <= +inf + 0 <= GenericInvestmentStorageBlock_storage_content(storage_invest_limit_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage_invest_limit_2) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage_invest_limit_3) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage_invest_limit_4) <= +inf diff --git a/tests/lp_files/storage_invest_1_multi_period.lp b/tests/lp_files/storage_invest_1_multi_period.lp index ec9897a28..35c7ff688 100644 --- a/tests/lp_files/storage_invest_1_multi_period.lp +++ b/tests/lp_files/storage_invest_1_multi_period.lp @@ -293,11 +293,15 @@ c_e_GenericInvestmentStorageBlock_old_rule(storage1_2)_: -1 GenericInvestmentStorageBlock_old_exo(storage1_2) = 0 +c_e_GenericInvestmentStorageBlock_initially_empty(storage1_0)_: ++1 GenericInvestmentStorageBlock_storage_content(storage1_0) += 0 + c_e_GenericInvestmentStorageBlock_balance(storage1_0_1)_: -0.97 flow(electricityBus_storage1_0_1) +1.1627906976744187 flow(storage1_electricityBus_0_1) -+1 GenericInvestmentStorageBlock_storage_content(storage1_1) -0.87 GenericInvestmentStorageBlock_storage_content(storage1_0) ++1 GenericInvestmentStorageBlock_storage_content(storage1_1) = 0 c_e_GenericInvestmentStorageBlock_balance(storage1_1_2)_: @@ -492,8 +496,8 @@ bounds 0 <= GenericInvestmentStorageBlock_old_exo(storage1_1) <= +inf 0 <= GenericInvestmentStorageBlock_old_exo(storage1_2) <= +inf 0 <= GenericInvestmentStorageBlock_old(storage1_0) <= +inf - 0 <= GenericInvestmentStorageBlock_storage_content(storage1_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage1_0) <= +inf + 0 <= GenericInvestmentStorageBlock_storage_content(storage1_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage1_2) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage1_3) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage1_4) <= +inf diff --git a/tests/lp_files/storage_invest_2_multi_period.lp b/tests/lp_files/storage_invest_2_multi_period.lp index 3c1e1d058..2331318ef 100644 --- a/tests/lp_files/storage_invest_2_multi_period.lp +++ b/tests/lp_files/storage_invest_2_multi_period.lp @@ -287,11 +287,15 @@ c_e_GenericInvestmentStorageBlock_old_rule(storage2_2)_: -1 GenericInvestmentStorageBlock_old_exo(storage2_2) = 0 +c_e_GenericInvestmentStorageBlock_initially_empty(storage2_0)_: ++1 GenericInvestmentStorageBlock_storage_content(storage2_0) += 0 + c_e_GenericInvestmentStorageBlock_balance(storage2_0_1)_: +1 flow(storage2_electricityBus_0_1) -1 flow(electricityBus_storage2_0_1) -+1 GenericInvestmentStorageBlock_storage_content(storage2_1) -1 GenericInvestmentStorageBlock_storage_content(storage2_0) ++1 GenericInvestmentStorageBlock_storage_content(storage2_1) = 0 c_e_GenericInvestmentStorageBlock_balance(storage2_1_2)_: @@ -410,8 +414,8 @@ bounds 0 <= GenericInvestmentStorageBlock_old_exo(storage2_1) <= +inf 0 <= GenericInvestmentStorageBlock_old_exo(storage2_2) <= +inf 0 <= GenericInvestmentStorageBlock_old(storage2_0) <= +inf - 0 <= GenericInvestmentStorageBlock_storage_content(storage2_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage2_0) <= +inf + 0 <= GenericInvestmentStorageBlock_storage_content(storage2_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage2_2) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage2_3) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage2_4) <= +inf diff --git a/tests/lp_files/storage_invest_3_multi_period.lp b/tests/lp_files/storage_invest_3_multi_period.lp index 51410232d..2fc9750d0 100644 --- a/tests/lp_files/storage_invest_3_multi_period.lp +++ b/tests/lp_files/storage_invest_3_multi_period.lp @@ -2,12 +2,12 @@ min objective: -+11.00820926255226 InvestmentFlowBlock_invest(storage3_electricityBus_0) -+10.792362022110058 InvestmentFlowBlock_invest(storage3_electricityBus_1) -+10.580747080500057 InvestmentFlowBlock_invest(storage3_electricityBus_2) +101.97980198019803 InvestmentFlowBlock_invest(electricityBus_storage3_0) +99.98019801980199 InvestmentFlowBlock_invest(electricityBus_storage3_1) +98.01980198019803 InvestmentFlowBlock_invest(electricityBus_storage3_2) ++11.00820926255226 InvestmentFlowBlock_invest(storage3_electricityBus_0) ++10.792362022110058 InvestmentFlowBlock_invest(storage3_electricityBus_1) ++10.580747080500057 InvestmentFlowBlock_invest(storage3_electricityBus_2) s.t. @@ -41,25 +41,6 @@ c_e_BusBlock_balance(electricityBus_2_5)_: -1 flow(electricityBus_storage3_2_5) = 0 -c_e_InvestmentFlowBlock_total_rule(storage3_electricityBus_0)_: --1 InvestmentFlowBlock_invest(storage3_electricityBus_0) -+1 InvestmentFlowBlock_total(storage3_electricityBus_0) -= 0 - -c_e_InvestmentFlowBlock_total_rule(storage3_electricityBus_1)_: --1 InvestmentFlowBlock_invest(storage3_electricityBus_1) --1 InvestmentFlowBlock_total(storage3_electricityBus_0) -+1 InvestmentFlowBlock_total(storage3_electricityBus_1) -+1 InvestmentFlowBlock_old(storage3_electricityBus_1) -= 0 - -c_e_InvestmentFlowBlock_total_rule(storage3_electricityBus_2)_: --1 InvestmentFlowBlock_invest(storage3_electricityBus_2) --1 InvestmentFlowBlock_total(storage3_electricityBus_1) -+1 InvestmentFlowBlock_total(storage3_electricityBus_2) -+1 InvestmentFlowBlock_old(storage3_electricityBus_2) -= 0 - c_e_InvestmentFlowBlock_total_rule(electricityBus_storage3_0)_: -1 InvestmentFlowBlock_invest(electricityBus_storage3_0) +1 InvestmentFlowBlock_total(electricityBus_storage3_0) @@ -79,16 +60,23 @@ c_e_InvestmentFlowBlock_total_rule(electricityBus_storage3_2)_: +1 InvestmentFlowBlock_old(electricityBus_storage3_2) = 0 -c_e_InvestmentFlowBlock_old_rule_end(storage3_electricityBus_0)_: -+1 InvestmentFlowBlock_old_end(storage3_electricityBus_0) +c_e_InvestmentFlowBlock_total_rule(storage3_electricityBus_0)_: +-1 InvestmentFlowBlock_invest(storage3_electricityBus_0) ++1 InvestmentFlowBlock_total(storage3_electricityBus_0) = 0 -c_e_InvestmentFlowBlock_old_rule_end(storage3_electricityBus_1)_: -+1 InvestmentFlowBlock_old_end(storage3_electricityBus_1) +c_e_InvestmentFlowBlock_total_rule(storage3_electricityBus_1)_: +-1 InvestmentFlowBlock_invest(storage3_electricityBus_1) +-1 InvestmentFlowBlock_total(storage3_electricityBus_0) ++1 InvestmentFlowBlock_total(storage3_electricityBus_1) ++1 InvestmentFlowBlock_old(storage3_electricityBus_1) = 0 -c_e_InvestmentFlowBlock_old_rule_end(storage3_electricityBus_2)_: -+1 InvestmentFlowBlock_old_end(storage3_electricityBus_2) +c_e_InvestmentFlowBlock_total_rule(storage3_electricityBus_2)_: +-1 InvestmentFlowBlock_invest(storage3_electricityBus_2) +-1 InvestmentFlowBlock_total(storage3_electricityBus_1) ++1 InvestmentFlowBlock_total(storage3_electricityBus_2) ++1 InvestmentFlowBlock_old(storage3_electricityBus_2) = 0 c_e_InvestmentFlowBlock_old_rule_end(electricityBus_storage3_0)_: @@ -104,16 +92,16 @@ c_e_InvestmentFlowBlock_old_rule_end(electricityBus_storage3_2)_: +1 InvestmentFlowBlock_old_end(electricityBus_storage3_2) = 0 -c_e_InvestmentFlowBlock_old_rule_exo(storage3_electricityBus_0)_: -+1 InvestmentFlowBlock_old_exo(storage3_electricityBus_0) +c_e_InvestmentFlowBlock_old_rule_end(storage3_electricityBus_0)_: ++1 InvestmentFlowBlock_old_end(storage3_electricityBus_0) = 0 -c_e_InvestmentFlowBlock_old_rule_exo(storage3_electricityBus_1)_: -+1 InvestmentFlowBlock_old_exo(storage3_electricityBus_1) +c_e_InvestmentFlowBlock_old_rule_end(storage3_electricityBus_1)_: ++1 InvestmentFlowBlock_old_end(storage3_electricityBus_1) = 0 -c_e_InvestmentFlowBlock_old_rule_exo(storage3_electricityBus_2)_: -+1 InvestmentFlowBlock_old_exo(storage3_electricityBus_2) +c_e_InvestmentFlowBlock_old_rule_end(storage3_electricityBus_2)_: ++1 InvestmentFlowBlock_old_end(storage3_electricityBus_2) = 0 c_e_InvestmentFlowBlock_old_rule_exo(electricityBus_storage3_0)_: @@ -128,22 +116,16 @@ c_e_InvestmentFlowBlock_old_rule_exo(electricityBus_storage3_2)_: +1 InvestmentFlowBlock_old_exo(electricityBus_storage3_2) = 0 -c_e_InvestmentFlowBlock_old_rule(storage3_electricityBus_0)_: --1 InvestmentFlowBlock_old_end(storage3_electricityBus_0) --1 InvestmentFlowBlock_old_exo(storage3_electricityBus_0) -+1 InvestmentFlowBlock_old(storage3_electricityBus_0) +c_e_InvestmentFlowBlock_old_rule_exo(storage3_electricityBus_0)_: ++1 InvestmentFlowBlock_old_exo(storage3_electricityBus_0) = 0 -c_e_InvestmentFlowBlock_old_rule(storage3_electricityBus_1)_: -+1 InvestmentFlowBlock_old(storage3_electricityBus_1) --1 InvestmentFlowBlock_old_end(storage3_electricityBus_1) --1 InvestmentFlowBlock_old_exo(storage3_electricityBus_1) +c_e_InvestmentFlowBlock_old_rule_exo(storage3_electricityBus_1)_: ++1 InvestmentFlowBlock_old_exo(storage3_electricityBus_1) = 0 -c_e_InvestmentFlowBlock_old_rule(storage3_electricityBus_2)_: -+1 InvestmentFlowBlock_old(storage3_electricityBus_2) --1 InvestmentFlowBlock_old_end(storage3_electricityBus_2) --1 InvestmentFlowBlock_old_exo(storage3_electricityBus_2) +c_e_InvestmentFlowBlock_old_rule_exo(storage3_electricityBus_2)_: ++1 InvestmentFlowBlock_old_exo(storage3_electricityBus_2) = 0 c_e_InvestmentFlowBlock_old_rule(electricityBus_storage3_0)_: @@ -164,35 +146,23 @@ c_e_InvestmentFlowBlock_old_rule(electricityBus_storage3_2)_: -1 InvestmentFlowBlock_old_exo(electricityBus_storage3_2) = 0 -c_u_InvestmentFlowBlock_max(storage3_electricityBus_0_0)_: -+1 flow(storage3_electricityBus_0_0) --1 InvestmentFlowBlock_total(storage3_electricityBus_0) -<= 0 - -c_u_InvestmentFlowBlock_max(storage3_electricityBus_0_1)_: -+1 flow(storage3_electricityBus_0_1) --1 InvestmentFlowBlock_total(storage3_electricityBus_0) -<= 0 - -c_u_InvestmentFlowBlock_max(storage3_electricityBus_1_2)_: -+1 flow(storage3_electricityBus_1_2) --1 InvestmentFlowBlock_total(storage3_electricityBus_1) -<= 0 - -c_u_InvestmentFlowBlock_max(storage3_electricityBus_1_3)_: -+1 flow(storage3_electricityBus_1_3) --1 InvestmentFlowBlock_total(storage3_electricityBus_1) -<= 0 +c_e_InvestmentFlowBlock_old_rule(storage3_electricityBus_0)_: +-1 InvestmentFlowBlock_old_end(storage3_electricityBus_0) +-1 InvestmentFlowBlock_old_exo(storage3_electricityBus_0) ++1 InvestmentFlowBlock_old(storage3_electricityBus_0) += 0 -c_u_InvestmentFlowBlock_max(storage3_electricityBus_2_4)_: -+1 flow(storage3_electricityBus_2_4) --1 InvestmentFlowBlock_total(storage3_electricityBus_2) -<= 0 +c_e_InvestmentFlowBlock_old_rule(storage3_electricityBus_1)_: ++1 InvestmentFlowBlock_old(storage3_electricityBus_1) +-1 InvestmentFlowBlock_old_end(storage3_electricityBus_1) +-1 InvestmentFlowBlock_old_exo(storage3_electricityBus_1) += 0 -c_u_InvestmentFlowBlock_max(storage3_electricityBus_2_5)_: -+1 flow(storage3_electricityBus_2_5) --1 InvestmentFlowBlock_total(storage3_electricityBus_2) -<= 0 +c_e_InvestmentFlowBlock_old_rule(storage3_electricityBus_2)_: ++1 InvestmentFlowBlock_old(storage3_electricityBus_2) +-1 InvestmentFlowBlock_old_end(storage3_electricityBus_2) +-1 InvestmentFlowBlock_old_exo(storage3_electricityBus_2) += 0 c_u_InvestmentFlowBlock_max(electricityBus_storage3_0_0)_: +1 flow(electricityBus_storage3_0_0) @@ -224,6 +194,36 @@ c_u_InvestmentFlowBlock_max(electricityBus_storage3_2_5)_: -1 InvestmentFlowBlock_total(electricityBus_storage3_2) <= 0 +c_u_InvestmentFlowBlock_max(storage3_electricityBus_0_0)_: ++1 flow(storage3_electricityBus_0_0) +-1 InvestmentFlowBlock_total(storage3_electricityBus_0) +<= 0 + +c_u_InvestmentFlowBlock_max(storage3_electricityBus_0_1)_: ++1 flow(storage3_electricityBus_0_1) +-1 InvestmentFlowBlock_total(storage3_electricityBus_0) +<= 0 + +c_u_InvestmentFlowBlock_max(storage3_electricityBus_1_2)_: ++1 flow(storage3_electricityBus_1_2) +-1 InvestmentFlowBlock_total(storage3_electricityBus_1) +<= 0 + +c_u_InvestmentFlowBlock_max(storage3_electricityBus_1_3)_: ++1 flow(storage3_electricityBus_1_3) +-1 InvestmentFlowBlock_total(storage3_electricityBus_1) +<= 0 + +c_u_InvestmentFlowBlock_max(storage3_electricityBus_2_4)_: ++1 flow(storage3_electricityBus_2_4) +-1 InvestmentFlowBlock_total(storage3_electricityBus_2) +<= 0 + +c_u_InvestmentFlowBlock_max(storage3_electricityBus_2_5)_: ++1 flow(storage3_electricityBus_2_5) +-1 InvestmentFlowBlock_total(storage3_electricityBus_2) +<= 0 + c_e_GenericStorageBlock_balance(storage3_0_0)_: +1 flow(storage3_electricityBus_0_0) -1 flow(electricityBus_storage3_0_0) @@ -272,12 +272,12 @@ c_e_GenericStorageBlock_balanced_cstr(storage3)_: = 0 bounds - 0 <= InvestmentFlowBlock_invest(storage3_electricityBus_0) <= +inf - 0 <= InvestmentFlowBlock_invest(storage3_electricityBus_1) <= +inf - 0 <= InvestmentFlowBlock_invest(storage3_electricityBus_2) <= +inf 0 <= InvestmentFlowBlock_invest(electricityBus_storage3_0) <= +inf 0 <= InvestmentFlowBlock_invest(electricityBus_storage3_1) <= +inf 0 <= InvestmentFlowBlock_invest(electricityBus_storage3_2) <= +inf + 0 <= InvestmentFlowBlock_invest(storage3_electricityBus_0) <= +inf + 0 <= InvestmentFlowBlock_invest(storage3_electricityBus_1) <= +inf + 0 <= InvestmentFlowBlock_invest(storage3_electricityBus_2) <= +inf 0 <= flow(storage3_electricityBus_0_0) <= +inf 0 <= flow(electricityBus_storage3_0_0) <= +inf 0 <= flow(storage3_electricityBus_0_1) <= +inf @@ -290,30 +290,30 @@ bounds 0 <= flow(electricityBus_storage3_2_4) <= +inf 0 <= flow(storage3_electricityBus_2_5) <= +inf 0 <= flow(electricityBus_storage3_2_5) <= +inf - 0 <= InvestmentFlowBlock_total(storage3_electricityBus_0) <= +inf - 0 <= InvestmentFlowBlock_total(storage3_electricityBus_1) <= +inf - 0 <= InvestmentFlowBlock_old(storage3_electricityBus_1) <= +inf - 0 <= InvestmentFlowBlock_total(storage3_electricityBus_2) <= +inf - 0 <= InvestmentFlowBlock_old(storage3_electricityBus_2) <= +inf 0 <= InvestmentFlowBlock_total(electricityBus_storage3_0) <= +inf 0 <= InvestmentFlowBlock_total(electricityBus_storage3_1) <= +inf 0 <= InvestmentFlowBlock_old(electricityBus_storage3_1) <= +inf 0 <= InvestmentFlowBlock_total(electricityBus_storage3_2) <= +inf 0 <= InvestmentFlowBlock_old(electricityBus_storage3_2) <= +inf - 0 <= InvestmentFlowBlock_old_end(storage3_electricityBus_0) <= +inf - 0 <= InvestmentFlowBlock_old_end(storage3_electricityBus_1) <= +inf - 0 <= InvestmentFlowBlock_old_end(storage3_electricityBus_2) <= +inf + 0 <= InvestmentFlowBlock_total(storage3_electricityBus_0) <= +inf + 0 <= InvestmentFlowBlock_total(storage3_electricityBus_1) <= +inf + 0 <= InvestmentFlowBlock_old(storage3_electricityBus_1) <= +inf + 0 <= InvestmentFlowBlock_total(storage3_electricityBus_2) <= +inf + 0 <= InvestmentFlowBlock_old(storage3_electricityBus_2) <= +inf 0 <= InvestmentFlowBlock_old_end(electricityBus_storage3_0) <= +inf 0 <= InvestmentFlowBlock_old_end(electricityBus_storage3_1) <= +inf 0 <= InvestmentFlowBlock_old_end(electricityBus_storage3_2) <= +inf - 0 <= InvestmentFlowBlock_old_exo(storage3_electricityBus_0) <= +inf - 0 <= InvestmentFlowBlock_old_exo(storage3_electricityBus_1) <= +inf - 0 <= InvestmentFlowBlock_old_exo(storage3_electricityBus_2) <= +inf + 0 <= InvestmentFlowBlock_old_end(storage3_electricityBus_0) <= +inf + 0 <= InvestmentFlowBlock_old_end(storage3_electricityBus_1) <= +inf + 0 <= InvestmentFlowBlock_old_end(storage3_electricityBus_2) <= +inf 0 <= InvestmentFlowBlock_old_exo(electricityBus_storage3_0) <= +inf 0 <= InvestmentFlowBlock_old_exo(electricityBus_storage3_1) <= +inf 0 <= InvestmentFlowBlock_old_exo(electricityBus_storage3_2) <= +inf - 0 <= InvestmentFlowBlock_old(storage3_electricityBus_0) <= +inf + 0 <= InvestmentFlowBlock_old_exo(storage3_electricityBus_0) <= +inf + 0 <= InvestmentFlowBlock_old_exo(storage3_electricityBus_1) <= +inf + 0 <= InvestmentFlowBlock_old_exo(storage3_electricityBus_2) <= +inf 0 <= InvestmentFlowBlock_old(electricityBus_storage3_0) <= +inf + 0 <= InvestmentFlowBlock_old(storage3_electricityBus_0) <= +inf 0 <= GenericStorageBlock_storage_content(storage3_1) <= 5000 0 <= GenericStorageBlock_storage_content(storage3_0) <= 5000 0 <= GenericStorageBlock_storage_content(storage3_2) <= 5000 diff --git a/tests/lp_files/storage_invest_4_multi_period.lp b/tests/lp_files/storage_invest_4_multi_period.lp index 75b419e4f..c391c9b46 100644 --- a/tests/lp_files/storage_invest_4_multi_period.lp +++ b/tests/lp_files/storage_invest_4_multi_period.lp @@ -100,11 +100,15 @@ c_e_GenericInvestmentStorageBlock_old_rule(storage4_2)_: -1 GenericInvestmentStorageBlock_old_exo(storage4_2) = 0 +c_e_GenericInvestmentStorageBlock_initially_empty(storage4_0)_: ++1 GenericInvestmentStorageBlock_storage_content(storage4_0) += 0 + c_e_GenericInvestmentStorageBlock_balance(storage4_0_1)_: +1 flow(storage4_electricityBus_0_1) -1 flow(electricityBus_storage4_0_1) -+1 GenericInvestmentStorageBlock_storage_content(storage4_1) -1 GenericInvestmentStorageBlock_storage_content(storage4_0) ++1 GenericInvestmentStorageBlock_storage_content(storage4_1) = 0 c_e_GenericInvestmentStorageBlock_balance(storage4_1_2)_: @@ -193,8 +197,8 @@ bounds 0 <= GenericInvestmentStorageBlock_old_exo(storage4_1) <= +inf 0 <= GenericInvestmentStorageBlock_old_exo(storage4_2) <= +inf 0 <= GenericInvestmentStorageBlock_old(storage4_0) <= +inf - 0 <= GenericInvestmentStorageBlock_storage_content(storage4_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage4_0) <= +inf + 0 <= GenericInvestmentStorageBlock_storage_content(storage4_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage4_2) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage4_3) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage4_4) <= +inf diff --git a/tests/lp_files/storage_invest_5_multi_period.lp b/tests/lp_files/storage_invest_5_multi_period.lp index ec6eebef5..db88b35f0 100644 --- a/tests/lp_files/storage_invest_5_multi_period.lp +++ b/tests/lp_files/storage_invest_5_multi_period.lp @@ -38,25 +38,6 @@ c_e_BusBlock_balance(electricityBus_2_5)_: -1 flow(electricityBus_storage5_2_5) = 0 -c_e_InvestmentFlowBlock_total_rule(storage5_electricityBus_0)_: -+1 InvestmentFlowBlock_total(storage5_electricityBus_0) --1 InvestmentFlowBlock_invest(storage5_electricityBus_0) -= 100 - -c_e_InvestmentFlowBlock_total_rule(storage5_electricityBus_1)_: --1 InvestmentFlowBlock_total(storage5_electricityBus_0) -+1 InvestmentFlowBlock_total(storage5_electricityBus_1) --1 InvestmentFlowBlock_invest(storage5_electricityBus_1) -+1 InvestmentFlowBlock_old(storage5_electricityBus_1) -= 0 - -c_e_InvestmentFlowBlock_total_rule(storage5_electricityBus_2)_: --1 InvestmentFlowBlock_total(storage5_electricityBus_1) -+1 InvestmentFlowBlock_total(storage5_electricityBus_2) --1 InvestmentFlowBlock_invest(storage5_electricityBus_2) -+1 InvestmentFlowBlock_old(storage5_electricityBus_2) -= 0 - c_e_InvestmentFlowBlock_total_rule(electricityBus_storage5_0)_: -1 InvestmentFlowBlock_invest(electricityBus_storage5_0) +1 InvestmentFlowBlock_total(electricityBus_storage5_0) @@ -76,16 +57,23 @@ c_e_InvestmentFlowBlock_total_rule(electricityBus_storage5_2)_: +1 InvestmentFlowBlock_old(electricityBus_storage5_2) = 0 -c_e_InvestmentFlowBlock_old_rule_end(storage5_electricityBus_0)_: -+1 InvestmentFlowBlock_old_end(storage5_electricityBus_0) -= 0 +c_e_InvestmentFlowBlock_total_rule(storage5_electricityBus_0)_: ++1 InvestmentFlowBlock_total(storage5_electricityBus_0) +-1 InvestmentFlowBlock_invest(storage5_electricityBus_0) += 100 -c_e_InvestmentFlowBlock_old_rule_end(storage5_electricityBus_1)_: -+1 InvestmentFlowBlock_old_end(storage5_electricityBus_1) +c_e_InvestmentFlowBlock_total_rule(storage5_electricityBus_1)_: +-1 InvestmentFlowBlock_total(storage5_electricityBus_0) ++1 InvestmentFlowBlock_total(storage5_electricityBus_1) +-1 InvestmentFlowBlock_invest(storage5_electricityBus_1) ++1 InvestmentFlowBlock_old(storage5_electricityBus_1) = 0 -c_e_InvestmentFlowBlock_old_rule_end(storage5_electricityBus_2)_: -+1 InvestmentFlowBlock_old_end(storage5_electricityBus_2) +c_e_InvestmentFlowBlock_total_rule(storage5_electricityBus_2)_: +-1 InvestmentFlowBlock_total(storage5_electricityBus_1) ++1 InvestmentFlowBlock_total(storage5_electricityBus_2) +-1 InvestmentFlowBlock_invest(storage5_electricityBus_2) ++1 InvestmentFlowBlock_old(storage5_electricityBus_2) = 0 c_e_InvestmentFlowBlock_old_rule_end(electricityBus_storage5_0)_: @@ -100,16 +88,16 @@ c_e_InvestmentFlowBlock_old_rule_end(electricityBus_storage5_2)_: +1 InvestmentFlowBlock_old_end(electricityBus_storage5_2) = 0 -c_e_InvestmentFlowBlock_old_rule_exo(storage5_electricityBus_0)_: -+1 InvestmentFlowBlock_old_exo(storage5_electricityBus_0) +c_e_InvestmentFlowBlock_old_rule_end(storage5_electricityBus_0)_: ++1 InvestmentFlowBlock_old_end(storage5_electricityBus_0) = 0 -c_e_InvestmentFlowBlock_old_rule_exo(storage5_electricityBus_1)_: -+1 InvestmentFlowBlock_old_exo(storage5_electricityBus_1) +c_e_InvestmentFlowBlock_old_rule_end(storage5_electricityBus_1)_: ++1 InvestmentFlowBlock_old_end(storage5_electricityBus_1) = 0 -c_e_InvestmentFlowBlock_old_rule_exo(storage5_electricityBus_2)_: -+1 InvestmentFlowBlock_old_exo(storage5_electricityBus_2) +c_e_InvestmentFlowBlock_old_rule_end(storage5_electricityBus_2)_: ++1 InvestmentFlowBlock_old_end(storage5_electricityBus_2) = 0 c_e_InvestmentFlowBlock_old_rule_exo(electricityBus_storage5_0)_: @@ -124,22 +112,16 @@ c_e_InvestmentFlowBlock_old_rule_exo(electricityBus_storage5_2)_: +1 InvestmentFlowBlock_old_exo(electricityBus_storage5_2) = 0 -c_e_InvestmentFlowBlock_old_rule(storage5_electricityBus_0)_: --1 InvestmentFlowBlock_old_end(storage5_electricityBus_0) --1 InvestmentFlowBlock_old_exo(storage5_electricityBus_0) -+1 InvestmentFlowBlock_old(storage5_electricityBus_0) +c_e_InvestmentFlowBlock_old_rule_exo(storage5_electricityBus_0)_: ++1 InvestmentFlowBlock_old_exo(storage5_electricityBus_0) = 0 -c_e_InvestmentFlowBlock_old_rule(storage5_electricityBus_1)_: -+1 InvestmentFlowBlock_old(storage5_electricityBus_1) --1 InvestmentFlowBlock_old_end(storage5_electricityBus_1) --1 InvestmentFlowBlock_old_exo(storage5_electricityBus_1) +c_e_InvestmentFlowBlock_old_rule_exo(storage5_electricityBus_1)_: ++1 InvestmentFlowBlock_old_exo(storage5_electricityBus_1) = 0 -c_e_InvestmentFlowBlock_old_rule(storage5_electricityBus_2)_: -+1 InvestmentFlowBlock_old(storage5_electricityBus_2) --1 InvestmentFlowBlock_old_end(storage5_electricityBus_2) --1 InvestmentFlowBlock_old_exo(storage5_electricityBus_2) +c_e_InvestmentFlowBlock_old_rule_exo(storage5_electricityBus_2)_: ++1 InvestmentFlowBlock_old_exo(storage5_electricityBus_2) = 0 c_e_InvestmentFlowBlock_old_rule(electricityBus_storage5_0)_: @@ -160,35 +142,23 @@ c_e_InvestmentFlowBlock_old_rule(electricityBus_storage5_2)_: -1 InvestmentFlowBlock_old_exo(electricityBus_storage5_2) = 0 -c_u_InvestmentFlowBlock_max(storage5_electricityBus_0_0)_: -+1 flow(storage5_electricityBus_0_0) --1 InvestmentFlowBlock_total(storage5_electricityBus_0) -<= 0 - -c_u_InvestmentFlowBlock_max(storage5_electricityBus_0_1)_: -+1 flow(storage5_electricityBus_0_1) --1 InvestmentFlowBlock_total(storage5_electricityBus_0) -<= 0 - -c_u_InvestmentFlowBlock_max(storage5_electricityBus_1_2)_: -+1 flow(storage5_electricityBus_1_2) --1 InvestmentFlowBlock_total(storage5_electricityBus_1) -<= 0 - -c_u_InvestmentFlowBlock_max(storage5_electricityBus_1_3)_: -+1 flow(storage5_electricityBus_1_3) --1 InvestmentFlowBlock_total(storage5_electricityBus_1) -<= 0 +c_e_InvestmentFlowBlock_old_rule(storage5_electricityBus_0)_: +-1 InvestmentFlowBlock_old_end(storage5_electricityBus_0) +-1 InvestmentFlowBlock_old_exo(storage5_electricityBus_0) ++1 InvestmentFlowBlock_old(storage5_electricityBus_0) += 0 -c_u_InvestmentFlowBlock_max(storage5_electricityBus_2_4)_: -+1 flow(storage5_electricityBus_2_4) --1 InvestmentFlowBlock_total(storage5_electricityBus_2) -<= 0 +c_e_InvestmentFlowBlock_old_rule(storage5_electricityBus_1)_: ++1 InvestmentFlowBlock_old(storage5_electricityBus_1) +-1 InvestmentFlowBlock_old_end(storage5_electricityBus_1) +-1 InvestmentFlowBlock_old_exo(storage5_electricityBus_1) += 0 -c_u_InvestmentFlowBlock_max(storage5_electricityBus_2_5)_: -+1 flow(storage5_electricityBus_2_5) --1 InvestmentFlowBlock_total(storage5_electricityBus_2) -<= 0 +c_e_InvestmentFlowBlock_old_rule(storage5_electricityBus_2)_: ++1 InvestmentFlowBlock_old(storage5_electricityBus_2) +-1 InvestmentFlowBlock_old_end(storage5_electricityBus_2) +-1 InvestmentFlowBlock_old_exo(storage5_electricityBus_2) += 0 c_u_InvestmentFlowBlock_max(electricityBus_storage5_0_0)_: +1 flow(electricityBus_storage5_0_0) @@ -220,6 +190,36 @@ c_u_InvestmentFlowBlock_max(electricityBus_storage5_2_5)_: -1 InvestmentFlowBlock_total(electricityBus_storage5_2) <= 0 +c_u_InvestmentFlowBlock_max(storage5_electricityBus_0_0)_: ++1 flow(storage5_electricityBus_0_0) +-1 InvestmentFlowBlock_total(storage5_electricityBus_0) +<= 0 + +c_u_InvestmentFlowBlock_max(storage5_electricityBus_0_1)_: ++1 flow(storage5_electricityBus_0_1) +-1 InvestmentFlowBlock_total(storage5_electricityBus_0) +<= 0 + +c_u_InvestmentFlowBlock_max(storage5_electricityBus_1_2)_: ++1 flow(storage5_electricityBus_1_2) +-1 InvestmentFlowBlock_total(storage5_electricityBus_1) +<= 0 + +c_u_InvestmentFlowBlock_max(storage5_electricityBus_1_3)_: ++1 flow(storage5_electricityBus_1_3) +-1 InvestmentFlowBlock_total(storage5_electricityBus_1) +<= 0 + +c_u_InvestmentFlowBlock_max(storage5_electricityBus_2_4)_: ++1 flow(storage5_electricityBus_2_4) +-1 InvestmentFlowBlock_total(storage5_electricityBus_2) +<= 0 + +c_u_InvestmentFlowBlock_max(storage5_electricityBus_2_5)_: ++1 flow(storage5_electricityBus_2_5) +-1 InvestmentFlowBlock_total(storage5_electricityBus_2) +<= 0 + c_e_GenericStorageBlock_balance(storage5_0_0)_: +1 flow(storage5_electricityBus_0_0) -1 flow(electricityBus_storage5_0_0) @@ -268,18 +268,18 @@ c_e_GenericStorageBlock_balanced_cstr(storage5)_: = 0 c_e_GenericStorageBlock_power_coupled(storage5_0)_: -+1.1 InvestmentFlowBlock_total(storage5_electricityBus_0) -1 InvestmentFlowBlock_total(electricityBus_storage5_0) ++1.1 InvestmentFlowBlock_total(storage5_electricityBus_0) = 0 c_e_GenericStorageBlock_power_coupled(storage5_1)_: -+1.1 InvestmentFlowBlock_total(storage5_electricityBus_1) -1 InvestmentFlowBlock_total(electricityBus_storage5_1) ++1.1 InvestmentFlowBlock_total(storage5_electricityBus_1) = 0 c_e_GenericStorageBlock_power_coupled(storage5_2)_: -+1.1 InvestmentFlowBlock_total(storage5_electricityBus_2) -1 InvestmentFlowBlock_total(electricityBus_storage5_2) ++1.1 InvestmentFlowBlock_total(storage5_electricityBus_2) = 0 bounds @@ -298,6 +298,11 @@ bounds 0 <= flow(electricityBus_storage5_2_4) <= +inf 0 <= flow(storage5_electricityBus_2_5) <= +inf 0 <= flow(electricityBus_storage5_2_5) <= +inf + 0 <= InvestmentFlowBlock_total(electricityBus_storage5_0) <= +inf + 0 <= InvestmentFlowBlock_total(electricityBus_storage5_1) <= +inf + 0 <= InvestmentFlowBlock_old(electricityBus_storage5_1) <= +inf + 0 <= InvestmentFlowBlock_total(electricityBus_storage5_2) <= +inf + 0 <= InvestmentFlowBlock_old(electricityBus_storage5_2) <= +inf 0 <= InvestmentFlowBlock_total(storage5_electricityBus_0) <= +inf 0 <= InvestmentFlowBlock_invest(storage5_electricityBus_0) <= +inf 0 <= InvestmentFlowBlock_total(storage5_electricityBus_1) <= +inf @@ -306,25 +311,20 @@ bounds 0 <= InvestmentFlowBlock_total(storage5_electricityBus_2) <= +inf 0 <= InvestmentFlowBlock_invest(storage5_electricityBus_2) <= +inf 0 <= InvestmentFlowBlock_old(storage5_electricityBus_2) <= +inf - 0 <= InvestmentFlowBlock_total(electricityBus_storage5_0) <= +inf - 0 <= InvestmentFlowBlock_total(electricityBus_storage5_1) <= +inf - 0 <= InvestmentFlowBlock_old(electricityBus_storage5_1) <= +inf - 0 <= InvestmentFlowBlock_total(electricityBus_storage5_2) <= +inf - 0 <= InvestmentFlowBlock_old(electricityBus_storage5_2) <= +inf - 0 <= InvestmentFlowBlock_old_end(storage5_electricityBus_0) <= +inf - 0 <= InvestmentFlowBlock_old_end(storage5_electricityBus_1) <= +inf - 0 <= InvestmentFlowBlock_old_end(storage5_electricityBus_2) <= +inf 0 <= InvestmentFlowBlock_old_end(electricityBus_storage5_0) <= +inf 0 <= InvestmentFlowBlock_old_end(electricityBus_storage5_1) <= +inf 0 <= InvestmentFlowBlock_old_end(electricityBus_storage5_2) <= +inf - 0 <= InvestmentFlowBlock_old_exo(storage5_electricityBus_0) <= +inf - 0 <= InvestmentFlowBlock_old_exo(storage5_electricityBus_1) <= +inf - 0 <= InvestmentFlowBlock_old_exo(storage5_electricityBus_2) <= +inf + 0 <= InvestmentFlowBlock_old_end(storage5_electricityBus_0) <= +inf + 0 <= InvestmentFlowBlock_old_end(storage5_electricityBus_1) <= +inf + 0 <= InvestmentFlowBlock_old_end(storage5_electricityBus_2) <= +inf 0 <= InvestmentFlowBlock_old_exo(electricityBus_storage5_0) <= +inf 0 <= InvestmentFlowBlock_old_exo(electricityBus_storage5_1) <= +inf 0 <= InvestmentFlowBlock_old_exo(electricityBus_storage5_2) <= +inf - 0 <= InvestmentFlowBlock_old(storage5_electricityBus_0) <= +inf + 0 <= InvestmentFlowBlock_old_exo(storage5_electricityBus_0) <= +inf + 0 <= InvestmentFlowBlock_old_exo(storage5_electricityBus_1) <= +inf + 0 <= InvestmentFlowBlock_old_exo(storage5_electricityBus_2) <= +inf 0 <= InvestmentFlowBlock_old(electricityBus_storage5_0) <= +inf + 0 <= InvestmentFlowBlock_old(storage5_electricityBus_0) <= +inf 0 <= GenericStorageBlock_storage_content(storage5_1) <= 10000 0 <= GenericStorageBlock_storage_content(storage5_0) <= 10000 0 <= GenericStorageBlock_storage_content(storage5_2) <= 10000 diff --git a/tests/lp_files/storage_invest_6_multi_period.lp b/tests/lp_files/storage_invest_6_multi_period.lp index 24c767b33..8ad4b9f42 100644 --- a/tests/lp_files/storage_invest_6_multi_period.lp +++ b/tests/lp_files/storage_invest_6_multi_period.lp @@ -284,11 +284,15 @@ c_e_GenericInvestmentStorageBlock_old_rule(storage6_2)_: -1 GenericInvestmentStorageBlock_old_exo(storage6_2) = 0 +c_e_GenericInvestmentStorageBlock_initially_empty(storage6_0)_: ++1 GenericInvestmentStorageBlock_storage_content(storage6_0) += 0 + c_e_GenericInvestmentStorageBlock_balance(storage6_0_1)_: +1 flow(storage6_electricityBus_0_1) -1 flow(electricityBus_storage6_0_1) -+1 GenericInvestmentStorageBlock_storage_content(storage6_1) -1 GenericInvestmentStorageBlock_storage_content(storage6_0) ++1 GenericInvestmentStorageBlock_storage_content(storage6_1) = 0 c_e_GenericInvestmentStorageBlock_balance(storage6_1_2)_: @@ -422,8 +426,8 @@ bounds 0 <= GenericInvestmentStorageBlock_old_exo(storage6_1) <= +inf 0 <= GenericInvestmentStorageBlock_old_exo(storage6_2) <= +inf 0 <= GenericInvestmentStorageBlock_old(storage6_0) <= +inf - 0 <= GenericInvestmentStorageBlock_storage_content(storage6_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage6_0) <= +inf + 0 <= GenericInvestmentStorageBlock_storage_content(storage6_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage6_2) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage6_3) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage6_4) <= +inf diff --git a/tests/lp_files/storage_invest_all_nonconvex_multi_period.lp b/tests/lp_files/storage_invest_all_nonconvex_multi_period.lp index 84eabdec1..68765fd78 100644 --- a/tests/lp_files/storage_invest_all_nonconvex_multi_period.lp +++ b/tests/lp_files/storage_invest_all_nonconvex_multi_period.lp @@ -2,18 +2,18 @@ min objective: -+12.231343625058066 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_0) -+15 InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_0) -+11.991513357900065 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_1) -+14.705882352941176 InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_1) -+11.756385645000064 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_2) -+14.41753171856978 InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_2) +12.231343625058066 InvestmentFlowBlock_invest(bus1_storage_all_nonconvex_0) +10 InvestmentFlowBlock_invest_status(bus1_storage_all_nonconvex_0) +11.991513357900065 InvestmentFlowBlock_invest(bus1_storage_all_nonconvex_1) +9.80392156862745 InvestmentFlowBlock_invest_status(bus1_storage_all_nonconvex_1) +11.756385645000064 InvestmentFlowBlock_invest(bus1_storage_all_nonconvex_2) +9.611687812379854 InvestmentFlowBlock_invest_status(bus1_storage_all_nonconvex_2) ++12.231343625058066 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_0) ++15 InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_0) ++11.991513357900065 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_1) ++14.705882352941176 InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_1) ++11.756385645000064 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_2) ++14.41753171856978 InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_2) +24.462687250116133 GenericInvestmentStorageBlock_invest(storage_all_nonconvex_0) +30 GenericInvestmentStorageBlock_invest_status(storage_all_nonconvex_0) +23.98302671580013 GenericInvestmentStorageBlock_invest(storage_all_nonconvex_1) @@ -53,21 +53,6 @@ c_e_BusBlock_balance(bus1_2_5)_: -1 flow(bus1_storage_all_nonconvex_2_5) = 0 -c_u_InvestmentFlowBlock_minimum_rule(storage_all_nonconvex_bus1_0)_: --1 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_0) -+8 InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_0) -<= 0 - -c_u_InvestmentFlowBlock_minimum_rule(storage_all_nonconvex_bus1_1)_: --1 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_1) -+8 InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_1) -<= 0 - -c_u_InvestmentFlowBlock_minimum_rule(storage_all_nonconvex_bus1_2)_: --1 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_2) -+8 InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_2) -<= 0 - c_u_InvestmentFlowBlock_minimum_rule(bus1_storage_all_nonconvex_0)_: -1 InvestmentFlowBlock_invest(bus1_storage_all_nonconvex_0) +5 InvestmentFlowBlock_invest_status(bus1_storage_all_nonconvex_0) @@ -83,19 +68,19 @@ c_u_InvestmentFlowBlock_minimum_rule(bus1_storage_all_nonconvex_2)_: +5 InvestmentFlowBlock_invest_status(bus1_storage_all_nonconvex_2) <= 0 -c_u_InvestmentFlowBlock_maximum_rule(storage_all_nonconvex_bus1_0)_: -+1 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_0) --20 InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_0) +c_u_InvestmentFlowBlock_minimum_rule(storage_all_nonconvex_bus1_0)_: +-1 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_0) ++8 InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_0) <= 0 -c_u_InvestmentFlowBlock_maximum_rule(storage_all_nonconvex_bus1_1)_: -+1 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_1) --20 InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_1) +c_u_InvestmentFlowBlock_minimum_rule(storage_all_nonconvex_bus1_1)_: +-1 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_1) ++8 InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_1) <= 0 -c_u_InvestmentFlowBlock_maximum_rule(storage_all_nonconvex_bus1_2)_: -+1 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_2) --20 InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_2) +c_u_InvestmentFlowBlock_minimum_rule(storage_all_nonconvex_bus1_2)_: +-1 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_2) ++8 InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_2) <= 0 c_u_InvestmentFlowBlock_maximum_rule(bus1_storage_all_nonconvex_0)_: @@ -113,24 +98,20 @@ c_u_InvestmentFlowBlock_maximum_rule(bus1_storage_all_nonconvex_2)_: -30 InvestmentFlowBlock_invest_status(bus1_storage_all_nonconvex_2) <= 0 -c_e_InvestmentFlowBlock_total_rule(storage_all_nonconvex_bus1_0)_: --1 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_0) -+1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_0) -= 0 +c_u_InvestmentFlowBlock_maximum_rule(storage_all_nonconvex_bus1_0)_: ++1 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_0) +-20 InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_0) +<= 0 -c_e_InvestmentFlowBlock_total_rule(storage_all_nonconvex_bus1_1)_: --1 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_1) --1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_0) -+1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_1) -+1 InvestmentFlowBlock_old(storage_all_nonconvex_bus1_1) -= 0 +c_u_InvestmentFlowBlock_maximum_rule(storage_all_nonconvex_bus1_1)_: ++1 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_1) +-20 InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_1) +<= 0 -c_e_InvestmentFlowBlock_total_rule(storage_all_nonconvex_bus1_2)_: --1 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_2) --1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_1) -+1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_2) -+1 InvestmentFlowBlock_old(storage_all_nonconvex_bus1_2) -= 0 +c_u_InvestmentFlowBlock_maximum_rule(storage_all_nonconvex_bus1_2)_: ++1 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_2) +-20 InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_2) +<= 0 c_e_InvestmentFlowBlock_total_rule(bus1_storage_all_nonconvex_0)_: -1 InvestmentFlowBlock_invest(bus1_storage_all_nonconvex_0) @@ -151,16 +132,23 @@ c_e_InvestmentFlowBlock_total_rule(bus1_storage_all_nonconvex_2)_: +1 InvestmentFlowBlock_old(bus1_storage_all_nonconvex_2) = 0 -c_e_InvestmentFlowBlock_old_rule_end(storage_all_nonconvex_bus1_0)_: -+1 InvestmentFlowBlock_old_end(storage_all_nonconvex_bus1_0) +c_e_InvestmentFlowBlock_total_rule(storage_all_nonconvex_bus1_0)_: +-1 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_0) ++1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_0) = 0 -c_e_InvestmentFlowBlock_old_rule_end(storage_all_nonconvex_bus1_1)_: -+1 InvestmentFlowBlock_old_end(storage_all_nonconvex_bus1_1) +c_e_InvestmentFlowBlock_total_rule(storage_all_nonconvex_bus1_1)_: +-1 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_1) +-1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_0) ++1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_1) ++1 InvestmentFlowBlock_old(storage_all_nonconvex_bus1_1) = 0 -c_e_InvestmentFlowBlock_old_rule_end(storage_all_nonconvex_bus1_2)_: -+1 InvestmentFlowBlock_old_end(storage_all_nonconvex_bus1_2) +c_e_InvestmentFlowBlock_total_rule(storage_all_nonconvex_bus1_2)_: +-1 InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_2) +-1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_1) ++1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_2) ++1 InvestmentFlowBlock_old(storage_all_nonconvex_bus1_2) = 0 c_e_InvestmentFlowBlock_old_rule_end(bus1_storage_all_nonconvex_0)_: @@ -175,16 +163,16 @@ c_e_InvestmentFlowBlock_old_rule_end(bus1_storage_all_nonconvex_2)_: +1 InvestmentFlowBlock_old_end(bus1_storage_all_nonconvex_2) = 0 -c_e_InvestmentFlowBlock_old_rule_exo(storage_all_nonconvex_bus1_0)_: -+1 InvestmentFlowBlock_old_exo(storage_all_nonconvex_bus1_0) +c_e_InvestmentFlowBlock_old_rule_end(storage_all_nonconvex_bus1_0)_: ++1 InvestmentFlowBlock_old_end(storage_all_nonconvex_bus1_0) = 0 -c_e_InvestmentFlowBlock_old_rule_exo(storage_all_nonconvex_bus1_1)_: -+1 InvestmentFlowBlock_old_exo(storage_all_nonconvex_bus1_1) +c_e_InvestmentFlowBlock_old_rule_end(storage_all_nonconvex_bus1_1)_: ++1 InvestmentFlowBlock_old_end(storage_all_nonconvex_bus1_1) = 0 -c_e_InvestmentFlowBlock_old_rule_exo(storage_all_nonconvex_bus1_2)_: -+1 InvestmentFlowBlock_old_exo(storage_all_nonconvex_bus1_2) +c_e_InvestmentFlowBlock_old_rule_end(storage_all_nonconvex_bus1_2)_: ++1 InvestmentFlowBlock_old_end(storage_all_nonconvex_bus1_2) = 0 c_e_InvestmentFlowBlock_old_rule_exo(bus1_storage_all_nonconvex_0)_: @@ -199,22 +187,16 @@ c_e_InvestmentFlowBlock_old_rule_exo(bus1_storage_all_nonconvex_2)_: +1 InvestmentFlowBlock_old_exo(bus1_storage_all_nonconvex_2) = 0 -c_e_InvestmentFlowBlock_old_rule(storage_all_nonconvex_bus1_0)_: --1 InvestmentFlowBlock_old_end(storage_all_nonconvex_bus1_0) --1 InvestmentFlowBlock_old_exo(storage_all_nonconvex_bus1_0) -+1 InvestmentFlowBlock_old(storage_all_nonconvex_bus1_0) +c_e_InvestmentFlowBlock_old_rule_exo(storage_all_nonconvex_bus1_0)_: ++1 InvestmentFlowBlock_old_exo(storage_all_nonconvex_bus1_0) = 0 -c_e_InvestmentFlowBlock_old_rule(storage_all_nonconvex_bus1_1)_: -+1 InvestmentFlowBlock_old(storage_all_nonconvex_bus1_1) --1 InvestmentFlowBlock_old_end(storage_all_nonconvex_bus1_1) --1 InvestmentFlowBlock_old_exo(storage_all_nonconvex_bus1_1) +c_e_InvestmentFlowBlock_old_rule_exo(storage_all_nonconvex_bus1_1)_: ++1 InvestmentFlowBlock_old_exo(storage_all_nonconvex_bus1_1) = 0 -c_e_InvestmentFlowBlock_old_rule(storage_all_nonconvex_bus1_2)_: -+1 InvestmentFlowBlock_old(storage_all_nonconvex_bus1_2) --1 InvestmentFlowBlock_old_end(storage_all_nonconvex_bus1_2) --1 InvestmentFlowBlock_old_exo(storage_all_nonconvex_bus1_2) +c_e_InvestmentFlowBlock_old_rule_exo(storage_all_nonconvex_bus1_2)_: ++1 InvestmentFlowBlock_old_exo(storage_all_nonconvex_bus1_2) = 0 c_e_InvestmentFlowBlock_old_rule(bus1_storage_all_nonconvex_0)_: @@ -235,35 +217,23 @@ c_e_InvestmentFlowBlock_old_rule(bus1_storage_all_nonconvex_2)_: -1 InvestmentFlowBlock_old_exo(bus1_storage_all_nonconvex_2) = 0 -c_u_InvestmentFlowBlock_max(storage_all_nonconvex_bus1_0_0)_: -+1 flow(storage_all_nonconvex_bus1_0_0) --1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_0) -<= 0 - -c_u_InvestmentFlowBlock_max(storage_all_nonconvex_bus1_0_1)_: -+1 flow(storage_all_nonconvex_bus1_0_1) --1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_0) -<= 0 - -c_u_InvestmentFlowBlock_max(storage_all_nonconvex_bus1_1_2)_: -+1 flow(storage_all_nonconvex_bus1_1_2) --1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_1) -<= 0 - -c_u_InvestmentFlowBlock_max(storage_all_nonconvex_bus1_1_3)_: -+1 flow(storage_all_nonconvex_bus1_1_3) --1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_1) -<= 0 +c_e_InvestmentFlowBlock_old_rule(storage_all_nonconvex_bus1_0)_: +-1 InvestmentFlowBlock_old_end(storage_all_nonconvex_bus1_0) +-1 InvestmentFlowBlock_old_exo(storage_all_nonconvex_bus1_0) ++1 InvestmentFlowBlock_old(storage_all_nonconvex_bus1_0) += 0 -c_u_InvestmentFlowBlock_max(storage_all_nonconvex_bus1_2_4)_: -+1 flow(storage_all_nonconvex_bus1_2_4) --1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_2) -<= 0 +c_e_InvestmentFlowBlock_old_rule(storage_all_nonconvex_bus1_1)_: ++1 InvestmentFlowBlock_old(storage_all_nonconvex_bus1_1) +-1 InvestmentFlowBlock_old_end(storage_all_nonconvex_bus1_1) +-1 InvestmentFlowBlock_old_exo(storage_all_nonconvex_bus1_1) += 0 -c_u_InvestmentFlowBlock_max(storage_all_nonconvex_bus1_2_5)_: -+1 flow(storage_all_nonconvex_bus1_2_5) --1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_2) -<= 0 +c_e_InvestmentFlowBlock_old_rule(storage_all_nonconvex_bus1_2)_: ++1 InvestmentFlowBlock_old(storage_all_nonconvex_bus1_2) +-1 InvestmentFlowBlock_old_end(storage_all_nonconvex_bus1_2) +-1 InvestmentFlowBlock_old_exo(storage_all_nonconvex_bus1_2) += 0 c_u_InvestmentFlowBlock_max(bus1_storage_all_nonconvex_0_0)_: +1 flow(bus1_storage_all_nonconvex_0_0) @@ -295,6 +265,36 @@ c_u_InvestmentFlowBlock_max(bus1_storage_all_nonconvex_2_5)_: -1 InvestmentFlowBlock_total(bus1_storage_all_nonconvex_2) <= 0 +c_u_InvestmentFlowBlock_max(storage_all_nonconvex_bus1_0_0)_: ++1 flow(storage_all_nonconvex_bus1_0_0) +-1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_0) +<= 0 + +c_u_InvestmentFlowBlock_max(storage_all_nonconvex_bus1_0_1)_: ++1 flow(storage_all_nonconvex_bus1_0_1) +-1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_0) +<= 0 + +c_u_InvestmentFlowBlock_max(storage_all_nonconvex_bus1_1_2)_: ++1 flow(storage_all_nonconvex_bus1_1_2) +-1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_1) +<= 0 + +c_u_InvestmentFlowBlock_max(storage_all_nonconvex_bus1_1_3)_: ++1 flow(storage_all_nonconvex_bus1_1_3) +-1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_1) +<= 0 + +c_u_InvestmentFlowBlock_max(storage_all_nonconvex_bus1_2_4)_: ++1 flow(storage_all_nonconvex_bus1_2_4) +-1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_2) +<= 0 + +c_u_InvestmentFlowBlock_max(storage_all_nonconvex_bus1_2_5)_: ++1 flow(storage_all_nonconvex_bus1_2_5) +-1 InvestmentFlowBlock_total(storage_all_nonconvex_bus1_2) +<= 0 + c_e_GenericInvestmentStorageBlock_total_storage_rule(storage_all_nonconvex_0)_: -1 GenericInvestmentStorageBlock_invest(storage_all_nonconvex_0) +1 GenericInvestmentStorageBlock_total(storage_all_nonconvex_0) @@ -356,11 +356,15 @@ c_e_GenericInvestmentStorageBlock_old_rule(storage_all_nonconvex_2)_: -1 GenericInvestmentStorageBlock_old_exo(storage_all_nonconvex_2) = 0 +c_e_GenericInvestmentStorageBlock_initially_empty(storage_all_nonconvex_0)_: ++1 GenericInvestmentStorageBlock_storage_content(storage_all_nonconvex_0) += 0 + c_e_GenericInvestmentStorageBlock_balance(storage_all_nonconvex_0_1)_: +1 flow(storage_all_nonconvex_bus1_0_1) -1 flow(bus1_storage_all_nonconvex_0_1) -+1 GenericInvestmentStorageBlock_storage_content(storage_all_nonconvex_1) -1 GenericInvestmentStorageBlock_storage_content(storage_all_nonconvex_0) ++1 GenericInvestmentStorageBlock_storage_content(storage_all_nonconvex_1) = 0 c_e_GenericInvestmentStorageBlock_balance(storage_all_nonconvex_1_2)_: @@ -452,18 +456,18 @@ c_l_GenericInvestmentStorageBlock_limit_min(storage_all_nonconvex_2)_: >= 0 bounds - 0 <= InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_0) <= 20 - 0 <= InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_0) <= 1 - 0 <= InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_1) <= 20 - 0 <= InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_1) <= 1 - 0 <= InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_2) <= 20 - 0 <= InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_2) <= 1 0 <= InvestmentFlowBlock_invest(bus1_storage_all_nonconvex_0) <= 30 0 <= InvestmentFlowBlock_invest_status(bus1_storage_all_nonconvex_0) <= 1 0 <= InvestmentFlowBlock_invest(bus1_storage_all_nonconvex_1) <= 30 0 <= InvestmentFlowBlock_invest_status(bus1_storage_all_nonconvex_1) <= 1 0 <= InvestmentFlowBlock_invest(bus1_storage_all_nonconvex_2) <= 30 0 <= InvestmentFlowBlock_invest_status(bus1_storage_all_nonconvex_2) <= 1 + 0 <= InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_0) <= 20 + 0 <= InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_0) <= 1 + 0 <= InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_1) <= 20 + 0 <= InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_1) <= 1 + 0 <= InvestmentFlowBlock_invest(storage_all_nonconvex_bus1_2) <= 20 + 0 <= InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_2) <= 1 0 <= GenericInvestmentStorageBlock_invest(storage_all_nonconvex_0) <= 100 0 <= GenericInvestmentStorageBlock_invest_status(storage_all_nonconvex_0) <= 1 0 <= GenericInvestmentStorageBlock_invest(storage_all_nonconvex_1) <= 100 @@ -482,30 +486,30 @@ bounds 0 <= flow(bus1_storage_all_nonconvex_2_4) <= +inf 0 <= flow(storage_all_nonconvex_bus1_2_5) <= +inf 0 <= flow(bus1_storage_all_nonconvex_2_5) <= +inf - 0 <= InvestmentFlowBlock_total(storage_all_nonconvex_bus1_0) <= +inf - 0 <= InvestmentFlowBlock_total(storage_all_nonconvex_bus1_1) <= +inf - 0 <= InvestmentFlowBlock_old(storage_all_nonconvex_bus1_1) <= +inf - 0 <= InvestmentFlowBlock_total(storage_all_nonconvex_bus1_2) <= +inf - 0 <= InvestmentFlowBlock_old(storage_all_nonconvex_bus1_2) <= +inf 0 <= InvestmentFlowBlock_total(bus1_storage_all_nonconvex_0) <= +inf 0 <= InvestmentFlowBlock_total(bus1_storage_all_nonconvex_1) <= +inf 0 <= InvestmentFlowBlock_old(bus1_storage_all_nonconvex_1) <= +inf 0 <= InvestmentFlowBlock_total(bus1_storage_all_nonconvex_2) <= +inf 0 <= InvestmentFlowBlock_old(bus1_storage_all_nonconvex_2) <= +inf - 0 <= InvestmentFlowBlock_old_end(storage_all_nonconvex_bus1_0) <= +inf - 0 <= InvestmentFlowBlock_old_end(storage_all_nonconvex_bus1_1) <= +inf - 0 <= InvestmentFlowBlock_old_end(storage_all_nonconvex_bus1_2) <= +inf + 0 <= InvestmentFlowBlock_total(storage_all_nonconvex_bus1_0) <= +inf + 0 <= InvestmentFlowBlock_total(storage_all_nonconvex_bus1_1) <= +inf + 0 <= InvestmentFlowBlock_old(storage_all_nonconvex_bus1_1) <= +inf + 0 <= InvestmentFlowBlock_total(storage_all_nonconvex_bus1_2) <= +inf + 0 <= InvestmentFlowBlock_old(storage_all_nonconvex_bus1_2) <= +inf 0 <= InvestmentFlowBlock_old_end(bus1_storage_all_nonconvex_0) <= +inf 0 <= InvestmentFlowBlock_old_end(bus1_storage_all_nonconvex_1) <= +inf 0 <= InvestmentFlowBlock_old_end(bus1_storage_all_nonconvex_2) <= +inf - 0 <= InvestmentFlowBlock_old_exo(storage_all_nonconvex_bus1_0) <= +inf - 0 <= InvestmentFlowBlock_old_exo(storage_all_nonconvex_bus1_1) <= +inf - 0 <= InvestmentFlowBlock_old_exo(storage_all_nonconvex_bus1_2) <= +inf + 0 <= InvestmentFlowBlock_old_end(storage_all_nonconvex_bus1_0) <= +inf + 0 <= InvestmentFlowBlock_old_end(storage_all_nonconvex_bus1_1) <= +inf + 0 <= InvestmentFlowBlock_old_end(storage_all_nonconvex_bus1_2) <= +inf 0 <= InvestmentFlowBlock_old_exo(bus1_storage_all_nonconvex_0) <= +inf 0 <= InvestmentFlowBlock_old_exo(bus1_storage_all_nonconvex_1) <= +inf 0 <= InvestmentFlowBlock_old_exo(bus1_storage_all_nonconvex_2) <= +inf - 0 <= InvestmentFlowBlock_old(storage_all_nonconvex_bus1_0) <= +inf + 0 <= InvestmentFlowBlock_old_exo(storage_all_nonconvex_bus1_0) <= +inf + 0 <= InvestmentFlowBlock_old_exo(storage_all_nonconvex_bus1_1) <= +inf + 0 <= InvestmentFlowBlock_old_exo(storage_all_nonconvex_bus1_2) <= +inf 0 <= InvestmentFlowBlock_old(bus1_storage_all_nonconvex_0) <= +inf + 0 <= InvestmentFlowBlock_old(storage_all_nonconvex_bus1_0) <= +inf 0 <= GenericInvestmentStorageBlock_total(storage_all_nonconvex_0) <= +inf 0 <= GenericInvestmentStorageBlock_total(storage_all_nonconvex_1) <= +inf 0 <= GenericInvestmentStorageBlock_old(storage_all_nonconvex_1) <= +inf @@ -518,19 +522,19 @@ bounds 0 <= GenericInvestmentStorageBlock_old_exo(storage_all_nonconvex_1) <= +inf 0 <= GenericInvestmentStorageBlock_old_exo(storage_all_nonconvex_2) <= +inf 0 <= GenericInvestmentStorageBlock_old(storage_all_nonconvex_0) <= +inf - 0 <= GenericInvestmentStorageBlock_storage_content(storage_all_nonconvex_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage_all_nonconvex_0) <= +inf + 0 <= GenericInvestmentStorageBlock_storage_content(storage_all_nonconvex_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage_all_nonconvex_2) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage_all_nonconvex_3) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage_all_nonconvex_4) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage_all_nonconvex_5) <= +inf binary - InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_0) - InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_1) - InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_2) InvestmentFlowBlock_invest_status(bus1_storage_all_nonconvex_0) InvestmentFlowBlock_invest_status(bus1_storage_all_nonconvex_1) InvestmentFlowBlock_invest_status(bus1_storage_all_nonconvex_2) + InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_0) + InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_1) + InvestmentFlowBlock_invest_status(storage_all_nonconvex_bus1_2) GenericInvestmentStorageBlock_invest_status(storage_all_nonconvex_0) GenericInvestmentStorageBlock_invest_status(storage_all_nonconvex_1) GenericInvestmentStorageBlock_invest_status(storage_all_nonconvex_2) diff --git a/tests/lp_files/storage_invest_minimum_multi_period.lp b/tests/lp_files/storage_invest_minimum_multi_period.lp index 25e1482b3..76e8aa662 100644 --- a/tests/lp_files/storage_invest_minimum_multi_period.lp +++ b/tests/lp_files/storage_invest_minimum_multi_period.lp @@ -99,11 +99,15 @@ c_e_GenericInvestmentStorageBlock_old_rule(storage1_2)_: -1 GenericInvestmentStorageBlock_old_exo(storage1_2) = 0 +c_e_GenericInvestmentStorageBlock_initially_empty(storage1_0)_: ++1 GenericInvestmentStorageBlock_storage_content(storage1_0) += 0 + c_e_GenericInvestmentStorageBlock_balance(storage1_0_1)_: +1 flow(storage1_electricityBus_0_1) -1 flow(electricityBus_storage1_0_1) -+1 GenericInvestmentStorageBlock_storage_content(storage1_1) -1 GenericInvestmentStorageBlock_storage_content(storage1_0) ++1 GenericInvestmentStorageBlock_storage_content(storage1_1) = 0 c_e_GenericInvestmentStorageBlock_balance(storage1_1_2)_: @@ -192,8 +196,8 @@ bounds 0 <= GenericInvestmentStorageBlock_old_exo(storage1_1) <= +inf 0 <= GenericInvestmentStorageBlock_old_exo(storage1_2) <= +inf 0 <= GenericInvestmentStorageBlock_old(storage1_0) <= +inf - 0 <= GenericInvestmentStorageBlock_storage_content(storage1_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage1_0) <= +inf + 0 <= GenericInvestmentStorageBlock_storage_content(storage1_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage1_2) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage1_3) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage1_4) <= +inf diff --git a/tests/lp_files/storage_invest_multi_period.lp b/tests/lp_files/storage_invest_multi_period.lp index 983ada947..228aadf96 100644 --- a/tests/lp_files/storage_invest_multi_period.lp +++ b/tests/lp_files/storage_invest_multi_period.lp @@ -100,11 +100,15 @@ c_e_GenericInvestmentStorageBlock_old_rule(storage1_2)_: -1 GenericInvestmentStorageBlock_old_exo(storage1_2) = 0 +c_e_GenericInvestmentStorageBlock_initially_empty(storage1_0)_: ++1 GenericInvestmentStorageBlock_storage_content(storage1_0) += 0 + c_e_GenericInvestmentStorageBlock_balance(storage1_0_1)_: +1 flow(storage1_electricityBus_0_1) -1 flow(electricityBus_storage1_0_1) -+1 GenericInvestmentStorageBlock_storage_content(storage1_1) -1 GenericInvestmentStorageBlock_storage_content(storage1_0) ++1 GenericInvestmentStorageBlock_storage_content(storage1_1) = 0 c_e_GenericInvestmentStorageBlock_balance(storage1_1_2)_: @@ -210,8 +214,8 @@ bounds 0 <= GenericInvestmentStorageBlock_old_exo(storage1_1) <= +inf 0 <= GenericInvestmentStorageBlock_old_exo(storage1_2) <= +inf 0 <= GenericInvestmentStorageBlock_old(storage1_0) <= +inf - 0 <= GenericInvestmentStorageBlock_storage_content(storage1_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage1_0) <= +inf + 0 <= GenericInvestmentStorageBlock_storage_content(storage1_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage1_2) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage1_3) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage1_4) <= +inf diff --git a/tests/lp_files/storage_invest_with_offset_multi_period.lp b/tests/lp_files/storage_invest_with_offset_multi_period.lp index 9686a957f..9fb9d7680 100644 --- a/tests/lp_files/storage_invest_with_offset_multi_period.lp +++ b/tests/lp_files/storage_invest_with_offset_multi_period.lp @@ -296,11 +296,15 @@ c_e_GenericInvestmentStorageBlock_old_rule(storage_non_convex_2)_: -1 GenericInvestmentStorageBlock_old_exo(storage_non_convex_2) = 0 +c_e_GenericInvestmentStorageBlock_initially_empty(storage_non_convex_0)_: ++1 GenericInvestmentStorageBlock_storage_content(storage_non_convex_0) += 0 + c_e_GenericInvestmentStorageBlock_balance(storage_non_convex_0_1)_: -0.97 flow(electricityBus_storage_non_convex_0_1) +1.1627906976744187 flow(storage_non_convex_electricityBus_0_1) -+1 GenericInvestmentStorageBlock_storage_content(storage_non_convex_1) -0.87 GenericInvestmentStorageBlock_storage_content(storage_non_convex_0) ++1 GenericInvestmentStorageBlock_storage_content(storage_non_convex_1) = 0 c_e_GenericInvestmentStorageBlock_balance(storage_non_convex_1_2)_: @@ -512,8 +516,8 @@ bounds 0 <= GenericInvestmentStorageBlock_old_exo(storage_non_convex_1) <= +inf 0 <= GenericInvestmentStorageBlock_old_exo(storage_non_convex_2) <= +inf 0 <= GenericInvestmentStorageBlock_old(storage_non_convex_0) <= +inf - 0 <= GenericInvestmentStorageBlock_storage_content(storage_non_convex_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage_non_convex_0) <= +inf + 0 <= GenericInvestmentStorageBlock_storage_content(storage_non_convex_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage_non_convex_2) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage_non_convex_3) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage_non_convex_4) <= +inf diff --git a/tests/lp_files/storage_invest_without_offset_multi_period.lp b/tests/lp_files/storage_invest_without_offset_multi_period.lp index 327b74c93..3e98a271f 100644 --- a/tests/lp_files/storage_invest_without_offset_multi_period.lp +++ b/tests/lp_files/storage_invest_without_offset_multi_period.lp @@ -293,11 +293,15 @@ c_e_GenericInvestmentStorageBlock_old_rule(storage_non_convex_2)_: -1 GenericInvestmentStorageBlock_old_exo(storage_non_convex_2) = 0 +c_e_GenericInvestmentStorageBlock_initially_empty(storage_non_convex_0)_: ++1 GenericInvestmentStorageBlock_storage_content(storage_non_convex_0) += 0 + c_e_GenericInvestmentStorageBlock_balance(storage_non_convex_0_1)_: -0.97 flow(electricityBus_storage_non_convex_0_1) +1.1627906976744187 flow(storage_non_convex_electricityBus_0_1) -+1 GenericInvestmentStorageBlock_storage_content(storage_non_convex_1) -0.87 GenericInvestmentStorageBlock_storage_content(storage_non_convex_0) ++1 GenericInvestmentStorageBlock_storage_content(storage_non_convex_1) = 0 c_e_GenericInvestmentStorageBlock_balance(storage_non_convex_1_2)_: @@ -506,8 +510,8 @@ bounds 0 <= GenericInvestmentStorageBlock_old_exo(storage_non_convex_1) <= +inf 0 <= GenericInvestmentStorageBlock_old_exo(storage_non_convex_2) <= +inf 0 <= GenericInvestmentStorageBlock_old(storage_non_convex_0) <= +inf - 0 <= GenericInvestmentStorageBlock_storage_content(storage_non_convex_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage_non_convex_0) <= +inf + 0 <= GenericInvestmentStorageBlock_storage_content(storage_non_convex_1) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage_non_convex_2) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage_non_convex_3) <= +inf 0 <= GenericInvestmentStorageBlock_storage_content(storage_non_convex_4) <= +inf From 670ccbdc9091cc03126879ae7a4e72dde5984d0b Mon Sep 17 00:00:00 2001 From: Johannes Kochems Date: Mon, 7 Aug 2023 15:51:57 +0200 Subject: [PATCH 03/16] Add improvements from code review --- .../solph/components/_generic_storage.py | 21 ++++++++----------- tests/multi_period_constraint_tests.py | 13 +++++------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/oemof/solph/components/_generic_storage.py b/src/oemof/solph/components/_generic_storage.py index 1c34269ad..05a492216 100644 --- a/src/oemof/solph/components/_generic_storage.py +++ b/src/oemof/solph/components/_generic_storage.py @@ -1032,21 +1032,20 @@ def _create(self, group=None): # ########################## CHECKS ################################### if m.es.periods is not None: for n in group: - error = ( + error_fixed_absolute_losses = ( "For a multi-period investment model, fixed absolute" " losses are not supported. Please remove parameter." ) if n.fixed_losses_absolute.default != 0: - raise ValueError(error) - warning = ( + raise ValueError(error_fixed_absolute_losses) + error_initial_storage_level = ( "For a multi-period model, initial_storage_level is" - " not supported.\nIt is suggested to remove that" - " parameter since it has no effect.\nstorage_content" - " will be zero, until there is some usable storage " - " capacity installed." + " not supported.\nIt needs to be removed since it" + " has no effect.\nstorage_content will be zero," + " until there is some usable storage capacity installed." ) if n.initial_storage_level is not None: - warn(warning, debugging.SuspiciousUsageWarning) + raise ValueError(error_initial_storage_level) # ########################## SETS ##################################### @@ -1315,10 +1314,8 @@ def _old_storage_capacity_rule(block): def _initially_empty_rule(block): """Ensure storage to be empty initially""" for n in self.INVESTSTORAGES: - for t in m.TIMESTEPS: - if t == 0: - expr = self.storage_content[n, 0] == 0 - self.initially_empty.add((n, t), expr) + expr = self.storage_content[n, 0] == 0 + self.initially_empty.add((n, 0), expr) self.initially_empty = Constraint( self.INVESTSTORAGES, m.TIMESTEPS, noruleinit=True diff --git a/tests/multi_period_constraint_tests.py b/tests/multi_period_constraint_tests.py index ac776fc93..974e65e10 100644 --- a/tests/multi_period_constraint_tests.py +++ b/tests/multi_period_constraint_tests.py @@ -385,7 +385,6 @@ def test_storage_invest_2(self): investment=solph.Investment( ep_costs=145, lifetime=20, existing=20, age=19 ), - initial_storage_level=0.5, ) self.energysystem.add(bel, storage) self.compare_lp_files("storage_invest_2_multi_period.lp") @@ -612,7 +611,7 @@ def test_storage_invest_1_fixed_losses(self): self.get_om() def test_storage_invest_1_initial_storage_level(self): - """Test warning for initial storage level + """Test error for initial storage level with multi-period investments""" bel = solph.buses.Bus(label="electricityBus") storage = solph.components.GenericStorage( @@ -642,14 +641,12 @@ def test_storage_invest_1_initial_storage_level(self): self.energysystem.add(bel, storage) msg = ( "For a multi-period model, initial_storage_level is" - " not supported.\nIt is suggested to remove that" - " parameter since it has no effect.\nstorage_content" - " will be zero, until there is some usable storage " - " capacity installed." + " not supported.\nIt needs to be removed since it" + " has no effect.\nstorage_content will be zero," + " until there is some usable storage capacity installed." ) - with warnings.catch_warnings(record=True) as w: + with pytest.raises(ValueError, match=msg): self.get_om() - assert msg in str(w[1].message) def test_storage_invest_1_missing_lifetime(self): """Test error thrown if storage misses necessary lifetime""" From 863ade7c785bcaeccbee422d9b8aee3a7305f407 Mon Sep 17 00:00:00 2001 From: Johannes Kochems Date: Mon, 7 Aug 2023 15:54:19 +0200 Subject: [PATCH 04/16] Remove unused import --- tests/multi_period_constraint_tests.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/multi_period_constraint_tests.py b/tests/multi_period_constraint_tests.py index 974e65e10..2f2694ad1 100644 --- a/tests/multi_period_constraint_tests.py +++ b/tests/multi_period_constraint_tests.py @@ -11,7 +11,6 @@ import logging import re -import warnings from os import path as ospath import pandas as pd From 2260d270beec1872c5303b9dcb36835b05e64d6e Mon Sep 17 00:00:00 2001 From: Johannes Kochems Date: Mon, 7 Aug 2023 16:25:22 +0200 Subject: [PATCH 05/16] Fix failing test --- .../test_multi_period_investment_model.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_scripts/test_solph/test_multi_period_model/test_multi_period_investment_model.py b/tests/test_scripts/test_solph/test_multi_period_model/test_multi_period_investment_model.py index e0a8e6ca7..d5714275f 100644 --- a/tests/test_scripts/test_solph/test_multi_period_model/test_multi_period_investment_model.py +++ b/tests/test_scripts/test_solph/test_multi_period_model/test_multi_period_investment_model.py @@ -242,7 +242,6 @@ def test_multi_period_investment_model(solver="cbc"): ) }, loss_rate=0, - initial_storage_level=0, max_storage_level=1, min_storage_level=0, inflow_conversion_factor=1, From fe59b8a8848cff4e51300b18190685ee54f4d709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Tue, 8 Aug 2023 19:59:50 +0200 Subject: [PATCH 06/16] Add all dependencies to docs/requirements.txt Readthedocs does not provide system-wide Python packages any more, so we need to add the dependencies explicitly. --- docs/requirements.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/requirements.txt b/docs/requirements.txt index dde8ed384..edcd95c40 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -2,3 +2,11 @@ sphinx>=1.3 sphinx-rtd-theme setuptools matplotlib +blinker +dill +numpy +pandas >= 1.5.3 +pyomo >= 6.6.0, < 7.0 +networkx +oemof.tools >= 0.4.2 +oemof.network >= 0.5.0a1 From 24d29eff13d5cdffc983c826b18ee5813a98d6cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Tue, 8 Aug 2023 21:07:33 +0200 Subject: [PATCH 07/16] Fix constraint example The example was not adjusted when the period index was introduced. --- examples/flexible_modelling/add_constraints.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/flexible_modelling/add_constraints.py b/examples/flexible_modelling/add_constraints.py index 3f76264ae..56db0dbc4 100644 --- a/examples/flexible_modelling/add_constraints.py +++ b/examples/flexible_modelling/add_constraints.py @@ -113,26 +113,26 @@ def run_add_constraints_example(solver="cbc", nologg=False): # add the sub-model to the oemof Model instance om.add_component("MyBlock", myblock) - def _inflow_share_rule(m, s, e, t): + def _inflow_share_rule(m, s, e, p, t): """pyomo rule definition: Here we can use all objects from the block or the om object, in this case we don't need anything from the block except the newly defined set MYFLOWS. """ - expr = om.flow[s, e, t] >= om.flows[s, e].outflow_share[t] * sum( - om.flow[i, o, t] for (i, o) in om.FLOWS if o == e + expr = om.flow[s, e, p, t] >= om.flows[s, e].outflow_share[t] * sum( + om.flow[i, o, p, t] for (i, o) in om.FLOWS if o == e ) return expr myblock.inflow_share = po.Constraint( - myblock.MYFLOWS, om.TIMESTEPS, rule=_inflow_share_rule + myblock.MYFLOWS, om.TIMEINDEX, rule=_inflow_share_rule ) # add emission constraint myblock.emission_constr = po.Constraint( expr=( sum( - om.flow[i, o, t] + om.flow[i, o, p, t] for (i, o) in myblock.COMMODITYFLOWS - for t in om.TIMESTEPS + for p, t in om.TIMEINDEX ) <= emission_limit ) From 705251e692a9d219864335bfdf5391f9d1e54e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Tue, 8 Aug 2023 21:09:18 +0200 Subject: [PATCH 08/16] Fix invest nonconvex example There were two typos in keyword arguments. Also, as the script will fail if the time index does not match, the fallback for the read-in was deleted. --- .../diesel_genset_nonconvex_investment.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/examples/invest_nonconvex_flow_examples/diesel_genset_nonconvex_investment.py b/examples/invest_nonconvex_flow_examples/diesel_genset_nonconvex_investment.py index 2413733df..aeab52562 100644 --- a/examples/invest_nonconvex_flow_examples/diesel_genset_nonconvex_investment.py +++ b/examples/invest_nonconvex_flow_examples/diesel_genset_nonconvex_investment.py @@ -69,12 +69,7 @@ def main(): # Import data. filename = os.path.join(os.getcwd(), "solar_generation.csv") - try: - data = pd.read_csv(filename) - except FileNotFoundError: - msg = "Data file not found: {0}. Only one value used!" - warnings.warn(msg.format(filename), UserWarning) - data = pd.DataFrame({"pv": [0.3], "wind": [0.6], "demand_el": [500]}) + data = pd.read_csv(filename) # Change the index of data to be able to select data based on the time # range. @@ -174,7 +169,7 @@ def main(): ) }, outputs={b_el_dc: solph.flows.Flow()}, - conversion_factor={ + conversion_factors={ b_el_dc: 0.98, }, ) @@ -193,7 +188,7 @@ def main(): ) }, outputs={b_el_ac: solph.flows.Flow()}, - conversion_factor={ + conversion_factors={ b_el_ac: 0.98, }, ) From c35e9398737734e297c2cbd37a489bb68d88ddb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Tue, 8 Aug 2023 21:11:04 +0200 Subject: [PATCH 09/16] Add saturating storage example Another example for flexible modelling (in the sense of using custom constraints) is presented: The storage charges slower at higher states of charge. --- .../flexible_modelling/saturating_storage.py | 128 ++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 examples/flexible_modelling/saturating_storage.py diff --git a/examples/flexible_modelling/saturating_storage.py b/examples/flexible_modelling/saturating_storage.py new file mode 100644 index 000000000..c2841ec88 --- /dev/null +++ b/examples/flexible_modelling/saturating_storage.py @@ -0,0 +1,128 @@ +# -*- coding: utf-8 -*- + +""" +General description +------------------- +Example that shows the how to implement a `GenericStorage` +that charges at reduced rates for high storage contents. + + +Installation requirements +------------------------- +This example requires oemof.solph (v0.5.x), install by: + + pip install oemof.solph[examples] + + +License +------- +`MIT license `_ +""" + +import pandas as pd +from pyomo import environ as po +from matplotlib import pyplot as plt + +from oemof import solph + + +def saturating_storage_example(): + # create an energy system + idx = pd.date_range("1/1/2023", periods=100, freq="H") + es = solph.EnergySystem(timeindex=idx, infer_last_interval=False) + + # power bus + bel = solph.Bus(label="bel") + es.add(bel) + + es.add( + solph.components.Source( + label="source_el", + outputs={bel: solph.Flow(nominal_value=1, fix=1)}, + ) + ) + + es.add( + solph.components.Sink( + label="sink_el", + inputs={ + bel: solph.Flow( + nominal_value=1, + variable_costs=1, + ) + }, + ) + ) + + # Electric Storage + + inflow_capacity = 0.5 + full_charging_limit = 0.4 + storage_capacity = 10 + battery = solph.components.GenericStorage( + label="battery", + nominal_storage_capacity=storage_capacity, + inputs={bel: solph.Flow(nominal_value=inflow_capacity)}, + outputs={bel: solph.Flow(variable_costs=2)}, + initial_storage_level=0, + balanced=False, + loss_rate=0.0001, + ) + es.add(battery) + + # create an optimization problem and solve it + model = solph.Model(es) + + def soc_limit_rule(m): + for p, ts in m.TIMEINDEX: + soc = ( + m.GenericStorageBlock.storage_content[battery, ts + 1] + / storage_capacity + ) + expr = (1 - soc) / (1 - full_charging_limit) >= m.flow[ + bel, battery, p, ts + ] / inflow_capacity + getattr(m, "soc_limit").add((p, ts), expr) + + setattr( + model, + "soc_limit", + po.Constraint( + model.TIMEINDEX, + noruleinit=True, + ), + ) + setattr( + model, + "soc_limit_build", + po.BuildAction(rule=soc_limit_rule), + ) + + # solve model + model.solve(solver="cbc") + + # create result object + results = solph.processing.results(model) + + plt.plot(results[(battery, None)]["sequences"], "r--", label="content") + plt.step( + 20 * results[(bel, battery)]["sequences"], "b-", label="20*inflow" + ) + plt.legend() + plt.grid() + + plt.figure() + plt.plot( + results[(battery, None)]["sequences"][1:], + results[(bel, battery)]["sequences"][:-1], + "b-", + ) + plt.grid() + plt.xlabel("Storage content") + plt.ylabel("Charging power") + + plt.show() + + +if __name__ == "__main__": + saturating_storage_example() From 03621581f449eb46f16f85eb0d28dce4892350b7 Mon Sep 17 00:00:00 2001 From: MaGering Date: Wed, 9 Aug 2023 14:29:01 +0200 Subject: [PATCH 10/16] Add 'custom_attributes' for link component --- src/oemof/solph/components/_link.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/oemof/solph/components/_link.py b/src/oemof/solph/components/_link.py index 68df92481..e4b2c47f2 100644 --- a/src/oemof/solph/components/_link.py +++ b/src/oemof/solph/components/_link.py @@ -84,6 +84,7 @@ def __init__( inputs=None, outputs=None, conversion_factors=None, + custom_attributes=None, ): if inputs is None: warn_if_missing_attribute(self, "inputs") @@ -94,10 +95,13 @@ def __init__( if conversion_factors is None: warn_if_missing_attribute(self, "conversion_factors") conversion_factors = {} + if custom_attributes is None: + custom_attributes = {} super().__init__( label=label, inputs=inputs, outputs=outputs, + **custom_attributes, ) self.conversion_factors = { k: sequence(v) for k, v in conversion_factors.items() From 06717f02fb814d371dbb441b11ce792c529df72f Mon Sep 17 00:00:00 2001 From: MaGering Date: Wed, 9 Aug 2023 14:29:17 +0200 Subject: [PATCH 11/16] Update docs/whatsnew/v0-5-1.rst --- docs/whatsnew/v0-5-1.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/whatsnew/v0-5-1.rst b/docs/whatsnew/v0-5-1.rst index 09df9b280..91252f40b 100644 --- a/docs/whatsnew/v0-5-1.rst +++ b/docs/whatsnew/v0-5-1.rst @@ -43,6 +43,7 @@ Bug fixes * Fixed error when calling `oemof_installation_test` as console script. * Corrected several typos in the docs. +* Add missing 'custom_attributes' for the link component Testing ####### From 07affaf942f2699569a4d8f389666eb14de6c090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Wed, 9 Aug 2023 21:12:07 +0200 Subject: [PATCH 12/16] Make constraint_group a method where possible Pyomo expects a keyword argument, so _ is used where self is not needed. --- src/oemof/solph/components/_extraction_turbine_chp.py | 2 +- src/oemof/solph/components/_link.py | 2 +- src/oemof/solph/components/_source.py | 2 +- src/oemof/solph/flows/experimental/_electrical_line.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/oemof/solph/components/_extraction_turbine_chp.py b/src/oemof/solph/components/_extraction_turbine_chp.py index 138ed5951..7184bfe87 100644 --- a/src/oemof/solph/components/_extraction_turbine_chp.py +++ b/src/oemof/solph/components/_extraction_turbine_chp.py @@ -91,7 +91,7 @@ def __init__( for k, v in conversion_factor_full_condensation.items() } - def constraint_group(self): + def constraint_group(_): return ExtractionTurbineCHPBlock diff --git a/src/oemof/solph/components/_link.py b/src/oemof/solph/components/_link.py index 68df92481..66b60ee8d 100644 --- a/src/oemof/solph/components/_link.py +++ b/src/oemof/solph/components/_link.py @@ -118,7 +118,7 @@ def __init__( ): warn(msg, debugging.SuspiciousUsageWarning) - def constraint_group(self): + def constraint_group(_): return LinkBlock diff --git a/src/oemof/solph/components/_source.py b/src/oemof/solph/components/_source.py index 287c8d2b5..0e7da0211 100644 --- a/src/oemof/solph/components/_source.py +++ b/src/oemof/solph/components/_source.py @@ -75,5 +75,5 @@ def __init__(self, label=None, outputs=None, custom_attributes=None): super().__init__(label=label, outputs=outputs, **custom_attributes) - def constraint_group(self): + def constraint_group(_): pass diff --git a/src/oemof/solph/flows/experimental/_electrical_line.py b/src/oemof/solph/flows/experimental/_electrical_line.py index e96f85de7..978bdd880 100644 --- a/src/oemof/solph/flows/experimental/_electrical_line.py +++ b/src/oemof/solph/flows/experimental/_electrical_line.py @@ -93,7 +93,7 @@ def __init__(self, **kwargs): # to be used in grouping for all bidi flows self.bidirectional = True - def constraint_group(self): + def constraint_group(_): return ElectricalLineBlock From 84a89fe4df8d5bee877f27b1834620797b52bbee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Wed, 9 Aug 2023 21:19:53 +0200 Subject: [PATCH 13/16] Make constraint_group a method where possible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pyomo expects a keyword argument, so _ is used where self is not needed. Signed-off-by: Patrik Schönfeldt --- src/oemof/solph/components/_extraction_turbine_chp.py | 2 +- src/oemof/solph/components/_generic_chp.py | 2 +- src/oemof/solph/components/_link.py | 2 +- src/oemof/solph/components/_offset_transformer.py | 2 +- src/oemof/solph/components/_sink.py | 2 +- src/oemof/solph/components/_source.py | 2 +- src/oemof/solph/components/_transformer.py | 2 +- src/oemof/solph/components/experimental/_generic_caes.py | 2 +- .../components/experimental/_piecewise_linear_transformer.py | 2 +- src/oemof/solph/flows/experimental/_electrical_line.py | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/oemof/solph/components/_extraction_turbine_chp.py b/src/oemof/solph/components/_extraction_turbine_chp.py index 138ed5951..7184bfe87 100644 --- a/src/oemof/solph/components/_extraction_turbine_chp.py +++ b/src/oemof/solph/components/_extraction_turbine_chp.py @@ -91,7 +91,7 @@ def __init__( for k, v in conversion_factor_full_condensation.items() } - def constraint_group(self): + def constraint_group(_): return ExtractionTurbineCHPBlock diff --git a/src/oemof/solph/components/_generic_chp.py b/src/oemof/solph/components/_generic_chp.py index d817f00f5..8a019da65 100644 --- a/src/oemof/solph/components/_generic_chp.py +++ b/src/oemof/solph/components/_generic_chp.py @@ -206,7 +206,7 @@ def alphas(self): self._calculate_alphas() return self._alphas - def constraint_group(self): + def constraint_group(_): return GenericCHPBlock diff --git a/src/oemof/solph/components/_link.py b/src/oemof/solph/components/_link.py index 68df92481..66b60ee8d 100644 --- a/src/oemof/solph/components/_link.py +++ b/src/oemof/solph/components/_link.py @@ -118,7 +118,7 @@ def __init__( ): warn(msg, debugging.SuspiciousUsageWarning) - def constraint_group(self): + def constraint_group(_): return LinkBlock diff --git a/src/oemof/solph/components/_offset_transformer.py b/src/oemof/solph/components/_offset_transformer.py index ec9bc21b6..2266cf227 100644 --- a/src/oemof/solph/components/_offset_transformer.py +++ b/src/oemof/solph/components/_offset_transformer.py @@ -100,7 +100,7 @@ def __init__( + "more than 1 input and 1 output!" ) - def constraint_group(self): + def constraint_group(_): return OffsetTransformerBlock diff --git a/src/oemof/solph/components/_sink.py b/src/oemof/solph/components/_sink.py index 883dda31a..d0b4663e1 100644 --- a/src/oemof/solph/components/_sink.py +++ b/src/oemof/solph/components/_sink.py @@ -65,5 +65,5 @@ def __init__(self, label=None, inputs=None, custom_attributes=None): super().__init__(label=label, inputs=inputs, **custom_attributes) - def constraint_group(self): + def constraint_group(_): pass diff --git a/src/oemof/solph/components/_source.py b/src/oemof/solph/components/_source.py index 287c8d2b5..0e7da0211 100644 --- a/src/oemof/solph/components/_source.py +++ b/src/oemof/solph/components/_source.py @@ -75,5 +75,5 @@ def __init__(self, label=None, outputs=None, custom_attributes=None): super().__init__(label=label, outputs=outputs, **custom_attributes) - def constraint_group(self): + def constraint_group(_): pass diff --git a/src/oemof/solph/components/_transformer.py b/src/oemof/solph/components/_transformer.py index e194001e6..c5eb6f3c9 100644 --- a/src/oemof/solph/components/_transformer.py +++ b/src/oemof/solph/components/_transformer.py @@ -132,7 +132,7 @@ def __init__( for cf in missing_conversion_factor_keys: self.conversion_factors[cf] = sequence(1) - def constraint_group(self): + def constraint_group(_): return TransformerBlock diff --git a/src/oemof/solph/components/experimental/_generic_caes.py b/src/oemof/solph/components/experimental/_generic_caes.py index 25948b5bc..ad0de7907 100644 --- a/src/oemof/solph/components/experimental/_generic_caes.py +++ b/src/oemof/solph/components/experimental/_generic_caes.py @@ -110,7 +110,7 @@ def __init__(self, *args, **kwargs): self.inputs.update(kwargs.get("fuel_input")) self.outputs.update(kwargs.get("electrical_output")) - def constraint_group(self): + def constraint_group(_): return GenericCAESBlock diff --git a/src/oemof/solph/components/experimental/_piecewise_linear_transformer.py b/src/oemof/solph/components/experimental/_piecewise_linear_transformer.py index d9265d4fe..8d9b618eb 100644 --- a/src/oemof/solph/components/experimental/_piecewise_linear_transformer.py +++ b/src/oemof/solph/components/experimental/_piecewise_linear_transformer.py @@ -86,7 +86,7 @@ def __init__(self, *args, **kwargs): + "nominal value" ) - def constraint_group(self): + def constraint_group(_): return PiecewiseLinearTransformerBlock diff --git a/src/oemof/solph/flows/experimental/_electrical_line.py b/src/oemof/solph/flows/experimental/_electrical_line.py index e96f85de7..978bdd880 100644 --- a/src/oemof/solph/flows/experimental/_electrical_line.py +++ b/src/oemof/solph/flows/experimental/_electrical_line.py @@ -93,7 +93,7 @@ def __init__(self, **kwargs): # to be used in grouping for all bidi flows self.bidirectional = True - def constraint_group(self): + def constraint_group(_): return ElectricalLineBlock From e85360ad16fb264b805338884861ff57d88d8a58 Mon Sep 17 00:00:00 2001 From: MaGering Date: Thu, 10 Aug 2023 13:40:27 +0200 Subject: [PATCH 14/16] Add Marie-Claire Gering to AUTHORS.rst --- AUTHORS.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index 72c31562a..85443fee1 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -30,6 +30,7 @@ Authors * Lluis Millet * Lennart Schürmann * Martin Soethe +* Marie-Claire Gering * Patrik Schönfeldt * Pierre-François Duc * Saeed Sayadi From 152f35684b650e54bda2558698eb926c29eafa07 Mon Sep 17 00:00:00 2001 From: MaGering Date: Thu, 10 Aug 2023 13:40:50 +0200 Subject: [PATCH 15/16] Add Marie-Claire Gering to CITATION.cff --- CITATION.cff | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CITATION.cff b/CITATION.cff index 5a48cd292..d28fb74ec 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -162,4 +162,8 @@ authors: family-names: Rohrer given-names: Tobi alias: "@tobirohrer" + - + family-names: Gering + given-names: Marie-Claire + alias: "@MaGering" ... From 527832839b96bf131faebc45dbfa7bcf4d1e604e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Thu, 10 Aug 2023 19:23:56 +0200 Subject: [PATCH 16/16] Revert "Make constraint_group a method where possible" This reverts commit 84a89fe4df8d5bee877f27b1834620797b52bbee. --- src/oemof/solph/components/_extraction_turbine_chp.py | 2 +- src/oemof/solph/components/_generic_chp.py | 2 +- src/oemof/solph/components/_link.py | 2 +- src/oemof/solph/components/_offset_transformer.py | 2 +- src/oemof/solph/components/_sink.py | 2 +- src/oemof/solph/components/_source.py | 2 +- src/oemof/solph/components/_transformer.py | 2 +- src/oemof/solph/components/experimental/_generic_caes.py | 2 +- .../components/experimental/_piecewise_linear_transformer.py | 2 +- src/oemof/solph/flows/experimental/_electrical_line.py | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/oemof/solph/components/_extraction_turbine_chp.py b/src/oemof/solph/components/_extraction_turbine_chp.py index 7184bfe87..138ed5951 100644 --- a/src/oemof/solph/components/_extraction_turbine_chp.py +++ b/src/oemof/solph/components/_extraction_turbine_chp.py @@ -91,7 +91,7 @@ def __init__( for k, v in conversion_factor_full_condensation.items() } - def constraint_group(_): + def constraint_group(self): return ExtractionTurbineCHPBlock diff --git a/src/oemof/solph/components/_generic_chp.py b/src/oemof/solph/components/_generic_chp.py index 8a019da65..d817f00f5 100644 --- a/src/oemof/solph/components/_generic_chp.py +++ b/src/oemof/solph/components/_generic_chp.py @@ -206,7 +206,7 @@ def alphas(self): self._calculate_alphas() return self._alphas - def constraint_group(_): + def constraint_group(self): return GenericCHPBlock diff --git a/src/oemof/solph/components/_link.py b/src/oemof/solph/components/_link.py index c20c50541..e4b2c47f2 100644 --- a/src/oemof/solph/components/_link.py +++ b/src/oemof/solph/components/_link.py @@ -122,7 +122,7 @@ def __init__( ): warn(msg, debugging.SuspiciousUsageWarning) - def constraint_group(_): + def constraint_group(self): return LinkBlock diff --git a/src/oemof/solph/components/_offset_transformer.py b/src/oemof/solph/components/_offset_transformer.py index 2266cf227..ec9bc21b6 100644 --- a/src/oemof/solph/components/_offset_transformer.py +++ b/src/oemof/solph/components/_offset_transformer.py @@ -100,7 +100,7 @@ def __init__( + "more than 1 input and 1 output!" ) - def constraint_group(_): + def constraint_group(self): return OffsetTransformerBlock diff --git a/src/oemof/solph/components/_sink.py b/src/oemof/solph/components/_sink.py index d0b4663e1..883dda31a 100644 --- a/src/oemof/solph/components/_sink.py +++ b/src/oemof/solph/components/_sink.py @@ -65,5 +65,5 @@ def __init__(self, label=None, inputs=None, custom_attributes=None): super().__init__(label=label, inputs=inputs, **custom_attributes) - def constraint_group(_): + def constraint_group(self): pass diff --git a/src/oemof/solph/components/_source.py b/src/oemof/solph/components/_source.py index 0e7da0211..287c8d2b5 100644 --- a/src/oemof/solph/components/_source.py +++ b/src/oemof/solph/components/_source.py @@ -75,5 +75,5 @@ def __init__(self, label=None, outputs=None, custom_attributes=None): super().__init__(label=label, outputs=outputs, **custom_attributes) - def constraint_group(_): + def constraint_group(self): pass diff --git a/src/oemof/solph/components/_transformer.py b/src/oemof/solph/components/_transformer.py index c5eb6f3c9..e194001e6 100644 --- a/src/oemof/solph/components/_transformer.py +++ b/src/oemof/solph/components/_transformer.py @@ -132,7 +132,7 @@ def __init__( for cf in missing_conversion_factor_keys: self.conversion_factors[cf] = sequence(1) - def constraint_group(_): + def constraint_group(self): return TransformerBlock diff --git a/src/oemof/solph/components/experimental/_generic_caes.py b/src/oemof/solph/components/experimental/_generic_caes.py index ad0de7907..25948b5bc 100644 --- a/src/oemof/solph/components/experimental/_generic_caes.py +++ b/src/oemof/solph/components/experimental/_generic_caes.py @@ -110,7 +110,7 @@ def __init__(self, *args, **kwargs): self.inputs.update(kwargs.get("fuel_input")) self.outputs.update(kwargs.get("electrical_output")) - def constraint_group(_): + def constraint_group(self): return GenericCAESBlock diff --git a/src/oemof/solph/components/experimental/_piecewise_linear_transformer.py b/src/oemof/solph/components/experimental/_piecewise_linear_transformer.py index 8d9b618eb..d9265d4fe 100644 --- a/src/oemof/solph/components/experimental/_piecewise_linear_transformer.py +++ b/src/oemof/solph/components/experimental/_piecewise_linear_transformer.py @@ -86,7 +86,7 @@ def __init__(self, *args, **kwargs): + "nominal value" ) - def constraint_group(_): + def constraint_group(self): return PiecewiseLinearTransformerBlock diff --git a/src/oemof/solph/flows/experimental/_electrical_line.py b/src/oemof/solph/flows/experimental/_electrical_line.py index 978bdd880..e96f85de7 100644 --- a/src/oemof/solph/flows/experimental/_electrical_line.py +++ b/src/oemof/solph/flows/experimental/_electrical_line.py @@ -93,7 +93,7 @@ def __init__(self, **kwargs): # to be used in grouping for all bidi flows self.bidirectional = True - def constraint_group(_): + def constraint_group(self): return ElectricalLineBlock