From 3130ee5eeca35be1d3cb66eb3862f49d3f456c58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Tue, 17 Dec 2024 14:48:42 +0100 Subject: [PATCH] Remove internal interest rate --- docs/usage.rst | 4 ---- src/oemof/solph/_options.py | 7 ------- src/oemof/solph/components/_generic_storage.py | 6 ++---- src/oemof/solph/components/experimental/_sink_dsm.py | 6 +++--- src/oemof/solph/flows/_investment_flow_block.py | 4 ++-- tests/test_processing.py | 2 -- .../test_multi_period_investment_model.py | 8 -------- 7 files changed, 7 insertions(+), 30 deletions(-) diff --git a/docs/usage.rst b/docs/usage.rst index 025e68e46..c9a0ff0b0 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -1199,8 +1199,6 @@ but with a few minor additions and modifications in the investment object itself free to reinvest or choose another option to fill up the missing capacity. * You can define an initial `age` if you have `existing` capacity. If you do not specify anything, the default value 0 will be used, meaning your `existing` capacity has just been newly invested. -* You can define an `interest_rate` that the investor you model has, i.e. the return he desires expressed as the weighted - average osts of capital (wacc) and used for calculating annuities in the model itself. * You also can define `fixed_costs`, i.e. costs that occur every period independent of the plants usage. Here is an example @@ -1216,7 +1214,6 @@ Here is an example maximum=1000, ep_costs=1e6, lifetime=30, - interest_rate=0.06, fixed_costs=100, ), variable_costs=3, @@ -1250,7 +1247,6 @@ This would mean that for investments in the particular period, these values woul maximum=1000, ep_costs=[1e6, 1.1e6], lifetime=30, - interest_rate=0.06, fixed_costs=[100, 110], ), variable_costs=3, diff --git a/src/oemof/solph/_options.py b/src/oemof/solph/_options.py index ae0cecd22..34fce84d1 100644 --- a/src/oemof/solph/_options.py +++ b/src/oemof/solph/_options.py @@ -63,11 +63,6 @@ class Investment: age : int, :math:`a` Units start age, given in years at the beginning of the optimization; only applicable for multi-period models - interest_rate : float, :math:`ir` - Interest rate for calculating annuities when investing in a particular - unit; only applicable for multi-period models. - If nothing else is specified, the interest rate is the same as the - model discount rate of the multi-period model. fixed_costs : float or list of float, :math:`c_{fixed}(p)` Fixed costs in each period (given in nominal terms); only applicable for multi-period models @@ -95,7 +90,6 @@ def __init__( overall_minimum=None, lifetime=None, age=0, - interest_rate=0, fixed_costs=None, custom_attributes=None, ): @@ -111,7 +105,6 @@ def __init__( self.overall_minimum = overall_minimum self.lifetime = lifetime self.age = age - self.interest_rate = interest_rate self.fixed_costs = sequence(fixed_costs) for attribute in custom_attributes.keys(): diff --git a/src/oemof/solph/components/_generic_storage.py b/src/oemof/solph/components/_generic_storage.py index c76d72d33..c67999de1 100644 --- a/src/oemof/solph/components/_generic_storage.py +++ b/src/oemof/solph/components/_generic_storage.py @@ -1087,8 +1087,6 @@ class GenericInvestmentStorageBlock(ScalarBlock): Lifetime for investments in storage capacity" ":math:`a`", "`flows[i, o].investment.age`", " Initial age of existing capacity / energy" - ":math:`ir`", "`flows[i, o].investment.interest_rate`", " - interest rate for investment" ":math:`\tau(t)`", "", "Duration of time step" ":math:`t_u`", "", "Time unit of losses :math:`\beta(t)`, :math:`\gamma(t)`, :math:`\delta(t)` and timeincrement :math:`\tau(t)`" @@ -1776,7 +1774,7 @@ def _objective_expression(self): ) for n in self.CONVEX_INVESTSTORAGES: lifetime = n.investment.lifetime - interest = n.investment.interest_rate + interest = 0 if interest == 0: warn( msg.format(m.discount_rate), @@ -1816,7 +1814,7 @@ def _objective_expression(self): for n in self.NON_CONVEX_INVESTSTORAGES: lifetime = n.investment.lifetime - interest = n.investment.interest_rate + interest = 0 if interest == 0: warn( msg.format(m.discount_rate), diff --git a/src/oemof/solph/components/experimental/_sink_dsm.py b/src/oemof/solph/components/experimental/_sink_dsm.py index 7a0537d3b..bd2071086 100644 --- a/src/oemof/solph/components/experimental/_sink_dsm.py +++ b/src/oemof/solph/components/experimental/_sink_dsm.py @@ -1369,7 +1369,7 @@ def _objective_expression(self): for g in self.investdsm: if g.investment.ep_costs is not None: lifetime = g.investment.lifetime - interest = g.investment.interest_rate + interest = 0 if interest == 0: warn( msg.format(m.discount_rate), @@ -3203,7 +3203,7 @@ def _objective_expression(self): for g in self.investdsm: if g.investment.ep_costs is not None: lifetime = g.investment.lifetime - interest = g.investment.interest_rate + interest = 0 if interest == 0: warn( msg.format(m.discount_rate), @@ -5675,7 +5675,7 @@ def _objective_expression(self): for g in self.INVESTDR: if g.investment.ep_costs is not None: lifetime = g.investment.lifetime - interest = g.investment.interest_rate + interest = 0 if interest == 0: warn( msg.format(m.discount_rate), diff --git a/src/oemof/solph/flows/_investment_flow_block.py b/src/oemof/solph/flows/_investment_flow_block.py index 072fdba76..757a672d0 100644 --- a/src/oemof/solph/flows/_investment_flow_block.py +++ b/src/oemof/solph/flows/_investment_flow_block.py @@ -921,7 +921,7 @@ def _objective_expression(self): ) for i, o in self.CONVEX_INVESTFLOWS: lifetime = m.flows[i, o].investment.lifetime - interest = m.flows[i, o].investment.interest_rate + interest = 0 if interest == 0: warn( msg.format(m.discount_rate), @@ -964,7 +964,7 @@ def _objective_expression(self): for i, o in self.NON_CONVEX_INVESTFLOWS: lifetime = m.flows[i, o].investment.lifetime - interest = m.flows[i, o].investment.interest_rate + interest = 0 if interest == 0: warn( msg.format(m.discount_rate), diff --git a/tests/test_processing.py b/tests/test_processing.py index e79980b0d..ce673fb0c 100644 --- a/tests/test_processing.py +++ b/tests/test_processing.py @@ -166,7 +166,6 @@ def test_nodes_with_none_exclusion(self): "initial_storage_level": 0, "investment_age": 0, "investment_existing": 0, - "investment_interest_rate": 0, "investment_nonconvex": False, "investment_ep_costs": 0.4, "investment_maximum": float("inf"), @@ -206,7 +205,6 @@ def test_nodes_with_none_exclusion_old_name(self): "initial_storage_level": 0, "investment_age": 0, "investment_existing": 0, - "investment_interest_rate": 0, "investment_nonconvex": False, "investment_ep_costs": 0.4, "investment_maximum": float("inf"), 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 43c45834b..e537d45a5 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 @@ -153,7 +153,6 @@ def test_multi_period_investment_model(solver="cbc"): existing=0, lifetime=20, age=0, - interest_rate=0.02, ), variable_costs=1, ) @@ -172,7 +171,6 @@ def test_multi_period_investment_model(solver="cbc"): existing=0, lifetime=20, age=0, - interest_rate=0.02, ), variable_costs=2, ) @@ -191,7 +189,6 @@ def test_multi_period_investment_model(solver="cbc"): existing=0, lifetime=20, age=0, - interest_rate=0.02, ), variable_costs=3, ) @@ -210,7 +207,6 @@ def test_multi_period_investment_model(solver="cbc"): existing=0, lifetime=20, age=0, - interest_rate=0.02, fixed_costs=1000, ), variable_costs=4, @@ -231,7 +227,6 @@ def test_multi_period_investment_model(solver="cbc"): existing=10, lifetime=2, age=1, - interest_rate=0.02, ), ) }, @@ -245,7 +240,6 @@ def test_multi_period_investment_model(solver="cbc"): existing=10, lifetime=2, age=1, - interest_rate=0.02, ), ) }, @@ -265,7 +259,6 @@ def test_multi_period_investment_model(solver="cbc"): existing=10, lifetime=2, age=1, - interest_rate=0.02, fixed_costs=10, ), ) @@ -335,7 +328,6 @@ def test_multi_period_investment_model(solver="cbc"): ep_costs=10, lifetime=2, age=1, - interest_rate=0.02, ), )