From 363628b1445f1bfd980e42c41b9f48ca951dbb1f Mon Sep 17 00:00:00 2001 From: Francesco Witte Date: Mon, 22 Jul 2024 11:39:10 +0200 Subject: [PATCH] Display inline math correctly and hint towards the usage of the inbuilt slope and offset calculation methods --- .../solph/components/_offset_converter.py | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/oemof/solph/components/_offset_converter.py b/src/oemof/solph/components/_offset_converter.py index 094d6a292..c8f742df3 100644 --- a/src/oemof/solph/components/_offset_converter.py +++ b/src/oemof/solph/components/_offset_converter.py @@ -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: @@ -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` @@ -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()},