Skip to content

Commit

Permalink
Merge pull request #108 from oemof/features/multi-period-investment
Browse files Browse the repository at this point in the history
Multi period investment
  • Loading branch information
nailend committed Jul 18, 2023
2 parents 8429a9b + ea6f311 commit d01f97a
Show file tree
Hide file tree
Showing 26 changed files with 5,515 additions and 3 deletions.
13 changes: 13 additions & 0 deletions src/oemof/tabular/_facade.py
Expand Up @@ -180,7 +180,9 @@ def _investment(self):
"attribute `capacity_cost` of component {}!"
)
raise ValueError(msg.format(self.label))
# If storage component
if isinstance(self, GenericStorage):
# If invest costs/MWH are given
if self.storage_capacity_cost is not None:
self.investment = Investment(
ep_costs=self.storage_capacity_cost,
Expand All @@ -189,15 +191,23 @@ def _investment(self):
),
minimum=getattr(self, "minimum_storage_capacity", 0),
existing=getattr(self, "storage_capacity", 0),
lifetime=getattr(self, "lifetime", None),
age=getattr(self, "age", 0),
fixed_costs=getattr(self, "fixed_costs", None),
)
# If invest costs/MWh are not given
else:
self.investment = Investment(
maximum=self._get_maximum_additional_invest(
"storage_capacity_potential", "storage_capacity"
),
minimum=getattr(self, "minimum_storage_capacity", 0),
existing=getattr(self, "storage_capacity", 0),
lifetime=getattr(self, "lifetime", None),
age=getattr(self, "age", 0),
fixed_costs=getattr(self, "fixed_costs", None),
)
# If other component than storage
else:
self.investment = Investment(
ep_costs=self.capacity_cost,
Expand All @@ -206,6 +216,9 @@ def _investment(self):
),
minimum=getattr(self, "capacity_minimum", 0),
existing=getattr(self, "capacity", 0),
lifetime=getattr(self, "lifetime", None),
age=getattr(self, "age", 0),
fixed_costs=getattr(self, "fixed_costs", None),
)
return self.investment

Expand Down
18 changes: 18 additions & 0 deletions src/oemof/tabular/facades/backpressure_turbine.py
Expand Up @@ -40,6 +40,18 @@ class BackpressureTurbine(Transformer, Facade):
if timestep length is one hour. Default: 0
expandable: boolean
True, if capacity can be expanded within optimization. Default: False.
lifetime: int (optional)
Lifetime of the component in years. Necessary for multi-period
investment optimization.
Note: Only applicable for a multi-period model. Default: None.
age : int (optional)
The initial age of a flow (usually given in years);
once it reaches its lifetime (considering also
an initial age), the flow is forced to 0.
Note: Only applicable for a multi-period model. Default: 0.
fixed_costs : numeric (iterable or scalar) (optional)
The fixed costs associated with a flow.
Note: Only applicable for a multi-period model. Default: None.
capacity_cost: numeric
Investment costs per unit of electrical capacity (e.g. Euro / MW) .
If capacity is not set, this value will be used for optimizing the
Expand Down Expand Up @@ -116,6 +128,12 @@ class BackpressureTurbine(Transformer, Facade):

expandable: bool = False

lifetime: int = None

age: int = 0

fixed_costs: Union[float, Sequence[float]] = None

input_parameters: dict = field(default_factory=dict)

def build_solph_components(self):
Expand Down
18 changes: 18 additions & 0 deletions src/oemof/tabular/facades/dispatchable.py
Expand Up @@ -39,6 +39,18 @@ class Dispatchable(Source, Facade):
Max install capacity if capacity is to be expanded
capacity_minimum: numeric
Minimum install capacity if capacity is to be expanded
lifetime: int (optional)
Lifetime of the component in years. Necessary for multi-period
investment optimization.
Note: Only applicable for a multi-period model. Default: None.
age : int (optional)
The initial age of a flow (usually given in years);
once it reaches its lifetime (considering also
an initial age), the flow is forced to 0.
Note: Only applicable for a multi-period model. Default: 0.
fixed_costs : numeric (iterable or scalar) (optional)
The fixed costs associated with a flow.
Note: Only applicable for a multi-period model. Default: None.
The mathematical representations for these components are dependent on the
Expand Down Expand Up @@ -109,6 +121,12 @@ class Dispatchable(Source, Facade):

capacity_cost: float = None

lifetime: int = None

age: int = 0

fixed_costs: Union[float, Sequence[float]] = None

capacity_minimum: float = None

expandable: bool = False
Expand Down
18 changes: 18 additions & 0 deletions src/oemof/tabular/facades/extraction_turbine.py
Expand Up @@ -46,6 +46,18 @@ class ExtractionTurbine(ExtractionTurbineCHP, Facade):
chp capacity.
expandable: boolean
True, if capacity can be expanded within optimization. Default: False.
lifetime: int (optional)
Lifetime of the component in years. Necessary for multi-period
investment optimization.
Note: Only applicable for a multi-period model. Default: None.
age : int (optional)
The initial age of a flow (usually given in years);
once it reaches its lifetime (considering also
an initial age), the flow is forced to 0.
Note: Only applicable for a multi-period model. Default: 0.
fixed_costs : numeric (iterable or scalar) (optional)
The fixed costs associated with a flow.
Note: Only applicable for a multi-period model. Default: None.
The mathematical description is derived from the oemof base class
Expand Down Expand Up @@ -126,6 +138,12 @@ class ExtractionTurbine(ExtractionTurbineCHP, Facade):

expandable: bool = False

lifetime: int = None

age: int = 0

fixed_costs: Union[float, Sequence[float]] = None

input_parameters: dict = field(default_factory=dict)

conversion_factor_full_condensation: dict = field(default_factory=dict)
Expand Down
19 changes: 19 additions & 0 deletions src/oemof/tabular/facades/heatpump.py
@@ -1,4 +1,5 @@
from dataclasses import field
from typing import Sequence, Union

from oemof.solph._plumbing import sequence
from oemof.solph.buses import Bus
Expand Down Expand Up @@ -32,6 +33,18 @@ class HeatPump(Transformer, Facade):
conversion output capacity.
expandable: boolean or numeric (binary)
True, if capacity can be expanded within optimization. Default: False.
lifetime: int (optional)
Lifetime of the component in years. Necessary for multi-period
investment optimization.
Note: Only applicable for a multi-period model. Default: None.
age : int (optional)
The initial age of a flow (usually given in years);
once it reaches its lifetime (considering also
an initial age), the flow is forced to 0.
Note: Only applicable for a multi-period model. Default: 0.
fixed_costs : numeric (iterable or scalar) (optional)
The fixed costs associated with a flow.
Note: Only applicable for a multi-period model. Default: None.
capacity_potential: numeric
Maximum invest capacity in unit of output capacity. Default: +inf.
low_temperature_parameters: dict (optional)
Expand Down Expand Up @@ -103,6 +116,12 @@ class HeatPump(Transformer, Facade):

expandable: bool = False

lifetime: int = None

age: int = 0

fixed_costs: Union[float, Sequence[float]] = None

capacity_potential: float = float("+inf")

low_temperature_parameters: dict = field(default_factory=dict)
Expand Down
30 changes: 28 additions & 2 deletions src/oemof/tabular/facades/storage.py
@@ -1,4 +1,5 @@
from dataclasses import field
from typing import Sequence, Union

from oemof.solph import Bus, Flow, Investment
from oemof.solph._plumbing import sequence
Expand Down Expand Up @@ -27,14 +28,26 @@ class Storage(GenericStorage, Facade):
Investment costs for the storage unit e.g in €/MW-capacity
expandable: boolean
True, if capacity can be expanded within optimization. Default: False.
lifetime: int (optional)
Lifetime of the component in years. Necessary for multi-period
investment optimization.
Note: Only applicable for a multi-period model. Default: None.
age : int (optional)
The initial age of a flow (usually given in years);
once it reaches its lifetime (considering also
an initial age), the flow is forced to 0.
Note: Only applicable for a multi-period model. Default: 0.
fixed_costs : numeric (iterable or scalar) (optional)
The fixed costs associated with a flow.
Note: Only applicable for a multi-period model. Default: None.
storage_capacity_potential: numeric
Potential of the investment for storage capacity in MWh. Default: +inf.
capacity_potential: numeric
Potential of the investment for capacity in MW. Default: +inf.
input_parameters: dict (optional)
Set parameters on the input edge of the storage (see oemof.solph for
more information on possible parameters)
ouput_parameters: dict (optional)
output_parameters: dict (optional)
Set parameters on the output edge of the storage (see oemof.solph for
more information on possible parameters)
Expand Down Expand Up @@ -104,6 +117,12 @@ class Storage(GenericStorage, Facade):

expandable: bool = False

lifetime: int = None

age: int = 0

fixed_costs: Union[float, Sequence[float]] = 0

marginal_cost: float = 0

efficiency: float = 1
Expand Down Expand Up @@ -142,12 +161,19 @@ def build_solph_components(self):
"capacity_potential", "capacity"
),
existing=self.capacity,
lifetime=getattr(self, "lifetime", None),
age=getattr(self, "age", 0),
fixed_costs=getattr(self, "fixed_costs", None),
),
**self.input_parameters,
)
# set investment, but no costs (as relation input / output = 1)
fo = Flow(
investment=Investment(existing=self.capacity),
investment=Investment(
existing=self.capacity,
lifetime=getattr(self, "lifetime", None),
age=getattr(self, "age", 0),
),
variable_costs=self.marginal_cost,
**self.output_parameters,
)
Expand Down
18 changes: 18 additions & 0 deletions src/oemof/tabular/facades/volatile.py
Expand Up @@ -40,6 +40,18 @@ class Volatile(Source, Facade):
Minimum install capacity if investment
expandable: boolean
True, if capacity can be expanded within optimization. Default: False.
lifetime: int (optional)
Lifetime of the component in years. Necessary for multi-period
investment optimization.
Note: Only applicable for a multi-period model. Default: None.
age : int (optional)
The initial age of a flow (usually given in years);
once it reaches its lifetime (considering also
an initial age), the flow is forced to 0.
Note: Only applicable for a multi-period model. Default: 0.
fixed_costs : numeric (iterable or scalar) (optional)
The fixed costs associated with a flow.
Note: Only applicable for a multi-period model. Default: None.
The mathematical representations for this components are dependent on the
Expand Down Expand Up @@ -108,6 +120,12 @@ class Volatile(Source, Facade):

capacity_cost: float = None

lifetime: int = None

age: int = 0

fixed_costs: Union[float, Sequence[float]] = None

output_parameters: dict = field(default_factory=dict)

def build_solph_components(self):
Expand Down

0 comments on commit d01f97a

Please sign in to comment.