Feature/get costs from optimization #1052
17 errors
Black found 17 errors
Annotations
Check failure on line 49 in /home/runner/work/oemof-solph/oemof-solph/examples/cellular/cellular.py
github-actions / Black
/home/runner/work/oemof-solph/oemof-solph/examples/cellular/cellular.py#L38-L49
Lennart Schürmann <[email protected]>
`MIT license <https://github.com/oemof/oemof-solph/blob/dev/LICENSE>`_
"""
-
from oemof.solph import EnergySystem
from oemof.solph import Model
from oemof.solph import buses
from oemof.solph import components as cmp
github-actions / Black
/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/_link.py#L143-L153
\times P_{\mathrm{out},n}(p, t)
\quad \forall t \in T, \forall n in {1,2} \\
&
"""
+
CONSTRAINT_GROUP = True
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
github-actions / Black
/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/_offset_converter.py#L183-L193
+--------------------+------------------------+------+--------------------------------------------+
Note that :math:`P_{max}(t) \cdot Y(t)` is merged into one variable,
called `status_nominal[n, o, p, t]`.
""" # noqa: E501
+
CONSTRAINT_GROUP = True
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
github-actions / Black
/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/_generic_chp.py#L297-L307
:math:`\eta_{el,min,woDH}` `Eta_el_min_woDH[n,t]` P el. eff. at min. fuel flow w/o distr. heating
:math:`\eta_{el,max,woDH}` `Eta_el_max_woDH[n,t]` P el. eff. at max. fuel flow w/o distr. heating
=============================== ======================= ==== =============================================
""" # noqa: E501
+
CONSTRAINT_GROUP = True
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
github-actions / Black
/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/experimental/_piecewise_linear_converter.py#L110-L120
:class:`~oemof.solph.components.experimental._piecewise_linear_converter.PiecewiseLinearConverter`
**The following constraints are created:**
"""
+
CONSTRAINT_GROUP = True
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Check failure on line 424 in /home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/views.py
github-actions / Black
/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/views.py#L407-L424
for lb in labels:
subset = (
df.T.groupby(
lambda x1: (
- lambda fr, to, ty: "output"
- if (fr == lb and ty == "flow")
- else "input"
- if (to == lb and ty == "flow")
- else "level"
- if (fr == lb and ty != "flow")
- else None
+ lambda fr, to, ty: (
+ "output"
+ if (fr == lb and ty == "flow")
+ else (
+ "input"
+ if (to == lb and ty == "flow")
+ else (
+ "level"
+ if (fr == lb and ty != "flow")
+ else None
+ )
+ )
+ )
)(*x1)
)
.sum()
.T
)
Check failure on line 244 in /home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/processing.py
github-actions / Black
/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/processing.py#L231-L244
# Extraction steps that are the same for both model types
df = create_dataframe(model)
# create a dict of dataframes keyed by oemof tuples
df_dict = {
- k
- if len(k) > 1
- else (k[0], None): v[["timestep", "variable_name", "value"]]
+ k if len(k) > 1 else (k[0], None): v[
+ ["timestep", "variable_name", "value"]
+ ]
for k, v in df.groupby("oemof_tuple")
}
# Define index
if model.es.timeindex is None:
Check failure on line 443 in /home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/processing.py
github-actions / Black
/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/processing.py#L428-L443
converted into strings that represent the object labels
e.g. results[('pp1','bus1')].
"""
if keep_none_type:
converted = {
- tuple([str(e) if e is not None else None for e in k])
- if isinstance(k, tuple)
- else str(k)
- if k is not None
- else None: v
+ (
+ tuple([str(e) if e is not None else None for e in k])
+ if isinstance(k, tuple)
+ else str(k) if k is not None else None
+ ): v
for k, v in result.items()
}
else:
converted = {
tuple(map(str, k)) if isinstance(k, tuple) else str(k): v
github-actions / Black
/home/runner/work/oemof-solph/oemof-solph/tests/test_experimental_get_costs.py#L88-L101
)
lp_file = os.path.join(
os.getcwd(), "tests", "lp_files", "costs_from_lpfile.lp"
)
- tdc, tic = exppro.get_set_costs_from_lpfile(
- lp_file, self.om
- )
+ tdc, tic = exppro.get_set_costs_from_lpfile(lp_file, self.om)
expected_values_tdc = {
"b_diesel_diesel": 2,
"diesel_b_el1": 1,
"b_el1_storage": 3,
github-actions / Black
/home/runner/work/oemof-solph/oemof-solph/tests/test_experimental_get_costs.py#L111-L124
for name, val in expected_values_tic.items():
assert tic[name][0] == val
def test_get_time_dependent_results_as_dataframe(self):
results = processing.results(self.om, remove_last_time_point=True)
- results_dataframe = exppro.time_dependent_values_as_dataframe(
- results
- )
+ results_dataframe = exppro.time_dependent_values_as_dataframe(results)
assert isinstance(results_dataframe, pandas.DataFrame)
def test_time_indepentden_results_as_dataframe(self):
Check failure on line 14 in /home/runner/work/oemof-solph/oemof-solph/tests/test_options.py
github-actions / Black
/home/runner/work/oemof-solph/oemof-solph/tests/test_options.py#L4-L14
by the contributors recorded in the version control history of the file,
available from its original location oemof/tests/test_components.py
SPDX-License-Identifier: MIT
"""
+
import pytest
from oemof import solph
github-actions / Black
/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/experimental/_sink_dsm.py#L492-L502
:math:`\omega_{t}` P Objective weighting of the model for timestep t
:math:`year_{max}` P Last year of the optimization horizon
================================= ======================== ==== =======================================
""" # noqa: E501
+
CONSTRAINT_GROUP = True
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
github-actions / Black
/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/experimental/_sink_dsm.py#L892-L902
:math:`\mathbb{P}` S Periods of the model
:math:`\textrm{TIMEINDEX}` S Timeindex set of the model (periods, timesteps)
================================= ======================== ==== =======================================
""" # noqa: E501
+
CONSTRAINT_GROUP = True
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
github-actions / Black
/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/experimental/_sink_dsm.py#L1664-L1674
:math:`\omega_{t}` P Objective weighting of the model for timestep t
:math:`year_{max}` P Last year of the optimization horizon
================================= ======================== ==== =======================================
""" # noqa E:501
+
CONSTRAINT_GROUP = True
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
github-actions / Black
/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/experimental/_sink_dsm.py#L2412-L2422
:math:`\mathbb{P}` S Periods of the model
:math:`\textrm{TIMEINDEX}` S Timeindex set of the model (periods, timesteps)
================================= ======================== ==== =======================================
""" # noqa: E501
+
CONSTRAINT_GROUP = True
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
github-actions / Black
/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/experimental/_sink_dsm.py#L3608-L3618
| resp. in the last hours before the current"
:math:`year_{max}` P Last year of the optimization horizon
=========================================== ================================= ==== =======================================
""" # noqa: E501
+
CONSTRAINT_GROUP = True
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
github-actions / Black
/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/experimental/_sink_dsm.py#L4679-L4689
:math:`\mathbb{P}` S Periods of the model
:math:`\textrm{TIMEINDEX}` S Timeindex set of the model (periods, timesteps)
================================= ======================== ==== =======================================
""" # noqa: E501
+
CONSTRAINT_GROUP = True
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)