feat: complete 15-minute optimization support

This commit is contained in:
Andreas
2026-07-14 17:00:07 +02:00
parent 81a36cf355
commit 92a8a093e8
31 changed files with 1812 additions and 1032 deletions
+44
View File
@@ -294,3 +294,47 @@ def test_car_and_pv_battery_discharge_and_max_charge_power(setup_pv_battery, set
assert car_battery.parameters.max_charge_power_w == 7000, (
"Car battery max charge power should remain as defined"
)
def test_quarter_hour_charge_calls_share_one_power_budget():
params = SolarPanelBatteryParameters(
device_id="battery1",
capacity_wh=10_000,
initial_soc_percentage=0,
min_soc_percentage=0,
max_soc_percentage=100,
max_charge_power_w=1_000,
charging_efficiency=1.0,
discharging_efficiency=1.0,
)
battery = Battery(params, prediction_hours=4, slot_duration_h=0.25)
battery.set_charge_per_hour(np.ones(4))
first_stored, _ = battery.charge_energy(200.0, 0)
second_stored, _ = battery.charge_energy(200.0, 0)
assert first_stored == pytest.approx(200.0)
assert second_stored == pytest.approx(50.0)
assert battery.soc_wh == pytest.approx(250.0)
def test_quarter_hour_discharge_calls_share_one_power_budget():
params = SolarPanelBatteryParameters(
device_id="battery1",
capacity_wh=10_000,
initial_soc_percentage=100,
min_soc_percentage=0,
max_soc_percentage=100,
max_charge_power_w=1_000,
charging_efficiency=1.0,
discharging_efficiency=1.0,
)
battery = Battery(params, prediction_hours=4, slot_duration_h=0.25)
battery.set_discharge_per_hour(np.ones(4))
first_delivered, _ = battery.discharge_energy(200.0, 0)
second_delivered, _ = battery.discharge_energy(200.0, 0)
assert first_delivered == pytest.approx(200.0)
assert second_delivered == pytest.approx(50.0)
assert battery.soc_wh == pytest.approx(9_750.0)
+38 -4
View File
@@ -118,9 +118,9 @@ def test_update_data(mock_get, provider, sample_energycharts_json, cache_store):
# Assert: Verify the result is as expected
mock_get.assert_called_once()
assert (
len(provider) == 73
) # we have 48 datasets in the api response, we want to know 48h into the future. The data we get has already 23h into the future so we need only 25h more. 48+25=73
assert len(provider) == 72
# The final raw timestamp already represents its complete interval. Thus the
# 48 API values need 24, rather than 25, additional hourly forecasts.
# Assert we get hours prioce values by resampling
np_price_array = provider.key_to_array(
@@ -131,10 +131,43 @@ def test_update_data(mock_get, provider, sample_energycharts_json, cache_store):
assert len(np_price_array) == provider.total_hours
def test_update_data_keeps_quarter_hour_resolution(provider):
# Use a range that does not overlap the hourly fixture data used by the
# neighbouring tests; the provider is a singleton by design.
start = to_datetime("2025-01-15 00:00:00", in_timezone="Europe/Berlin")
get_ems().set_start_datetime(start)
provider.highest_orig_datetime = None
raw_slots = provider.config.prediction.hours * 2
energy_charts_data = EnergyChartsElecPrice(
license_info="",
unix_seconds=[int(start.add(minutes=15 * i).timestamp()) for i in range(raw_slots)],
price=[100.0] * raw_slots,
unit="EUR/MWh",
deprecated=False,
)
with patch.object(provider, "_request_forecast", return_value=energy_charts_data):
provider._update_data(force_update=True)
result = provider.key_to_series(
key="elecprice_marketprice_wh",
start_datetime=start,
end_datetime=start.add(hours=provider.config.prediction.hours),
)
assert len(result) == provider.config.prediction.hours * 4
assert result.index.to_series().diff().dropna().dt.total_seconds().unique().tolist() == [900.0]
@patch("requests.get")
def test_update_data_with_incomplete_forecast(mock_get, provider):
"""Test `_update_data` with incomplete or missing forecast data."""
incomplete_data: dict = {"license_info": "", "unix_seconds": [], "price": [], "unit": "", "deprecated": False}
incomplete_data: dict = {
"license_info": "",
"unix_seconds": [],
"price": [],
"unit": "",
"deprecated": False,
}
mock_response = Mock()
mock_response.status_code = 200
mock_response.content = json.dumps(incomplete_data)
@@ -218,6 +251,7 @@ def test_request_forecast_url_bidding_zone_is_value(mock_get, provider, sample_e
# Extract the bzn= query parameter value from the URL
from urllib.parse import parse_qs, urlparse
parsed = urlparse(actual_url)
query_params = parse_qs(parsed.query)
+11
View File
@@ -12,6 +12,7 @@ from akkudoktoreos.prediction.elecprice import ElecPriceCommonSettings
from akkudoktoreos.prediction.elecpricetibber import (
ElecPriceTibber,
ElecPriceTibberCommonSettings,
TIBBER_PRICE_QUERY_QUARTER_HOURLY,
TibberGraphQLResponse,
)
from akkudoktoreos.utils.datetimeutil import to_datetime
@@ -255,6 +256,16 @@ def test_request_forecast_uses_tibber_graphql_api(
assert kwargs["timeout"] == 30
def test_quarter_hour_query_sets_resolution_on_price_info():
"""Tibber defines resolution on priceInfo, not on today or tomorrow."""
compact_query = " ".join(TIBBER_PRICE_QUERY_QUARTER_HOURLY.split())
assert "priceInfo(resolution: QUARTER_HOURLY)" in compact_query
assert "today(resolution:" not in compact_query
assert "tomorrow(resolution:" not in compact_query
assert "priceInfoRange(resolution: QUARTER_HOURLY, last: 672)" in compact_query
def test_tibber_update_extrapolates_missing_hours_with_seasonal_history(
tibber_provider, monkeypatch
):
+24
View File
@@ -75,3 +75,27 @@ def test_request_forecast_uses_feedintariff_bidding_zone(
actual_url = mock_get.call_args[0][0]
assert "bzn=AT" in actual_url
def test_update_data_keeps_quarter_hour_resolution(provider):
start = to_datetime("2025-01-15 00:00:00", in_timezone="Europe/Berlin")
get_ems().set_start_datetime(start)
raw_slots = provider.config.prediction.hours * 2
energy_charts_data = EnergyChartsElecPrice(
license_info="",
unix_seconds=[int(start.add(minutes=15 * i).timestamp()) for i in range(raw_slots)],
price=[100.0] * raw_slots,
unit="EUR/MWh",
deprecated=False,
)
with patch.object(provider, "_request_forecast", return_value=energy_charts_data):
provider._update_data(force_update=True)
result = provider.key_to_series(
key="feed_in_tariff_wh",
start_datetime=start,
end_datetime=start.add(hours=provider.config.prediction.hours),
)
assert len(result) == provider.config.prediction.hours * 4
assert result.index.to_series().diff().dropna().dt.total_seconds().unique().tolist() == [900.0]
+62 -58
View File
@@ -43,13 +43,15 @@ def genetic_simulation(config_eos) -> GeneticSimulation:
initial_soc_percentage=80,
min_soc_percentage=10,
),
prediction_hours = config_eos.prediction.hours,
prediction_hours=config_eos.prediction.hours,
)
akku.reset()
inverter = Inverter(
InverterParameters(device_id="inverter1", max_power_wh=10000, battery_id=akku.parameters.device_id),
battery = akku,
InverterParameters(
device_id="inverter1", max_power_wh=10000, battery_id=akku.parameters.device_id
),
battery=akku,
)
# Household device (currently not used, set to None)
@@ -60,8 +62,8 @@ def genetic_simulation(config_eos) -> GeneticSimulation:
duration_h=2,
time_windows=None,
),
optimization_hours = config_eos.optimization.horizon_hours,
prediction_hours = config_eos.prediction.hours,
optimization_hours=config_eos.optimization.horizon_hours,
prediction_hours=config_eos.prediction.hours,
)
# Example initialization of electric car battery
@@ -69,7 +71,7 @@ def genetic_simulation(config_eos) -> GeneticSimulation:
ElectricVehicleParameters(
device_id="ev1", capacity_wh=26400, initial_soc_percentage=10, min_soc_percentage=10
),
prediction_hours = config_eos.prediction.hours,
prediction_hours=config_eos.prediction.hours,
)
eauto.set_charge_per_hour(np.full(config_eos.prediction.hours, 1))
@@ -240,8 +242,8 @@ def genetic_simulation(config_eos) -> GeneticSimulation:
preis_euro_pro_wh_akku=preis_euro_pro_wh_akku,
gesamtlast=gesamtlast,
),
optimization_hours = config_eos.optimization.horizon_hours,
prediction_hours = config_eos.prediction.hours,
optimization_hours=config_eos.optimization.horizon_hours,
prediction_hours=config_eos.prediction.hours,
inverter=inverter,
ev=eauto,
home_appliance=home_appliance,
@@ -301,69 +303,67 @@ def test_simulation(genetic_simulation):
assert GeneticSimulationResult(**result) is not None
# Check the length of the main arrays
assert len(result["Last_Wh_pro_Stunde"]) == 47, (
"The length of 'Last_Wh_pro_Stunde' should be 48."
)
assert len(result["Netzeinspeisung_Wh_pro_Stunde"]) == 47, (
"The length of 'Netzeinspeisung_Wh_pro_Stunde' should be 48."
)
assert len(result["Netzbezug_Wh_pro_Stunde"]) == 47, (
"The length of 'Netzbezug_Wh_pro_Stunde' should be 48."
)
assert len(result["Kosten_Euro_pro_Stunde"]) == 47, (
"The length of 'Kosten_Euro_pro_Stunde' should be 48."
)
assert len(result["akku_soc_pro_stunde"]) == 47, (
"The length of 'akku_soc_pro_stunde' should be 48."
)
assert (
len(result["Last_Wh_pro_Stunde"]) == 47
), "The length of 'Last_Wh_pro_Stunde' should be 48."
assert (
len(result["Netzeinspeisung_Wh_pro_Stunde"]) == 47
), "The length of 'Netzeinspeisung_Wh_pro_Stunde' should be 48."
assert (
len(result["Netzbezug_Wh_pro_Stunde"]) == 47
), "The length of 'Netzbezug_Wh_pro_Stunde' should be 48."
assert (
len(result["Kosten_Euro_pro_Stunde"]) == 47
), "The length of 'Kosten_Euro_pro_Stunde' should be 48."
assert (
len(result["akku_soc_pro_stunde"]) == 47
), "The length of 'akku_soc_pro_stunde' should be 48."
# Verify specific values in the 'Last_Wh_pro_Stunde' array
assert result["Last_Wh_pro_Stunde"][1] == 1527.13, (
"The value at index 1 of 'Last_Wh_pro_Stunde' should be 1527.13."
)
assert result["Last_Wh_pro_Stunde"][2] == 1468.88, (
"The value at index 2 of 'Last_Wh_pro_Stunde' should be 1468.88."
)
assert result["Last_Wh_pro_Stunde"][12] == 1132.03, (
"The value at index 12 of 'Last_Wh_pro_Stunde' should be 1132.03."
)
assert (
result["Last_Wh_pro_Stunde"][1] == 1527.13
), "The value at index 1 of 'Last_Wh_pro_Stunde' should be 1527.13."
assert (
result["Last_Wh_pro_Stunde"][2] == 1468.88
), "The value at index 2 of 'Last_Wh_pro_Stunde' should be 1468.88."
assert (
result["Last_Wh_pro_Stunde"][12] == 1132.03
), "The value at index 12 of 'Last_Wh_pro_Stunde' should be 1132.03."
# Verify that the value at index 0 is 'None'
# Check that 'Netzeinspeisung_Wh_pro_Stunde' and 'Netzbezug_Wh_pro_Stunde' are consistent
assert result["Netzbezug_Wh_pro_Stunde"][1] == 1527.13, (
"The value at index 1 of 'Netzbezug_Wh_pro_Stunde' should be 1527.13."
)
assert (
result["Netzbezug_Wh_pro_Stunde"][1] == 1527.13
), "The value at index 1 of 'Netzbezug_Wh_pro_Stunde' should be 1527.13."
# Verify the total balance
assert abs(result["Gesamtbilanz_Euro"] - 6.612835813556755) < 1e-5, (
"Total balance should be 6.612835813556755."
)
assert (
abs(result["Gesamtbilanz_Euro"] - 6.62818441758576) < 1e-5
), "Total balance should reflect the shared per-slot battery power limit."
# Check total revenue and total costs
assert abs(result["Gesamteinnahmen_Euro"] - 1.964301131937134) < 1e-5, (
"Total revenue should be 1.964301131937134."
)
assert abs(result["Gesamtkosten_Euro"] - 8.577136945493889) < 1e-5, (
"Total costs should be 8.577136945493889 ."
)
assert (
abs(result["Gesamteinnahmen_Euro"] - 1.9606946615517515) < 1e-5
), "Total revenue should respect the shared per-slot battery power limit."
assert (
abs(result["Gesamtkosten_Euro"] - 8.588879079137512) < 1e-5
), "Total costs should respect the shared per-slot battery power limit."
# Check the losses
assert abs(result["Gesamt_Verluste"] - 1620.0) < 1e-5, (
"Total losses should be 1620.0 ."
)
assert abs(result["Gesamt_Verluste"] - 1620.0) < 1e-5, "Total losses should be 1620.0 ."
# Check the values in 'akku_soc_pro_stunde'
assert result["akku_soc_pro_stunde"][-1] == 98.0, (
"The value at index -1 of 'akku_soc_pro_stunde' should be 98.0."
)
assert result["akku_soc_pro_stunde"][1] == 98.0, (
"The value at index 1 of 'akku_soc_pro_stunde' should be 98.0."
)
assert (
result["akku_soc_pro_stunde"][-1] == 98.0
), "The value at index -1 of 'akku_soc_pro_stunde' should be 98.0."
assert (
result["akku_soc_pro_stunde"][1] == 98.0
), "The value at index 1 of 'akku_soc_pro_stunde' should be 98.0."
# Check home appliances
assert sum(simulation.home_appliance.get_load_curve()) == 2000, (
"The sum of 'simulation.home_appliance.get_load_curve()' should be 2000."
)
assert (
sum(simulation.home_appliance.get_load_curve()) == 2000
), "The sum of 'simulation.home_appliance.get_load_curve()' should be 2000."
assert (
np.nansum(
@@ -379,13 +379,17 @@ def test_simulation(genetic_simulation):
print("All tests passed successfully.")
def test_direct_marketing_curtails_negative_feed_in(config_eos):
def test_direct_marketing_curtails_negative_feed_in(config_eos, monkeypatch):
config_eos.merge_settings_from_dict(
{"prediction": {"hours": 2}, "optimization": {"horizon_hours": 2}}
)
inverter = Inverter(InverterParameters(device_id="inverter1", max_power_wh=1000.0))
inverter.self_consumption_predictor.calculate_self_consumption = Mock(return_value=1.0)
monkeypatch.setattr(
inverter.self_consumption_predictor,
"calculate_self_consumption",
Mock(return_value=1.0),
)
simulation = GeneticSimulation()
simulation.prepare(
+30
View File
@@ -0,0 +1,30 @@
import pytest
from akkudoktoreos.prediction.interpolator import get_eos_load_interpolator
def test_quarter_hour_energy_is_converted_back_to_same_mean_power():
"""Splitting hourly energy must not change the minute-load probability lookup."""
interpolator = get_eos_load_interpolator()
hourly_load_wh = 800.0
hourly_pv_wh = 1200.0
slot_duration_h = 0.25
hourly = interpolator.calculate_self_consumption(hourly_load_wh, hourly_pv_wh)
quarter_hour = interpolator.calculate_self_consumption(
(hourly_load_wh / 4) / slot_duration_h,
(hourly_pv_wh / 4) / slot_duration_h,
)
assert quarter_hour == pytest.approx(hourly)
def test_load_above_probability_grid_uses_highest_supported_distribution():
"""Out-of-range household load must not make self-consumption jump to zero."""
interpolator = get_eos_load_interpolator()
at_boundary = interpolator.calculate_self_consumption(3450.0, 5000.0)
above_boundary = interpolator.calculate_self_consumption(4000.0, 5000.0)
assert above_boundary == pytest.approx(at_boundary)
assert above_boundary > 0.99
+45 -1
View File
@@ -1,8 +1,11 @@
from unittest.mock import Mock, call, patch
import numpy as np
import pytest
from akkudoktoreos.devices.genetic.battery import Battery
from akkudoktoreos.devices.genetic.inverter import Inverter, InverterParameters
from akkudoktoreos.optimization.genetic.geneticdevices import SolarPanelBatteryParameters
@pytest.fixture
@@ -26,11 +29,51 @@ def inverter(mock_battery) -> Inverter:
InverterParameters(
device_id="iv1", max_power_wh=500.0, battery_id=mock_battery.parameters.device_id
),
battery = mock_battery
battery=mock_battery,
)
return iv
def test_quarter_hour_load_and_grid_export_share_discharge_power_limit():
"""Local supply plus direct export may not exceed one slot's battery budget."""
battery = Battery(
SolarPanelBatteryParameters(
device_id="battery",
capacity_wh=10000,
charging_efficiency=1.0,
discharging_efficiency=1.0,
max_charge_power_w=7000,
initial_soc_percentage=100,
),
prediction_hours=1,
slot_duration_h=0.25,
)
battery.set_discharge_per_hour(np.array([1]))
quarter_hour_inverter = Inverter(
InverterParameters(
device_id="inverter",
max_power_wh=10000,
battery_id="battery",
dc_to_ac_efficiency=1.0,
ac_to_dc_efficiency=1.0,
),
battery=battery,
slot_duration_h=0.25,
)
initial_soc_wh = battery.soc_wh
grid_export, grid_import, _, _ = quarter_hour_inverter.process_energy(
generation=0.0,
consumption=1000.0,
hour=0,
allow_battery_grid_export=True,
)
assert grid_import == 0.0
assert grid_export == pytest.approx(750.0)
assert initial_soc_wh - battery.soc_wh == pytest.approx(1750.0)
def test_process_energy_excess_generation(inverter, mock_battery):
# Battery charges 100 Wh with 10 Wh loss
mock_battery.charge_energy.return_value = (100.0, 10.0)
@@ -125,6 +168,7 @@ def test_process_energy_battery_discharges(inverter, mock_battery):
def test_process_energy_allows_battery_grid_export(inverter, mock_battery):
mock_battery.max_charge_power_w = 300.0
mock_battery.remaining_discharge_energy_wh.return_value = 200.0
mock_battery.discharge_energy.side_effect = [(100.0, 0.0), (200.0, 0.0)]
grid_export, grid_import, losses, self_consumption = inverter.process_energy(
+195 -5
View File
@@ -16,6 +16,7 @@ from akkudoktoreos.config.config import ConfigEOS
from akkudoktoreos.core.cache import CacheEnergyManagementStore
from akkudoktoreos.core.coreabc import get_ems
from akkudoktoreos.optimization.genetic.genetic import GeneticOptimization
from akkudoktoreos.optimization.genetic.geneticdevices import HomeApplianceParameters
from akkudoktoreos.optimization.genetic.geneticparams import (
GeneticOptimizationParameters,
)
@@ -27,6 +28,12 @@ ems_eos = get_ems(init=True) # init once
DIR_TESTDATA = Path(__file__).parent / "testdata"
def load_hourly_parameters() -> GeneticOptimizationParameters:
"""Load the legacy 48-value API example used by hourly clients."""
with (DIR_TESTDATA / "optimize_input_1.json").open("r") as f_in:
return GeneticOptimizationParameters(**json.load(f_in))
@pytest.mark.parametrize(
"interval, exp_slots_per_hour, exp_slot_duration_h",
[
@@ -76,6 +83,189 @@ def test_start_day_slot_includes_minute_offset(config_eos: ConfigEOS):
assert opt._start_day_slot() == sd.hour * 4 + sd.minute // 15
def test_ems_start_is_floored_to_quarter_hour(config_eos: ConfigEOS):
"""Rolling optimization starts at the current slot, not the previous full hour."""
config_eos.merge_settings_from_dict(
{
"prediction": {"hours": 48},
"optimization": {"horizon_hours": 48, "interval": 900},
}
)
aligned = ems_eos.set_start_datetime(to_datetime().set(hour=10, minute=38, second=42))
assert aligned.hour == 10
assert aligned.minute == 30
assert aligned.second == 0
def test_unsupported_interval_falls_back_to_hourly(config_eos: ConfigEOS):
"""The genetic optimizer falls back without restricting interval-aware providers."""
config_eos.merge_settings_from_dict({"optimization": {"interval": 1800}})
assert config_eos.optimization.interval == 1800
GeneticOptimization(fixed_seed=42)
assert config_eos.optimization.interval == 3600
def test_hourly_api_input_is_normalized_to_quarter_hour_slots(config_eos: ConfigEOS):
"""Legacy API energy is split while prices are held over four slots."""
config_eos.merge_settings_from_dict(
{
"prediction": {"hours": 48},
"optimization": {"horizon_hours": 48, "interval": 900},
}
)
parameters = load_hourly_parameters()
opt = GeneticOptimization(fixed_seed=42)
normalized = opt._parameters_for_slot_grid(parameters)
assert len(normalized.ems.pv_prognose_wh) == 192
assert len(normalized.ems.gesamtlast) == 192
assert len(normalized.ems.strompreis_euro_pro_wh) == 192
assert len(normalized.ems.einspeiseverguetung_euro_pro_wh) == 192
assert sum(normalized.ems.pv_prognose_wh[:4]) == pytest.approx(parameters.ems.pv_prognose_wh[0])
assert sum(normalized.ems.gesamtlast[:4]) == pytest.approx(parameters.ems.gesamtlast[0])
assert (
normalized.ems.strompreis_euro_pro_wh[:4] == [parameters.ems.strompreis_euro_pro_wh[0]] * 4
)
assert (
normalized.ems.einspeiseverguetung_euro_pro_wh[:4]
== [parameters.ems.einspeiseverguetung_euro_pro_wh[0]] * 4
)
def test_native_quarter_hour_input_is_not_resampled(config_eos: ConfigEOS):
"""Native 192-value input survives normalization without repetition or scaling."""
config_eos.merge_settings_from_dict(
{
"prediction": {"hours": 48},
"optimization": {"horizon_hours": 48, "interval": 900},
}
)
parameters = load_hourly_parameters()
native_values = [float(i) for i in range(192)]
native_ems = parameters.ems.model_copy(
update={
"pv_prognose_wh": native_values,
"gesamtlast": native_values,
"strompreis_euro_pro_wh": native_values,
"einspeiseverguetung_euro_pro_wh": native_values,
},
deep=True,
)
native_parameters = parameters.model_copy(update={"ems": native_ems}, deep=True)
normalized = GeneticOptimization(fixed_seed=42)._parameters_for_slot_grid(native_parameters)
assert normalized.ems.pv_prognose_wh == native_values
assert normalized.ems.gesamtlast == native_values
assert normalized.ems.strompreis_euro_pro_wh == native_values
assert normalized.ems.einspeiseverguetung_euro_pro_wh == native_values
def test_scalar_feed_in_tariff_fills_quarter_hour_grid(config_eos: ConfigEOS):
"""A fixed feed-in tariff becomes one value per optimization slot."""
config_eos.merge_settings_from_dict(
{
"prediction": {"hours": 48},
"optimization": {"horizon_hours": 48, "interval": 900},
}
)
parameters = load_hourly_parameters()
fixed_tariff = 0.00008
scalar_ems = parameters.ems.model_copy(
update={"einspeiseverguetung_euro_pro_wh": fixed_tariff}, deep=True
)
scalar_parameters = parameters.model_copy(update={"ems": scalar_ems}, deep=True)
normalized = GeneticOptimization(fixed_seed=42)._parameters_for_slot_grid(scalar_parameters)
assert normalized.ems.einspeiseverguetung_euro_pro_wh == [fixed_tariff] * 192
def test_ambiguous_input_length_is_rejected(config_eos: ConfigEOS):
"""Unexpected input lengths fail instead of silently shortening the simulation."""
config_eos.merge_settings_from_dict(
{
"prediction": {"hours": 48},
"optimization": {"horizon_hours": 48, "interval": 900},
}
)
parameters = load_hourly_parameters()
invalid_ems = parameters.ems.model_copy(
update={
"pv_prognose_wh": [0.0] * 96,
"gesamtlast": [0.0] * 96,
"strompreis_euro_pro_wh": [0.0] * 96,
"einspeiseverguetung_euro_pro_wh": [0.0] * 96,
},
deep=True,
)
invalid_parameters = parameters.model_copy(update={"ems": invalid_ems}, deep=True)
with pytest.raises(ValueError, match="expected either 48 hourly values or 192"):
GeneticOptimization(fixed_seed=42)._parameters_for_slot_grid(invalid_parameters)
def test_hourly_start_solution_is_expanded_to_slots(config_eos: ConfigEOS):
"""A cached hourly genome becomes a valid quarter-hour warm start."""
config_eos.merge_settings_from_dict(
{
"prediction": {"hours": 48},
"optimization": {"horizon_hours": 48, "interval": 900},
}
)
opt = GeneticOptimization(fixed_seed=42)
opt.optimize_ev = False
hourly = list(range(48))
migrated = opt._start_solution_for_slot_grid(hourly, has_appliance=False)
assert len(migrated) == 192
assert migrated[:8] == [0, 0, 0, 0, 1, 1, 1, 1]
def test_quarter_hour_mutation_probability_preserves_hourly_rate(config_eos: ConfigEOS):
"""A finer genome does not mutate four times as many controls per hour."""
config_eos.merge_settings_from_dict(
{
"prediction": {"hours": 48},
"optimization": {"horizon_hours": 48, "interval": 900},
}
)
opt = GeneticOptimization(fixed_seed=42)
opt.optimize_ev = False
opt.setup_deap_environment({"home_appliance": 0}, start_hour=0)
assert opt.toolbox.mutate_charge_discharge.keywords["indpb"] == pytest.approx(0.05)
def test_sub_hourly_home_appliance_is_rejected(config_eos: ConfigEOS):
"""An hourly appliance model must not silently run on slot indices."""
config_eos.merge_settings_from_dict(
{
"prediction": {"hours": 48},
"optimization": {"horizon_hours": 48, "interval": 900},
}
)
parameters = load_hourly_parameters().model_copy(
update={
"dishwasher": HomeApplianceParameters(
device_id="dishwasher", consumption_wh=1200, duration_h=2
)
},
deep=True,
)
ems_eos.set_start_datetime(to_datetime().set(hour=10, minute=0))
with pytest.raises(ValueError, match="Home-appliance scheduling"):
GeneticOptimization(fixed_seed=42).optimierung_ems(
parameters=parameters, start_hour=10, ngen=1
)
def test_optimize_15min_slot_grid(config_eos: ConfigEOS):
"""An end-to-end optimization at interval=900 runs on a 192-slot day grid.
@@ -110,8 +300,7 @@ def test_optimize_15min_slot_grid(config_eos: ConfigEOS):
}
)
with (DIR_TESTDATA / "optimize_input_1.json").open("r") as f_in:
input_data = GeneticOptimizationParameters(**json.load(f_in))
input_data = load_hourly_parameters()
ems_eos.set_start_datetime(to_datetime().set(hour=10, minute=0))
CacheEnergyManagementStore().clear()
@@ -127,14 +316,15 @@ def test_optimize_15min_slot_grid(config_eos: ConfigEOS):
parameters, results, filename=visualize_filename, **kwargs
),
):
genetic_solution = opt.optimierung_ems(
parameters=input_data, start_hour=10, ngen=3
)
genetic_solution = opt.optimierung_ems(parameters=input_data, start_hour=10, ngen=3)
# The genetic core emitted a full-day grid at 15-min resolution.
assert len(genetic_solution.ac_charge) == 192
assert len(genetic_solution.dc_charge) == 192
assert len(genetic_solution.discharge_allowed) == 192
expected_result_slots = 192 - opt._start_day_slot()
assert len(genetic_solution.result.Last_Wh_pro_Stunde) == expected_result_slots
assert len(genetic_solution.result.Electricity_price) == expected_result_slots
# The serializers consume the 15-min grid without error and emit a 900 s
# spaced solution index.
+23 -17
View File
@@ -7,6 +7,7 @@ from akkudoktoreos.prediction.elecpriceenergycharts import ElecPriceEnergyCharts
from akkudoktoreos.prediction.elecpricefixed import ElecPriceFixed
from akkudoktoreos.prediction.elecpriceimport import ElecPriceImport
from akkudoktoreos.prediction.elecpricetibber import ElecPriceTibber
from akkudoktoreos.prediction.feedintariffenergycharts import FeedInTariffEnergyCharts
from akkudoktoreos.prediction.feedintarifffixed import FeedInTariffFixed
from akkudoktoreos.prediction.feedintariffimport import FeedInTariffImport
from akkudoktoreos.prediction.loadakkudoktor import (
@@ -46,6 +47,7 @@ def forecast_providers():
ElecPriceTibber(),
ElecPriceFixed(),
ElecPriceImport(),
FeedInTariffEnergyCharts(),
FeedInTariffFixed(),
FeedInTariffImport(),
LoadAkkudoktor(),
@@ -99,28 +101,32 @@ def test_provider_sequence(prediction):
assert isinstance(prediction.providers[2], ElecPriceTibber)
assert isinstance(prediction.providers[3], ElecPriceFixed)
assert isinstance(prediction.providers[4], ElecPriceImport)
assert isinstance(prediction.providers[5], FeedInTariffFixed)
assert isinstance(prediction.providers[6], FeedInTariffImport)
assert isinstance(prediction.providers[7], LoadAkkudoktor)
assert isinstance(prediction.providers[8], LoadAkkudoktorAdjusted)
assert isinstance(prediction.providers[9], LoadVrm)
assert isinstance(prediction.providers[10], LoadImport)
assert isinstance(prediction.providers[11], PVForecastAkkudoktor)
assert isinstance(prediction.providers[12], PVForecastVrm)
assert isinstance(prediction.providers[13], PVForecastPVNode)
assert isinstance(prediction.providers[14], PVForecastForecastSolar)
assert isinstance(prediction.providers[15], PVForecastSolcast)
assert isinstance(prediction.providers[16], PVForecastImport)
assert isinstance(prediction.providers[17], WeatherBrightSky)
assert isinstance(prediction.providers[18], WeatherClearOutside)
assert isinstance(prediction.providers[19], WeatherOpenMeteo)
assert isinstance(prediction.providers[20], WeatherImport)
assert isinstance(prediction.providers[5], FeedInTariffEnergyCharts)
assert isinstance(prediction.providers[6], FeedInTariffFixed)
assert isinstance(prediction.providers[7], FeedInTariffImport)
assert isinstance(prediction.providers[8], LoadAkkudoktor)
assert isinstance(prediction.providers[9], LoadAkkudoktorAdjusted)
assert isinstance(prediction.providers[10], LoadVrm)
assert isinstance(prediction.providers[11], LoadImport)
assert isinstance(prediction.providers[12], PVForecastAkkudoktor)
assert isinstance(prediction.providers[13], PVForecastVrm)
assert isinstance(prediction.providers[14], PVForecastPVNode)
assert isinstance(prediction.providers[15], PVForecastForecastSolar)
assert isinstance(prediction.providers[16], PVForecastSolcast)
assert isinstance(prediction.providers[17], PVForecastImport)
assert isinstance(prediction.providers[18], WeatherBrightSky)
assert isinstance(prediction.providers[19], WeatherClearOutside)
assert isinstance(prediction.providers[20], WeatherOpenMeteo)
assert isinstance(prediction.providers[21], WeatherImport)
def test_provider_by_id(prediction, forecast_providers):
"""Test that provider_by_id method returns the correct provider."""
for provider in forecast_providers:
assert prediction.provider_by_id(provider.provider_id()).provider_id() == provider.provider_id()
assert (
prediction.provider_by_id(provider.provider_id()).provider_id()
== provider.provider_id()
)
def test_prediction_repr(prediction):
Binary file not shown.
+171 -182
View File
@@ -14,10 +14,11 @@
0.0,
0.0,
0.0,
1.0,
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
1.0,
0.0,
1.0,
0.0,
@@ -39,12 +40,11 @@
0.0,
0.0,
0.0,
1.0,
1.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1.0,
1.0,
0.0,
0.0,
0.0
@@ -111,44 +111,45 @@
0,
0,
1,
0,
1,
1,
1,
0,
1,
0,
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
1,
1,
1,
1,
0,
1,
0,
0,
1,
0,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
0,
0,
1,
0,
0,
1,
1,
0
],
"battery_grid_export_allowed": [],
"eautocharge_hours_float": null,
"result": {
"Last_Wh_pro_Stunde": [
@@ -156,7 +157,7 @@
1063.91,
1320.56,
1132.03,
1163.67,
1308.5200000002487,
1176.82,
1216.22,
1103.78,
@@ -237,10 +238,10 @@
0.0,
0.0,
0.0,
0.19391086083906173,
0.18681973047764083,
0.12880892587597292,
0.02404700392596282,
0.20303854854278033,
0.1899652543898917,
0.12833851757957424,
0.04233866391809883,
0.0,
0.0,
0.0,
@@ -261,20 +262,20 @@
0.0,
0.0,
0.0,
0.12500582038027028,
0.14608958812480227,
0.09047346757070289,
0.010404817872487553,
0.16357655037574115,
0.14900060381217387,
0.08949503544160814,
0.010110585812541543,
0.0,
0.0,
0.0,
0.0,
0.0
],
"Gesamt_Verluste": 2878.660271824896,
"Gesamtbilanz_Euro": 1.053854835771092,
"Gesamteinnahmen_Euro": 0.9055602150669013,
"Gesamtkosten_Euro": 1.9594150508379933,
"Gesamt_Verluste": 2807.7292841655817,
"Gesamtbilanz_Euro": 0.8879905947253857,
"Gesamteinnahmen_Euro": 0.9758637598724098,
"Gesamtkosten_Euro": 1.8638543545977955,
"Home_appliance_wh_per_hour": [
0.0,
0.0,
@@ -316,82 +317,82 @@
0.0
],
"Kosten_Euro_pro_Stunde": [
0.0,
0.004569992000000018,
0.0,
0.0,
0.0,
0.001880612819166666,
0.026623430000091274,
4.482711108977355e-14,
0.0,
0.016809914659344942,
0.0,
0.008763569215739961,
0.018335381563380656,
0.06267084962493971,
0.05480703000000003,
0.225316611,
0.0,
0.291163892,
0.26650619799999997,
0.19588158,
0.0,
0.0,
0.0,
0.0,
0.22802125600000003,
0.0,
0.182970359,
0.162995926,
0.0,
0.26411047,
0.16677339,
0.0,
0.0,
0.0,
0.0,
0.0,
0.010682755832597498,
0.02844719513362201,
0.0,
0.0003442778967139274,
0.0,
0.028137079449292023,
0.0004412281431084693,
0.008372170029774037,
0.03130999506792791,
0.0,
0.08231598,
0.174597189,
0.293043269,
0.0,
0.0,
0.16484566
],
"Netzbezug_Wh_pro_Stunde": [
0.0,
20.660000000000082,
0.0,
0.0,
0.0,
10.008583390988111,
144.8500000004966,
2.236881790906864e-10,
0.0,
74.05248748610107,
0.0,
39.870651572975255,
80.77260600608219,
209.11194402715952,
171.54000000000008,
731.31,
0.0,
980.68,
912.38,
704.61,
0.0,
0.0,
0.0,
0.0,
694.34,
0.0,
556.31,
488.89,
0.0,
799.85,
506.91,
0.0,
0.0,
0.0,
0.0,
0.0,
56.853410498124,
135.91588692604878,
0.0,
1.7179535764168035,
0.0,
123.95189184710142,
2.201737241060226,
38.089945540373236,
137.92949369131236,
0.0,
257.64,
566.69,
987.01,
0.0,
0.0,
592.97
],
@@ -401,10 +402,10 @@
0.0,
0.0,
0.0,
2770.155154843739,
2668.8532925377262,
1840.127512513899,
343.5286275137546,
2900.550693468291,
2713.7893484270244,
1833.4073939939178,
604.8380559728405,
0.0,
0.0,
0.0,
@@ -425,10 +426,10 @@
0.0,
0.0,
0.0,
1785.797434003861,
2086.994116068604,
1292.4781081528986,
148.64025532125078,
2336.807862510588,
2128.580054459627,
1278.5005063086878,
144.4369401791649,
0.0,
0.0,
0.0,
@@ -437,83 +438,83 @@
],
"Verluste_Pro_Stunde": [
16.744090909090914,
0.0,
2.817272727272737,
29.157272727272726,
3.7179773678125034,
582.6180000000041,
188.65138141872444,
10.782457846871594,
2.358169993081436,
600.0000000000002,
173.00391678377832,
0.0,
59.810111380126784,
0.0,
99.72409090909093,
0.0,
124.41545454545451,
96.08318181818186,
0.0,
0.0,
133.72909090909081,
0.0,
0.0,
70.41409090909087,
118.37045454545455,
0.0,
94.68272727272722,
83.01681818181817,
0.0,
0.0,
69.12409090909085,
0.0,
109.0704545454546,
109.96227272727276,
47.952272727272714,
16.01263877609336,
55.946263193163475,
161.62968357967037,
14.209990740225123,
16.031648664443644,
55.9754990365584,
143.33449356887422,
21.973794868109557,
538.2984000000038,
227.42215349036655,
10.13011689299087,
0.0,
44.377460775206174,
161.2428480298022,
0.0,
0.0,
44.91187685729284,
0.0,
0.0,
134.59227272727276,
100.08954545454549,
0.0
],
"akku_soc_pro_stunde": [
80.0,
79.4714617768595,
79.4714617768595,
78.55109331955923,
78.57585051614844,
94.75968384947988,
100.0,
100.0,
100.0,
100.0,
100.0,
96.85214359504131,
96.85214359504131,
92.92488808539943,
89.89195936639118,
87.6692923553719,
83.93285123966942,
83.93285123966942,
81.31237086776858,
81.31237086776858,
81.31237086776858,
79.13042355371898,
79.13042355371898,
75.65939221763084,
74.14574724517905,
74.30696088041155,
74.82732877552169,
78.33526266026307,
78.72998462526934,
93.68271795860093,
79.38253271349862,
78.46216425619835,
78.52766897822838,
95.19433564489505,
100.0,
100.0,
100.0,
100.0,
100.0,
100.0,
95.77875344352617,
95.77875344352617,
95.77875344352617,
93.55608643250687,
89.8196453168044,
86.83092286501376,
84.21044249311292,
84.21044249311292,
84.21044249311292,
84.21044249311292,
80.76756198347105,
77.2965306473829,
75.78288567493111,
75.93522642877453,
76.44194846937079,
80.42346217961729,
80.56829866584056,
95.52103199917215,
100.0,
96.84060778236915
100.0,
100.0,
100.0,
100.0,
100.0,
95.75150654269973,
92.59211432506888
],
"Electricity_price": [
0.000228,
@@ -554,6 +555,46 @@
0.0002969,
0.0002921,
0.000278
],
"Feed_in_tariff": [
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05
]
},
"eauto_obj": {
@@ -667,14 +708,12 @@
"initial_soc_percentage": 54
},
"start_solution": [
1.0,
1.0,
1.0,
1.0,
0.0,
0.0,
1.0,
2.0,
0.0,
1.0,
2.0,
2.0,
1.0,
1.0,
@@ -683,90 +722,40 @@
1.0,
1.0,
0.0,
1.0,
2.0,
2.0,
0.0,
2.0,
2.0,
0.0,
1.0,
2.0,
1.0,
0.0,
0.0,
1.0,
1.0,
1.0,
1.0,
0.0,
1.0,
0.0,
0.0,
1.0,
0.0,
1.0,
1.0,
1.0,
1.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
2.0,
2.0,
1.0,
0.0,
0.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
2.0,
2.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0
0.0
],
"washingstart": null
}
}
+185 -196
View File
@@ -14,6 +14,13 @@
0.0,
0.0,
0.0,
1.0,
1.0,
0.0,
1.0,
1.0,
0.0,
1.0,
0.0,
0.0,
0.0,
@@ -34,14 +41,7 @@
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
@@ -111,16 +111,15 @@
0,
0,
1,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
0,
0,
0,
1,
0,
@@ -129,6 +128,16 @@
1,
1,
1,
0,
0,
1,
1,
1,
0,
0,
0,
0,
1,
1,
0,
1,
@@ -136,19 +145,11 @@
0,
0,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0
1
],
"battery_grid_export_allowed": [],
"eautocharge_hours_float": null,
"result": {
"Last_Wh_pro_Stunde": [
@@ -156,7 +157,7 @@
1063.91,
1320.56,
1132.03,
1163.67,
1308.5200000002487,
1176.82,
1216.22,
1103.78,
@@ -237,10 +238,10 @@
0.0,
0.0,
0.0,
0.19478794541504615,
0.18681973047764083,
0.12880892587597292,
0.02404700392596282,
0.20303854854278033,
0.1899652543898917,
0.12833851757957424,
0.04233866391809883,
0.0,
0.0,
0.0,
@@ -261,20 +262,20 @@
0.0,
0.0,
0.0,
0.17104472158211628,
0.14608958812480227,
0.09047346757070289,
0.010404817872487553,
0.16452297290911175,
0.1455575560489687,
0.08949503544160814,
0.024046008596276005,
0.0,
0.0,
0.0,
0.0,
0.0
],
"Gesamt_Verluste": 2804.7326610375394,
"Gesamtbilanz_Euro": 0.9004618481798127,
"Gesamteinnahmen_Euro": 0.9524762008447317,
"Gesamtkosten_Euro": 1.8529380490245444,
"Gesamt_Verluste": 2717.1309464905708,
"Gesamtbilanz_Euro": 0.998163925609791,
"Gesamteinnahmen_Euro": 0.9873025574263097,
"Gesamtkosten_Euro": 1.9854664830361006,
"Home_appliance_wh_per_hour": [
0.0,
0.0,
@@ -317,83 +318,83 @@
],
"Kosten_Euro_pro_Stunde": [
0.0,
0.004569992000000018,
0.0,
0.0018232052307313393,
0.0,
0.001880612819166666,
0.026623430000091274,
4.482711108977355e-14,
0.0,
0.016809914659344942,
0.0,
0.008763569215739961,
0.018335381563380656,
0.06267084962493971,
0.05480703000000003,
0.225316611,
0.0,
0.291163892,
0.0,
0.26650619799999997,
0.19588158,
0.174739608,
0.0,
0.0,
0.0,
0.0,
0.182970359,
0.162995926,
0.0,
0.0,
0.16677339,
0.0,
0.24530383800000005,
0.08545095,
0.007989913613567745,
0.028255713342252034,
0.008254784724581705,
0.028650916976410694,
0.02844719513362201,
0.0,
0.010682755832597498,
0.0,
0.0003442778967139274,
0.0,
0.028137079449292023,
0.0004412281431084693,
0.0,
0.03130999506792791,
0.04620342776708689,
0.08231598,
0.0,
0.174597189,
0.293043269,
0.0,
0.16484566
0.0
],
"Netzbezug_Wh_pro_Stunde": [
0.0,
20.660000000000082,
0.0,
9.703061366318996,
0.0,
10.008583390988111,
144.8500000004966,
2.236881790906864e-10,
0.0,
74.05248748610107,
0.0,
39.870651572975255,
80.77260600608219,
209.11194402715952,
171.54000000000008,
731.31,
0.0,
980.68,
0.0,
912.38,
704.61,
516.37,
0.0,
0.0,
0.0,
0.0,
556.31,
488.89,
0.0,
0.0,
506.91,
0.0,
806.3900000000001,
351.65,
35.04348076126204,
127.73830624887898,
36.20519616044607,
129.52494112301397,
135.91588692604878,
0.0,
56.853410498124,
0.0,
1.7179535764168035,
0.0,
123.95189184710142,
2.201737241060226,
0.0,
137.92949369131236,
154.1655914817714,
257.64,
0.0,
566.69,
987.01,
0.0,
592.97
0.0
],
"Netzeinspeisung_Wh_pro_Stunde": [
0.0,
@@ -401,10 +402,10 @@
0.0,
0.0,
0.0,
2782.6849345006594,
2668.8532925377262,
1840.127512513899,
343.5286275137546,
2900.550693468291,
2713.7893484270244,
1833.4073939939178,
604.8380559728405,
0.0,
0.0,
0.0,
@@ -425,10 +426,10 @@
0.0,
0.0,
0.0,
2443.4960226016615,
2086.994116068604,
1292.4781081528986,
148.64025532125078,
2350.3281844158823,
2079.39365784241,
1278.5005063086878,
343.51440851822866,
0.0,
0.0,
0.0,
@@ -437,83 +438,83 @@
],
"Verluste_Pro_Stunde": [
16.744090909090914,
0.0,
2.817272727272737,
29.157272727272726,
2.3948326360417305,
582.6180000000041,
187.1478078598941,
10.782457846871594,
0.0,
59.810111380126784,
0.0,
99.72409090909093,
0.0,
124.41545454545451,
2.358169993081436,
600.0000000000002,
173.00391678377832,
0.0,
0.0,
0.0,
0.0,
0.0,
133.72909090909081,
0.0,
0.0,
70.41409090909087,
118.37045454545455,
94.68272727272722,
83.01681818181817,
75.86045454545456,
66.66681818181814,
0.0,
0.0,
69.12409090909085,
109.0704545454546,
109.96227272727276,
0.0,
0.0,
11.233982308648535,
38.52740325013451,
161.62968357967037,
14.209990740225123,
11.094576460746453,
38.31300706523831,
143.33449356887422,
21.973794868109557,
538.2984000000038,
148.49832285863067,
10.13011689299087,
159.62040940116685,
11.096451076844168,
0.0,
0.0,
0.0,
44.377460775206174,
0.0,
77.27590909090907,
0.0,
100.08954545454549,
0.0
80.85954545454547
],
"akku_soc_pro_stunde": [
80.0,
79.4714617768595,
79.4714617768595,
78.55109331955923,
78.61761644833817,
94.80144978166962,
79.38253271349862,
78.46216425619835,
78.52766897822838,
95.19433564489505,
100.0,
100.0,
100.0,
100.0,
100.0,
96.85214359504131,
96.85214359504131,
92.92488808539943,
92.92488808539943,
92.92488808539943,
89.18844696969695,
86.19972451790632,
83.57924414600548,
81.18465909090907,
79.08027720385672,
79.08027720385672,
75.63739669421484,
75.63739669421484,
75.63739669421484,
75.94945175834397,
77.01965740418103,
80.52759128892241,
80.92231325392866,
95.87504658726026,
100.0,
95.77875344352617,
95.77875344352617,
95.77875344352617,
93.55608643250687,
89.8196453168044,
86.83092286501376,
84.21044249311292,
84.21044249311292,
84.21044249311292,
82.02849517906333,
78.58561466942146,
75.1145833333333,
75.1145833333333,
75.42276601279848,
76.4870162090551,
80.4685299193016,
80.61336640552487,
95.56609973885648,
100.0,
100.0,
100.0,
100.0,
100.0,
97.56073519283747,
97.56073519283747,
94.40134297520663
100.0,
100.0,
96.84060778236915
],
"Electricity_price": [
0.000228,
@@ -554,6 +555,46 @@
0.0002969,
0.0002921,
0.000278
],
"Feed_in_tariff": [
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05
]
},
"eauto_obj": {
@@ -667,28 +708,27 @@
"initial_soc_percentage": 54
},
"start_solution": [
1.0,
1.0,
1.0,
1.0,
0.0,
1.0,
0.0,
1.0,
2.0,
2.0,
1.0,
1.0,
0.0,
1.0,
1.0,
1.0,
0.0,
1.0,
2.0,
2.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
2.0,
2.0,
0.0,
2.0,
1.0,
0.0,
0.0,
@@ -696,77 +736,26 @@
1.0,
1.0,
1.0,
1.0,
0.0,
0.0,
1.0,
1.0,
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
2.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
0.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0
],
"washingstart": null
}
}
+108 -67
View File
@@ -149,17 +149,18 @@
1,
1
],
"battery_grid_export_allowed": [],
"eautocharge_hours_float": [
1.0,
0.5,
0.375,
0.375,
1.0,
0.75,
1.0,
0.75,
0.5,
0.875,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.875,
0.75,
@@ -168,36 +169,36 @@
0.375,
0.75,
0.875,
0.625,
1.0,
0.75,
0.375,
0.75,
0.5,
0.5,
0.625,
0.875,
0.5,
0.1,
0.0,
0.0,
0.75,
0.875,
0.0,
0.0,
1.0,
0.375,
0.375,
1.0,
0.0,
0.875,
0.5,
1.0,
0.625,
0.75,
0.875,
1.0,
0.5,
0.5
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0
],
"result": {
"Last_Wh_pro_Stunde": [
@@ -309,21 +310,21 @@
0.0,
0.0,
0.0,
0.010924611164505103,
0.25751345302450973,
0.14608958812480227,
0.07926913850394514,
0.010404817872487553,
0.00826914812545985,
0.25743585772309185,
0.1455575560489687,
0.07702723513376727,
0.010110585812541543,
0.0,
0.0,
0.0,
0.0,
0.0
],
"Gesamt_Verluste": 5766.286846118221,
"Gesamtbilanz_Euro": 12.78299149726557,
"Gesamteinnahmen_Euro": 0.5042016086902498,
"Gesamtkosten_Euro": 13.28719310595582,
"Gesamt_Verluste": 5776.448801897527,
"Gesamtbilanz_Euro": 12.789452797857164,
"Gesamteinnahmen_Euro": 0.49840038284382926,
"Gesamtkosten_Euro": 13.287853180700994,
"Home_appliance_wh_per_hour": [
0.0,
0.0,
@@ -389,8 +390,8 @@
0.0,
0.0,
0.0,
0.007989913613567745,
0.028255713342252034,
0.008254784724581705,
0.028650916976410694,
0.0,
0.0,
0.0,
@@ -429,8 +430,8 @@
0.0,
0.0,
0.0,
35.04348076126204,
127.73830624887898,
36.20519616044607,
129.52494112301397,
0.0,
0.0,
0.0,
@@ -473,11 +474,11 @@
0.0,
0.0,
0.0,
156.06587377864435,
3678.7636146358536,
2086.994116068604,
1132.4162643420734,
148.64025532125078,
118.1306875065693,
3677.655110329884,
2079.39365784241,
1100.3890733395326,
144.4369401791649,
0.0,
0.0,
0.0,
@@ -509,15 +510,15 @@
109.0704545454546,
109.96227272727276,
47.952272727272714,
11.233982308648535,
38.52740325013451,
161.62968357967037,
21.962728535423857,
519.5704951465664,
0.5004782113116364,
10.13011689299087,
36.109951963721926,
44.377460775206174,
11.094576460746453,
38.31300706523831,
161.86847814969906,
21.973794868109557,
524.1227174992155,
0.6414151879949013,
11.096451076844168,
40.181939277841224,
44.91187685729284,
0.0,
0.0,
0.0,
@@ -550,10 +551,10 @@
85.51196625344349,
82.04093491735533,
80.52728994490354,
80.83934500903268,
81.90955065486975,
85.41748453961112,
85.56748624593055,
80.83547262436872,
81.89972282062534,
85.29619913880036,
85.44103562502363,
100.0,
100.0,
100.0,
@@ -603,6 +604,46 @@
0.0002969,
0.0002921,
0.000278
],
"Feed_in_tariff": [
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05
]
},
"eauto_obj": {
@@ -815,4 +856,4 @@
14.0
],
"washingstart": 14
}
}
+335 -294
View File
@@ -10,11 +10,19 @@
0.0,
0.0,
0.0,
1.0,
0.0,
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
1.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
@@ -26,23 +34,15 @@
0.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
@@ -110,32 +110,6 @@
0,
0,
0,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
1,
1,
0,
0,
1,
1,
0,
0,
1,
1,
0,
1,
0,
0,
0,
0,
0,
0,
0,
@@ -143,90 +117,117 @@
1,
1,
0,
0,
0,
0,
1,
0,
0,
1,
0,
0,
1,
0,
1,
1,
0,
1,
1,
1,
0,
0,
1
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
0
],
"battery_grid_export_allowed": [],
"eautocharge_hours_float": [
0.625,
0.375,
0.5,
1.0,
1.0,
0.75,
0.5,
0.375,
0.375,
0.625,
0.75,
0.875,
0.625,
0.625,
0.625,
1.0,
0.375,
0.625,
0.875,
0.0,
0.5,
0.0,
0.0,
0.5,
0.875,
0.625,
0.75,
0.5,
0.375,
0.375,
0.75,
0.625,
1.0,
0.375,
0.625,
0.625,
0.0,
0.5,
0.875,
0.375,
0.5,
0.875,
0.5,
0.875,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.75,
0.625,
0.5,
0.375,
0.875,
0.5,
0.75,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0
],
"result": {
"Last_Wh_pro_Stunde": [
8919.07,
10240.91,
7875.5599999999995,
7687.03,
7718.67,
11664.82,
5149.22,
6347.78,
16541.07,
8929.91,
8875.56,
6376.03,
5096.67,
12853.82,
8960.220000000001,
13969.78,
1129.12,
8678.71,
3550.98,
1178.71,
1050.98,
988.56,
912.38,
1912.38,
704.61,
516.37,
868.05,
5694.34,
608.79,
694.34,
2108.79,
556.31,
488.89,
506.91,
804.89,
6141.98,
1141.98,
1056.97,
992.46,
6155.99,
1155.99,
827.01,
1257.98,
1232.67,
@@ -242,13 +243,13 @@
],
"EAuto_SoC_pro_Stunde": [
5.0,
18.11,
33.405,
44.330000000000005,
22.48,
35.589999999999996,
46.515,
55.254999999999995,
66.18,
83.66,
90.215,
61.809999999999995,
77.105,
85.845,
98.955,
98.955,
98.955,
@@ -285,6 +286,7 @@
0.0,
0.0,
0.0,
0.06455049999999336,
0.0,
0.0,
0.0,
@@ -308,27 +310,22 @@
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.12279079241545988,
0.25743585772309185,
0.1455575560489687,
0.07702723513376727,
0.024046008596276005,
0.0,
0.0,
0.0,
0.0,
0.0
],
"Gesamt_Verluste": 10674.660531928814,
"Gesamtbilanz_Euro": 14.366070195145795,
"Gesamteinnahmen_Euro": 0.0,
"Gesamtkosten_Euro": 14.366070195145795,
"Gesamt_Verluste": 6842.366945701403,
"Gesamtbilanz_Euro": 14.10088133917546,
"Gesamteinnahmen_Euro": 0.6914079499175572,
"Gesamtkosten_Euro": 14.792289289093018,
"Home_appliance_wh_per_hour": [
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
@@ -362,93 +359,98 @@
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0
],
"Kosten_Euro_pro_Stunde": [
0.81824412,
1.061242392,
0.49579402599999994,
0.399351386,
0.13127915000000007,
1.2316083,
0.259218932,
0.7558691399999999,
0.061530097476751734,
2.4510570300000003,
3.55926012,
1.7445291920000001,
1.6260140259999998,
0.979774486,
0.0,
0.5881238999999999,
1.0968767320000004,
2.4860631399999997,
0.06267084962493971,
0.05480703000000003,
0.0,
0.26650619799999997,
0.19588158,
0.13029273082161758,
0.291163892,
0.558606198,
0.0,
0.174739608,
0.28801899,
1.870021256,
0.199865757,
0.0,
0.692315757,
0.0,
0.0,
0.16677339,
0.0,
1.7663038380000002,
0.08545095,
0.007989913613567745,
1.134255713342252,
0.025392879919306634,
0.010682755832597498,
4.174095896658514e-14,
0.0003442778967139274,
0.0,
0.0,
0.04565364324294593,
0.008254784724581705,
0.028650916976410694,
0.0,
0.0,
0.293043269,
0.214398479,
0.0
0.0,
0.0,
0.0,
0.0,
0.04620342776708689,
0.0,
0.174597189,
0.0,
0.0,
0.16484566
],
"Netzbezug_Wh_pro_Stunde": [
3588.79,
4797.66,
2368.8199999999997,
2125.34,
714.2500000000003,
6145.75,
1179.3400000000001,
3329.8199999999997,
205.30563055305882,
7671.54,
15610.789999999999,
7886.66,
7768.82,
5214.34,
0.0,
2934.75,
4990.340000000001,
10951.82,
209.11194402715952,
171.54000000000008,
0.0,
912.38,
704.61,
385.0258003002884,
980.68,
1912.38,
0.0,
516.37,
868.05,
5694.34,
608.79,
0.0,
2108.79,
0.0,
0.0,
506.91,
0.0,
5806.39,
351.65,
35.04348076126204,
5127.738306248879,
121.32288542430308,
56.853410498124,
2.270998855635753e-10,
1.7179535764168035,
0.0,
0.0,
152.3311419517715,
36.20519616044607,
129.52494112301397,
0.0,
0.0,
987.01,
733.99,
0.0
0.0,
0.0,
0.0,
0.0,
154.1655914817714,
0.0,
566.69,
0.0,
0.0,
592.97
],
"Netzeinspeisung_Wh_pro_Stunde": [
0.0,
0.0,
0.0,
0.0,
922.1499999999053,
0.0,
0.0,
0.0,
@@ -472,12 +474,11 @@
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1754.1541773637127,
3677.655110329884,
2079.39365784241,
1100.3890733395326,
343.51440851822866,
0.0,
0.0,
0.0,
@@ -485,84 +486,84 @@
0.0
],
"Verluste_Pro_Stunde": [
1014.0,
1083.0,
945.0,
945.0,
479.4,
552.0,
207.0,
1152.0,
414.0,
465.0,
276.0,
73.03732433363291,
600.0,
440.6331818181816,
133.72909090909081,
207.00000000001197,
1083.0,
276.0,
1014.0,
72.5805667167408,
0.0,
99.72409090909093,
0.0,
120.0,
96.08318181818186,
0.0,
0.0,
17.910572686324315,
0.0,
600.0,
0.0,
94.68272727272722,
180.0,
75.86045454545456,
66.66681818181814,
0.0,
109.0704545454546,
600.0,
109.96227272727276,
47.952272727272714,
11.094576460746453,
38.31300706523831,
161.86847814969906,
21.973794868109557,
327.79989871635826,
0.6414151879949013,
11.096451076844168,
40.181939277841224,
0.0,
11.233982308648535,
638.5274032501345,
145.08565374908358,
14.209990740225123,
538.2983999999728,
441.7178455708299,
260.56941082122324,
171.99990368477063,
41.441862965787436,
35.132727272727266,
77.27590909090907,
0.0,
0.0,
80.85954545454547
134.59227272727276,
100.08954545454549,
0.0
],
"akku_soc_pro_stunde": [
80.0,
61.06060606060606,
42.12121212121212,
23.18181818181818,
4.242424242424243,
0.0,
0.0,
0.0,
0.0,
2.0288145648231377,
18.695481231489804,
4.786605542784571,
0.5653589863107422,
0.5653589863107422,
0.5653589863107422,
0.0,
0.0,
16.666666666666664,
16.666666666666664,
14.272081611570247,
12.167699724517906,
12.167699724517906,
8.724819214876034,
25.391485881542703,
25.391485881542703,
25.703540945671826,
43.44041325817556,
47.47057030676122,
47.86529227176747,
62.81802560510005,
75.08796575984533,
82.04461281340734,
85.81933369454761,
86.97049655470836,
85.86150895140257,
83.42224414424004,
83.42224414424004,
83.42224414424004
96.66666666666667,
96.66666666666667,
100.0,
100.0,
100.0,
81.06060606060606,
81.06060606060606,
97.72727272727273,
99.74339958051553,
99.74339958051553,
96.59554317555684,
96.59554317555684,
99.92887650889017,
96.89594778988192,
96.89594778988192,
96.89594778988192,
93.90722533809128,
98.90722533809128,
96.51264028299485,
94.40825839594251,
94.40825839594251,
90.96537788630063,
87.49434655021247,
85.9807015777607,
86.28888425722586,
87.35313445348248,
90.7496107716575,
90.89444725788077,
100.0,
100.0,
100.0,
100.0,
100.0,
98.89101239669421,
98.89101239669421,
94.64251893939394,
91.48312672176309
],
"Electricity_price": [
0.000228,
@@ -603,6 +604,46 @@
0.0002969,
0.0002921,
0.000278
],
"Feed_in_tariff": [
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05
]
},
"eauto_obj": {
@@ -619,14 +660,14 @@
0.0,
0.0,
0.0,
0.75,
0.875,
0.625,
0.625,
0.625,
1.0,
0.375,
0.75,
0.625,
0.5,
0.375,
0.875,
0.5,
0.75,
0.0,
0.0,
0.0,
@@ -716,103 +757,103 @@
"initial_soc_percentage": 5
},
"start_solution": [
2.0,
2.0,
0.0,
0.0,
2.0,
0.0,
0.0,
1.0,
2.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
0.0,
0.0,
2.0,
1.0,
1.0,
2.0,
2.0,
0.0,
0.0,
1.0,
1.0,
2.0,
0.0,
1.0,
1.0,
0.0,
1.0,
2.0,
0.0,
2.0,
1.0,
0.0,
2.0,
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
2.0,
1.0,
1.0,
0.0,
1.0,
1.0,
1.0,
0.0,
0.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
2.0,
1.0,
0.0,
1.0,
1.0,
0.0,
1.0,
6.0,
5.0,
3.0,
0.0,
0.0,
4.0,
6.0,
3.0,
1.0,
2.0,
6.0,
6.0,
4.0,
3.0,
2.0,
1.0,
5.0,
2.0,
4.0,
4.0,
6.0,
5.0,
0.0,
2.0,
2.0,
2.0,
4.0,
0.0,
1.0,
3.0,
4.0,
5.0,
3.0,
3.0,
3.0,
6.0,
1.0,
3.0,
5.0,
0.0,
2.0,
0.0,
0.0,
2.0,
5.0,
3.0,
4.0,
2.0,
1.0,
1.0,
4.0,
3.0,
6.0,
1.0,
3.0,
3.0,
5.0,
2.0,
0.0,
2.0,
5.0,
1.0,
2.0,
5.0,
2.0,
6.0,
4.0,
5.0,
4.0,
3.0,
4.0,
0.0,
19.0
3.0,
1.0,
3.0,
15.0
],
"washingstart": 19
}
"washingstart": 15
}