Skip to content

Commit 2c75302

Browse files
committed
Lint with black
1 parent 6b8a08e commit 2c75302

5 files changed

Lines changed: 35 additions & 16 deletions

File tree

src/multi_vector_simulator/C0_data_processing.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,13 +804,21 @@ def change_sign_of_feedin_tariff(dict_feedin_tariff, dso):
804804
else:
805805
if (dict_feedin_tariff[VALUE] < 0).any():
806806
# Add a warning msg in case the feedin induces expenses rather than revenue
807-
ts_info = ", ".join(dict_feedin_tariff[VALUE].loc[dict_feedin_tariff[VALUE] < 0].index.astype(str))
807+
ts_info = ", ".join(
808+
dict_feedin_tariff[VALUE]
809+
.loc[dict_feedin_tariff[VALUE] < 0]
810+
.index.astype(str)
811+
)
808812
logging.warning(
809813
f"The {FEEDIN_TARIFF} of {dso} is 0 for the following timestamps:\n{ts_info}\n. This means that there is no renumeration for feed-in to the grid. Potentially, this can lead to random dispatch into feed-in and excess sinks."
810814
)
811815
elif (dict_feedin_tariff[VALUE] < 0).any():
812816
# Add a warning msg in case the feedin induces expenses rather than revenue
813-
ts_info = ", ".join(dict_feedin_tariff[VALUE].loc[dict_feedin_tariff[VALUE] < 0].index.astype(str))
817+
ts_info = ", ".join(
818+
dict_feedin_tariff[VALUE]
819+
.loc[dict_feedin_tariff[VALUE] < 0]
820+
.index.astype(str)
821+
)
814822
logging.warning(
815823
f"The {FEEDIN_TARIFF} of {dso} is negative for the following timestamps:\n{ts_info}\n. A negative value means that payments are necessary to be allowed to feed-into the grid. If you intended a revenue stream, set the feedin tariff to a positive value."
816824
)

src/multi_vector_simulator/D1_model_components.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@
6363
)
6464

6565

66-
def check_list_parameters_transformers_single_input_single_output(dict_asset, n_timesteps):
66+
def check_list_parameters_transformers_single_input_single_output(
67+
dict_asset, n_timesteps
68+
):
6769
parameters_defined_as_list = []
6870
for parameter in [DISPATCH_PRICE, EFFICIENCY]:
6971
len_param = get_length_if_list(dict_asset[parameter][VALUE])
@@ -608,7 +610,9 @@ def transformer_constant_efficiency_fix(model, dict_asset, **kwargs):
608610
else:
609611
# single input and single output
610612

611-
check_list_parameters_transformers_single_input_single_output(dict_asset, model.timeindex.size)
613+
check_list_parameters_transformers_single_input_single_output(
614+
dict_asset, model.timeindex.size
615+
)
612616

613617
inputs = {kwargs[OEMOF_BUSSES][dict_asset[INFLOW_DIRECTION]]: solph.Flow()}
614618
outputs = {
@@ -821,7 +825,9 @@ def storage_fix(model, dict_asset, **kwargs):
821825
"""
822826
storage = solph.components.GenericStorage(
823827
label=dict_asset[LABEL],
824-
nominal_storage_capacity=dict_asset[STORAGE_CAPACITY][INSTALLED_CAP][VALUE], #THERMAL --> yes
828+
nominal_storage_capacity=dict_asset[STORAGE_CAPACITY][INSTALLED_CAP][
829+
VALUE
830+
], # THERMAL --> yes
825831
inputs={
826832
kwargs[OEMOF_BUSSES][dict_asset[INFLOW_DIRECTION]]: solph.Flow(
827833
nominal_value=dict_asset[INPUT_POWER][INSTALLED_CAP][
@@ -839,9 +845,16 @@ def storage_fix(model, dict_asset, **kwargs):
839845
variable_costs=dict_asset[OUTPUT_POWER][DISPATCH_PRICE][VALUE],
840846
)
841847
}, # maximum discharge possible in one timestep
842-
loss_rate=1 - dict_asset[STORAGE_CAPACITY][EFFICIENCY][VALUE], # from timestep to timestep #THERMAL
843-
fixed_losses_absolute=dict_asset[STORAGE_CAPACITY][THERM_LOSSES_ABS][VALUE], #THERMAL
844-
fixed_losses_relative=dict_asset[STORAGE_CAPACITY][THERM_LOSSES_REL][VALUE], #THERMAL
848+
loss_rate=1
849+
- dict_asset[STORAGE_CAPACITY][EFFICIENCY][
850+
VALUE
851+
], # from timestep to timestep #THERMAL
852+
fixed_losses_absolute=dict_asset[STORAGE_CAPACITY][THERM_LOSSES_ABS][
853+
VALUE
854+
], # THERMAL
855+
fixed_losses_relative=dict_asset[STORAGE_CAPACITY][THERM_LOSSES_REL][
856+
VALUE
857+
], # THERMAL
845858
min_storage_level=dict_asset[STORAGE_CAPACITY][SOC_MIN][VALUE],
846859
max_storage_level=dict_asset[STORAGE_CAPACITY][SOC_MAX][VALUE],
847860
initial_storage_level=dict_asset[STORAGE_CAPACITY][SOC_INITIAL][

src/multi_vector_simulator/F1_plotting.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -705,9 +705,7 @@ def plot_timeseries(
705705
logging.warning(
706706
"The timeseries for {} do not have correct timestamps, it is likely that you uploaded "
707707
"a timeseries with more or less values than the number of days multiplied by number of "
708-
"timesteps within a day.".format(
709-
data_type
710-
)
708+
"timesteps within a day.".format(data_type)
711709
)
712710
else:
713711
if not isinstance(df_pd["timestamp"], pd.DatetimeIndex):

src/multi_vector_simulator/utils/data_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ def convert_epa_params_to_mvs(epa_dict):
457457
if isinstance(param_value, list):
458458
dict_asset[asset_label][asset_param][VALUE] = {
459459
VALUE: param_value,
460-
DATA_TYPE_JSON_KEY: TYPE_SERIES
460+
DATA_TYPE_JSON_KEY: TYPE_SERIES,
461461
}
462462

463463
# TODO remove this when change has been made on EPA side

tests/test_benchmark_feedin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def test_benchmark_feedin_tariff_optimize_negative_value(self, margs):
291291
@pytest.mark.skipif(
292292
EXECUTE_TESTS_ON not in (TESTS_ON_MASTER),
293293
reason="Benchmark test deactivated, set env variable "
294-
"EXECUTE_TESTS_ON to 'master' to run this test",
294+
"EXECUTE_TESTS_ON to 'master' to run this test",
295295
)
296296
@mock.patch("argparse.ArgumentParser.parse_args", return_value=argparse.Namespace())
297297
def test_dso_energy_price_scalar_feedin_tariff_scalar(self, margs):
@@ -313,7 +313,7 @@ def test_dso_energy_price_scalar_feedin_tariff_scalar(self, margs):
313313
@pytest.mark.skipif(
314314
EXECUTE_TESTS_ON not in (TESTS_ON_MASTER),
315315
reason="Benchmark test deactivated, set env variable "
316-
"EXECUTE_TESTS_ON to 'master' to run this test",
316+
"EXECUTE_TESTS_ON to 'master' to run this test",
317317
)
318318
@mock.patch("argparse.ArgumentParser.parse_args", return_value=argparse.Namespace())
319319
def test_dso_energy_price_series_feedin_tariff_scalar(self, margs):
@@ -335,7 +335,7 @@ def test_dso_energy_price_series_feedin_tariff_scalar(self, margs):
335335
@pytest.mark.skipif(
336336
EXECUTE_TESTS_ON not in (TESTS_ON_MASTER),
337337
reason="Benchmark test deactivated, set env variable "
338-
"EXECUTE_TESTS_ON to 'master' to run this test",
338+
"EXECUTE_TESTS_ON to 'master' to run this test",
339339
)
340340
@mock.patch("argparse.ArgumentParser.parse_args", return_value=argparse.Namespace())
341341
def test_dso_energy_price_scalar_feedin_tariff_series(self, margs):
@@ -357,7 +357,7 @@ def test_dso_energy_price_scalar_feedin_tariff_series(self, margs):
357357
@pytest.mark.skipif(
358358
EXECUTE_TESTS_ON not in (TESTS_ON_MASTER),
359359
reason="Benchmark test deactivated, set env variable "
360-
"EXECUTE_TESTS_ON to 'master' to run this test",
360+
"EXECUTE_TESTS_ON to 'master' to run this test",
361361
)
362362
@mock.patch("argparse.ArgumentParser.parse_args", return_value=argparse.Namespace())
363363
def test_dso_energy_price_series_feedin_tariff_series(self, margs):

0 commit comments

Comments
 (0)