mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-09-13 07:21:16 +00:00
Fix2 electricity price prediction. (#296)
Normalize electricity price prediction to €/Wh. Provide electricity price prediction by €/kWh for convenience. Allow to configure electricity price charges by €/kWh. Also added error page to fastapi rest server to get rid of annoying unrelated fault messages during testing. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
This commit is contained in:
@@ -144,7 +144,7 @@ def test_update_data(mock_get, elecprice_provider, sample_akkudoktor_1_json, cac
|
||||
|
||||
# Assert we get prediction_hours prioce values by resampling
|
||||
np_price_array = elecprice_provider.key_to_array(
|
||||
key="elecprice_marketprice",
|
||||
key="elecprice_marketprice_wh",
|
||||
start_datetime=elecprice_provider.start_datetime,
|
||||
end_datetime=elecprice_provider.end_datetime,
|
||||
)
|
||||
@@ -203,7 +203,7 @@ def test_key_to_array_resampling(elecprice_provider):
|
||||
"""Test resampling of forecast data to NumPy array."""
|
||||
elecprice_provider.update_data(force_update=True)
|
||||
array = elecprice_provider.key_to_array(
|
||||
key="elecprice_marketprice",
|
||||
key="elecprice_marketprice_wh",
|
||||
start_datetime=elecprice_provider.start_datetime,
|
||||
end_datetime=elecprice_provider.end_datetime,
|
||||
)
|
||||
|
@@ -92,7 +92,7 @@ def test_import(elecprice_provider, sample_import_1_json, start_datetime, from_f
|
||||
assert elecprice_provider.start_datetime is not None
|
||||
assert elecprice_provider.total_hours is not None
|
||||
assert compare_datetimes(elecprice_provider.start_datetime, ems_eos.start_datetime).equal
|
||||
values = sample_import_1_json["elecprice_marketprice"]
|
||||
values = sample_import_1_json["elecprice_marketprice_wh"]
|
||||
value_datetime_mapping = elecprice_provider.import_datetimes(
|
||||
ems_eos.start_datetime, len(values)
|
||||
)
|
||||
@@ -101,7 +101,7 @@ def test_import(elecprice_provider, sample_import_1_json, start_datetime, from_f
|
||||
expected_datetime, expected_value_index = mapping
|
||||
expected_value = values[expected_value_index]
|
||||
result_datetime = elecprice_provider.records[i].date_time
|
||||
result_value = elecprice_provider.records[i]["elecprice_marketprice"]
|
||||
result_value = elecprice_provider.records[i]["elecprice_marketprice_wh"]
|
||||
|
||||
# print(f"{i}: Expected: {expected_datetime}:{expected_value}")
|
||||
# print(f"{i}: Result: {result_datetime}:{result_value}")
|
||||
|
16
tests/testdata/import_input_1.json
vendored
16
tests/testdata/import_input_1.json
vendored
@@ -6,14 +6,14 @@
|
||||
488.89, 506.91, 804.89, 1141.98, 1056.97, 992.46, 1155.99, 827.01, 1257.98, 1232.67,
|
||||
871.26, 860.88, 1158.03, 1222.72, 1221.04, 949.99, 987.01, 733.99, 592.97
|
||||
],
|
||||
"elecprice_marketprice": [
|
||||
0.3384, 0.3318, 0.3284, 0.3283, 0.3289, 0.3334, 0.3290,
|
||||
0.3302, 0.3042, 0.2430, 0.2280, 0.2212, 0.2093, 0.1879,
|
||||
0.1838, 0.2004, 0.2198, 0.2270, 0.2997, 0.3195, 0.3081,
|
||||
0.2969, 0.2921, 0.2780, 0.3384, 0.3318, 0.3284, 0.3283,
|
||||
0.3289, 0.3334, 0.3290, 0.3302, 0.3042, 0.2430, 0.2280,
|
||||
0.2212, 0.2093, 0.1879, 0.1838, 0.2004, 0.2198, 0.2270,
|
||||
0.2997, 0.3195, 0.3081, 0.2969, 0.2921, 0.2780
|
||||
"elecprice_marketprice_wh": [
|
||||
0.0003384, 0.0003318, 0.0003284, 0.0003283, 0.0003289, 0.0003334, 0.0003290,
|
||||
0.0003302, 0.0003042, 0.0002430, 0.0002280, 0.0002212, 0.0002093, 0.0001879,
|
||||
0.0001838, 0.0002004, 0.0002198, 0.0002270, 0.0002997, 0.0003195, 0.0003081,
|
||||
0.0002969, 0.0002921, 0.0002780, 0.0003384, 0.0003318, 0.0003284, 0.0003283,
|
||||
0.0003289, 0.0003334, 0.0003290, 0.0003302, 0.0003042, 0.0002430, 0.0002280,
|
||||
0.0002212, 0.0002093, 0.0001879, 0.0001838, 0.0002004, 0.0002198, 0.0002270,
|
||||
0.0002997, 0.0003195, 0.0003081, 0.0002969, 0.0002921, 0.0002780
|
||||
],
|
||||
"pvforecast_ac_power": [
|
||||
0, 0, 0, 0, 0, 0, 0, 8.05, 352.91, 728.51, 930.28, 1043.25, 1106.74, 1161.69,
|
||||
|
Reference in New Issue
Block a user