Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display inline math correctly and hint towards the usage of the inbuilt slope and offset calculation methods #1092

Merged
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
28 changes: 25 additions & 3 deletions src/oemof/solph/components/_offset_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ class OffsetConverter(Node):
be a scalar or a sequence with length of time horizon for simulation.
Notes
-----
**:math:`m(t)` and :math:`y_\text{0,normed}(t)` can be calculated as **
**follows:**

:math:`m(t)` and :math:`y_\text{0,normed}(t)` can be calculated as follows:

.. _OffsetConverterCoefficients-equations:

Expand All @@ -66,7 +66,18 @@ class OffsetConverter(Node):
Where :math:`l_{max}` and :math:`l_{min}` are the maximum and minimum
partload share (e.g. 1.0 and 0.5) with reference to the `NonConvex` flow
and :math:`\eta_{max}` and :math:`\eta_{min}` are the respective
efficiencies/conversion factors at these partloads.
efficiencies/conversion factors at these partloads. Alternatively, you can
use the inbuilt methods:

- If the `NonConvex` flow is at an input of the component:
:py:meth:`oemof.solph.components._offset_converter.slope_offset_from_nonconvex_input`,
- If the `NonConvex` flow is at an output of the component:
:py:meth:`oemof.solph.components._offset_converter.slope_offset_from_nonconvex_output`

You can import these methods from the `oemof.solph.components` level:

>>> from oemof.solph.components import slope_offset_from_nonconvex_input
>>> from oemof.solph.components import slope_offset_from_nonconvex_output

The sets, variables, constraints and objective parts are created
* :py:class:`~oemof.solph.components._offset_converter.OffsetConverterBlock`
Expand All @@ -83,6 +94,17 @@ class OffsetConverter(Node):
>>> eta_min = 0.3
>>> slope = (l_max / eta_max - l_min / eta_min) / (l_max - l_min)
>>> offset = 1 / eta_max - slope

Or use the provided method as explained in the previous section:

>>> _slope, _offset = slope_offset_from_nonconvex_output(
... l_max, l_min, eta_max, eta_min
... )
>>> slope == _slope
True
>>> offset == _offset
True

>>> ostf = solph.components.OffsetConverter(
... label='ostf',
... inputs={bel: solph.flows.Flow()},
Expand Down
Loading