Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/reference/oemof.solph.flow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ InvestmentFlow
:undoc-members:
:show-inheritance:

NonConvexFlow (shared)
----------------------

.. automodule:: oemof.solph.flows._shared
:members:
:undoc-members:
:show-inheritance:

NonConvexFlow
-------------

Expand Down
2 changes: 1 addition & 1 deletion src/oemof/solph/constraints/flow_count_limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def limit_active_flow_count_by_keyword(
limit_active_flow_count
"""
flows = []
for i, o in model.NonConvexFlowBlock.NONCONVEX_FLOWS:
for i, o in model.NonConvexFlowBlock.FIXED_CAPACITY_NONCONVEX_FLOWS:
if hasattr(model.flows[i, o], keyword):
flows.append((i, o))

Expand Down
35 changes: 19 additions & 16 deletions src/oemof/solph/flows/_invest_non_convex_flow_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@
from pyomo.core import NonNegativeReals
from pyomo.core import Set
from pyomo.core import Var
from pyomo.core.base.block import ScalarBlock

from ._non_convex_flow_block import NonConvexFlowBlock
from . import _shared


class InvestNonConvexFlowBlock(NonConvexFlowBlock):
class InvestNonConvexFlowBlock(ScalarBlock):
r"""
.. automethod:: _create_constraints
.. automethod:: _create_variables
Expand Down Expand Up @@ -68,7 +69,7 @@ def _create_sets(self, group):
:class:`.options.NonConvex` and the attribute `invest`
of type :class:`.options.Invest`.

.. automethod:: _sets_for_non_convex_flows
Also creates :py:func:`sets_for_non_convex_flows`.
"""
self.INVEST_NON_CONVEX_FLOWS = Set(
initialize=[(g[0], g[1]) for g in group]
Expand All @@ -90,7 +91,7 @@ def _create_sets(self, group):
]
)

self._sets_for_non_convex_flows(group)
_shared.sets_for_non_convex_flows(self, group)

def _create_variables(self):
r"""
Expand All @@ -113,7 +114,7 @@ def _create_variables(self):
used for the constraints on the minimum and maximum
flow constraints.

.. automethod:: _variables_for_non_convex_flows
Also creates :py:func:`variables_for_non_convex_flows`.
"""

m = self.parent_block()
Expand All @@ -123,7 +124,7 @@ def _create_variables(self):
self.INVEST_NON_CONVEX_FLOWS, m.TIMESTEPS, within=Binary
)

self._variables_for_non_convex_flows()
_shared.variables_for_non_convex_flows(self)

# Investment-related variable similar to the
# <class 'oemof.solph.flows.InvestmentFlow'> class.
Expand Down Expand Up @@ -164,20 +165,22 @@ def _investvar_bound_rule(block, i, o, p):

def _create_constraints(self):
r"""
.. automethod:: _shared_constraints_for_non_convex_flows
.. automethod:: _minimum_invest_constraint
.. automethod:: _maximum_invest_constraint
.. automethod:: _minimum_flow_constraint
.. automethod:: _maximum_flow_constraint
.. automethod:: _linearised_investment_constraints

Also creates
* :py:func:`shared_constraints_for_non_convex_flows`,
* :py:func:`minimum_flow_constraint`, and
* :py:func:`maximum_flow_constraint`.
"""
self._shared_constraints_for_non_convex_flows()
_shared.shared_constraints_for_non_convex_flows(self)

self.minimum_investment = self._minimum_invest_constraint()
self.maximum_investment = self._maximum_invest_constraint()

self.min = self._minimum_flow_constraint()
self.max = self._maximum_flow_constraint()
self.min = _shared.minimum_flow_constraint(self)
self.max = _shared.maximum_flow_constraint(self)

self._linearised_investment_constraints()

Expand Down Expand Up @@ -302,10 +305,10 @@ def _objective_expression(self):

m = self.parent_block()

startup_costs = self._startup_costs()
shutdown_costs = self._shutdown_costs()
activity_costs = self._activity_costs()
inactivity_costs = self._inactivity_costs()
startup_costs = _shared.startup_costs(self)
shutdown_costs = _shared.shutdown_costs(self)
activity_costs = _shared.activity_costs(self)
inactivity_costs = _shared.inactivity_costs(self)
investment_costs = 0

for i, o in self.LINEAR_INVEST_NON_CONVEX_FLOWS:
Expand Down
Loading
Loading