Skip to content

Commit

Permalink
Merge pull request #965 from oemof/fix/multi-period-investment-storag…
Browse files Browse the repository at this point in the history
…e-limit

Define multi-period investment storage level for very first time step of optimization
  • Loading branch information
p-snft authored Aug 10, 2023
2 parents 5278328 + 2260d27 commit 869b60b
Show file tree
Hide file tree
Showing 16 changed files with 667 additions and 615 deletions.
29 changes: 21 additions & 8 deletions src/oemof/solph/components/_generic_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 #####################################

Expand Down Expand Up @@ -1312,6 +1311,20 @@ 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:
expr = self.storage_content[n, 0] == 0
self.initially_empty.add((n, 0), 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:

Expand Down
Loading

0 comments on commit 869b60b

Please sign in to comment.