Skip to content

Commit

Permalink
Merge branch 'dev' into fix/minimum-uptime-downtime
Browse files Browse the repository at this point in the history
  • Loading branch information
p-snft committed Dec 6, 2023
2 parents 44639b6 + 2e9ea5e commit 8d20184
Show file tree
Hide file tree
Showing 14 changed files with 407 additions and 408 deletions.
1 change: 1 addition & 0 deletions docs/whatsnew/v0-5-2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Bug fixes
* Fix bugs in multi-period documentation.
* Fix y intersect of OffsetConverter
* Fix minimum uptime being relevant for initial downtime (and vice versa).
* Fix duplicated discounting of fixed costs for multi-period investment

Testing
#######
Expand Down
2 changes: 1 addition & 1 deletion src/oemof/solph/components/_generic_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1869,7 +1869,7 @@ def _objective_expression(self):
m.es.periods_years[p],
range_limit,
)
) * (1 + m.discount_rate) ** (-m.es.periods_years[p])
)

for n in self.EXISTING_INVESTSTORAGES:
if n.investment.fixed_costs[0] is not None:
Expand Down
6 changes: 3 additions & 3 deletions src/oemof/solph/components/experimental/_sink_dsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,7 @@ def _objective_expression(self):
m.es.periods_years[p],
range_limit,
)
) * (1 + m.discount_rate) ** (-m.es.periods_years[p])
)

for g in self.EXISTING_INVESTDSM:
if g.investment.fixed_costs[0] is not None:
Expand Down Expand Up @@ -3301,7 +3301,7 @@ def _objective_expression(self):
m.es.periods_years[p],
range_limit,
)
) * (1 + m.discount_rate) ** (-m.es.periods_years[p])
)

for g in self.EXISTING_INVESTDSM:
if g.investment.fixed_costs[0] is not None:
Expand Down Expand Up @@ -5800,7 +5800,7 @@ def _objective_expression(self):
m.es.periods_years[p],
range_limit,
)
) * (1 + m.discount_rate) ** (-m.es.periods_years[p])
)

for g in self.EXISTING_INVESTDSM:
if g.investment.fixed_costs[0] is not None:
Expand Down
7 changes: 2 additions & 5 deletions src/oemof/solph/flows/_investment_flow_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,11 +1022,8 @@ def _objective_expression(self):
self.invest[i, o, p]
* m.flows[i, o].investment.fixed_costs[pp]
* (1 + m.discount_rate) ** (-pp)
for pp in range(
m.es.periods_years[p],
range_limit,
)
) * (1 + m.discount_rate) ** (-m.es.periods_years[p])
for pp in range(m.es.periods_years[p], range_limit)
)

for i, o in self.EXISTING_INVESTFLOWS:
if m.flows[i, o].investment.fixed_costs[0] is not None:
Expand Down
142 changes: 71 additions & 71 deletions tests/lp_files/converter_invest_multi_period.lp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

min
objective:
+3.5273767282312036 InvestmentFlowBlock_invest(powerplant_gas_coal_electricityBus_0)
+2.328225392441188 InvestmentFlowBlock_invest(powerplant_gas_coal_electricityBus_1)
+1.1525868279411837 InvestmentFlowBlock_invest(powerplant_gas_coal_electricityBus_2)
+32.94298610923851 InvestmentFlowBlock_invest(powerplant_gas_coal_electricityBus_0)
+21.74383477344849 InvestmentFlowBlock_invest(powerplant_gas_coal_electricityBus_1)
+10.764274640321037 InvestmentFlowBlock_invest(powerplant_gas_coal_electricityBus_2)
+50 flow(powerplant_gas_coal_electricityBus_0_0)
+50 flow(powerplant_gas_coal_electricityBus_0_1)
+49.01960784313725 flow(powerplant_gas_coal_electricityBus_1_2)
Expand Down Expand Up @@ -44,28 +44,28 @@ c_e_BusBlock_balance(electricityBus_2_5)_:
+1 flow(powerplant_gas_coal_electricityBus_2_5)
= 0

c_e_BusBlock_balance(gasBus_0_0)_:
+1 flow(gasBus_powerplant_gas_coal_0_0)
c_e_BusBlock_balance(coalBus_0_0)_:
+1 flow(coalBus_powerplant_gas_coal_0_0)
= 0

c_e_BusBlock_balance(gasBus_0_1)_:
+1 flow(gasBus_powerplant_gas_coal_0_1)
c_e_BusBlock_balance(coalBus_0_1)_:
+1 flow(coalBus_powerplant_gas_coal_0_1)
= 0

c_e_BusBlock_balance(gasBus_1_2)_:
+1 flow(gasBus_powerplant_gas_coal_1_2)
c_e_BusBlock_balance(coalBus_1_2)_:
+1 flow(coalBus_powerplant_gas_coal_1_2)
= 0

c_e_BusBlock_balance(gasBus_1_3)_:
+1 flow(gasBus_powerplant_gas_coal_1_3)
c_e_BusBlock_balance(coalBus_1_3)_:
+1 flow(coalBus_powerplant_gas_coal_1_3)
= 0

c_e_BusBlock_balance(gasBus_2_4)_:
+1 flow(gasBus_powerplant_gas_coal_2_4)
c_e_BusBlock_balance(coalBus_2_4)_:
+1 flow(coalBus_powerplant_gas_coal_2_4)
= 0

c_e_BusBlock_balance(gasBus_2_5)_:
+1 flow(gasBus_powerplant_gas_coal_2_5)
c_e_BusBlock_balance(coalBus_2_5)_:
+1 flow(coalBus_powerplant_gas_coal_2_5)
= 0

c_e_BusBlock_balance(thermalBus_0_0)_:
Expand All @@ -92,150 +92,150 @@ c_e_BusBlock_balance(thermalBus_2_5)_:
+1 flow(powerplant_gas_coal_thermalBus_2_5)
= 0

c_e_BusBlock_balance(coalBus_0_0)_:
+1 flow(coalBus_powerplant_gas_coal_0_0)
= 0

c_e_BusBlock_balance(coalBus_0_1)_:
+1 flow(coalBus_powerplant_gas_coal_0_1)
c_e_BusBlock_balance(gasBus_0_0)_:
+1 flow(gasBus_powerplant_gas_coal_0_0)
= 0

c_e_BusBlock_balance(coalBus_1_2)_:
+1 flow(coalBus_powerplant_gas_coal_1_2)
c_e_BusBlock_balance(gasBus_0_1)_:
+1 flow(gasBus_powerplant_gas_coal_0_1)
= 0

c_e_BusBlock_balance(coalBus_1_3)_:
+1 flow(coalBus_powerplant_gas_coal_1_3)
c_e_BusBlock_balance(gasBus_1_2)_:
+1 flow(gasBus_powerplant_gas_coal_1_2)
= 0

c_e_BusBlock_balance(coalBus_2_4)_:
+1 flow(coalBus_powerplant_gas_coal_2_4)
c_e_BusBlock_balance(gasBus_1_3)_:
+1 flow(gasBus_powerplant_gas_coal_1_3)
= 0

c_e_BusBlock_balance(coalBus_2_5)_:
+1 flow(coalBus_powerplant_gas_coal_2_5)
c_e_BusBlock_balance(gasBus_2_4)_:
+1 flow(gasBus_powerplant_gas_coal_2_4)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_electricityBus_0_0)_:
-0.58 flow(powerplant_gas_coal_electricityBus_0_0)
+0.3 flow(gasBus_powerplant_gas_coal_0_0)
c_e_BusBlock_balance(gasBus_2_5)_:
+1 flow(gasBus_powerplant_gas_coal_2_5)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_coalBus_electricityBus_0_0)_:
-0.2 flow(powerplant_gas_coal_electricityBus_0_0)
+0.3 flow(coalBus_powerplant_gas_coal_0_0)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_thermalBus_0_0)_:
-0.58 flow(powerplant_gas_coal_thermalBus_0_0)
+0.5 flow(gasBus_powerplant_gas_coal_0_0)
c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_electricityBus_0_0)_:
-0.58 flow(powerplant_gas_coal_electricityBus_0_0)
+0.3 flow(gasBus_powerplant_gas_coal_0_0)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_coalBus_thermalBus_0_0)_:
-0.2 flow(powerplant_gas_coal_thermalBus_0_0)
+0.5 flow(coalBus_powerplant_gas_coal_0_0)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_electricityBus_0_1)_:
-0.58 flow(powerplant_gas_coal_electricityBus_0_1)
+0.3 flow(gasBus_powerplant_gas_coal_0_1)
c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_thermalBus_0_0)_:
-0.58 flow(powerplant_gas_coal_thermalBus_0_0)
+0.5 flow(gasBus_powerplant_gas_coal_0_0)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_coalBus_electricityBus_0_1)_:
-0.2 flow(powerplant_gas_coal_electricityBus_0_1)
+0.3 flow(coalBus_powerplant_gas_coal_0_1)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_thermalBus_0_1)_:
-0.58 flow(powerplant_gas_coal_thermalBus_0_1)
+0.5 flow(gasBus_powerplant_gas_coal_0_1)
c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_electricityBus_0_1)_:
-0.58 flow(powerplant_gas_coal_electricityBus_0_1)
+0.3 flow(gasBus_powerplant_gas_coal_0_1)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_coalBus_thermalBus_0_1)_:
-0.2 flow(powerplant_gas_coal_thermalBus_0_1)
+0.5 flow(coalBus_powerplant_gas_coal_0_1)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_electricityBus_1_2)_:
-0.58 flow(powerplant_gas_coal_electricityBus_1_2)
+0.3 flow(gasBus_powerplant_gas_coal_1_2)
c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_thermalBus_0_1)_:
-0.58 flow(powerplant_gas_coal_thermalBus_0_1)
+0.5 flow(gasBus_powerplant_gas_coal_0_1)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_coalBus_electricityBus_1_2)_:
-0.2 flow(powerplant_gas_coal_electricityBus_1_2)
+0.3 flow(coalBus_powerplant_gas_coal_1_2)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_thermalBus_1_2)_:
-0.58 flow(powerplant_gas_coal_thermalBus_1_2)
+0.5 flow(gasBus_powerplant_gas_coal_1_2)
c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_electricityBus_1_2)_:
-0.58 flow(powerplant_gas_coal_electricityBus_1_2)
+0.3 flow(gasBus_powerplant_gas_coal_1_2)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_coalBus_thermalBus_1_2)_:
-0.2 flow(powerplant_gas_coal_thermalBus_1_2)
+0.5 flow(coalBus_powerplant_gas_coal_1_2)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_electricityBus_1_3)_:
-0.58 flow(powerplant_gas_coal_electricityBus_1_3)
+0.3 flow(gasBus_powerplant_gas_coal_1_3)
c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_thermalBus_1_2)_:
-0.58 flow(powerplant_gas_coal_thermalBus_1_2)
+0.5 flow(gasBus_powerplant_gas_coal_1_2)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_coalBus_electricityBus_1_3)_:
-0.2 flow(powerplant_gas_coal_electricityBus_1_3)
+0.3 flow(coalBus_powerplant_gas_coal_1_3)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_thermalBus_1_3)_:
-0.58 flow(powerplant_gas_coal_thermalBus_1_3)
+0.5 flow(gasBus_powerplant_gas_coal_1_3)
c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_electricityBus_1_3)_:
-0.58 flow(powerplant_gas_coal_electricityBus_1_3)
+0.3 flow(gasBus_powerplant_gas_coal_1_3)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_coalBus_thermalBus_1_3)_:
-0.2 flow(powerplant_gas_coal_thermalBus_1_3)
+0.5 flow(coalBus_powerplant_gas_coal_1_3)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_electricityBus_2_4)_:
-0.58 flow(powerplant_gas_coal_electricityBus_2_4)
+0.3 flow(gasBus_powerplant_gas_coal_2_4)
c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_thermalBus_1_3)_:
-0.58 flow(powerplant_gas_coal_thermalBus_1_3)
+0.5 flow(gasBus_powerplant_gas_coal_1_3)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_coalBus_electricityBus_2_4)_:
-0.2 flow(powerplant_gas_coal_electricityBus_2_4)
+0.3 flow(coalBus_powerplant_gas_coal_2_4)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_thermalBus_2_4)_:
-0.58 flow(powerplant_gas_coal_thermalBus_2_4)
+0.5 flow(gasBus_powerplant_gas_coal_2_4)
c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_electricityBus_2_4)_:
-0.58 flow(powerplant_gas_coal_electricityBus_2_4)
+0.3 flow(gasBus_powerplant_gas_coal_2_4)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_coalBus_thermalBus_2_4)_:
-0.2 flow(powerplant_gas_coal_thermalBus_2_4)
+0.5 flow(coalBus_powerplant_gas_coal_2_4)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_electricityBus_2_5)_:
-0.58 flow(powerplant_gas_coal_electricityBus_2_5)
+0.3 flow(gasBus_powerplant_gas_coal_2_5)
c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_thermalBus_2_4)_:
-0.58 flow(powerplant_gas_coal_thermalBus_2_4)
+0.5 flow(gasBus_powerplant_gas_coal_2_4)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_coalBus_electricityBus_2_5)_:
-0.2 flow(powerplant_gas_coal_electricityBus_2_5)
+0.3 flow(coalBus_powerplant_gas_coal_2_5)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_thermalBus_2_5)_:
-0.58 flow(powerplant_gas_coal_thermalBus_2_5)
+0.5 flow(gasBus_powerplant_gas_coal_2_5)
c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_electricityBus_2_5)_:
-0.58 flow(powerplant_gas_coal_electricityBus_2_5)
+0.3 flow(gasBus_powerplant_gas_coal_2_5)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_coalBus_thermalBus_2_5)_:
-0.2 flow(powerplant_gas_coal_thermalBus_2_5)
+0.5 flow(coalBus_powerplant_gas_coal_2_5)
= 0

c_e_ConverterBlock_relation(powerplant_gas_coal_gasBus_thermalBus_2_5)_:
-0.58 flow(powerplant_gas_coal_thermalBus_2_5)
+0.5 flow(gasBus_powerplant_gas_coal_2_5)
= 0

c_e_InvestmentFlowBlock_total_rule(powerplant_gas_coal_electricityBus_0)_:
-1 InvestmentFlowBlock_invest(powerplant_gas_coal_electricityBus_0)
+1 InvestmentFlowBlock_total(powerplant_gas_coal_electricityBus_0)
Expand Down Expand Up @@ -343,18 +343,18 @@ bounds
0 <= flow(powerplant_gas_coal_thermalBus_1_3) <= +inf
0 <= flow(powerplant_gas_coal_thermalBus_2_4) <= +inf
0 <= flow(powerplant_gas_coal_thermalBus_2_5) <= +inf
0 <= flow(gasBus_powerplant_gas_coal_0_0) <= +inf
0 <= flow(gasBus_powerplant_gas_coal_0_1) <= +inf
0 <= flow(gasBus_powerplant_gas_coal_1_2) <= +inf
0 <= flow(gasBus_powerplant_gas_coal_1_3) <= +inf
0 <= flow(gasBus_powerplant_gas_coal_2_4) <= +inf
0 <= flow(gasBus_powerplant_gas_coal_2_5) <= +inf
0 <= flow(coalBus_powerplant_gas_coal_0_0) <= +inf
0 <= flow(coalBus_powerplant_gas_coal_0_1) <= +inf
0 <= flow(coalBus_powerplant_gas_coal_1_2) <= +inf
0 <= flow(coalBus_powerplant_gas_coal_1_3) <= +inf
0 <= flow(coalBus_powerplant_gas_coal_2_4) <= +inf
0 <= flow(coalBus_powerplant_gas_coal_2_5) <= +inf
0 <= flow(gasBus_powerplant_gas_coal_0_0) <= +inf
0 <= flow(gasBus_powerplant_gas_coal_0_1) <= +inf
0 <= flow(gasBus_powerplant_gas_coal_1_2) <= +inf
0 <= flow(gasBus_powerplant_gas_coal_1_3) <= +inf
0 <= flow(gasBus_powerplant_gas_coal_2_4) <= +inf
0 <= flow(gasBus_powerplant_gas_coal_2_5) <= +inf
0 <= InvestmentFlowBlock_total(powerplant_gas_coal_electricityBus_0) <= +inf
0 <= InvestmentFlowBlock_total(powerplant_gas_coal_electricityBus_1) <= +inf
0 <= InvestmentFlowBlock_old(powerplant_gas_coal_electricityBus_1) <= +inf
Expand Down
4 changes: 2 additions & 2 deletions tests/lp_files/dsm_module_DIW_invest_multi_period.lp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ objective:
+0.9611687812379853 SinkDSMDIWInvestmentBlock_dsm_do_shift(demand_dsm_5_5)
+96.11687812379853 SinkDSMDIWInvestmentBlock_dsm_do_shed(demand_dsm_5)
+76.46810240317063 SinkDSMDIWInvestmentBlock_invest(demand_dsm_0)
+49.710949277906536 SinkDSMDIWInvestmentBlock_invest(demand_dsm_1)
+24.239842660236203 SinkDSMDIWInvestmentBlock_invest(demand_dsm_2)
+50.47234572422055 SinkDSMDIWInvestmentBlock_invest(demand_dsm_1)
+24.986309764465627 SinkDSMDIWInvestmentBlock_invest(demand_dsm_2)

s.t.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ objective:
+0.9611687812379853 SinkDSMDIWInvestmentBlock_dsm_do_shift(demand_dsm_5_5)
+96.11687812379853 SinkDSMDIWInvestmentBlock_dsm_do_shed(demand_dsm_5)
+57.62165571222974 SinkDSMDIWInvestmentBlock_invest(demand_dsm_0)
+39.12361323621548 SinkDSMDIWInvestmentBlock_invest(demand_dsm_1)
+23.087255832295018 SinkDSMDIWInvestmentBlock_invest(demand_dsm_2)
+39.8850096825295 SinkDSMDIWInvestmentBlock_invest(demand_dsm_1)
+23.833722936524442 SinkDSMDIWInvestmentBlock_invest(demand_dsm_2)

s.t.

Expand Down
4 changes: 2 additions & 2 deletions tests/lp_files/dsm_module_DLR_invest_multi_period.lp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ objective:
+0.9611687812379853 SinkDSMDLRInvestmentBlock_balance_dsm_up(demand_dsm_2_5)
+96.11687812379853 SinkDSMDLRInvestmentBlock_dsm_do_shed(demand_dsm_5)
+76.46810240317063 SinkDSMDLRInvestmentBlock_invest(demand_dsm_0)
+49.710949277906536 SinkDSMDLRInvestmentBlock_invest(demand_dsm_1)
+24.239842660236203 SinkDSMDLRInvestmentBlock_invest(demand_dsm_2)
+50.47234572422055 SinkDSMDLRInvestmentBlock_invest(demand_dsm_1)
+24.986309764465627 SinkDSMDLRInvestmentBlock_invest(demand_dsm_2)

s.t.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ objective:
+0.9611687812379853 SinkDSMDLRInvestmentBlock_balance_dsm_up(demand_dsm_2_5)
+96.11687812379853 SinkDSMDLRInvestmentBlock_dsm_do_shed(demand_dsm_5)
+57.62165571222974 SinkDSMDLRInvestmentBlock_invest(demand_dsm_0)
+39.12361323621548 SinkDSMDLRInvestmentBlock_invest(demand_dsm_1)
+23.087255832295018 SinkDSMDLRInvestmentBlock_invest(demand_dsm_2)
+39.8850096825295 SinkDSMDLRInvestmentBlock_invest(demand_dsm_1)
+23.833722936524442 SinkDSMDLRInvestmentBlock_invest(demand_dsm_2)

s.t.

Expand Down
4 changes: 2 additions & 2 deletions tests/lp_files/dsm_module_oemof_invest_multi_period.lp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ objective:
+0.9611687812379853 SinkDSMOemofInvestmentBlock_dsm_do_shift(demand_dsm_5)
+96.11687812379853 SinkDSMOemofInvestmentBlock_dsm_do_shed(demand_dsm_5)
+76.46810240317063 SinkDSMOemofInvestmentBlock_invest(demand_dsm_0)
+49.710949277906536 SinkDSMOemofInvestmentBlock_invest(demand_dsm_1)
+24.239842660236203 SinkDSMOemofInvestmentBlock_invest(demand_dsm_2)
+50.47234572422055 SinkDSMOemofInvestmentBlock_invest(demand_dsm_1)
+24.986309764465627 SinkDSMOemofInvestmentBlock_invest(demand_dsm_2)

s.t.

Expand Down
Loading

0 comments on commit 8d20184

Please sign in to comment.