refactor(genetic0): refactor GENETIC0 to consolidated optimizer architecture

Pin the conversion, plan and visualization of golden runs.
Drive GENETIC0 through the optimizer registry.
Move GENETIC0 into one directory with role-named modules.
Prepare every run input once, run from the parameters.
Fall back on bad inputs instead of cancelling the run.
Simulate from frozen device dataclasses, not settings.
Convert and visualize from the parameters and result only.
Serve GENETIC0 from its own router, return a frozen result.

Additional changes
- Fix the run start of the golden runs and add a run across the DST switch.
- Configure a home appliance so the conversion covers it.
- Pass the warm start to the legacy preparation instead of reading the EMS.
- Replace EnergyManagement.genetic0_solution() by optimizer_result(name).
- Cover the warm start of the parameter preparation.
- Rename Genetic0OptimizationParameters to Genetic0Request, Genetic0CommonSettings to Genetic0Settings.
- Say in ADR 0007 and the skill that a move relabels baseline entries one to one.
- Record the renamed OpenAPI schemas in CHANGELOG.md and the upgrade guide.
- Add the observation time to the optimizer interface.
- Cache the load interpolator by its backend instead of in the EMS run cache.
- Add replay files that reproduce each golden result from its parameters.
- Stop writing demo providers, demo devices and defaults into the configuration.
- Count a NaN state of charge as invalid.
- Remove the unused electricity fee check.
- Record the fallbacks in CHANGELOG.md instead of the former demo providers.
- Leave out a battery that is not linked to the inverter.
- Count infinite forecast values as missing.
- Extend a prediction.hours that leaves fewer than two hours after the start hour.
- Do not charge from the grid without any known price.
- Without an inverter, buy the whole load from the grid instead of planning it at no cost.
- Keep the zone of the run start in the replay files.
- Correct the DVhub documentation that said a missing tariff cancels the run.
- Rename the request models to <Name><Thing>Request.
- Move the settings' to_genetic0_*() converters into the preparation.
- Remove the solution's unreachable configuration fallbacks.
- Record the renamed OpenAPI schemas in CHANGELOG.md and the upgrade guide.
- Add EnergyManagement.optimizer_run() and render the PDF from the run's own start.
- Read the presentation series from the earlier of the run's start hours.
- Render the PDF report for runs of any length, not only 48 hours.
- Add the generic OptimizerProblem, rendered like EOSProblem.
- Move Genetic0ParametersBaseModel into genetic0request.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: Claude Code (claude-opus-5-5)
This commit is contained in:
Bobby Noelte
2026-11-27 13:55:41 +01:00
co-authored by Claude Opus 5.5
parent 9adf7b8be2
commit 40d0fab9d2
89 changed files with 44476 additions and 3933 deletions
+10 -11
View File
@@ -14,8 +14,8 @@ from loguru import logger
from akkudoktoreos.core.coreabc import get_config, get_ems, get_prediction
from akkudoktoreos.core.emsettings import EnergyManagementMode
from akkudoktoreos.optimization.genetic0.genetic0params import (
Genetic0OptimizationParameters,
from akkudoktoreos.optimization.genetic0.genetic0request import (
Genetic0Request,
)
from akkudoktoreos.optimization.optimization import OptimizationAlgorithm
from akkudoktoreos.utils.datetimeutil import to_datetime
@@ -25,7 +25,7 @@ prediction_eos = get_prediction()
ems_eos = get_ems()
async def prepare_optimization_real_parameters() -> Genetic0OptimizationParameters:
async def prepare_optimization_real_parameters() -> Genetic0Request:
"""Prepare and return optimization parameters with real world data.
Returns:
@@ -170,7 +170,7 @@ async def prepare_optimization_real_parameters() -> Genetic0OptimizationParamete
print(f"start_solution: {start_solution}")
# Define parameters for the optimization problem
return Genetic0OptimizationParameters.model_validate({
return Genetic0Request.model_validate({
"ems": {
"price_per_wh_battery": 0e-05,
"feed_in_tariff_per_wh": 7e-05,
@@ -202,7 +202,7 @@ async def prepare_optimization_real_parameters() -> Genetic0OptimizationParamete
})
def prepare_optimization_parameters() -> Genetic0OptimizationParameters:
def prepare_optimization_parameters() -> Genetic0Request:
"""Prepare and return optimization parameters with predefined data.
Returns:
@@ -364,7 +364,7 @@ def prepare_optimization_parameters() -> Genetic0OptimizationParameters:
start_solution = None
# Define parameters for the optimization problem
return Genetic0OptimizationParameters.model_validate({
return Genetic0Request.model_validate({
"ems": {
"price_per_wh_battery": 0e-05,
"feed_in_tariff_per_wh": 7e-05,
@@ -411,7 +411,7 @@ def run_optimization(
# Prepare parameters
if parameters_file:
with open(parameters_file, "r") as f:
parameters = Genetic0OptimizationParameters(**json.load(f))
parameters = Genetic0Request(**json.load(f))
elif real_world:
parameters = asyncio.run(prepare_optimization_real_parameters())
else:
@@ -429,13 +429,12 @@ def run_optimization(
start_datetime=start_datetime,
mode=EnergyManagementMode.OPTIMIZATION,
algorithm=OptimizationAlgorithm.GENETIC0,
genetic0_parameters=parameters,
genetic0_generations=ngen,
genetic0_seed=seed,
request=parameters,
overrides={"generations": ngen, "seed": seed},
)
)
solution = ems_eos.genetic0_solution()
solution = ems_eos.optimizer_result(OptimizationAlgorithm.GENETIC0)
if solution is None:
return None
return solution.model_dump_json()
+33 -15
View File
@@ -76,6 +76,24 @@ PARAMETER_METHODS = [
"to_genetic0_ev_bat_param",
]
# GENETIC0's conversions live in its parameter preparation (ADR 0004), not in the settings.
GENETIC0_CONVERSIONS = {
"to_genetic0_pv_bat_param": "battery_request",
"to_genetic0_ev_bat_param": "electric_vehicle_request",
}
def converter(settings, method):
"""The conversion ``method`` of the settings, or GENETIC0's function for them."""
if method in GENETIC0_CONVERSIONS:
from akkudoktoreos.optimization.genetic0 import genetic0prepare
function = getattr(genetic0prepare, GENETIC0_CONVERSIONS[method])
return lambda *args, **kwargs: function(settings, *args, **kwargs)
return getattr(settings, method)
COMPUTED_FIELDS = [
"effective_nominal_capacity_wh",
"effective_max_charge_power_w",
@@ -876,7 +894,7 @@ class TestGetBatteryProfile:
):
settings = make_settings(battery_profile="does-not-exist")
with pytest.raises(BatteryResolutionError, match="does-not-exist"):
getattr(settings, method)()
converter(settings, method)()
# --- Maximum charge power -------------------------------------------------------
@@ -951,7 +969,7 @@ class TestMaxChargePower:
parameters = await current(settings)
assert parameters.max_charge_power_w == 0.0
assert settings.to_genetic_pv_bat_param(parameters).max_charge_power_w == 0.0
assert settings.to_genetic0_pv_bat_param(parameters).max_charge_power_w == 0.0
assert converter(settings, "to_genetic0_pv_bat_param")(parameters).max_charge_power_w == 0.0
def test_zero_charge_power_yields_zero(self, make_profiled_settings):
settings = make_profiled_settings(make_profile(charge=0.0), capacity_wh=10000)
@@ -1311,7 +1329,7 @@ class TestOptimizationParameters:
@pytest.mark.parametrize("method", PARAMETER_METHODS)
def test_values_come_from_profile(self, make_profiled_settings, full_profile, method):
settings = make_profiled_settings(full_profile, capacity_wh=10000)
params = getattr(settings, method)()
params = converter(settings, method)()
assert params.device_id == "battery1"
assert params.capacity_wh == 10000
assert params.max_charge_power_w == pytest.approx(5000.0)
@@ -1323,7 +1341,7 @@ class TestOptimizationParameters:
@pytest.mark.parametrize("method", PARAMETER_METHODS)
def test_parameters_match_computed_fields(self, make_profiled_settings, full_profile, method):
settings = make_profiled_settings(full_profile, capacity_wh=10000)
params = getattr(settings, method)()
params = converter(settings, method)()
assert params.capacity_wh == settings.effective_nominal_capacity_wh
assert params.charging_efficiency == pytest.approx(settings.effective_charging_efficiency)
assert params.discharging_efficiency == pytest.approx(settings.effective_discharging_efficiency)
@@ -1340,7 +1358,7 @@ class TestOptimizationParameters:
grid[ROW_0_DEGC] = [0.1] * 10
settings = make_profiled_settings(make_profile(charge=grid), capacity_wh=10000)
measurements["battery1-temperature-degc"] = 0.0
params = getattr(settings, method)(await current(settings))
params = converter(settings, method)(await current(settings))
assert params.max_charge_power_w == pytest.approx(1000.0)
@pytest.mark.parametrize("method", PARAMETER_METHODS)
@@ -1351,7 +1369,7 @@ class TestOptimizationParameters:
measurements["battery1-charge-power-w"] = 2500.0
measurements["battery1-discharge-power-w"] = 2000.0
settings = make_profiled_settings(full_profile, capacity_wh=10000)
params = getattr(settings, method)(await current(settings))
params = converter(settings, method)(await current(settings))
assert params.charging_efficiency == pytest.approx(0.9225)
assert params.discharging_efficiency == pytest.approx(0.9125)
@@ -1362,7 +1380,7 @@ class TestOptimizationParameters:
grid = make_grid(0.5)
grid[ROW_0_DEGC] = [0.1] * 10
settings = make_profiled_settings(make_profile(charge=grid), capacity_wh=10000)
assert getattr(settings, method)().max_charge_power_w == pytest.approx(5000.0)
assert converter(settings, method)().max_charge_power_w == pytest.approx(5000.0)
assert measurement_calls == []
@pytest.mark.parametrize("method", PARAMETER_METHODS)
@@ -1371,7 +1389,7 @@ class TestOptimizationParameters:
snapshot = settings.resolve_operating_parameters(
BatteryOperatingPoint(charge_power_w=2500.0)
)
params = getattr(settings, method)(snapshot)
params = converter(settings, method)(snapshot)
assert params.capacity_wh == snapshot.capacity_wh
assert params.charging_efficiency == pytest.approx(snapshot.charging_efficiency)
assert params.max_charge_power_w == pytest.approx(snapshot.max_charge_power_w)
@@ -1381,7 +1399,7 @@ class TestOptimizationParameters:
self, make_profiled_settings, method
):
profile = make_profile(charge=0.5, nominal_capacity_wh=8000.0)
params = getattr(make_profiled_settings(profile), method)()
params = converter(make_profiled_settings(profile), method)()
assert params.capacity_wh == 8000
assert params.max_charge_power_w == pytest.approx(4000.0)
@@ -1390,7 +1408,7 @@ class TestOptimizationParameters:
settings = make_profiled_settings(
full_profile, capacity_wh=10000, charge_limit_w=2000.0
)
assert getattr(settings, method)().max_charge_power_w == pytest.approx(2000.0)
assert converter(settings, method)().max_charge_power_w == pytest.approx(2000.0)
@pytest.mark.parametrize("method", PARAMETER_METHODS)
def test_user_soc_range_is_clamped_into_technical_bounds(
@@ -1399,7 +1417,7 @@ class TestOptimizationParameters:
settings = make_profiled_settings(
full_profile, capacity_wh=10000, min_soc_percentage=10, max_soc_percentage=90
)
params = getattr(settings, method)()
params = converter(settings, method)()
assert params.min_soc_percentage == 10
assert params.max_soc_percentage == 90
@@ -1408,7 +1426,7 @@ class TestOptimizationParameters:
"""The optimization gets valid parameters that do not allow charging."""
profile = make_profile(hard_cutoffs=charge_inhibited_below_30())
settings = make_profiled_settings(profile, capacity_wh=10000)
assert getattr(settings, method)().max_charge_power_w == 0.0
assert converter(settings, method)().max_charge_power_w == 0.0
def test_genetic_pv_receives_storage_cost(self):
params = make_settings(levelized_cost_of_storage_amt_kwh=0.12).to_genetic_pv_bat_param()
@@ -1809,13 +1827,13 @@ class TestOptimizationDefaults:
settings = make_settings(capacity_wh=10000)
parameters, use_tables = settings.resolve_operating_parameters_or_defaults()
assert use_tables is True
expected = getattr(settings, method)(parameters, use_tables)
expected = converter(settings, method)(parameters, use_tables)
def missing(document_type, name, **options):
raise FileNotFoundError(f"No battery profile for '{name}'")
monkeypatch.setattr(get_profile_store(), "get", missing)
converted = getattr(settings, method)(parameters, use_tables)
converted = converter(settings, method)(parameters, use_tables)
assert converted.model_dump() == expected.model_dump()
def test_inhibited_charging_is_no_configuration_error(
@@ -1850,7 +1868,7 @@ class TestOptimizationDefaults:
def test_conversion_without_profile_tables(self, broken_profile_loader, method):
settings = make_settings(battery_profile="does-not-exist")
parameters, use_tables = settings.resolve_operating_parameters_or_defaults(report=False)
converted = getattr(settings, method)(parameters, use_tables)
converted = converter(settings, method)(parameters, use_tables)
assert converted.capacity_wh == 8000
assert converted.max_charge_power_w == pytest.approx(5000.0)
assert converted.charge_power_limit_w_by_soc is None
+2 -1
View File
@@ -23,6 +23,7 @@ from akkudoktoreos.devices.settings.invertersettings import (
InverterCommonSettings,
InverterProfileAdjustment,
)
from akkudoktoreos.optimization.genetic0 import genetic0prepare
def make_settings(**adjustment: Any) -> InverterCommonSettings:
@@ -245,7 +246,7 @@ class TestConversion:
def test_genetic0_parameters(self, generic):
settings = make_settings(nominal_power_w=10000)
genetic0 = settings.to_genetic0_param()
genetic0 = genetic0prepare.inverter_request(settings)
assert genetic0.max_power_wh == pytest.approx(10000)
assert genetic0.dc_to_ac_efficiency == pytest.approx(settings.effective_dc_to_ac_efficiency)
assert genetic0.ac_to_dc_efficiency == pytest.approx(settings.effective_ac_to_dc_efficiency)
+11 -11
View File
@@ -1,9 +1,9 @@
import numpy as np
import pytest
from akkudoktoreos.devices.genetic0.genetic0battery import (
Genetic0Battery,
Genetic0SolarPanelBatteryParameters,
from akkudoktoreos.optimization.genetic0.devices.genetic0battery import Genetic0Battery
from akkudoktoreos.optimization.genetic0.genetic0request import (
Genetic0SolarPanelBatteryRequest,
)
@@ -19,7 +19,7 @@ def setup_pv_battery():
max_charge_power_w=8000
hours=24
params = Genetic0SolarPanelBatteryParameters(
params = Genetic0SolarPanelBatteryRequest(
device_id=device_id,
capacity_wh=capacity_wh,
initial_soc_percentage=initial_soc_percentage,
@@ -31,7 +31,7 @@ def setup_pv_battery():
hours=hours,
)
battery = Genetic0Battery(
params,
params.to_parameters(),
prediction_hours=48,
)
battery.reset()
@@ -260,11 +260,11 @@ def test_charge_energy_with_charge_factor(setup_pv_battery, wh, charge_factor, e
@pytest.fixture
def setup_car_battery():
from akkudoktoreos.optimization.genetic0.genetic0params import (
Genetic0ElectricVehicleParameters,
from akkudoktoreos.optimization.genetic0.genetic0request import (
Genetic0ElectricVehicleRequest,
)
params = Genetic0ElectricVehicleParameters(
params = Genetic0ElectricVehicleRequest(
device_id="ev1",
capacity_wh=40000,
initial_soc_percentage=60,
@@ -274,7 +274,7 @@ def setup_car_battery():
hours=24,
)
battery = Genetic0Battery(
params,
params.to_parameters(),
prediction_hours=48,
)
battery.reset()
@@ -314,7 +314,7 @@ def test_car_and_pv_battery_discharge_and_max_charge_power(setup_pv_battery, set
def _battery_with_limits(max_charge_power_w, max_discharge_power_w=None) -> Genetic0Battery:
params = Genetic0SolarPanelBatteryParameters(
params = Genetic0SolarPanelBatteryRequest(
device_id="battery1",
capacity_wh=10000,
initial_soc_percentage=50,
@@ -323,7 +323,7 @@ def _battery_with_limits(max_charge_power_w, max_discharge_power_w=None) -> Gene
max_charge_power_w=max_charge_power_w,
max_discharge_power_w=max_discharge_power_w,
)
battery = Genetic0Battery(params, prediction_hours=24)
battery = Genetic0Battery(params.to_parameters(), prediction_hours=24)
battery.reset()
battery.discharge_array = np.full(battery.prediction_hours, 1)
battery.charge_array = np.full(battery.prediction_hours, 1)
+5 -5
View File
@@ -2,10 +2,10 @@ from unittest.mock import Mock, patch
import pytest
from akkudoktoreos.devices.genetic0.genetic0inverter import (
from akkudoktoreos.optimization.genetic0.devices.genetic0inverter import (
Genetic0Inverter,
Genetic0InverterParameters,
)
from akkudoktoreos.optimization.genetic0.genetic0request import Genetic0InverterRequest
@pytest.fixture
@@ -22,13 +22,13 @@ def inverter(mock_battery) -> Genetic0Inverter:
mock_self_consumption_predictor = Mock()
mock_self_consumption_predictor.calculate_self_consumption.return_value = 1.0
with patch(
"akkudoktoreos.devices.genetic0.genetic0inverter.get_genetic0_load_interpolator",
"akkudoktoreos.optimization.genetic0.devices.genetic0inverter.get_genetic0_load_interpolator",
return_value=mock_self_consumption_predictor,
):
iv = Genetic0Inverter(
Genetic0InverterParameters(
Genetic0InverterRequest(
device_id="iv1", max_power_wh=500.0, battery_id=mock_battery.parameters.device_id
),
).to_parameters(),
battery = mock_battery
)
return iv
+46 -40
View File
@@ -17,18 +17,16 @@ from unittest.mock import Mock, patch
import numpy as np
import pytest
from akkudoktoreos.devices.genetic0.genetic0battery import (
Genetic0Battery,
Genetic0SolarPanelBatteryParameters,
)
from akkudoktoreos.devices.genetic0.genetic0inverter import (
from akkudoktoreos.optimization.genetic0.devices.genetic0battery import Genetic0Battery
from akkudoktoreos.optimization.genetic0.devices.genetic0inverter import (
Genetic0Inverter,
Genetic0InverterParameters,
)
from akkudoktoreos.optimization.genetic0.genetic0 import (
Genetic0EnergyManagementParameters,
Genetic0Simulation,
from akkudoktoreos.optimization.genetic0.genetic0request import (
Genetic0EnergyManagementRequest,
Genetic0InverterRequest,
Genetic0SolarPanelBatteryRequest,
)
from akkudoktoreos.optimization.genetic0.genetic0simulation import Genetic0Simulation
# ---------------------------------------------------------------------------
# Helpers / Fixtures
@@ -46,7 +44,7 @@ def _make_inverter(
mock_self_consumption_predictor = Mock()
mock_self_consumption_predictor.calculate_self_consumption.return_value = 1.0
params = Genetic0InverterParameters(
params = Genetic0InverterRequest(
device_id="inv1",
max_power_wh=max_power_wh,
battery_id=mock_battery.parameters.device_id if mock_battery else None,
@@ -55,10 +53,10 @@ def _make_inverter(
max_ac_charge_power_w=max_ac_charge_power_w,
)
with patch(
"akkudoktoreos.devices.genetic0.genetic0inverter.get_genetic0_load_interpolator",
"akkudoktoreos.optimization.genetic0.devices.genetic0inverter.get_genetic0_load_interpolator",
return_value=mock_self_consumption_predictor,
):
return Genetic0Inverter(params, battery=mock_battery)
return Genetic0Inverter(params.to_parameters(), battery=mock_battery)
@pytest.fixture
@@ -79,13 +77,13 @@ class TestInverterParametersDefaults:
"""Verify backward-compatible defaults for new parameters."""
def test_defaults(self):
params = Genetic0InverterParameters(device_id="inv1", max_power_wh=5000)
params = Genetic0InverterRequest(device_id="inv1", max_power_wh=5000)
assert params.dc_to_ac_efficiency == 1.0
assert params.ac_to_dc_efficiency == 1.0
assert params.max_ac_charge_power_w is None
def test_custom_values(self):
params = Genetic0InverterParameters(
params = Genetic0InverterRequest(
device_id="inv1",
max_power_wh=5000,
dc_to_ac_efficiency=0.95,
@@ -97,17 +95,17 @@ class TestInverterParametersDefaults:
assert params.max_ac_charge_power_w == 3000
def test_ac_to_dc_zero_disables_ac_charging(self):
params = Genetic0InverterParameters(
params = Genetic0InverterRequest(
device_id="inv1", max_power_wh=5000, ac_to_dc_efficiency=0.0
)
assert params.ac_to_dc_efficiency == 0.0
def test_dc_to_ac_must_be_positive(self):
with pytest.raises(Exception):
Genetic0InverterParameters(device_id="inv1", max_power_wh=5000, dc_to_ac_efficiency=0.0)
Genetic0InverterRequest(device_id="inv1", max_power_wh=5000, dc_to_ac_efficiency=0.0)
def test_max_ac_charge_power_zero(self):
params = Genetic0InverterParameters(
params = Genetic0InverterRequest(
device_id="inv1", max_power_wh=5000, max_ac_charge_power_w=0
)
assert params.max_ac_charge_power_w == 0
@@ -215,9 +213,11 @@ class TestAcChargingInSimulation:
@pytest.fixture
def simulation_setup(self, config_eos):
"""Set up a minimal GeneticSimulation with battery and inverter."""
from akkudoktoreos.optimization.genetic0.genetic0 import Genetic0Simulation
from akkudoktoreos.optimization.genetic0.genetic0params import (
Genetic0EnergyManagementParameters,
from akkudoktoreos.optimization.genetic0.genetic0request import (
Genetic0EnergyManagementRequest,
)
from akkudoktoreos.optimization.genetic0.genetic0simulation import (
Genetic0Simulation,
)
config_eos.merge_settings_from_dict(
@@ -237,7 +237,7 @@ class TestAcChargingInSimulation:
battery_max_charge_power_w: int = 5000,
):
akku = Genetic0Battery(
Genetic0SolarPanelBatteryParameters(
Genetic0SolarPanelBatteryRequest(
device_id="battery1",
capacity_wh=battery_capacity_wh,
initial_soc_percentage=battery_initial_soc_pct,
@@ -246,32 +246,32 @@ class TestAcChargingInSimulation:
min_soc_percentage=0,
max_soc_percentage=100,
max_charge_power_w=battery_max_charge_power_w,
),
).to_parameters(),
prediction_hours=prediction_hours,
)
akku.reset()
inverter = Genetic0Inverter(
Genetic0InverterParameters(
Genetic0InverterRequest(
device_id="inverter1",
max_power_wh=10000,
battery_id="battery1",
ac_to_dc_efficiency=ac_to_dc_efficiency,
dc_to_ac_efficiency=dc_to_ac_efficiency,
max_ac_charge_power_w=max_ac_charge_power_w,
),
).to_parameters(),
battery=akku,
)
simulation = Genetic0Simulation()
simulation.prepare(
Genetic0EnergyManagementParameters.model_validate(dict(
Genetic0EnergyManagementRequest.model_validate(dict(
pv_prognose_wh=[0.0] * prediction_hours, # No PV
strompreis_euro_pro_wh=[0.0003] * prediction_hours, # ~30ct/kWh
einspeiseverguetung_euro_pro_wh=0.00008,
preis_euro_pro_wh_akku=0.0001,
gesamtlast=[1000.0] * prediction_hours, # 1 kW constant load
)),
)).to_parameters(),
optimization_hours=config_eos.optimization.genetic0.horizon_hours,
prediction_hours=prediction_hours,
inverter=inverter,
@@ -466,13 +466,13 @@ class TestResidualBatteryValue:
def test_current_energy_content_unaffected(self):
"""Battery.current_energy_content() is DC-only; inverter eff applied in optimizer."""
akku = Genetic0Battery(
Genetic0SolarPanelBatteryParameters(
Genetic0SolarPanelBatteryRequest(
device_id="bat1",
capacity_wh=10000,
initial_soc_percentage=50,
discharging_efficiency=0.90,
min_soc_percentage=0,
),
).to_parameters(),
prediction_hours=24,
)
akku.reset()
@@ -550,22 +550,28 @@ def _run_evaluate_with_mocked_sim(
- self.simulation is replaced by mock_sim
Then call evaluate() and return the fitness tuple.
"""
from akkudoktoreos.optimization.genetic0.genetic0 import Genetic0Optimization
config_eos.merge_settings_from_dict(
{
"prediction": {"hours": 48},
"optimization": {"hours": 24},
}
from akkudoktoreos.optimization.genetic0.genetic0algorithm import (
Genetic0Optimization,
)
config_eos.optimization.genetic0.penalties = {
"ev_soc_miss": 10,
"ac_charge_break_even": ac_charge_break_even,
}
from akkudoktoreos.optimization.genetic0.genetic0parameters import (
Genetic0RunSettings,
)
from akkudoktoreos.utils.gridinterpolator import GridInterpolatorBackend
optim = Genetic0Optimization.__new__(Genetic0Optimization)
# Minimal __init__ state expected by evaluate()
optim.config = config_eos
optim.settings = Genetic0RunSettings(
prediction_hours=48,
horizon_hours=24,
individuals=None,
generations=None,
seed=None,
penalties={"ev_soc_miss": 10, "ac_charge_break_even": ac_charge_break_even},
ev_charge_rates=None,
battery_charge_rates=None,
self_consumption_interpolator=GridInterpolatorBackend.SCIPY,
verbose=False,
)
optim.optimize_ev = False
optim.verbose = False
optim.opti_param = {"home_appliance": 0}
+366 -50
View File
@@ -1,9 +1,15 @@
import dataclasses
import inspect
import json
import math
import re
from collections.abc import Callable
from io import BytesIO
from pathlib import Path
from typing import Any
from unittest.mock import patch
import numpy as np
import pytest
from pydantic import ValidationError
from pypdf import PdfReader
@@ -11,20 +17,184 @@ from pypdf import PdfReader
from akkudoktoreos.config.config import ConfigEOS
from akkudoktoreos.core.cache import CacheEnergyManagementStore
from akkudoktoreos.core.coreabc import get_ems
from akkudoktoreos.optimization.genetic0.genetic0 import Genetic0Optimization
from akkudoktoreos.optimization.genetic0.genetic0params import (
Genetic0OptimizationParameters,
from akkudoktoreos.optimization.genetic0 import genetic0convert
from akkudoktoreos.optimization.genetic0.genetic0api import (
Genetic0Solution,
solution_response,
)
from akkudoktoreos.optimization.genetic0.genetic0optimizer import Genetic0Optimizer
from akkudoktoreos.optimization.genetic0.genetic0parameters import (
parameters_from_dict,
parameters_to_dict,
)
from akkudoktoreos.optimization.genetic0.genetic0request import (
Genetic0Request,
)
from akkudoktoreos.optimization.genetic0.genetic0result import (
Genetic0ElectricVehicleState,
Genetic0Result,
Genetic0SimulationOutput,
)
from akkudoktoreos.optimization.genetic0.genetic0solution import Genetic0Solution
from akkudoktoreos.optimization.genetic0.genetic0visualize import (
Genetic0VisualizationReport,
genetic0_prepare_visualize,
)
from akkudoktoreos.utils.datetimeutil import to_datetime
from akkudoktoreos.utils.datetimeutil import DateTime, Duration, to_datetime
ems_eos = get_ems(init=True) # init once
DIR_TESTDATA = Path(__file__).parent / "testdata" / "genetic0"
# Fixed run starts, so that the date-bearing output can be pinned (ADR 0008).
FIXED_START = "2026-01-14T10:00:00"
# The horizon crosses the switch to daylight saving time (Europe/Berlin, 2026-03-29).
DST_START = "2026-03-28T10:00:00"
# Origin of the fake prediction series: a value depends on its time, not its index.
PREDICTION_ORIGIN = "2026-01-01T00:00:00+00:00"
# The fill method the conversion asks for shifts the fake series, so it is pinned too.
FILL_METHOD_OFFSET = {"linear": 0.0, "ffill": 1000.0}
# Prediction keys the solution conversion reads; each gets its own rising series,
# so a shifted or swapped series changes the pinned output.
PREDICTION_KEYS = (
"pvforecast_ac_power",
"pvforecast_dc_power",
"elecprice_marketprice_wh",
"feed_in_tariff_wh",
"weather_temp_air",
"loadforecast_power_w",
"loadakkudoktor_std_power_w",
"loadakkudoktor_mean_power_w",
)
# Report methods whose arguments are the input of the visualization.
REPORT_METHODS = (
"create_line_chart_date",
"create_line_chart",
"create_scatter_plot",
"create_bar_chart",
"create_violin_plot",
"add_text_page",
"add_json_page",
)
# Placeholder for the wall-clock time of the conversion in IDs and timestamps.
NOW = "<now>"
# Random UUIDs, e.g. in instruction IDs ("battery1@<uuid>").
UUID_PATTERN = re.compile(r"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}")
class FakePrediction:
"""Deterministic predictions for the solution conversion."""
record_keys = list(PREDICTION_KEYS)
async def key_to_array(
self,
key: str,
start_datetime: DateTime,
end_datetime: DateTime,
interval: Duration,
fill_method: str,
**kwargs: Any,
) -> np.ndarray:
"""A rising series per key and fill method whose values follow the absolute time."""
step_hours = interval.total_seconds() / 3600
steps = int((end_datetime - start_datetime).total_seconds() // interval.total_seconds())
first_hour = (start_datetime - to_datetime(PREDICTION_ORIGIN)).total_seconds() / 3600
base = 10.0 * (PREDICTION_KEYS.index(key) + 1) + FILL_METHOD_OFFSET[fill_method]
return base + 0.5 * (first_hour + step_hours * np.arange(steps))
def mask_now(dump: dict[str, Any]) -> dict[str, Any]:
"""Replace the wall-clock time of the conversion in ``id`` and ``generated_at``."""
prefix, _, _ = dump["id"].partition("@")
return {**dump, "id": f"{prefix}@{NOW}", "generated_at": NOW}
def to_jsonable(value: Any) -> Any:
"""Convert the output of a run into plain JSON values for golden files."""
if isinstance(value, dict):
return {str(k): to_jsonable(v) for k, v in value.items()}
if isinstance(value, (list, tuple)):
return [to_jsonable(v) for v in value]
if isinstance(value, np.ndarray):
return to_jsonable(value.tolist())
if isinstance(value, np.generic):
return to_jsonable(value.item())
if isinstance(value, float) and math.isnan(value):
return None
if isinstance(value, str):
return UUID_PATTERN.sub("<uuid>", value)
if isinstance(value, (int, float, bool)) or value is None:
return value
return str(value)
def compare_jsonable(actual: Any, expected: Any, path: str = "$") -> None:
"""Compare plain JSON values; numbers approximately."""
if isinstance(expected, dict):
assert isinstance(actual, dict), path
assert set(actual) == set(expected), path
for key, value in expected.items():
compare_jsonable(actual[key], value, f"{path}.{key}")
elif isinstance(expected, list):
assert isinstance(actual, list), path
assert len(actual) == len(expected), path
for index, (a, e) in enumerate(zip(actual, expected)):
compare_jsonable(a, e, f"{path}[{index}]")
elif isinstance(expected, (int, float)) and not isinstance(expected, bool):
assert actual == pytest.approx(expected), path
else:
assert actual == expected, path
def check_golden(actual: Any, golden: str) -> None:
"""Compare ``actual`` with the golden file; write ``new_<golden>`` for review on a miss."""
actual = to_jsonable(actual)
new_file = DIR_TESTDATA / f"new_{golden}"
new_file.write_text(json.dumps(actual, indent=4) + "\n", encoding="utf-8", newline="\n")
golden_file = DIR_TESTDATA / golden
if not golden_file.exists():
pytest.fail(f"Missing golden file {golden_file}\ncp {new_file} {golden_file}\n")
compare_jsonable(actual, json.loads(golden_file.read_text(encoding="utf-8")))
new_file.unlink()
def record_report_calls() -> tuple[list[dict[str, Any]], dict[str, Any]]:
"""Spies on the report methods: the recorded calls and the patches to apply."""
calls: list[dict[str, Any]] = []
def spy(name: str, original: Callable[..., Any]) -> Callable[..., Any]:
signature = inspect.signature(original)
def method(self: Any, *args: Any, **kwargs: Any) -> Any:
# Bound by name with defaults, so the call style does not matter.
bound = signature.bind(self, *args, **kwargs)
bound.apply_defaults()
arguments = dict(bound.arguments)
arguments.pop("self")
calls.append({"method": name, "arguments": arguments})
return original(self, *args, **kwargs)
return method
patches = {
name: spy(name, getattr(Genetic0VisualizationReport, name)) for name in REPORT_METHODS
}
return calls, patches
def check_replay(parameters: Any, golden_stem: str, expected_result: str) -> None:
"""Compare the run's parameters with its replay file; write ``new_<replay>`` on a miss."""
replay = {"expected_result": expected_result, "parameters": parameters_to_dict(parameters)}
# Lossless: what is written reads back to the same values.
restored = parameters_from_dict(json.loads(json.dumps(replay["parameters"])))
assert parameters_to_dict(restored) == replay["parameters"]
check_golden(replay, f"replay_{golden_stem}.json")
def compare_dict(actual: dict[str, Any], expected: dict[str, Any]):
assert set(actual) == set(expected)
@@ -41,13 +211,35 @@ def compare_dict(actual: dict[str, Any], expected: dict[str, Any]):
@pytest.mark.asyncio
@pytest.mark.parametrize(
"fn_in, fn_out, ngen, break_even",
"fn_in, fn_out, ngen, break_even, start, golden_stem",
[
("optimize_input_1.json", "optimize_result_1.json", 3, 0),
("optimize_input_2.json", "optimize_result_2.json", 3, 0),
("optimize_input_2.json", "optimize_result_2_full.json", 400, 0),
("optimize_input_1.json", "optimize_result_1_be.json", 3, 1),
("optimize_input_2.json", "optimize_result_2_be.json", 3, 1),
("optimize_input_1.json", "optimize_result_1.json", 3, 0, FIXED_START, "optimize_result_1"),
("optimize_input_2.json", "optimize_result_2.json", 3, 0, FIXED_START, "optimize_result_2"),
(
"optimize_input_2.json",
"optimize_result_2_full.json",
400,
0,
FIXED_START,
"optimize_result_2_full",
),
(
"optimize_input_1.json",
"optimize_result_1_be.json",
3,
1,
FIXED_START,
"optimize_result_1_be",
),
(
"optimize_input_2.json",
"optimize_result_2_be.json",
3,
1,
FIXED_START,
"optimize_result_2_be",
),
("optimize_input_2.json", "optimize_result_2.json", 3, 0, DST_START, "optimize_result_2_dst"),
],
)
async def test_optimize(
@@ -55,6 +247,8 @@ async def test_optimize(
fn_out: str,
ngen: int,
break_even: int,
start: str,
golden_stem: str,
config_eos: ConfigEOS,
is_finalize: bool,
):
@@ -88,6 +282,9 @@ async def test_optimize(
"charge_rates": [0.0, 0.375, 0.5, 0.625, 0.75, 0.875, 1.0],
}
},
# Covers the home appliance part of the solution conversion.
"max_home_appliances": 1,
"home_appliances": {"dishwasher1": {"device_id": "dishwasher1"}},
}
}
)
@@ -95,27 +292,40 @@ async def test_optimize(
# Load input and output data
parameter_file = DIR_TESTDATA / fn_in
with parameter_file.open("r") as f_in:
input_data = Genetic0OptimizationParameters(**json.load(f_in))
input_data = Genetic0Request(**json.load(f_in))
# Fake energy management run start datetime
ems_eos.set_start_datetime(to_datetime().set(hour=fixed_start_hour))
ems_eos.set_start_datetime(
to_datetime(start, in_timezone=config_eos.general.timezone)
)
assert ems_eos.start_datetime.hour == fixed_start_hour
# Throw away any cached results of the last energy management run.
CacheEnergyManagementStore().clear()
genetic0_optimization = Genetic0Optimization(fixed_seed=fixed_seed)
# Activate with pytest --finalize
if ngen > 10 and not is_finalize:
pytest.skip()
# Call the optimization function
genetic0_solution = genetic0_optimization.optimize_ems(
parameters=input_data, start_hour=fixed_start_hour, ngen=ngen
)
# Prepare the parameters through the optimizer interface, then run.
optimizer = Genetic0Optimizer()
run_start = ems_eos.start_datetime
with patch(
"akkudoktoreos.optimization.genetic0.genetic0prepare.get_prediction",
return_value=FakePrediction(),
):
parameters = await optimizer.prepare_from_request(
input_data, run_start, run_start, None, {"generations": ngen, "seed": fixed_seed}
)
result = optimizer.run(parameters)
# The public solution, as the REST API returns it, is what the golden files hold.
genetic0_solution = solution_response(parameters, result)
# The parameters of this run are the replay input of test_replay (ADR 0008).
check_replay(parameters, golden_stem, fn_out)
# Write test output to file, so we can take it as new data on intended change
TESTDATA_FILE = DIR_TESTDATA / f"new_{fn_out}"
TESTDATA_FILE = DIR_TESTDATA / f"new_{golden_stem}.json"
with TESTDATA_FILE.open("w", encoding="utf-8", newline="\n") as f_out:
f_out.write(genetic0_solution.model_dump_json(indent=4, exclude_unset=True))
@@ -149,19 +359,29 @@ async def test_optimize(
# Reproducibility and mathematical accuracy should be tested on the level of individual components.
compare_dict(genetic0_solution.model_dump(), expected_result.model_dump())
# Check the correct generic optimization solution is created
optimization_solution = await genetic0_solution.optimization_solution()
# @TODO
# Check the correct generic optimization solution is created; the prediction series were
# read from FakePrediction by the parameter preparation.
optimization_solution = await genetic0convert.optimization_solution(
parameters, result
)
check_golden(
mask_now(optimization_solution.model_dump(mode="json")),
f"{golden_stem}_optimization_solution.json",
)
# Check the correct generic energy management plan is created
plan = genetic0_solution.energy_management_plan()
# @TODO
# Check visualization works
pdf = genetic0_prepare_visualize(
solution=genetic0_solution,
plan = genetic0convert.energy_management_plan(parameters, result)
check_golden(
mask_now(plan.model_dump(mode="json")),
f"{golden_stem}_plan.json",
)
# Check visualization works, and pin what it is drawn from
report_calls, report_patches = record_report_calls()
with patch.multiple(Genetic0VisualizationReport, **report_patches):
pdf = genetic0_prepare_visualize(parameters=parameters, solution=result)
assert pdf.startswith(b"%PDF-")
check_golden(report_calls, f"{golden_stem}_visualize.json")
reader = PdfReader(BytesIO(pdf))
assert len(reader.pages) == 6
@@ -171,6 +391,41 @@ async def test_optimize(
TESTDATA_FILE.unlink()
def result_of(solution: Genetic0Solution) -> Genetic0Result:
"""The run result a public solution was built from."""
simulation = solution.result.model_dump()
output_fields = {field.name for field in dataclasses.fields(Genetic0SimulationOutput)}
ev_fields = {field.name for field in dataclasses.fields(Genetic0ElectricVehicleState)}
return Genetic0Result(
ac_charge=solution.ac_charge,
dc_charge=solution.dc_charge,
discharge_allowed=solution.discharge_allowed,
ev_charge_hours_float=solution.ev_charge_hours_float,
result=Genetic0SimulationOutput(
**{key: value for key, value in simulation.items() if key in output_fields}
),
ev_obj=(
None
if solution.ev_obj is None
else Genetic0ElectricVehicleState(
**{k: v for k, v in solution.ev_obj.model_dump().items() if k in ev_fields}
)
),
start_hour=solution.start_hour,
start_solution=solution.start_solution,
washingstart=solution.washingstart,
extra_data=solution.extra_data,
fitness_history=solution.fitness_history,
fixed_seed=solution.fixed_seed,
)
# The parameters of golden run 1 (optimize_result_1.json), from its replay file.
RUN_1 = parameters_from_dict(
json.loads((DIR_TESTDATA / "replay_optimize_result_1.json").read_text())["parameters"]
)
class TestGenetic0SocClampedOperationFactors:
"""The SOC clamping uses the optimizer battery parameters, not the settings.
@@ -179,7 +434,7 @@ class TestGenetic0SocClampedOperationFactors:
"""
@pytest.fixture
def solution(self, config_eos: ConfigEOS) -> Genetic0Solution:
def solution(self, config_eos: ConfigEOS) -> Genetic0Result:
# A configured battery whose settings differ from the solution parameters.
config_eos.merge_settings_from_dict(
{
@@ -194,17 +449,19 @@ class TestGenetic0SocClampedOperationFactors:
}
)
data = json.loads((DIR_TESTDATA / "optimize_result_1.json").read_text())
return Genetic0Solution.model_validate(data)
return result_of(Genetic0Solution.model_validate(data))
def test_uses_solution_battery_parameters(self, solution):
bat = solution.parameters.pv_battery
bat = RUN_1.request.pv_battery
assert bat is not None
assert bat.capacity_wh == 26400
# 1 % headroom of 26400 Wh against one hour at 5000 W and the charging
# efficiency of the parameters (no inverter configured).
headroom_wh = 0.01 * bat.capacity_wh
assert bat.max_charge_power_w is not None
expected = headroom_wh / (bat.max_charge_power_w * bat.charging_efficiency)
ac, dc, dis = solution._soc_clamped_operation_factors(
ac, dc, dis = genetic0convert._soc_clamped_operation_factors(
RUN_1, solution,
1.0, 1.0, True, float(bat.max_soc_percentage) - 1.0
)
assert ac == pytest.approx(expected)
@@ -212,21 +469,28 @@ class TestGenetic0SocClampedOperationFactors:
assert dis is True
def test_full_and_empty_battery(self, solution):
bat = solution.parameters.pv_battery
assert solution._soc_clamped_operation_factors(
bat = RUN_1.request.pv_battery
assert bat is not None
assert genetic0convert._soc_clamped_operation_factors(
RUN_1, solution,
1.0, 1.0, True, float(bat.max_soc_percentage)
) == (0.0, 0.0, True)
assert solution._soc_clamped_operation_factors(
assert genetic0convert._soc_clamped_operation_factors(
RUN_1, solution,
0.0, 0.0, True, float(bat.min_soc_percentage)
) == (0.0, 0.0, False)
def test_without_battery_parameters_factors_are_unchanged(self, solution):
solution.parameters.pv_battery = None
assert solution._soc_clamped_operation_factors(1.0, 0.5, True, 50.0) == (1.0, 0.5, True)
without_battery = dataclasses.replace(
RUN_1, request=RUN_1.request.model_copy(update={"pv_battery": None})
)
assert genetic0convert._soc_clamped_operation_factors(
without_battery, solution, 1.0, 0.5, True, 50.0
) == (1.0, 0.5, True)
@pytest.mark.asyncio
async def test_optimization_solution_with_configured_battery(self, solution):
optimization_solution = await solution.optimization_solution()
optimization_solution = await genetic0convert.optimization_solution(RUN_1, solution)
assert optimization_solution is not None
@@ -238,7 +502,7 @@ class TestGenetic0SolutionWithProfileInverter:
"""
@pytest.fixture
def solution(self, config_eos: ConfigEOS) -> Genetic0Solution:
def solution(self, config_eos: ConfigEOS) -> Genetic0Result:
config_eos.merge_settings_from_dict(
{
"devices": {
@@ -264,38 +528,90 @@ class TestGenetic0SolutionWithProfileInverter:
}
)
data = json.loads((DIR_TESTDATA / "optimize_result_1.json").read_text())
return Genetic0Solution.model_validate(data)
return result_of(Genetic0Solution.model_validate(data))
def test_uses_solution_inverter_parameters(self, solution):
bat = solution.parameters.pv_battery
inverter = solution.parameters.inverter
bat = RUN_1.request.pv_battery
inverter = RUN_1.request.inverter
assert bat is not None and inverter is not None
assert bat.max_charge_power_w is not None
# The stored inverter has no AC charge limit and efficiency 1.0, unlike
# the configured one: the battery charge power limits the AC charge.
headroom_wh = 0.01 * bat.capacity_wh
expected = headroom_wh / (
bat.max_charge_power_w * inverter.ac_to_dc_efficiency * bat.charging_efficiency
)
ac, _, _ = solution._soc_clamped_operation_factors(
ac, _, _ = genetic0convert._soc_clamped_operation_factors(
RUN_1, solution,
1.0, 1.0, True, float(bat.max_soc_percentage) - 1.0
)
assert ac == pytest.approx(expected)
def test_without_stored_parameters_the_configured_inverter_is_resolved(self, solution):
inverter = solution._inverter_parameters(None)
assert inverter is not None
def test_the_preparation_resolves_the_configured_inverter(self, solution, config_eos):
"""The inverter profile is resolved by the parameter preparation, not by the solution."""
from akkudoktoreos.optimization.genetic0 import genetic0prepare
settings = list(config_eos.devices.inverters.values())[0]
inverter = genetic0prepare.inverter_request(settings)
assert inverter.max_power_wh == pytest.approx(10000)
assert inverter.max_ac_charge_power_w == pytest.approx(2000)
assert 0.0 < inverter.ac_to_dc_efficiency < 1.0
def test_unresolvable_inverter_counts_as_no_inverter(self, solution, config_eos):
def test_the_stored_inverter_is_used_whatever_the_configuration(self, solution, config_eos):
"""The conversion reads no configuration (ADR 0003)."""
config_eos.merge_settings_from_dict(
{"devices": {"inverters": {"inverter1": {"profile_adjustment": {"nominal_power_w": None}}}}}
)
assert solution._inverter_parameters(None) is None
assert genetic0convert._inverter_parameters(RUN_1) is RUN_1.request.inverter
@pytest.mark.asyncio
async def test_optimization_solution_with_configured_inverter(self, solution):
"""Regression: AttributeError 'ac_to_dc_efficiency' on InverterCommonSettings."""
optimization_solution = await solution.optimization_solution()
optimization_solution = await genetic0convert.optimization_solution(RUN_1, solution)
assert optimization_solution is not None
@pytest.mark.parametrize(
"golden_stem",
[
"optimize_result_1",
"optimize_result_2",
"optimize_result_1_be",
"optimize_result_2_be",
"optimize_result_2_dst",
"optimize_result_2_full",
],
)
def test_replay(golden_stem: str, config_eos: ConfigEOS, is_finalize: bool):
"""A run reproduces its golden result from the stored parameters alone (ADR 0006, 0008).
The configuration is set to different values on purpose: the run must not read it.
"""
replay = json.loads((DIR_TESTDATA / f"replay_{golden_stem}.json").read_text())
parameters = parameters_from_dict(replay["parameters"])
if parameters.settings.generations and parameters.settings.generations > 10 and not is_finalize:
pytest.skip()
config_eos.merge_settings_from_dict(
{
"prediction": {"hours": 24},
"optimization": {
"genetic0": {
"horizon_hours": 12,
"individuals": 11,
"generations": 12,
"seed": 1,
"penalties": {"ev_soc_miss": 99, "ac_charge_break_even": 3},
},
"self_consumption_interpolator": "numpy",
},
"devices": {"max_electric_vehicles": 0, "max_home_appliances": 0},
}
)
result = solution_response(parameters, Genetic0Optimizer().run(parameters))
expected = Genetic0Solution(
**json.loads((DIR_TESTDATA / replay["expected_result"]).read_text())
)
assert result.result.Gesamtbilanz_Euro == pytest.approx(expected.result.Gesamtbilanz_Euro)
compare_dict(result.model_dump(), expected.model_dump())
+731 -53
View File
@@ -1,5 +1,9 @@
"""GENETIC0 parameter preparation: time alignment, tariff coverage, and measured SoC."""
import json
import math
from types import SimpleNamespace
from typing import Any, cast
from unittest.mock import AsyncMock, Mock, patch
import numpy as np
@@ -9,10 +13,17 @@ import pytest
import pytest_asyncio
from akkudoktoreos.core.coreabc import get_ems, get_measurement
from akkudoktoreos.optimization.genetic0.genetic0params import (
Genetic0OptimizationParameters,
from akkudoktoreos.optimization.genetic0 import genetic0prepare
from akkudoktoreos.optimization.genetic0.genetic0optimizer import Genetic0Optimizer
from akkudoktoreos.optimization.genetic0.genetic0parameters import (
Genetic0Parameters,
parameters_from_dict,
parameters_to_dict,
)
from akkudoktoreos.utils.datetimeutil import to_datetime
from akkudoktoreos.optimization.genetic0.genetic0request import (
Genetic0Request,
)
from akkudoktoreos.utils.datetimeutil import to_datetime, to_duration
class TestGenetic0ParameterTimeAlignment:
@@ -66,8 +77,10 @@ class TestGenetic0ParameterTimeAlignment:
key_to_array=AsyncMock(side_effect=read_array),
key_to_raw_series=AsyncMock(return_value=prices),
)
with patch.object(Genetic0OptimizationParameters, "prediction", prediction):
parameters = await Genetic0OptimizationParameters.prepare()
with patch.object(genetic0prepare, "get_prediction", return_value=prediction):
parameters = await genetic0prepare.prepare_request(
get_ems().start_datetime, get_ems().observation_datetime
)
assert parameters is not None
# Index ``start.hour`` of every array is the start slot.
@@ -84,7 +97,7 @@ class TestGenetic0TariffCoverage:
@pytest.mark.asyncio
@pytest.mark.parametrize("published_hours", [20, 24])
async def test_dvhub_tariff_requires_real_control_horizon(self,
async def test_dvhub_tariff_short_of_the_control_horizon_is_carried_forward(self,
config_eos, published_hours, caplog
):
config_eos.merge_settings_from_dict(
@@ -117,21 +130,25 @@ class TestGenetic0TariffCoverage:
key_to_array=AsyncMock(side_effect=read_array),
key_to_raw_series=AsyncMock(return_value=prices),
)
with patch.object(Genetic0OptimizationParameters, "prediction", prediction):
parameters = await Genetic0OptimizationParameters.prepare()
with patch.object(genetic0prepare, "get_prediction", return_value=prediction):
parameters = await genetic0prepare.prepare_request(
get_ems().start_datetime, get_ems().observation_datetime
)
prediction.update_data.assert_awaited_once()
assert config_eos.feedintariff.provider == "FeedInTariffDvhubOnline"
tariffs = parameters.ems.feed_in_tariff_per_wh
assert isinstance(tariffs, list)
published = [(4 * hour + 1.5) / 1_000_000 for hour in range(published_hours)]
assert tariffs[:published_hours] == pytest.approx(published)
if published_hours < 24:
assert parameters is None
assert "Missing feed-in tariff within the GENETIC0 control horizon" in caplog.text
else:
assert parameters is not None
tariffs = parameters.ems.feed_in_tariff_per_wh
assert isinstance(tariffs, list)
assert tariffs[:24] == pytest.approx(
[(4 * hour + 1.5) / 1_000_000 for hour in range(24)]
# The run is not cancelled: the last known tariff is carried forward (step 3b).
assert "Missing feed-in tariff within the control horizon" in caplog.text
assert tariffs[published_hours:] == pytest.approx(
[published[-1]] * (48 - published_hours)
)
else:
# A covered control horizon is used as it is.
assert np.isnan(tariffs[24:]).all()
@@ -185,8 +202,10 @@ class TestGenetic0MeasuredSOC:
key_to_array=AsyncMock(side_effect=read_array),
key_to_raw_series=AsyncMock(return_value=tariff),
)
with patch.object(Genetic0OptimizationParameters, "prediction", prediction):
parameters = await Genetic0OptimizationParameters.prepare()
with patch.object(genetic0prepare, "get_prediction", return_value=prediction):
parameters = await genetic0prepare.prepare_request(
get_ems().start_datetime, get_ems().observation_datetime
)
assert parameters is not None
assert parameters.pv_battery is not None
@@ -232,8 +251,10 @@ class TestGenetic0MeasuredSOC:
key_to_array=AsyncMock(side_effect=read_array),
key_to_raw_series=AsyncMock(return_value=tariff),
)
with patch.object(Genetic0OptimizationParameters, "prediction", prediction):
parameters = await Genetic0OptimizationParameters.prepare()
with patch.object(genetic0prepare, "get_prediction", return_value=prediction):
parameters = await genetic0prepare.prepare_request(
get_ems().start_datetime, get_ems().observation_datetime
)
assert parameters is not None
assert parameters.pv_battery is not None
@@ -277,8 +298,10 @@ class TestGenetic0MeasuredSOC:
key_to_array=AsyncMock(side_effect=read_array),
key_to_raw_series=AsyncMock(return_value=tariff),
)
with patch.object(Genetic0OptimizationParameters, "prediction", prediction):
parameters = await Genetic0OptimizationParameters.prepare()
with patch.object(genetic0prepare, "get_prediction", return_value=prediction):
parameters = await genetic0prepare.prepare_request(
get_ems().start_datetime, get_ems().observation_datetime
)
assert parameters is not None
assert parameters.pv_battery is not None
@@ -286,10 +309,10 @@ class TestGenetic0MeasuredSOC:
class TestGenetic0DemoData:
"""Demo device data used when no battery / electric vehicle is configured."""
"""No demo devices: devices that are not configured are left out (step 3b)."""
@pytest.mark.asyncio
async def test_demo_devices_use_nominal_capacity(self, config_eos):
async def test_unconfigured_devices_are_left_out_and_not_written(self, config_eos):
config_eos.merge_settings_from_dict(
{
"prediction": {"hours": 48},
@@ -298,10 +321,12 @@ class TestGenetic0DemoData:
"devices": {
"max_batteries": 1,
"max_electric_vehicles": 1,
"max_inverters": 0,
"max_home_appliances": 0,
"max_inverters": 1,
"max_home_appliances": 1,
"batteries": None,
"electric_vehicles": None,
"inverters": None,
"home_appliances": {},
},
}
)
@@ -318,21 +343,24 @@ class TestGenetic0DemoData:
key_to_array=AsyncMock(side_effect=read_array),
key_to_raw_series=AsyncMock(return_value=tariff),
)
with patch.object(Genetic0OptimizationParameters, "prediction", prediction):
parameters = await Genetic0OptimizationParameters.prepare()
with patch.object(genetic0prepare, "get_prediction", return_value=prediction):
parameters = await genetic0prepare.prepare_request(
get_ems().start_datetime, get_ems().observation_datetime
)
assert parameters is not None
# The demo capacities must reach the profile adjustment of the settings;
# the generic default profile provides no capacity of its own.
assert config_eos.devices.batteries["battery1"].profile_adjustment.nominal_capacity_wh == 8000
assert (
config_eos.devices.electric_vehicles["ev1"].profile_adjustment.nominal_capacity_wh
== 50000
)
assert parameters.pv_battery is not None
assert parameters.pv_battery.capacity_wh == 8000
assert parameters.ev is not None
assert parameters.ev.capacity_wh == 50000
parameters.pv_battery,
parameters.ev,
parameters.inverter,
parameters.dishwasher,
) == (None, None, None, None)
devices = config_eos.devices
assert (
devices.batteries,
devices.electric_vehicles,
devices.inverters,
devices.home_appliances or None,
) == (None, None, None, None)
@pytest.mark.asyncio
async def test_battery_configuration_error_uses_defaults_not_demo_data(self, config_eos):
@@ -373,8 +401,10 @@ class TestGenetic0DemoData:
lambda message: messages.append(message.record["message"]), level="ERROR"
)
try:
with patch.object(Genetic0OptimizationParameters, "prediction", prediction):
parameters = await Genetic0OptimizationParameters.prepare()
with patch.object(genetic0prepare, "get_prediction", return_value=prediction):
parameters = await genetic0prepare.prepare_request(
get_ems().start_datetime, get_ems().observation_datetime
)
finally:
logger.remove(sink_id)
assert parameters is not None
@@ -389,20 +419,19 @@ class TestGenetic0DemoData:
@pytest.mark.asyncio
@pytest.mark.parametrize(
"settings_class, method, field, device_id",
"device, method, field, device_id",
[
("BatteriesCommonSettings", "to_genetic0_pv_bat_param", "pv_battery", "storage"),
("BatteriesCommonSettings", "to_genetic0_ev_bat_param", "ev", "car"),
("InverterCommonSettings", "to_genetic0_param", "inverter", "hybrid"),
("battery", "battery_request", "pv_battery", "storage"),
("electric vehicle", "electric_vehicle_request", "ev", "car"),
("inverter", "inverter_request", "inverter", "hybrid"),
],
)
async def test_device_that_cannot_be_prepared_is_left_out(
self, config_eos, monkeypatch, settings_class, method, field, device_id
self, config_eos, monkeypatch, device, method, field, device_id
):
"""No demo device replaces a configured device that cannot be prepared."""
from loguru import logger
from akkudoktoreos.devices.settings import batterysettings, invertersettings
config_eos.merge_settings_from_dict(
{
@@ -430,12 +459,11 @@ class TestGenetic0DemoData:
}
)
configured = config_eos.devices.model_dump(exclude_computed_fields=True)
module = batterysettings if settings_class == "BatteriesCommonSettings" else invertersettings
def broken(self, *args, **kwargs):
def broken(*args, **kwargs):
raise RuntimeError("conversion failed")
monkeypatch.setattr(getattr(module, settings_class), method, broken)
# The conversion of the settings belongs to GENETIC0's preparation (ADR 0004).
monkeypatch.setattr(genetic0prepare, method, broken)
get_ems().set_start_datetime(to_datetime("2026-08-01T14:00:00+00:00"))
tariff = pd.Series(
0.00008, index=pd.date_range("2026-08-01T00:00:00Z", periods=72 * 4, freq="15min")
@@ -454,8 +482,10 @@ class TestGenetic0DemoData:
lambda message: messages.append(message.record["message"]), level="ERROR"
)
try:
with patch.object(Genetic0OptimizationParameters, "prediction", prediction):
parameters = await Genetic0OptimizationParameters.prepare()
with patch.object(genetic0prepare, "get_prediction", return_value=prediction):
parameters = await genetic0prepare.prepare_request(
get_ems().start_datetime, get_ems().observation_datetime
)
finally:
logger.remove(sink_id)
assert parameters is not None
@@ -466,3 +496,651 @@ class TestGenetic0DemoData:
for other in {"pv_battery", "ev", "inverter"} - {field}:
assert getattr(parameters, other) is not None
assert config_eos.devices.model_dump(exclude_computed_fields=True) == configured
@pytest.mark.asyncio
async def test_battery_not_linked_to_the_inverter_is_left_out(self, config_eos, caplog):
"""A battery the inverter does not name is left out; the inverter runs without it."""
config_eos.merge_settings_from_dict(
{
"prediction": {"hours": 48},
"optimization": {"genetic0": {"horizon_hours": 24}},
"elecfee": {"provider": None},
"devices": {
"max_batteries": 1,
"max_electric_vehicles": 0,
"max_inverters": 1,
"max_home_appliances": 0,
"batteries": {
"storage": {"profile_adjustment": {"nominal_capacity_wh": 5000}}
},
"inverters": {
"hybrid": {
"battery_id": "other",
"profile_adjustment": {"nominal_power_w": 6000},
}
},
},
}
)
get_ems().set_start_datetime(to_datetime("2026-08-01T14:00:00+00:00"))
prediction = Mock(
update_data=AsyncMock(),
key_to_array=AsyncMock(return_value=np.full(48, 0.0003)),
key_to_raw_series=AsyncMock(side_effect=KeyError("no tariff")),
)
with patch.object(genetic0prepare, "get_prediction", return_value=prediction):
parameters = await genetic0prepare.prepare_request(
get_ems().start_datetime, get_ems().observation_datetime
)
assert parameters.pv_battery is None
assert parameters.inverter is not None
assert parameters.inverter.battery_id == "other"
assert "Battery 'storage' is not connected to the inverter (battery_id other)" in (
caplog.text
)
@pytest.mark.asyncio
@pytest.mark.parametrize("price_known", [True, False])
async def test_without_any_price_the_grid_does_not_charge(self, config_eos, price_known):
"""With the fallback price of 0 grid charging would look free: it is switched off."""
config_eos.merge_settings_from_dict(
{
"prediction": {"hours": 48},
"optimization": {"genetic0": {"horizon_hours": 24}},
"elecfee": {"provider": None},
"devices": {
"max_batteries": 1,
"max_electric_vehicles": 0,
"max_inverters": 1,
"max_home_appliances": 0,
"batteries": {
"storage": {"profile_adjustment": {"nominal_capacity_wh": 5000}}
},
"inverters": {
"hybrid": {
"battery_id": "storage",
"profile_adjustment": {"nominal_power_w": 6000},
}
},
},
}
)
get_ems().set_start_datetime(to_datetime("2026-08-01T14:00:00+00:00"))
async def read_array(*, key, **kwargs):
if key == "elecprice_marketprice_wh" and not price_known:
raise KeyError("no price")
return np.full(48, 0.0003)
prediction = Mock(
update_data=AsyncMock(),
key_to_array=AsyncMock(side_effect=read_array),
key_to_raw_series=AsyncMock(side_effect=KeyError("no tariff")),
)
with patch.object(genetic0prepare, "get_prediction", return_value=prediction):
parameters = await genetic0prepare.prepare_request(
get_ems().start_datetime, get_ems().observation_datetime
)
assert parameters.inverter is not None
assert parameters.pv_battery is not None
if price_known:
assert parameters.inverter.max_ac_charge_power_w != 0
else:
assert parameters.ems.electricity_price_per_wh == [0.0] * 48
assert parameters.inverter.max_ac_charge_power_w == 0.0
class TestGenetic0PrepareOverrides:
"""Run-time overrides reach the parameters; unknown keys are logged and ignored."""
@pytest.fixture
def request_parameters(self) -> Genetic0Request:
return Genetic0Request.model_validate(
{
"ems": {
"pv_prognose_wh": [0.0, 100.0],
"gesamtlast": [100.0, 100.0],
"strompreis_euro_pro_wh": [0.0003, 0.0003],
"einspeiseverguetung_euro_pro_wh": 0.00008,
"preis_euro_pro_wh_akku": 0.0,
},
"pv_akku": None,
"eauto": None,
"inverter": None,
}
)
@pytest.fixture
def errors(self, monkeypatch) -> list[str]:
logged: list[str] = []
monkeypatch.setattr(
genetic0prepare.logger, "error", lambda message, *args: logged.append(message)
)
return logged
@pytest.mark.asyncio
@pytest.mark.parametrize(
"overrides, generations, seed",
[
(None, 77, 5),
({}, 77, 5),
({"generations": None, "seed": None}, 77, 5),
({"generations": 12}, 12, 5),
({"generations": 12, "seed": 42}, 12, 42),
],
)
async def test_known_overrides_replace_the_settings(
self, config_eos, request_parameters, errors, overrides, generations, seed
):
config_eos.merge_settings_from_dict(
{"optimization": {"genetic0": {"generations": 77, "seed": 5}}}
)
start = to_datetime("2026-01-14T10:00:00", in_timezone="Europe/Berlin")
parameters = await genetic0prepare.prepare_from_request(
request_parameters, start, start, None, overrides
)
assert parameters.request is request_parameters
assert parameters.start_hour == 10
assert (parameters.settings.generations, parameters.settings.seed) == (generations, seed)
assert errors == []
@pytest.mark.asyncio
async def test_unknown_override_is_logged_and_ignored(
self, config_eos, request_parameters, errors
):
config_eos.merge_settings_from_dict(
{"optimization": {"genetic0": {"generations": 77, "seed": 5}}}
)
start = to_datetime("2026-01-14T10:00:00", in_timezone="Europe/Berlin")
parameters = await genetic0prepare.prepare_from_request(
request_parameters, start, start, None, {"individuals": 3, "generations": 12}
)
assert (parameters.settings.generations, parameters.settings.seed) == (12, 5)
assert errors == ["GENETIC0: Unknown override '{}' ignored."]
class TestGenetic0PrepareWarmStart:
"""The start solution of the previous run seeds the next one."""
@pytest.mark.asyncio
@pytest.mark.parametrize(
"warm_start, start_solution",
[
(None, None),
(SimpleNamespace(start_solution=None), None),
(SimpleNamespace(start_solution=[]), None),
(SimpleNamespace(start_solution=[1.0, 0.0, 2.0]), [1.0, 0.0, 2.0]),
],
ids=["no-previous-run", "no-start-solution", "empty-start-solution", "start-solution"],
)
async def test_previous_start_solution_reaches_the_preparation(
self, config_eos, monkeypatch, warm_start, start_solution
):
request = Mock()
legacy_prepare = AsyncMock(return_value=request)
monkeypatch.setattr(genetic0prepare, "prepare_request", legacy_prepare)
monkeypatch.setattr(
genetic0prepare.Genetic0Parameters,
"from_request",
classmethod(lambda cls, **fields: SimpleNamespace(**fields)),
)
start = to_datetime("2026-01-14T10:00:00", in_timezone="Europe/Berlin")
observation = start.add(minutes=7)
parameters = await genetic0prepare.prepare(start, observation, warm_start)
legacy_prepare.assert_awaited_once_with(start, observation, start_solution)
assert parameters.request is request
class TestGenetic0Presentation:
"""The data the solution conversion presents, read once before the run."""
@pytest.mark.asyncio
async def test_window_and_missing_values_survive_the_replay_file(self, config_eos, monkeypatch):
config_eos.merge_settings_from_dict(
{"general": {"timezone_override": "Europe/Berlin"}, "prediction": {"hours": 48}}
)
windows = []
async def key_to_array(*, key, start_datetime, end_datetime, interval, fill_method):
windows.append((key, start_datetime, end_datetime, fill_method))
hours = int((end_datetime - start_datetime).total_seconds() // 3600)
values = np.arange(hours, dtype=float)
values[1] = np.nan
return values
prediction = SimpleNamespace(
record_keys=["pvforecast_ac_power", "feed_in_tariff_wh"], key_to_array=key_to_array
)
monkeypatch.setattr(genetic0prepare, "get_prediction", lambda: prediction)
# 09:00 UTC is 10:00 in Berlin: read from the earlier hour, so the series cover every
# hour the conversion may show (it slices them to its own count).
start = to_datetime("2026-01-14T09:00:00+00:00", in_timezone="UTC")
settings = genetic0prepare._run_settings(None, 0)
presentation = await genetic0prepare._presentation(start, settings, False)
assert [(key, fill) for key, _, _, fill in windows] == [
("pvforecast_ac_power", "linear"),
("feed_in_tariff_wh", "ffill"),
]
assert {(end - begin).total_seconds() for _, begin, end, _ in windows} == {
to_duration("39 hours").total_seconds()
}
assert set(presentation.prediction_series) == {"pvforecast_ac_power", "feed_in_tariff_wh"}
assert presentation.timezone == "Europe/Berlin"
series = presentation.prediction_series["pvforecast_ac_power"]
assert len(series) == 39 and math.isnan(series[1])
request = Genetic0Request.model_validate(
{
"ems": {
"pv_prognose_wh": [0.0, 100.0],
"gesamtlast": [100.0, 100.0],
"strompreis_euro_pro_wh": [0.0003, 0.0003],
"einspeiseverguetung_euro_pro_wh": 0.00008,
"preis_euro_pro_wh_akku": 0.0,
},
"pv_akku": None,
"eauto": None,
"inverter": None,
}
)
parameters = Genetic0Parameters.from_request(
request=request, start_hour=start.hour, settings=settings, presentation=presentation
)
data = json.loads(json.dumps(parameters_to_dict(parameters)))
assert data["presentation"]["prediction_series"]["pvforecast_ac_power"][1] is None
restored = parameters_from_dict(data).presentation
assert restored.start_datetime == presentation.start_datetime
# The zone of the run start, not the configured one.
assert restored.start_datetime.timezone_name == start.timezone_name
restored_series = restored.prediction_series["pvforecast_ac_power"]
assert math.isnan(restored_series[1])
assert restored_series[2:] == series[2:]
def test_unconfigured_prediction_hours_fall_back_to_48(self, monkeypatch):
config = Mock()
config.prediction.hours = None
config.devices.electric_vehicles = None
config.devices.batteries = None
config.optimization.genetic0.penalties = {}
monkeypatch.setattr(genetic0prepare, "get_config", lambda: config)
errors: list[str] = []
monkeypatch.setattr(
genetic0prepare.logger, "error", lambda message, *args: errors.append(message)
)
assert genetic0prepare._run_settings(None, 0).prediction_hours == 48
assert errors == ["GENETIC0: prediction.hours not configured, using {}."]
class TestGenetic0AlwaysValid:
"""The preparation never fails, never cancels and never writes the configuration (step 3b)."""
def _configure(self, config_eos) -> None:
config_eos.merge_settings_from_dict(
{
"general": {"timezone_override": "UTC"},
"prediction": {"hours": 48},
"optimization": {"genetic0": {"horizon_hours": 24}},
"elecfee": {"provider": None},
"devices": {
"max_batteries": 0,
"max_electric_vehicles": 0,
"max_inverters": 0,
"max_home_appliances": 0,
},
}
)
get_ems().set_start_datetime(to_datetime("2026-08-01T10:00:00+00:00", in_timezone="UTC"))
@pytest.mark.asyncio
async def test_missing_predictions_give_fallback_values(self, config_eos, caplog):
self._configure(config_eos)
providers_before = config_eos.model_dump(
include={"weather", "load", "pvforecast", "elecprice", "elecfee", "general"}
)
prediction = Mock(
update_data=AsyncMock(side_effect=RuntimeError("synthetic update failure")),
key_to_array=AsyncMock(side_effect=KeyError("no provider")),
key_to_raw_series=AsyncMock(side_effect=KeyError("no provider")),
)
with patch.object(genetic0prepare, "get_prediction", return_value=prediction):
parameters = await genetic0prepare.prepare_request(
get_ems().start_datetime, get_ems().observation_datetime
)
ems = parameters.ems
assert ems.pv_forecast_wh == [0.0] * 48
assert ems.electricity_price_per_wh == [genetic0prepare.FALLBACK_PRICE_PER_WH] * 48
assert ems.feed_in_tariff_per_wh == [genetic0prepare.FALLBACK_FEED_IN_TARIFF_PER_WH] * 48
assert ems.total_load == pytest.approx([3000.0 * 1000.0 / 8760.0] * 48)
assert parameters.temperature_forecast is None
# Nothing written back, no provider switched.
assert config_eos.model_dump(
include={"weather", "load", "pvforecast", "elecprice", "elecfee", "general"}
) == providers_before
assert prediction.update_data.await_count == 1 # no retries
assert "using the stored predictions" in caplog.text
@pytest.mark.asyncio
async def test_gaps_are_carried_forward(self, config_eos):
self._configure(config_eos)
price = np.full(48, np.nan)
price[12:20] = np.arange(8, dtype=float) / 1000
load = np.full(48, 500.0)
load[30:] = np.nan
async def read_array(*, key, **kwargs):
return {
"elecprice_marketprice_wh": price,
"loadforecast_power_w": load,
}.get(key, np.full(48, 1.0))
tariff = pd.Series(
0.00008, index=pd.date_range("2026-08-01T00:00:00Z", periods=72 * 4, freq="15min")
)
prediction = Mock(
update_data=AsyncMock(),
key_to_array=AsyncMock(side_effect=read_array),
key_to_raw_series=AsyncMock(return_value=tariff),
)
with patch.object(genetic0prepare, "get_prediction", return_value=prediction):
parameters = await genetic0prepare.prepare_request(
get_ems().start_datetime, get_ems().observation_datetime
)
prices = parameters.ems.electricity_price_per_wh
assert prices[:12] == [0.0] * 12 # leading gap: the first known price
assert prices[12:20] == pytest.approx(list(np.arange(8) / 1000))
assert prices[20:] == pytest.approx([0.007] * 28) # carried forward
assert parameters.ems.total_load[30:] == [500.0] * 18
@pytest.mark.asyncio
async def test_prepare_never_raises_without_any_input(self, config_eos, monkeypatch):
self._configure(config_eos)
prediction = Mock(
update_data=AsyncMock(side_effect=RuntimeError("down")),
key_to_array=AsyncMock(side_effect=RuntimeError("down")),
key_to_raw_series=AsyncMock(side_effect=RuntimeError("down")),
record_keys=["pvforecast_ac_power"],
)
monkeypatch.setattr(genetic0prepare, "get_prediction", lambda: prediction)
start = get_ems().start_datetime
parameters = await genetic0prepare.prepare(start, start, None)
assert parameters.request.ems.pv_forecast_wh == [0.0] * 48
assert parameters.presentation.prediction_series == {}
class TestGenetic0Fallbacks:
"""Each fallback of the preparation gives a valid value and logs an error (step 3b)."""
@pytest.fixture
def errors(self, monkeypatch) -> list[str]:
logged: list[str] = []
monkeypatch.setattr(
genetic0prepare.logger, "error", lambda message, *args: logged.append(message)
)
return logged
@pytest.mark.asyncio
@pytest.mark.parametrize(
"measured, percentage, logged",
[
(0.42, 42, False),
(math.nan, 0, True),
(1.5, 0, True),
(-0.1, 0, True),
(KeyError("no reading"), 0, True),
],
ids=["valid", "nan", "above-one", "negative", "missing"],
)
async def test_state_of_charge(self, monkeypatch, errors, measured, percentage, logged):
nearest = AsyncMock(side_effect=[measured] if isinstance(measured, Exception) else None)
if not isinstance(measured, Exception):
nearest.return_value = measured
monkeypatch.setattr(genetic0prepare, "_nearest_soc_factor", nearest)
start = to_datetime("2026-01-14T10:00:00+00:00")
assert await genetic0prepare._initial_soc_percentage("battery", "soc", start) == percentage
assert bool(errors) == logged
@pytest.mark.asyncio
async def test_battery_without_cost_of_storage(self, monkeypatch, errors):
battery_params = SimpleNamespace(initial_soc_percentage=None)
battery = Mock(
device_id="battery1",
levelized_cost_of_storage_amt_kwh=None,
measurement_key_soc_factor="soc",
resolve_current_operating_parameters_or_defaults=AsyncMock(return_value=({}, None)),
)
monkeypatch.setattr(genetic0prepare, "battery_request", Mock(return_value=battery_params))
config = Mock()
config.devices.max_batteries = 1
config.devices.batteries = {"battery1": battery}
monkeypatch.setattr(genetic0prepare, "get_config", lambda: config)
monkeypatch.setattr(genetic0prepare, "_initial_soc_percentage", AsyncMock(return_value=33))
start = to_datetime("2026-01-14T10:00:00+00:00")
params, lcos = await genetic0prepare._battery(start)
assert (params, lcos) == (battery_params, 0.0)
assert battery_params.initial_soc_percentage == 33
assert battery.levelized_cost_of_storage_amt_kwh is None # not written back
assert errors == [
"GENETIC0: Battery '{}' has no levelized cost of storage; using 0 per kWh."
]
def test_unset_algorithm_settings(self, monkeypatch, errors):
config = Mock()
config.prediction.hours = 48
config.devices.electric_vehicles = None
config.devices.batteries = None
config.optimization.genetic0.horizon_hours = 24
config.optimization.genetic0.individuals = None
config.optimization.genetic0.generations = None
config.optimization.genetic0.seed = None
config.optimization.genetic0.penalties = {}
monkeypatch.setattr(genetic0prepare, "get_config", lambda: config)
settings = genetic0prepare._run_settings(None, 0)
assert (settings.individuals, settings.generations) == (300, 400)
assert len(errors) == 2
assert config.optimization.genetic0.individuals is None # not written back
@pytest.mark.asyncio
@pytest.mark.parametrize(
"configured, start_hour, expected",
[
(0, 14, 38), # nothing left: the control horizon of 24 hours
(24, 23, 47), # one hour left
(24, 14, 24), # enough left: unchanged
(6, 0, 6),
],
)
async def test_prediction_hours_leave_room_after_the_start(
self, config_eos, errors, configured, start_hour, expected
):
"""Fewer than two hours after the start hour: the run covers its control horizon."""
TestGenetic0AlwaysValid()._configure(config_eos)
config_eos.merge_settings_from_dict(
{
"prediction": {"hours": configured},
"optimization": {"genetic0": {"individuals": 10, "generations": 10, "seed": 1}},
}
)
start = to_datetime("2026-08-01T00:00:00+00:00", in_timezone="UTC").add(hours=start_hour)
get_ems().set_start_datetime(start)
prediction = Mock(
update_data=AsyncMock(),
key_to_array=AsyncMock(side_effect=KeyError("no data")),
key_to_raw_series=AsyncMock(side_effect=KeyError("no data")),
record_keys=[],
)
with patch.object(genetic0prepare, "get_prediction", return_value=prediction):
parameters = await genetic0prepare.prepare(start, start, None)
assert parameters.settings.prediction_hours == expected
assert len(parameters.request.ems.total_load) == expected
logged = any("leaves fewer than" in message for message in errors)
assert logged == (expected != configured)
if expected != configured:
Genetic0Optimizer().run(parameters) # runs instead of failing
@pytest.mark.asyncio
async def test_short_and_incomplete_forecasts(self, config_eos, errors):
TestGenetic0AlwaysValid()._configure(config_eos)
pv = np.full(48, 1000.0)
pv[5:7] = np.nan
pv[7] = np.inf
price = np.full(48, 0.0002)
price[3] = -np.inf
temperature = np.full(48, 20.0)
temperature[4] = np.inf
async def read_array(*, key, **kwargs):
if key == "pvforecast_ac_power":
return pv
if key == "loadforecast_power_w":
return np.full(10, 400.0) # does not cover the run
if key == "elecprice_marketprice_wh":
return price
if key == "weather_temp_air":
return temperature
return np.full(48, 0.0002)
tariff = pd.Series(
0.00008, index=pd.date_range("2026-08-01T00:00:00Z", periods=72 * 4, freq="15min")
)
tariff.iloc[44 * 4] = np.inf # 20:00 on the next day, after the control horizon
prediction = Mock(
update_data=AsyncMock(),
key_to_array=AsyncMock(side_effect=read_array),
key_to_raw_series=AsyncMock(return_value=tariff),
)
with patch.object(genetic0prepare, "get_prediction", return_value=prediction):
parameters = await genetic0prepare.prepare_request(
get_ems().start_datetime, get_ems().observation_datetime
)
# NaN and infinite values are missing.
assert math.isnan(cast(list[float], parameters.ems.feed_in_tariff_per_wh)[44])
assert parameters.ems.pv_forecast_wh[5:8] == [0.0, 0.0, 0.0]
assert parameters.ems.pv_forecast_wh[8] == 1000.0
assert parameters.ems.electricity_price_per_wh[3] == 0.0002
temperature_forecast = parameters.temperature_forecast
assert temperature_forecast is not None
assert temperature_forecast[4] is None
assert temperature_forecast[5] == 20.0
assert parameters.ems.total_load == pytest.approx([3000.0 * 1000.0 / 8760.0] * 48)
assert "GENETIC0: Prediction '{}' does not cover the run." in errors
assert "GENETIC0: PV forecast incomplete; using 0 Wh for the missing hours." in errors
@pytest.mark.asyncio
@pytest.mark.parametrize("failing_builds", [1, 2])
async def test_invalid_parameters_fall_back(self, config_eos, monkeypatch, errors, failing_builds):
TestGenetic0AlwaysValid()._configure(config_eos)
prediction = Mock(
update_data=AsyncMock(),
key_to_array=AsyncMock(return_value=np.full(48, 0.0002)),
key_to_raw_series=AsyncMock(
return_value=pd.Series(
0.00008,
index=pd.date_range("2026-08-01T00:00:00Z", periods=72 * 4, freq="15min"),
)
),
)
monkeypatch.setattr(genetic0prepare, "get_prediction", lambda: prediction)
real = genetic0prepare.Genetic0EnergyManagementRequest
calls = {"count": 0}
def build(**kwargs):
calls["count"] += 1
if calls["count"] <= failing_builds:
raise ValueError("synthetic invalid parameters")
return real(**kwargs)
monkeypatch.setattr(genetic0prepare, "Genetic0EnergyManagementRequest", build)
parameters = await genetic0prepare.prepare_request(
get_ems().start_datetime, get_ems().observation_datetime, start_solution=[1.0, 2.0]
)
assert parameters.pv_battery is None and parameters.start_solution is None
assert parameters.temperature_forecast is None
if failing_builds == 2:
assert parameters.ems.pv_forecast_wh == [0.0] * 48
assert parameters.ems.total_load == pytest.approx([3000.0 * 1000.0 / 8760.0] * 48)
assert len([message for message in errors if "are invalid" in message]) == failing_builds
class TestGenetic0HomeApplianceShown:
"""The solution shows the home appliance the preparation put into the request (step 3b)."""
@pytest.mark.asyncio
@pytest.mark.parametrize(
"dishwasher, max_home_appliances, automatic, enabled",
[
(object(), None, True, True), # default max: the configured appliance is shown
(None, None, True, False), # nothing configured: nothing invented
(object(), None, False, False), # a client's request: configured count, as before
(object(), 1, False, True),
],
)
async def test_decision(
self, config_eos, monkeypatch, dishwasher, max_home_appliances, automatic, enabled
):
config_eos.devices.max_home_appliances = max_home_appliances
request = SimpleNamespace(dishwasher=dishwasher)
monkeypatch.setattr(genetic0prepare, "prepare_request", AsyncMock(return_value=request))
# The stand-in request has no forecasts to derive the simulation's dataclasses from.
monkeypatch.setattr(
genetic0prepare.Genetic0Parameters,
"from_request",
classmethod(lambda cls, **fields: SimpleNamespace(**fields)),
)
monkeypatch.setattr(
genetic0prepare, "get_prediction", lambda: SimpleNamespace(record_keys=[])
)
start = to_datetime("2026-01-14T10:00:00", in_timezone="Europe/Berlin")
if automatic:
parameters = await genetic0prepare.prepare(start, start, None)
else:
parameters = await genetic0prepare.prepare_from_request(
cast(Any, request), start, start, None
)
assert parameters.presentation.home_appliance_enabled is enabled
@pytest.mark.asyncio
@pytest.mark.parametrize("enabled", [True, False])
async def test_conversion_follows_the_decision(self, enabled):
"""The conversion shows the home appliance as the preparation decided (step 5)."""
import dataclasses
from pathlib import Path
from test_genetic0optimize import result_of
from akkudoktoreos.optimization.genetic0 import genetic0convert
from akkudoktoreos.optimization.genetic0.genetic0api import (
Genetic0Solution,
)
testdata = Path(__file__).parent / "testdata" / "genetic0"
replay = json.loads((testdata / "replay_optimize_result_1.json").read_text())
parameters = parameters_from_dict(replay["parameters"])
parameters = dataclasses.replace(
parameters,
presentation=dataclasses.replace(
parameters.presentation, home_appliance_enabled=enabled
),
)
result = result_of(
Genetic0Solution.model_validate(
json.loads((testdata / replay["expected_result"]).read_text())
)
)
solution = await genetic0convert.optimization_solution(parameters, result)
plan = genetic0convert.energy_management_plan(parameters, result)
columns = next(iter(solution.solution.data.values()))
assert ("homeappliance1_energy_wh" in columns) is enabled
assert any(i.resource_id == "homeappliance1" for i in plan.instructions) is enabled
+256 -64
View File
@@ -9,23 +9,83 @@ import pytest
from akkudoktoreos.core import ems as ems_module
from akkudoktoreos.core.emsettings import EnergyManagementMode
from akkudoktoreos.optimization.genetic0 import genetic0 as genetic0_module
from akkudoktoreos.optimization.genetic0.genetic0params import (
Genetic0OptimizationParameters,
from akkudoktoreos.optimization.genetic0 import genetic0algorithm as genetic0_module
from akkudoktoreos.optimization.genetic0 import genetic0convert, genetic0prepare
from akkudoktoreos.optimization.genetic0.genetic0request import (
Genetic0Request,
)
from akkudoktoreos.optimization.optimization import OptimizationAlgorithm
from akkudoktoreos.optimization.optimizer import OptimizerRun
from akkudoktoreos.utils.datetimeutil import to_datetime
from akkudoktoreos.utils.gridinterpolator import GridInterpolatorBackend
def _patch_optimizer(monkeypatch, prefix: str, constructor: Any) -> None:
"""Replace the optimizer class that EnergyManagement.run() instantiates.
GENETIC0 is imported on first use inside run(), so it is patched at its source.
GENETIC0 is imported on first use inside its optimizer, so it is patched at its source.
"""
module = genetic0_module if prefix == "Genetic0" else ems_module
monkeypatch.setattr(module, prefix + "Optimization", constructor)
def _patch_prepare(monkeypatch, prefix: str, prepare: Any) -> None:
"""Replace the legacy parameter preparation of GENETIC or GENETIC0."""
if prefix == "Genetic0":
monkeypatch.setattr(genetic0prepare, "prepare_request", prepare)
else:
monkeypatch.setattr(ems_module.GeneticOptimizationParameters, "prepare", prepare)
def _warm_start_of(call: Any) -> Any:
"""The start solution a call of GENETIC0's legacy preparation got."""
start, observation, start_solution = call.args
return start_solution
def _assert_prepared_without_request(prefix: str, prepare: Any) -> None:
"""GENETIC0 passes start, observation time and warm start (none here) into its preparation."""
if prefix == "Genetic0":
prepare.assert_awaited_once()
assert _warm_start_of(prepare.await_args) is None
else:
prepare.assert_awaited_once_with()
def _conversion_arguments(prefix: str) -> dict[str, Any]:
"""Arguments of the stand-in results' conversion methods (none for both optimizers)."""
return {}
def _native_solution(prefix: str) -> Any:
"""The native solution the latest run published for GENETIC or GENETIC0."""
cls = ems_module.EnergyManagement
if prefix == "Genetic0":
return cls.optimizer_result("GENETIC0")
return cls._genetic_solution
def _set_native_solution(monkeypatch, prefix: str, solution: Any) -> None:
"""Publish ``solution`` as the result of a previous run of GENETIC or GENETIC0."""
cls = ems_module.EnergyManagement
if prefix == "Genetic0":
runs = {"GENETIC0": OptimizerRun(parameters=object(), result=solution)}
monkeypatch.setattr(cls, "_optimizer_runs", runs)
else:
monkeypatch.setattr(cls, "_genetic_solution", solution)
def _supplied(prefix: str, parameters: Any, generations: int, seed: int) -> dict[str, Any]:
"""Run arguments that supply the parameters, generations and seed of a run."""
if prefix == "Genetic0":
return {"request": parameters, "overrides": {"generations": generations, "seed": seed}}
return {
"genetic_parameters": parameters,
"genetic_generations": generations,
"genetic_seed": seed,
}
@pytest.fixture
def offline_ems(monkeypatch):
"""Run the actual EMS orchestration with no real adapters or prediction IO."""
@@ -37,20 +97,26 @@ def offline_ems(monkeypatch):
"_plan",
"_optimization_solution",
"_genetic_solution",
"_genetic0_solution",
):
monkeypatch.setattr(cls, name, None)
monkeypatch.setattr(cls, "_optimizer_runs", {})
monkeypatch.setattr(cls, "_stage", ems_module.EnergyManagementStage.IDLE)
monkeypatch.setattr(cls, "_run_lock", Lock())
monkeypatch.setattr(ems_module, "CacheEnergyManagementStore", Mock())
return SimpleNamespace(
ems = SimpleNamespace(
config=SimpleNamespace(
general=SimpleNamespace(timezone="Europe/Berlin"),
ems=SimpleNamespace(mode=EnergyManagementMode.OPTIMIZATION),
optimization=SimpleNamespace(
algorithm=OptimizationAlgorithm.GENETIC,
genetic=SimpleNamespace(generations=3, seed=17, interval_sec=3600, individuals=31),
genetic0=SimpleNamespace(generations=5, seed=29),
genetic0=SimpleNamespace(
generations=5, seed=29, horizon_hours=24, individuals=13, penalties={}
),
),
prediction=SimpleNamespace(hours=48),
devices=SimpleNamespace(
batteries=None, electric_vehicles=None, max_home_appliances=0
),
server=SimpleNamespace(verbose=False),
),
@@ -58,6 +124,33 @@ def offline_ems(monkeypatch):
adapter=SimpleNamespace(update_data=AsyncMock()),
set_start_datetime=cls.set_start_datetime,
)
# GENETIC0's parameter preparation reads the settings and predictions itself.
monkeypatch.setattr(genetic0prepare, "get_config", lambda: ems.config)
monkeypatch.setattr(
genetic0prepare, "get_prediction", lambda: SimpleNamespace(record_keys=[])
)
monkeypatch.setattr(
genetic0prepare,
"configured_grid_interpolator_backend",
lambda: GridInterpolatorBackend.SCIPY,
)
# Stand-in results carry their own conversion methods.
async def optimization_solution(parameters: Any, result: Any) -> Any:
return await result.optimization_solution()
monkeypatch.setattr(genetic0convert, "optimization_solution", optimization_solution)
monkeypatch.setattr(
genetic0convert,
"energy_management_plan",
lambda parameters, result: result.energy_management_plan(),
)
# Stand-in requests have no forecasts to derive the simulation's dataclasses from.
monkeypatch.setattr(
genetic0prepare.Genetic0Parameters,
"from_request",
classmethod(lambda cls, **fields: SimpleNamespace(**fields)),
)
return ems
@pytest.mark.asyncio
@@ -106,9 +199,11 @@ async def test_optimization_routes_only_selected_algorithm(
):
"""Configuration selection and explicit overrides retain isolated async paths."""
selected_name = "Genetic" if algorithm == OptimizationAlgorithm.GENETIC else "Genetic0"
other_name = "Genetic0" if selected_name == "Genetic" else "Genetic"
suffix = "genetic" if algorithm == OptimizationAlgorithm.GENETIC else "genetic0"
other_suffix = "genetic0" if suffix == "genetic" else "genetic"
sentinel_parameters = object()
# GENETIC0's preparation looks at the request's home appliance.
sentinel_parameters = SimpleNamespace(dishwasher=None)
sentinel_result, sentinel_plan = object(), object()
solution = SimpleNamespace(
optimization_solution=AsyncMock(return_value=sentinel_result),
@@ -123,9 +218,7 @@ async def test_optimization_routes_only_selected_algorithm(
_patch_optimizer(monkeypatch, prefix, constructor)
prepare = AsyncMock(return_value=sentinel_parameters)
preparers[prefix] = prepare
monkeypatch.setattr(
getattr(ems_module, prefix + "OptimizationParameters"), "prepare", prepare
)
_patch_prepare(monkeypatch, prefix, prepare)
kwargs: dict[str, Any] = {
"start_datetime": to_datetime("2026-09-16T10:00:00+02:00", in_timezone=timezone)
}
@@ -135,38 +228,50 @@ async def test_optimization_routes_only_selected_algorithm(
offline_ems.config.optimization.algorithm = OptimizationAlgorithm(other_suffix.upper())
kwargs["algorithm"] = algorithm
if supplied:
kwargs[suffix + "_parameters"] = sentinel_parameters
kwargs[suffix + "_generations"] = 7
kwargs[suffix + "_seed"] = 43
kwargs.update(_supplied(selected_name, sentinel_parameters, 7, 43))
if algorithm == OptimizationAlgorithm.GENETIC:
kwargs["genetic_individuals"] = 11
run_result = await ems_module.EnergyManagement.run(offline_ems, **kwargs)
assert run_result is solution
selected = constructors[selected_name]
expected_config = getattr(offline_ems.config.optimization, suffix)
selected.assert_called_once_with(
verbose=False, fixed_seed=43 if supplied else expected_config.seed
)
expected_seed = 43 if supplied else expected_config.seed
expected_generations = 7 if supplied else expected_config.generations
expected_arguments: dict[str, Any] = {
"start_hour": expected_hour,
"parameters": sentinel_parameters,
"ngen": 7 if supplied else expected_config.generations,
}
if algorithm == OptimizationAlgorithm.GENETIC:
selected.assert_called_once_with(verbose=False, fixed_seed=expected_seed)
expected_arguments["ngen"] = expected_generations
else:
# GENETIC0 gets its algorithm settings from the parameters (step 3).
(settings,) = selected.call_args.args
assert (settings.seed, settings.generations, settings.verbose) == (
expected_seed,
expected_generations,
False,
)
if algorithm == OptimizationAlgorithm.GENETIC:
expected_arguments["individuals"] = 11 if supplied else None
selected.return_value.optimize_ems.assert_called_once_with(**expected_arguments)
other_name = "Genetic0" if selected_name == "Genetic" else "Genetic"
selected.return_value.optimize_ems.assert_called_once_with(**expected_arguments)
else:
# GENETIC0 runs from its parameters, which carry the request and the start hour.
(parameters,) = selected.return_value.optimize_ems.call_args.args
assert parameters.request is sentinel_parameters
assert parameters.start_hour == expected_hour
constructors[other_name].assert_not_called()
preparers[other_name].assert_not_awaited()
if supplied:
preparers[selected_name].assert_not_awaited()
else:
preparers[selected_name].assert_awaited_once_with()
solution.optimization_solution.assert_awaited_once_with()
solution.energy_management_plan.assert_called_once_with()
_assert_prepared_without_request(selected_name, preparers[selected_name])
conversion_arguments = _conversion_arguments(selected_name)
solution.optimization_solution.assert_awaited_once_with(**conversion_arguments)
solution.energy_management_plan.assert_called_once_with(**conversion_arguments)
cls = ems_module.EnergyManagement
assert getattr(cls, "_" + suffix + "_solution") is solution
assert getattr(cls, "_" + other_suffix + "_solution") is None
assert _native_solution(selected_name) is solution
assert _native_solution(other_name) is None
assert cls.optimization_solution() is sentinel_result
assert cls.plan() is sentinel_plan
assert cls.stage() == ems_module.EnergyManagementStage.IDLE
@@ -194,16 +299,17 @@ async def test_non_optimization_modes_never_optimize(monkeypatch, offline_ems, m
@pytest.mark.asyncio
@pytest.mark.parametrize("prefix", ["Genetic", "Genetic0"])
@pytest.mark.parametrize("prefix", ["Genetic"])
async def test_missing_preparation_does_not_dispatch_controls(monkeypatch, offline_ems, prefix):
"""GENETIC may still cancel; GENETIC0's preparation never does (TestGenetic0AlwaysValid)."""
constructor = Mock()
_patch_optimizer(monkeypatch, prefix, constructor)
prepare = AsyncMock(return_value=None)
monkeypatch.setattr(getattr(ems_module, prefix + "OptimizationParameters"), "prepare", prepare)
_patch_prepare(monkeypatch, prefix, prepare)
await ems_module.EnergyManagement.run(
offline_ems, algorithm=OptimizationAlgorithm(prefix.upper())
)
prepare.assert_awaited_once_with()
_assert_prepared_without_request(prefix, prepare)
constructor.assert_not_called()
assert offline_ems.adapter.update_data.await_count == 1 # acquisition only
assert ems_module.EnergyManagement.plan() is None
@@ -213,35 +319,42 @@ async def test_missing_preparation_does_not_dispatch_controls(monkeypatch, offli
@pytest.mark.asyncio
@pytest.mark.parametrize("start_hour", [None, 11])
async def test_legacy_optimize_explicitly_uses_genetic0(monkeypatch, start_hour):
"""Even with GENETIC configured, /optimize must never become the new optimizer."""
"""Even with GENETIC configured, /optimize must never become the new optimizer.
The GENETIC0 router gets its run trigger from the server's placeholder override.
"""
from httpx import ASGITransport, AsyncClient
from akkudoktoreos.server import eos
from akkudoktoreos.server.rest.error import EOSProblem
fake = SimpleNamespace(
run=AsyncMock(return_value=None), genetic0_solution=Mock(return_value=None)
run=AsyncMock(return_value=None), optimizer_run=Mock(return_value=None)
)
monkeypatch.setattr(eos, "get_ems", lambda: fake)
parameters = Genetic0OptimizationParameters.model_validate(
{
"ems": {
"pv_prognose_wh": [0.0, 100.0],
"gesamtlast": [100.0, 100.0],
"strompreis_euro_pro_wh": [0.0003, 0.0003],
"einspeiseverguetung_euro_pro_wh": 0.00008,
"preis_euro_pro_wh_akku": 0.0,
},
"pv_akku": None,
"eauto": None,
"inverter": None,
}
)
with pytest.raises(EOSProblem):
await eos.fastapi_optimize(parameters=parameters, start_hour=start_hour, ngen=2)
body = {
"ems": {
"pv_prognose_wh": [0.0, 100.0],
"gesamtlast": [100.0, 100.0],
"strompreis_euro_pro_wh": [0.0003, 0.0003],
"einspeiseverguetung_euro_pro_wh": 0.00008,
"preis_euro_pro_wh_akku": 0.0,
},
"pv_akku": None,
"eauto": None,
"inverter": None,
}
query = "ngen=2" + ("" if start_hour is None else f"&start_hour={start_hour}")
async with AsyncClient(
transport=ASGITransport(app=eos.app, raise_app_exceptions=False), base_url="http://test"
) as client:
response = await client.post(f"/optimize?{query}", json=body)
assert response.status_code == 404
assert response.json()["title"] == "Optimization solution retrieval failed"
kwargs = fake.run.await_args.kwargs
assert kwargs["mode"] == EnergyManagementMode.OPTIMIZATION
assert kwargs["algorithm"] == OptimizationAlgorithm.GENETIC0
assert kwargs["genetic0_parameters"] is parameters
assert kwargs["genetic0_generations"] == 2
assert kwargs["request"].model_dump() == Genetic0Request.model_validate(body).model_dump()
assert kwargs["overrides"] == {"generations": 2}
assert "genetic_parameters" not in kwargs
assert (
kwargs["start_datetime"] is None
@@ -261,7 +374,7 @@ async def test_failed_legacy_http_run_never_reports_previous_solution(
from httpx import ASGITransport, AsyncClient
from akkudoktoreos.optimization.genetic0.genetic0solution import Genetic0Solution
from akkudoktoreos.optimization.genetic0.genetic0api import Genetic0Solution
from akkudoktoreos.server import eos
cls = ems_module.EnergyManagement
@@ -269,7 +382,7 @@ async def test_failed_legacy_http_run_never_reports_previous_solution(
(Path(__file__).parent / "testdata/genetic0/optimize_result_1.json").read_text()
)
previous = Genetic0Solution.model_validate(data)
monkeypatch.setattr(cls, "_genetic0_solution", previous)
_set_native_solution(monkeypatch, "Genetic0", previous)
constructor = Mock()
error = RuntimeError("synthetic " + phase + " failure")
native = SimpleNamespace(
@@ -285,7 +398,7 @@ async def test_failed_legacy_http_run_never_reports_previous_solution(
native.energy_management_plan.side_effect = error
_patch_optimizer(monkeypatch, "Genetic0", constructor)
offline_ems.run = MethodType(cls.run, offline_ems)
offline_ems.genetic0_solution = cls.genetic0_solution
offline_ems.optimizer_result = cls.optimizer_result
monkeypatch.setattr(eos, "get_ems", lambda: offline_ems)
async with AsyncClient(
transport=ASGITransport(app=eos.app, raise_app_exceptions=False), base_url="http://test"
@@ -309,8 +422,7 @@ async def test_conversion_failure_preserves_consistent_previous_results(
):
cls = ems_module.EnergyManagement
previous_specific, previous_generic, previous_plan = object(), object(), object()
suffix = prefix.lower()
monkeypatch.setattr(cls, "_" + suffix + "_solution", previous_specific)
_set_native_solution(monkeypatch, prefix, previous_specific)
monkeypatch.setattr(cls, "_optimization_solution", previous_generic)
monkeypatch.setattr(cls, "_plan", previous_plan)
conversion = AsyncMock(return_value=object())
@@ -322,18 +434,18 @@ async def test_conversion_failure_preserves_consistent_previous_results(
constructor = Mock()
constructor.return_value.optimize_ems.return_value = solution
_patch_optimizer(monkeypatch, prefix, constructor)
supplied_parameters: dict[str, Any] = {suffix + "_parameters": object()}
supplied_parameters = _supplied(prefix, SimpleNamespace(dishwasher=None), 3, 17)
result = await cls.run(
offline_ems,
algorithm=OptimizationAlgorithm(prefix.upper()),
**supplied_parameters,
)
assert result is None
conversion.assert_awaited_once_with()
conversion.assert_awaited_once_with(**_conversion_arguments(prefix))
assert solution.energy_management_plan.call_count == (phase == "plan")
assert offline_ems.adapter.update_data.await_count == 1
assert (
getattr(cls, "_" + suffix + "_solution"),
_native_solution(prefix),
cls.optimization_solution(),
cls.plan(),
cls.stage(),
@@ -352,7 +464,10 @@ async def test_legacy_endpoint_uses_run_return_value_not_last_cached_solution(mo
import json
from pathlib import Path
from akkudoktoreos.optimization.genetic0.genetic0solution import Genetic0Solution
from httpx import ASGITransport, AsyncClient
from test_genetic0optimize import result_of
from akkudoktoreos.optimization.genetic0.genetic0api import Genetic0Solution
from akkudoktoreos.server import eos
data = json.loads(
@@ -360,11 +475,88 @@ async def test_legacy_endpoint_uses_run_return_value_not_last_cached_solution(mo
)
produced = Genetic0Solution.model_validate(data)
fake = SimpleNamespace(
run=AsyncMock(return_value=produced),
genetic0_solution=Mock(side_effect=AssertionError("must use this run's result")),
run=AsyncMock(return_value=result_of(produced)),
optimizer_run=Mock(side_effect=AssertionError("must use this run's result")),
)
monkeypatch.setattr(eos, "get_ems", lambda: fake)
result = await eos.fastapi_optimize(parameters=produced.parameters, ngen=1)
assert result.start_solution == produced.start_solution
assert result.result.total_balance == produced.result.total_balance
fake.genetic0_solution.assert_not_called()
async with AsyncClient(
transport=ASGITransport(app=eos.app), base_url="http://test"
) as client:
response = await client.post("/optimize?ngen=1", json=data["parameters"])
assert response.status_code == 200
assert response.json()["start_solution"] == produced.start_solution
assert response.json()["result"]["total_balance"] == produced.result.total_balance
fake.optimizer_run.assert_not_called()
@pytest.mark.asyncio
@pytest.mark.parametrize("prefix", ["Genetic", "Genetic0"])
async def test_raising_preparation_cancels_the_run(monkeypatch, offline_ems, prefix):
"""A preparation that raises cancels the run like one that returns None."""
cls = ems_module.EnergyManagement
previous_specific, previous_generic, previous_plan = object(), object(), object()
_set_native_solution(monkeypatch, prefix, previous_specific)
monkeypatch.setattr(cls, "_optimization_solution", previous_generic)
monkeypatch.setattr(cls, "_plan", previous_plan)
constructor = Mock()
_patch_optimizer(monkeypatch, prefix, constructor)
_patch_prepare(monkeypatch, prefix, AsyncMock(side_effect=RuntimeError("synthetic")))
result = await cls.run(offline_ems, algorithm=OptimizationAlgorithm(prefix.upper()))
assert result is None
constructor.assert_not_called()
assert offline_ems.adapter.update_data.await_count == 1 # acquisition only
assert (
_native_solution(prefix),
cls.optimization_solution(),
cls.plan(),
cls.stage(),
) == (
previous_specific,
previous_generic,
previous_plan,
ems_module.EnergyManagementStage.IDLE,
)
@pytest.mark.asyncio
async def test_previous_genetic0_result_is_the_warm_start_of_the_next_run(
monkeypatch, offline_ems
):
"""The EMS passes the result of the last successful GENETIC0 run into the next preparation.
The optimizer holds no state: the warm start comes from the EMS slot, and a failed run keeps
the previous one.
"""
cls = ems_module.EnergyManagement
first = SimpleNamespace(
start_solution=[1.0, 2.0],
optimization_solution=AsyncMock(return_value=object()),
energy_management_plan=Mock(return_value=object()),
)
second = SimpleNamespace(
start_solution=[3.0, 4.0],
optimization_solution=AsyncMock(return_value=object()),
energy_management_plan=Mock(return_value=object()),
)
constructor = Mock()
constructor.return_value.optimize_ems.side_effect = [
first,
RuntimeError("synthetic optimizer failure"),
second,
second,
]
_patch_optimizer(monkeypatch, "Genetic0", constructor)
prepare = AsyncMock(return_value=SimpleNamespace(dishwasher=None))
_patch_prepare(monkeypatch, "Genetic0", prepare)
for _ in range(3):
await cls.run(offline_ems, algorithm=OptimizationAlgorithm.GENETIC0)
assert cls.optimizer_result("GENETIC0") is second
# Without a stored run there is no warm start.
monkeypatch.setattr(cls, "_optimizer_runs", {})
await cls.run(offline_ems, algorithm=OptimizationAlgorithm.GENETIC0)
assert [_warm_start_of(call) for call in prepare.await_args_list] == [
None,
[1.0, 2.0],
[1.0, 2.0], # the failed second run kept the first as warm start
None,
]
+52 -30
View File
@@ -2,24 +2,24 @@ import numpy as np
import pytest
from akkudoktoreos.config.configabc import TimeWindow, TimeWindowSequence
from akkudoktoreos.devices.genetic0.genetic0battery import (
Genetic0Battery,
Genetic0ElectricVehicleParameters,
Genetic0SolarPanelBatteryParameters,
)
from akkudoktoreos.devices.genetic0.genetic0homeappliance import (
from akkudoktoreos.optimization.genetic0.devices.genetic0battery import Genetic0Battery
from akkudoktoreos.optimization.genetic0.devices.genetic0homeappliance import (
Genetic0HomeAppliance,
Genetic0HomeApplianceParameters,
)
from akkudoktoreos.devices.genetic0.genetic0inverter import (
from akkudoktoreos.optimization.genetic0.devices.genetic0inverter import (
Genetic0Inverter,
Genetic0InverterParameters,
)
from akkudoktoreos.optimization.genetic0.genetic0 import (
Genetic0EnergyManagementParameters,
Genetic0Simulation,
from akkudoktoreos.optimization.genetic0.genetic0api import (
Genetic0SimulationResult,
)
from akkudoktoreos.optimization.genetic0.genetic0request import (
Genetic0ElectricVehicleRequest,
Genetic0EnergyManagementRequest,
Genetic0HomeApplianceRequest,
Genetic0InverterRequest,
Genetic0SolarPanelBatteryRequest,
)
from akkudoktoreos.optimization.genetic0.genetic0simulation import Genetic0Simulation
from akkudoktoreos.utils.datetimeutil import to_duration, to_time
START_HOUR = 0
@@ -45,38 +45,38 @@ def genetic0_simulation(config_eos) -> Genetic0Simulation:
# Initialize the battery and the inverter
akku = Genetic0Battery(
Genetic0SolarPanelBatteryParameters(
Genetic0SolarPanelBatteryRequest(
device_id="battery1",
capacity_wh=5000,
initial_soc_percentage=80,
min_soc_percentage=10,
),
).to_parameters(),
prediction_hours = config_eos.prediction.hours,
)
akku.reset()
inverter = Genetic0Inverter(
Genetic0InverterParameters(device_id="inverter1", max_power_wh=10000, battery_id=akku.parameters.device_id),
Genetic0InverterRequest(device_id="inverter1", max_power_wh=10000, battery_id=akku.parameters.device_id).to_parameters(),
battery = akku,
)
# Household device (currently not used, set to None)
home_appliance = Genetic0HomeAppliance(
Genetic0HomeApplianceParameters(
Genetic0HomeApplianceRequest(
device_id="dishwasher1",
consumption_wh=2000,
duration_h=2,
time_windows=None,
),
).to_parameters(48),
optimization_hours = config_eos.optimization.genetic0.horizon_hours,
prediction_hours = config_eos.prediction.hours,
)
# Example initialization of electric car battery
eauto = Genetic0Battery(
Genetic0ElectricVehicleParameters(
Genetic0ElectricVehicleRequest(
device_id="ev1", capacity_wh=26400, initial_soc_percentage=10, min_soc_percentage=10
),
).to_parameters(),
prediction_hours = config_eos.prediction.hours,
)
eauto.set_charge_per_hour(np.full(config_eos.prediction.hours, 1))
@@ -241,13 +241,13 @@ def genetic0_simulation(config_eos) -> Genetic0Simulation:
# Initialize the energy management system with the respective parameters
genetic0_simulation = Genetic0Simulation()
genetic0_simulation.prepare(
Genetic0EnergyManagementParameters.model_validate(dict(
Genetic0EnergyManagementRequest.model_validate(dict(
pv_prognose_wh=pv_prognose_wh,
strompreis_euro_pro_wh=strompreis_euro_pro_wh,
einspeiseverguetung_euro_pro_wh=einspeiseverguetung_euro_pro_wh,
preis_euro_pro_wh_akku=preis_euro_pro_wh_akku,
gesamtlast=gesamtlast,
)),
)).to_parameters(),
optimization_hours = config_eos.optimization.genetic0.horizon_hours,
prediction_hours = config_eos.prediction.hours,
inverter=inverter,
@@ -287,38 +287,38 @@ def genetic0_simulation_2(config_eos) -> Genetic0Simulation:
# Initialize the battery and the inverter
akku = Genetic0Battery(
Genetic0SolarPanelBatteryParameters(
Genetic0SolarPanelBatteryRequest(
device_id="battery1",
capacity_wh=5000,
initial_soc_percentage=80,
min_soc_percentage=10,
),
).to_parameters(),
prediction_hours = config_eos.prediction.hours,
)
akku.reset()
inverter = Genetic0Inverter(
Genetic0InverterParameters(device_id="inverter1", max_power_wh=10000, battery_id=akku.parameters.device_id),
Genetic0InverterRequest(device_id="inverter1", max_power_wh=10000, battery_id=akku.parameters.device_id).to_parameters(),
battery = akku,
)
# Household device (currently not used, set to None)
home_appliance = Genetic0HomeAppliance(
Genetic0HomeApplianceParameters(
Genetic0HomeApplianceRequest(
device_id="dishwasher1",
consumption_wh=2000,
duration_h=2,
time_windows=None,
),
).to_parameters(48),
optimization_hours = config_eos.optimization.genetic0.horizon_hours,
prediction_hours = config_eos.prediction.hours,
)
# Example initialization of electric car battery
eauto = Genetic0Battery(
Genetic0ElectricVehicleParameters(
Genetic0ElectricVehicleRequest(
device_id="ev1", capacity_wh=26400, initial_soc_percentage=10, min_soc_percentage=10
),
).to_parameters(),
prediction_hours = config_eos.prediction.hours,
)
@@ -389,13 +389,13 @@ def genetic0_simulation_2(config_eos) -> Genetic0Simulation:
# Initialize the energy management system with the respective parameters
simulation = Genetic0Simulation()
simulation.prepare(
Genetic0EnergyManagementParameters.model_validate(dict(
Genetic0EnergyManagementRequest.model_validate(dict(
pv_prognose_wh=pv_prognose_wh,
strompreis_euro_pro_wh=strompreis_euro_pro_wh,
einspeiseverguetung_euro_pro_wh=einspeiseverguetung_euro_pro_wh,
preis_euro_pro_wh_akku=preis_euro_pro_wh_akku,
gesamtlast=gesamtlast,
)),
)).to_parameters(),
optimization_hours = config_eos.optimization.genetic0.horizon_hours,
prediction_hours = config_eos.prediction.hours,
inverter=inverter,
@@ -654,3 +654,25 @@ def test_reset(genetic0_simulation_2):
assert simulation.battery.current_soc_percentage() == simulation.battery.parameters.initial_soc_percentage, (
"Battery SOC should be reset to initial value"
)
def test_without_inverter_the_grid_supplies_the_whole_load():
"""Without an inverter the load is bought from the grid; PV is neither used nor fed in."""
hours = 4
simulation = Genetic0Simulation()
simulation.prepare(
Genetic0EnergyManagementRequest(
pv_forecast_wh=[2000.0] * hours,
electricity_price_per_wh=[0.0003] * hours,
feed_in_tariff_per_wh=[0.0001] * hours,
price_per_wh_battery=0.0,
total_load=[1000.0] * hours,
).to_parameters(),
optimization_hours=hours,
prediction_hours=hours,
)
result = simulation.simulate(0)
assert list(result["Netzbezug_Wh_pro_Stunde"]) == [1000.0] * hours
assert list(result["Netzeinspeisung_Wh_pro_Stunde"]) == [0.0] * hours
assert result["Gesamtkosten_Euro"] == pytest.approx(hours * 1000.0 * 0.0003)
assert result["Gesamteinnahmen_Euro"] == 0.0
+12 -10
View File
@@ -3,9 +3,11 @@
import json
from akkudoktoreos.optimization.genetic0.genetic0 import Genetic0SimulationResult
from akkudoktoreos.optimization.genetic0.genetic0params import (
Genetic0EnergyManagementParameters,
from akkudoktoreos.optimization.genetic0.genetic0api import (
Genetic0SimulationResult,
)
from akkudoktoreos.optimization.genetic0.genetic0request import (
Genetic0EnergyManagementRequest,
)
@@ -18,7 +20,7 @@ def test_genetic0_params_german_input():
"preis_euro_pro_wh_akku": 0.0001,
"gesamtlast": [500.0, 600.0],
}
params = Genetic0EnergyManagementParameters.model_validate(data_de)
params = Genetic0EnergyManagementRequest.model_validate(data_de)
assert params.pv_forecast_wh == [100.0, 200.0]
print("✅ German input accepted")
@@ -31,7 +33,7 @@ def test_genetic0_params_english_input():
"price_per_wh_battery": 0.0001,
"total_load": [500.0, 600.0],
}
params = Genetic0EnergyManagementParameters.model_validate(data_en)
params = Genetic0EnergyManagementRequest.model_validate(data_en)
assert params.pv_forecast_wh == [100.0, 200.0]
print("✅ English input accepted")
@@ -44,7 +46,7 @@ def test_genetic0_params_english_output():
"preis_euro_pro_wh_akku": 0.0001,
"gesamtlast": [500.0, 600.0],
}
params = Genetic0EnergyManagementParameters.model_validate(data_de)
params = Genetic0EnergyManagementRequest.model_validate(data_de)
json_output = json.loads(params.model_dump_json(by_alias=True))
# English names should be in output
@@ -129,8 +131,8 @@ if __name__ == "__main__":
def test_genetic0_optimization_parameters_device_translations():
"""Test that German device field names are accepted and re-emitted."""
from akkudoktoreos.optimization.genetic0.genetic0params import (
Genetic0OptimizationParameters,
from akkudoktoreos.optimization.genetic0.genetic0request import (
Genetic0Request,
)
ems_de = {
@@ -140,7 +142,7 @@ def test_genetic0_optimization_parameters_device_translations():
"preis_euro_pro_wh_akku": 0.0001,
"gesamtlast": [500.0, 600.0],
}
params = Genetic0OptimizationParameters.model_validate(dict(
params = Genetic0Request.model_validate(dict(
ems=ems_de,
pv_akku={"device_id": "battery1", "capacity_wh": 8000},
inverter=None,
@@ -153,7 +155,7 @@ def test_genetic0_optimization_parameters_device_translations():
assert params.ev.capacity_wh == 60000
# English input names work as well
params_en = Genetic0OptimizationParameters.model_validate(dict(
params_en = Genetic0Request.model_validate(dict(
ems=ems_de,
pv_battery={"device_id": "battery1", "capacity_wh": 8000},
inverter=None,
+54
View File
@@ -1,10 +1,18 @@
from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
import numpy as np
import pytest
from matplotlib.testing.compare import compare_images
from akkudoktoreos.core.coreabc import get_ems
from akkudoktoreos.optimization.genetic0 import genetic0prepare
from akkudoktoreos.optimization.genetic0.genetic0optimizer import Genetic0Optimizer
from akkudoktoreos.optimization.genetic0.genetic0visualize import (
genetic0_generate_example_report,
genetic0_prepare_visualize,
)
from akkudoktoreos.utils.datetimeutil import to_datetime
filename = "example_report.pdf"
@@ -35,3 +43,49 @@ def test_generate_pdf_example(config_eos):
reference_png_file.unlink()
output_file.unlink()
output_png_file.unlink()
@pytest.mark.asyncio
@pytest.mark.parametrize(
"prediction_hours, start",
[
(6, "2026-08-01T00:00:00+00:00"), # fewer than 12 hours shown
(30, "2026-08-01T14:00:00+00:00"), # not the 48 hours the labels once assumed
],
)
async def test_report_of_a_run_that_is_not_48_hours_long(config_eos, prediction_hours, start):
"""The report shows a run of any length the run accepts."""
config_eos.merge_settings_from_dict(
{
"general": {"timezone_override": "UTC"},
"prediction": {"hours": prediction_hours},
"optimization": {"genetic0": {"individuals": 10, "generations": 10, "seed": 1}},
"elecfee": {"provider": None},
"devices": {
"max_batteries": 0,
"max_electric_vehicles": 0,
"max_inverters": 0,
"max_home_appliances": 0,
},
}
)
get_ems().set_start_datetime(to_datetime(start, in_timezone="UTC"))
async def read_array(*, start_datetime, end_datetime, interval, **kwargs):
slots = int((end_datetime - start_datetime).total_seconds() / interval.total_seconds())
return np.full(slots, 0.0003)
prediction = Mock(
update_data=AsyncMock(),
key_to_array=AsyncMock(side_effect=read_array),
key_to_raw_series=AsyncMock(side_effect=KeyError("no tariff")),
record_keys=[key for key, _ in genetic0prepare.PRESENTATION_PREDICTIONS],
)
optimizer = Genetic0Optimizer()
with patch.object(genetic0prepare, "get_prediction", return_value=prediction):
parameters = await optimizer.prepare(
get_ems().start_datetime, get_ems().observation_datetime, None
)
result = optimizer.run(parameters)
assert genetic0_prepare_visualize(parameters, result).startswith(b"%PDF-")
+2 -1
View File
@@ -11,6 +11,7 @@ from akkudoktoreos.devices.genetic.battery import (
SolarPanelBatteryParameters,
)
from akkudoktoreos.devices.settings.batterysettings import BatteryProfileAdjustment
from akkudoktoreos.optimization.genetic0 import genetic0prepare
@pytest.fixture
@@ -439,7 +440,7 @@ def test_equal_soc_limits_are_valid(target):
max_soc_percentage=target,
profile_adjustment=BatteryProfileAdjustment(nominal_capacity_wh=8000))
assert settings.to_genetic_ev_bat_param().min_soc_percentage == target
assert settings.to_genetic0_ev_bat_param().min_soc_percentage == target
assert genetic0prepare.electric_vehicle_request(settings).min_soc_percentage == target
@pytest.mark.parametrize("minimum,maximum", [(100, 99), (81, 80), (101, 100), (-1, 100)])
+4 -3
View File
@@ -20,6 +20,7 @@ from akkudoktoreos.devices.settings.batterysettings import BatteriesCommonSettin
from akkudoktoreos.devices.settings.homeappliancesettings import (
HomeApplianceCommonSettings,
)
from akkudoktoreos.optimization.genetic0 import genetic0prepare
from akkudoktoreos.utils.datetimeutil import to_datetime
@@ -74,7 +75,7 @@ def test_profile_cannot_silently_override_explicit_flat_definition(fields: dict[
def test_settings_profile_roundtrip_and_legacy_defaults() -> None:
defaults = HomeApplianceCommonSettings(device_id="legacy")
assert defaults.to_genetic_param().consumption_wh == 3000
assert defaults.to_genetic0_param().duration_h == 3
assert genetic0prepare.home_appliance_request(defaults).duration_h == 3
settings = HomeApplianceCommonSettings.model_validate(
{
"device_id": "washer",
@@ -94,7 +95,7 @@ def test_settings_profile_roundtrip_and_legacy_defaults() -> None:
assert params.schedule_mode == ConsumerScheduleMode.DAILY
assert params.shared_time_windows is not None
with pytest.raises(ValueError, match="GENETIC"):
restored.to_genetic0_param()
genetic0prepare.home_appliance_request(restored)
def test_cycle_and_shared_windows_intersect_after_completed_cycle() -> None:
@@ -245,7 +246,7 @@ def test_ev_deadlines_roundtrip_without_changing_slot_physics() -> None:
charged, losses = battery.charge_energy(2000, hour=0)
assert charged == pytest.approx(1000 * params.charging_efficiency)
assert losses == pytest.approx(1000 * (1 - params.charging_efficiency))
assert "min_soc_deadline_datetime" not in settings.to_genetic0_ev_bat_param().model_dump()
assert "min_soc_deadline_datetime" not in genetic0prepare.electric_vehicle_request(settings).model_dump()
@pytest.mark.parametrize("duration", [0.0, -1.0, float("inf"), float("nan")])
@@ -422,6 +422,7 @@ async def test_real_ems_returns_coherent_quarter_hour_solution_and_plan(
)
assert solution is not None
assert solution is ems.genetic_solution()
assert solution is not None # run() returns Any; `is` narrowed to Optional
assert solution.start_solution_datetime == fake.start_datetime
assert len(solution.ac_charge) == 4
assert ems.optimization_solution() is not None
+8 -2
View File
@@ -9,6 +9,7 @@ from akkudoktoreos.devices.genetic.battery import (
)
from akkudoktoreos.devices.genetic.inverter import Inverter, InverterParameters
from akkudoktoreos.devices.settings.invertersettings import InverterCommonSettings
from akkudoktoreos.optimization.genetic0 import genetic0prepare
@pytest.fixture
@@ -495,10 +496,15 @@ class TestInverterSettings:
def test_inverter_conversion_requires_nominal_power(self, config_eos, converter):
# The generic inverter profile provides no nominal power.
settings = InverterCommonSettings(device_id="inverter")
convert = (
(lambda: genetic0prepare.inverter_request(settings))
if converter == "to_genetic0_param"
else getattr(settings, converter)
)
with pytest.raises(ValueError, match="nominal_power_w"):
getattr(settings, converter)()
convert()
settings.profile_adjustment.nominal_power_w = 4200
assert getattr(settings, converter)().max_power_wh == 4200
assert convert().max_power_wh == 4200
def test_battery_discharge_limit_caps_load_and_grid_export():
+1 -3
View File
@@ -60,9 +60,7 @@ async def test_render_is_offloaded_and_uses_an_owned_copy(config_eos, monkeypatc
monkeypatch.setattr(
eos,
"get_ems",
lambda: SimpleNamespace(
genetic_solution=lambda: solution, genetic0_solution=lambda: solution
),
lambda: SimpleNamespace(genetic_solution=lambda: solution),
)
original_controls = list(solution.ac_charge)
+2 -1
View File
@@ -26,6 +26,7 @@ from akkudoktoreos.devices.settings.invertersettings import (
InverterCommonSettings,
InverterProfileAdjustment,
)
from akkudoktoreos.optimization.genetic0 import genetic0prepare
from akkudoktoreos.optimization.genetic.genetic import GeneticSimulation
from akkudoktoreos.optimization.genetic.geneticparams import (
GeneticEnergyManagementParameters,
@@ -444,7 +445,7 @@ class TestSettings:
device_id="inverter1",
profile_adjustment=InverterProfileAdjustment(nominal_power_w=5000),
)
params = settings.to_genetic0_param()
params = genetic0prepare.inverter_request(settings)
assert not hasattr(params, "dc_to_ac_efficiency_curve")
+5 -3
View File
@@ -87,15 +87,17 @@ def test_genetic_interpolator_boundaries_are_finite_and_physical(load, pv):
def test_genetic0_inverter_keeps_its_independent_interpolator():
from akkudoktoreos.devices.genetic0.genetic0inverter import (
from akkudoktoreos.optimization.genetic0.devices.genetic0inverter import (
Genetic0Inverter,
Genetic0InverterParameters,
)
from akkudoktoreos.optimization.genetic0.genetic0loadinterpolator import (
get_genetic0_load_interpolator,
)
from akkudoktoreos.optimization.genetic0.genetic0request import (
Genetic0InverterRequest,
)
inverter = Genetic0Inverter(Genetic0InverterParameters(device_id="legacy", max_power_wh=10000))
inverter = Genetic0Inverter(Genetic0InverterRequest(device_id="legacy", max_power_wh=10000).to_parameters())
assert inverter.self_consumption_predictor is get_genetic0_load_interpolator()
assert inverter.self_consumption_predictor is not get_eos_load_interpolator()
+2 -1
View File
@@ -24,7 +24,8 @@ LAZY_MODULES = [
"lxml",
"scipy",
"tzfpy",
"akkudoktoreos.optimization.genetic0.genetic0",
"akkudoktoreos.optimization.genetic0.genetic0algorithm",
"akkudoktoreos.optimization.genetic0.genetic0simulation",
"akkudoktoreos.optimization.genetic0.genetic0visualize",
"akkudoktoreos.optimization.genetic.geneticvisualize",
]
+38 -15
View File
@@ -1,12 +1,13 @@
"""Contracts shared by the configuration, tariff and optimizer PRs."""
from types import SimpleNamespace
from typing import Any
from unittest.mock import Mock
import pytest
from akkudoktoreos.optimization.genetic0.genetic0params import (
Genetic0EnergyManagementParameters,
from akkudoktoreos.optimization.genetic0.genetic0request import (
Genetic0EnergyManagementRequest,
)
from akkudoktoreos.optimization.genetic.geneticparams import (
GeneticEnergyManagementParameters,
@@ -15,7 +16,7 @@ from akkudoktoreos.optimization.optimization import OptimizationAlgorithm
@pytest.mark.parametrize(
"model", [GeneticEnergyManagementParameters, Genetic0EnergyManagementParameters]
"model", [GeneticEnergyManagementParameters, Genetic0EnergyManagementRequest]
)
@pytest.mark.parametrize("tariff", [0.00008, [0.00008, -0.00002]])
def test_energy_parameter_aliases_preserve_wh_prices(model, tariff):
@@ -45,12 +46,14 @@ def test_energy_parameter_aliases_preserve_wh_prices(model, tariff):
@pytest.mark.asyncio
@pytest.mark.parametrize("algorithm", list(OptimizationAlgorithm))
async def test_algorithm_result_endpoint_keeps_solution_types_separate(monkeypatch, algorithm):
"""GENETIC is served by the generic route, GENETIC0 by its own router (ADR 0005)."""
from httpx import ASGITransport, AsyncClient
from akkudoktoreos.server import eos
genetic, genetic0 = object(), object()
fake = SimpleNamespace(
genetic_solution=Mock(return_value=genetic),
genetic0_solution=Mock(return_value=genetic0),
genetic_solution=Mock(return_value=None),
optimizer_run=Mock(return_value=None),
)
monkeypatch.setattr(eos, "get_ems", lambda: fake)
monkeypatch.setattr(
@@ -58,14 +61,17 @@ async def test_algorithm_result_endpoint_keeps_solution_types_separate(monkeypat
"get_config",
lambda: SimpleNamespace(optimization=SimpleNamespace(algorithms=["GENETIC", "GENETIC0"])),
)
result = await eos.fastapi_energy_management_optimization_solution_algorithm_get(algorithm)
async with AsyncClient(
transport=ASGITransport(app=eos.app, raise_app_exceptions=False), base_url="http://test"
) as client:
response = await client.get(f"/v1/energy-management/optimization/solution/{algorithm}")
assert response.status_code == 404
assert response.json()["title"] == "Algorithm specific optimization solution retrieval failed"
if algorithm == OptimizationAlgorithm.GENETIC:
assert result is genetic
fake.genetic_solution.assert_called_once_with()
fake.genetic0_solution.assert_not_called()
fake.optimizer_run.assert_not_called()
else:
assert result is genetic0
fake.genetic0_solution.assert_called_once_with()
fake.optimizer_run.assert_called_once_with("GENETIC0")
fake.genetic_solution.assert_not_called()
@@ -95,10 +101,27 @@ def test_device_maps_feed_algorithm_specific_converters(algorithm):
assert settings.batteries is not None
assert settings.electric_vehicles is not None
assert settings.inverters is not None
battery = getattr(settings.batteries["storage"], "to_" + algorithm + "_pv_bat_param")()
ev = getattr(settings.electric_vehicles["car"], "to_" + algorithm + "_ev_bat_param")()
inverter = getattr(settings.inverters["inverter"], "to_" + algorithm + "_param")()
appliance = getattr(settings.home_appliances["washer"], "to_" + algorithm + "_param")()
storage = settings.batteries["storage"]
car = settings.electric_vehicles["car"]
hybrid = settings.inverters["inverter"]
washer = settings.home_appliances["washer"]
battery: Any
ev: Any
inverter: Any
appliance: Any
if algorithm == "genetic0":
# GENETIC0 converts the device settings in its parameter preparation (ADR 0004).
from akkudoktoreos.optimization.genetic0 import genetic0prepare
battery = genetic0prepare.battery_request(storage)
ev = genetic0prepare.electric_vehicle_request(car)
inverter = genetic0prepare.inverter_request(hybrid)
appliance = genetic0prepare.home_appliance_request(washer)
else:
battery = storage.to_genetic_pv_bat_param()
ev = car.to_genetic_ev_bat_param()
inverter = hybrid.to_genetic_param()
appliance = washer.to_genetic_param()
assert (battery.device_id, ev.device_id, inverter.device_id, appliance.device_id) == (
"storage",
"car",
+4 -174
View File
@@ -336,11 +336,6 @@ def collect_violations() -> frozenset[Violation]:
# the existing uses revealed by a new list entry (ADR 0007).
BASELINE: frozenset[Violation] = frozenset(
{
Violation(
"cross-optimizer",
"akkudoktoreos.optimization.genetic0.genetic0params",
"akkudoktoreos.optimization.genetic.forecast",
),
Violation(
"internals",
"akkudoktoreos.config.configmigrate",
@@ -366,31 +361,11 @@ BASELINE: frozenset[Violation] = frozenset(
"akkudoktoreos.core.ems",
"akkudoktoreos.optimization.genetic.geneticsolution",
),
Violation(
"internals",
"akkudoktoreos.core.ems",
"akkudoktoreos.optimization.genetic0.genetic0",
),
Violation(
"internals",
"akkudoktoreos.core.ems",
"akkudoktoreos.optimization.genetic0.genetic0params",
),
Violation(
"internals",
"akkudoktoreos.core.ems",
"akkudoktoreos.optimization.genetic0.genetic0solution",
),
Violation(
"internals",
"akkudoktoreos.optimization.optimization",
"akkudoktoreos.optimization.genetic.geneticsettings",
),
Violation(
"internals",
"akkudoktoreos.optimization.optimization",
"akkudoktoreos.optimization.genetic0.genetic0settings",
),
Violation(
"internals",
"akkudoktoreos.server.eos",
@@ -406,21 +381,6 @@ BASELINE: frozenset[Violation] = frozenset(
"akkudoktoreos.server.eos",
"akkudoktoreos.optimization.genetic.geneticvisualize",
),
Violation(
"internals",
"akkudoktoreos.server.eos",
"akkudoktoreos.optimization.genetic0.genetic0params",
),
Violation(
"internals",
"akkudoktoreos.server.eos",
"akkudoktoreos.optimization.genetic0.genetic0solution",
),
Violation(
"internals",
"akkudoktoreos.server.eos",
"akkudoktoreos.optimization.genetic0.genetic0visualize",
),
Violation(
"pydantic",
"akkudoktoreos.devices.genetic.battery",
@@ -436,21 +396,6 @@ BASELINE: frozenset[Violation] = frozenset(
"akkudoktoreos.devices.genetic.inverter",
"pydantic",
),
Violation(
"pydantic",
"akkudoktoreos.devices.genetic0.genetic0battery",
"pydantic",
),
Violation(
"pydantic",
"akkudoktoreos.devices.genetic0.genetic0homeappliance",
"pydantic",
),
Violation(
"pydantic",
"akkudoktoreos.devices.genetic0.genetic0inverter",
"pydantic",
),
Violation(
"pydantic",
"akkudoktoreos.optimization.genetic.configrequest",
@@ -513,74 +458,24 @@ BASELINE: frozenset[Violation] = frozenset(
),
Violation(
"pydantic",
"akkudoktoreos.optimization.genetic0.genetic0",
"akkudoktoreos.optimization.genetic0.genetic0convert",
"akkudoktoreos.core.pydantic",
),
Violation(
"pydantic",
"akkudoktoreos.optimization.genetic0.genetic0",
"pydantic",
),
Violation(
"pydantic",
"akkudoktoreos.optimization.genetic0.genetic0abc",
"akkudoktoreos.core.pydantic",
),
Violation(
"pydantic",
"akkudoktoreos.optimization.genetic0.genetic0abc",
"pydantic",
),
Violation(
"pydantic",
"akkudoktoreos.optimization.genetic0.genetic0devices",
"pydantic",
),
Violation(
"pydantic",
"akkudoktoreos.optimization.genetic0.genetic0params",
"pydantic",
),
Violation(
"pydantic",
"akkudoktoreos.optimization.genetic0.genetic0solution",
"akkudoktoreos.core.pydantic",
),
Violation(
"pydantic",
"akkudoktoreos.optimization.genetic0.genetic0solution",
"pydantic",
),
Violation(
"shared-config",
"akkudoktoreos.devices.settings.batterysettings",
"akkudoktoreos.devices.genetic.battery",
),
Violation(
"shared-config",
"akkudoktoreos.devices.settings.batterysettings",
"akkudoktoreos.devices.genetic0.genetic0battery",
),
Violation(
"shared-config",
"akkudoktoreos.devices.settings.homeappliancesettings",
"akkudoktoreos.devices.genetic.homeappliance",
),
Violation(
"shared-config",
"akkudoktoreos.devices.settings.homeappliancesettings",
"akkudoktoreos.devices.genetic0.genetic0homeappliance",
),
Violation(
"shared-config",
"akkudoktoreos.devices.settings.invertersettings",
"akkudoktoreos.devices.genetic.inverter",
),
Violation(
"shared-config",
"akkudoktoreos.devices.settings.invertersettings",
"akkudoktoreos.devices.genetic0.genetic0inverter",
),
Violation(
"world-access",
"akkudoktoreos.devices.genetic.battery",
@@ -616,16 +511,6 @@ BASELINE: frozenset[Violation] = frozenset(
"akkudoktoreos.devices.genetic.inverter",
"akkudoktoreos.prediction.interpolator",
),
Violation(
"world-access",
"akkudoktoreos.devices.genetic0.genetic0battery",
"akkudoktoreos.devices.settings.batterysettings",
),
Violation(
"world-access",
"akkudoktoreos.devices.genetic0.genetic0homeappliance",
"akkudoktoreos.config.configabc",
),
Violation(
"world-access",
"akkudoktoreos.optimization.genetic.configrequest",
@@ -713,68 +598,13 @@ BASELINE: frozenset[Violation] = frozenset(
),
Violation(
"world-access",
"akkudoktoreos.optimization.genetic0.genetic0",
"akkudoktoreos.optimization.optimizationabc:OptimizationBase",
),
Violation(
"world-access",
"akkudoktoreos.optimization.genetic0.genetic0loadinterpolator",
"akkudoktoreos.core.cache",
),
Violation(
"world-access",
"akkudoktoreos.optimization.genetic0.genetic0loadinterpolator",
"akkudoktoreos.utils.gridinterpolator:configured_grid_interpolator_backend",
),
Violation(
"world-access",
"akkudoktoreos.optimization.genetic0.genetic0params",
"akkudoktoreos.core.coreabc:ConfigMixin",
),
Violation(
"world-access",
"akkudoktoreos.optimization.genetic0.genetic0params",
"akkudoktoreos.core.coreabc:MeasurementMixin",
),
Violation(
"world-access",
"akkudoktoreos.optimization.genetic0.genetic0params",
"akkudoktoreos.core.coreabc:PredictionMixin",
),
Violation(
"world-access",
"akkudoktoreos.optimization.genetic0.genetic0params",
"akkudoktoreos.core.coreabc:get_ems",
),
Violation(
"world-access",
"akkudoktoreos.optimization.genetic0.genetic0solution",
"akkudoktoreos.core.coreabc:ConfigMixin",
),
Violation(
"world-access",
"akkudoktoreos.optimization.genetic0.genetic0solution",
"akkudoktoreos.core.coreabc:get_ems",
),
Violation(
"world-access",
"akkudoktoreos.optimization.genetic0.genetic0solution",
"akkudoktoreos.core.coreabc:get_prediction",
),
Violation(
"world-access",
"akkudoktoreos.optimization.genetic0.genetic0solution",
"akkudoktoreos.optimization.genetic0.genetic0convert",
"akkudoktoreos.devices.devicesabc",
),
Violation(
"world-access",
"akkudoktoreos.optimization.genetic0.genetic0visualize",
"akkudoktoreos.core.coreabc:ConfigMixin",
),
Violation(
"world-access",
"akkudoktoreos.optimization.genetic0.genetic0visualize",
"akkudoktoreos.core.coreabc:get_ems",
"akkudoktoreos.optimization.genetic0.genetic0request",
"akkudoktoreos.config.configabc",
),
}
)
+25
View File
@@ -0,0 +1,25 @@
"""The optimizer registry (ADR 0005)."""
import pytest
from akkudoktoreos.optimization.optimization import OptimizationAlgorithm
from akkudoktoreos.optimization.optimizerregistry import get_optimizer
class TestOptimizerRegistry:
"""Finding optimizers by name."""
@pytest.mark.parametrize("name", ["GENETIC0"])
def test_registered_optimizer_carries_its_name(self, name: str) -> None:
optimizer = get_optimizer(name)
assert optimizer is not None
assert optimizer.name == name
# The registry name is the value of optimization.algorithm.
assert OptimizationAlgorithm(name) == name
def test_algorithm_enum_finds_the_same_optimizer(self) -> None:
assert get_optimizer(OptimizationAlgorithm.GENETIC0) is get_optimizer("GENETIC0")
@pytest.mark.parametrize("name", ["UNKNOWN", "", "genetic0"])
def test_unregistered_name_gives_none(self, name: str) -> None:
assert get_optimizer(name) is None
File diff suppressed because it is too large Load Diff
+329
View File
@@ -0,0 +1,329 @@
{
"id": "plan-genetic@<now>",
"generated_at": "<now>",
"valid_from": "2026-01-14T10:00:00+01:00",
"valid_until": null,
"instructions": [
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T10:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T10:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "homeappliance1@<uuid>",
"execution_time": "2026-01-14T10:00:00+01:00",
"abnormal_condition": false,
"type": "DDBCInstruction",
"actuator_id": "homeappliance1",
"operation_mode_id": "OFF",
"operation_mode_factor": 1.0,
"resource_id": "homeappliance1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T11:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T12:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T13:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T14:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T15:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T16:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "PEAK_SHAVING",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T17:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T18:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "PEAK_SHAVING",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T19:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T20:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "PEAK_SHAVING",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T21:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T22:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T23:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T01:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T06:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T07:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T08:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T12:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T13:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T14:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T15:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T16:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "PEAK_SHAVING",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T17:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T18:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "PEAK_SHAVING",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T19:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T20:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "PEAK_SHAVING",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T21:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T22:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T23:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
}
],
"comment": "Energy management plan derived from GeneticSolution."
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+289
View File
@@ -0,0 +1,289 @@
{
"id": "plan-genetic@<now>",
"generated_at": "<now>",
"valid_from": "2026-01-14T10:00:00+01:00",
"valid_until": null,
"instructions": [
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T10:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T10:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "homeappliance1@<uuid>",
"execution_time": "2026-01-14T10:00:00+01:00",
"abnormal_condition": false,
"type": "DDBCInstruction",
"actuator_id": "homeappliance1",
"operation_mode_id": "OFF",
"operation_mode_factor": 1.0,
"resource_id": "homeappliance1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T11:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T12:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T15:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T16:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "PEAK_SHAVING",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T17:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T18:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "PEAK_SHAVING",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T19:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T20:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "PEAK_SHAVING",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T21:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T22:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T02:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T03:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T04:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T06:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T07:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T08:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T13:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T14:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T15:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T16:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "PEAK_SHAVING",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T17:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T18:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "PEAK_SHAVING",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T19:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T22:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "PEAK_SHAVING",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T23:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
}
],
"comment": "Energy management plan derived from GeneticSolution."
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+579
View File
@@ -0,0 +1,579 @@
{
"id": "plan-genetic@<now>",
"generated_at": "<now>",
"valid_from": "2026-01-14T10:00:00+01:00",
"valid_until": null,
"instructions": [
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T10:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T10:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.75,
"resource_id": "ev1"
},
{
"id": "homeappliance1@<uuid>",
"execution_time": "2026-01-14T10:00:00+01:00",
"abnormal_condition": false,
"type": "DDBCInstruction",
"actuator_id": "homeappliance1",
"operation_mode_id": "OFF",
"operation_mode_factor": 1.0,
"resource_id": "homeappliance1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T11:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T12:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.625,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T15:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T15:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T16:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.375,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T17:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.625,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T18:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T19:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "FORCED_CHARGE",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T19:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "homeappliance1@<uuid>",
"execution_time": "2026-01-14T19:00:00+01:00",
"abnormal_condition": false,
"type": "DDBCInstruction",
"actuator_id": "homeappliance1",
"operation_mode_id": "RUN",
"operation_mode_factor": 1.0,
"resource_id": "homeappliance1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T20:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T20:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.5,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T21:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "homeappliance1@<uuid>",
"execution_time": "2026-01-14T21:00:00+01:00",
"abnormal_condition": false,
"type": "DDBCInstruction",
"actuator_id": "homeappliance1",
"operation_mode_id": "OFF",
"operation_mode_factor": 1.0,
"resource_id": "homeappliance1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T22:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T23:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.5,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T00:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T00:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T01:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T01:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.625,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T02:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "FORCED_CHARGE",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T02:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.75,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T03:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T03:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.5,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T04:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T04:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.375,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T06:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T06:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.75,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T07:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T07:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.625,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T08:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "FORCED_CHARGE",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T08:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T09:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T09:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.375,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T10:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.625,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T11:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "FORCED_CHARGE",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T12:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T12:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T13:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.5,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T14:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T15:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.375,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T16:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T16:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.5,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T17:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T18:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T18:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.5,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T19:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T19:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T20:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.75,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T21:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T21:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.625,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T22:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.75,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T23:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T23:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
}
],
"comment": "Energy management plan derived from GeneticSolution."
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+599
View File
@@ -0,0 +1,599 @@
{
"id": "plan-genetic@<now>",
"generated_at": "<now>",
"valid_from": "2026-03-28T10:00:00+01:00",
"valid_until": null,
"instructions": [
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-28T10:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-28T10:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "homeappliance1@<uuid>",
"execution_time": "2026-03-28T10:00:00+01:00",
"abnormal_condition": false,
"type": "DDBCInstruction",
"actuator_id": "homeappliance1",
"operation_mode_id": "OFF",
"operation_mode_factor": 1.0,
"resource_id": "homeappliance1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-28T11:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-28T11:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-28T12:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "FORCED_CHARGE",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-28T12:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.75,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-28T13:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-28T13:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-28T14:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "FORCED_CHARGE",
"operation_mode_factor": 0.23171229338842977,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-28T14:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.625,
"resource_id": "ev1"
},
{
"id": "homeappliance1@<uuid>",
"execution_time": "2026-03-28T14:00:00+01:00",
"abnormal_condition": false,
"type": "DDBCInstruction",
"actuator_id": "homeappliance1",
"operation_mode_id": "RUN",
"operation_mode_factor": 1.0,
"resource_id": "homeappliance1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-28T15:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-28T15:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.375,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-28T16:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "FORCED_CHARGE",
"operation_mode_factor": 0.031712293388430055,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-28T16:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.75,
"resource_id": "ev1"
},
{
"id": "homeappliance1@<uuid>",
"execution_time": "2026-03-28T16:00:00+01:00",
"abnormal_condition": false,
"type": "DDBCInstruction",
"actuator_id": "homeappliance1",
"operation_mode_id": "OFF",
"operation_mode_factor": 1.0,
"resource_id": "homeappliance1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-28T17:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-28T18:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-28T18:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.625,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-28T19:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "FORCED_CHARGE",
"operation_mode_factor": 0.031712293388430055,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-28T19:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-28T20:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-28T20:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.75,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-28T21:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "FORCED_CHARGE",
"operation_mode_factor": 0.2205836776859505,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-28T21:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.375,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-28T22:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-28T22:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.75,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-28T23:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "FORCED_CHARGE",
"operation_mode_factor": 0.25621900826446364,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-28T23:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.5,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-29T00:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "FORCED_CHARGE",
"operation_mode_factor": 0.056219008264463924,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-29T01:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.625,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-29T03:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-29T03:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-29T04:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.5,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-29T05:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-29T07:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-29T07:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.75,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-29T08:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-29T08:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-29T09:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-29T11:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-29T11:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-29T12:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.375,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-29T13:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-29T14:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-29T15:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-29T16:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "PEAK_SHAVING",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-29T16:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-29T17:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.5,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-29T18:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-29T19:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.625,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-29T20:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-29T20:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.75,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-29T21:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-29T22:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-29T23:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "PEAK_SHAVING",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-03-29T23:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.5,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-03-30T00:00:00+02:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
}
],
"comment": "Energy management plan derived from GeneticSolution."
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+449
View File
@@ -0,0 +1,449 @@
{
"id": "plan-genetic@<now>",
"generated_at": "<now>",
"valid_from": "2026-01-14T10:00:00+01:00",
"valid_until": null,
"instructions": [
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T10:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T10:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "homeappliance1@<uuid>",
"execution_time": "2026-01-14T10:00:00+01:00",
"abnormal_condition": false,
"type": "DDBCInstruction",
"actuator_id": "homeappliance1",
"operation_mode_id": "OFF",
"operation_mode_factor": 1.0,
"resource_id": "homeappliance1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T11:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T11:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T12:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T12:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.5,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T13:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.625,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T14:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "homeappliance1@<uuid>",
"execution_time": "2026-01-14T14:00:00+01:00",
"abnormal_condition": false,
"type": "DDBCInstruction",
"actuator_id": "homeappliance1",
"operation_mode_id": "RUN",
"operation_mode_factor": 1.0,
"resource_id": "homeappliance1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T15:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.75,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T16:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T16:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.5,
"resource_id": "ev1"
},
{
"id": "homeappliance1@<uuid>",
"execution_time": "2026-01-14T16:00:00+01:00",
"abnormal_condition": false,
"type": "DDBCInstruction",
"actuator_id": "homeappliance1",
"operation_mode_id": "OFF",
"operation_mode_factor": 1.0,
"resource_id": "homeappliance1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T17:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T17:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.625,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T18:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T18:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.375,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T19:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.5,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T20:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.625,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T22:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.5,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T23:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T23:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.625,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T00:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T01:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T02:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.625,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T03:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.5,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T05:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T06:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.375,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T07:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.625,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T08:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T09:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T09:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.5,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T11:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T11:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.75,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T14:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T15:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T16:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.75,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T17:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T19:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.75,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T20:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.625,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T21:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T22:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.5,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T23:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
}
],
"comment": "Energy management plan derived from GeneticSolution."
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+599
View File
@@ -0,0 +1,599 @@
{
"id": "plan-genetic@<now>",
"generated_at": "<now>",
"valid_from": "2026-01-14T10:00:00+01:00",
"valid_until": null,
"instructions": [
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T10:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T10:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "homeappliance1@<uuid>",
"execution_time": "2026-01-14T10:00:00+01:00",
"abnormal_condition": false,
"type": "DDBCInstruction",
"actuator_id": "homeappliance1",
"operation_mode_id": "OFF",
"operation_mode_factor": 1.0,
"resource_id": "homeappliance1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T11:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T11:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T12:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "FORCED_CHARGE",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T12:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.75,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T13:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T13:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T14:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "FORCED_CHARGE",
"operation_mode_factor": 0.23171229338842977,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T14:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.625,
"resource_id": "ev1"
},
{
"id": "homeappliance1@<uuid>",
"execution_time": "2026-01-14T14:00:00+01:00",
"abnormal_condition": false,
"type": "DDBCInstruction",
"actuator_id": "homeappliance1",
"operation_mode_id": "RUN",
"operation_mode_factor": 1.0,
"resource_id": "homeappliance1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T15:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T15:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.375,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T16:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "FORCED_CHARGE",
"operation_mode_factor": 0.031712293388430055,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T16:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.75,
"resource_id": "ev1"
},
{
"id": "homeappliance1@<uuid>",
"execution_time": "2026-01-14T16:00:00+01:00",
"abnormal_condition": false,
"type": "DDBCInstruction",
"actuator_id": "homeappliance1",
"operation_mode_id": "OFF",
"operation_mode_factor": 1.0,
"resource_id": "homeappliance1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T17:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T18:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T18:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.625,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T19:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "FORCED_CHARGE",
"operation_mode_factor": 0.031712293388430055,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T19:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T20:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T20:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.75,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T21:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "FORCED_CHARGE",
"operation_mode_factor": 0.2205836776859505,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T21:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.375,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T22:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T22:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.75,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-14T23:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "FORCED_CHARGE",
"operation_mode_factor": 0.25621900826446364,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-14T23:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.5,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T00:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "FORCED_CHARGE",
"operation_mode_factor": 0.056219008264463924,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T01:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.625,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T02:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T02:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T03:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.5,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T04:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T06:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T06:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.75,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T07:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T07:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T08:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T10:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "NON_EXPORT",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T10:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T11:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.375,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T12:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T13:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T14:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T15:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "PEAK_SHAVING",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T15:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T16:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.5,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T17:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T18:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.625,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T19:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "IDLE",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T19:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.75,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T20:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.875,
"resource_id": "ev1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T21:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 1.0,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T22:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "PEAK_SHAVING",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
},
{
"id": "ev1@<uuid>",
"execution_time": "2026-01-15T22:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "ev1",
"operation_mode_id": "GRID_SUPPORT_IMPORT",
"operation_mode_factor": 0.5,
"resource_id": "ev1"
},
{
"id": "battery1@<uuid>",
"execution_time": "2026-01-15T23:00:00+01:00",
"abnormal_condition": false,
"type": "FRBCInstruction",
"actuator_id": "battery1",
"operation_mode_id": "SELF_CONSUMPTION",
"operation_mode_factor": 1.0,
"resource_id": "battery1"
}
],
"comment": "Energy management plan derived from GeneticSolution."
}
File diff suppressed because it is too large Load Diff
+982
View File
@@ -0,0 +1,982 @@
{
"expected_result": "optimize_result_1.json",
"parameters": {
"request": {
"ems": {
"pv_forecast_wh": [
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
8.05,
352.91,
728.51,
930.28,
1043.25,
1106.74,
1161.69,
6018.82,
5519.07,
3969.88,
3017.96,
1943.07,
1007.17,
319.67,
7.88,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
5.04,
335.59,
705.32,
1121.12,
1604.79,
2157.38,
1433.25,
5718.49,
4553.96,
3027.55,
2574.46,
1720.4,
963.4,
383.3,
0.0,
0.0,
0.0
],
"electricity_price_per_wh": [
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278,
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278
],
"feed_in_tariff_per_wh": [
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,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05
],
"price_per_wh_battery": 0.0001,
"total_load": [
676.71,
876.19,
527.13,
468.88,
531.38,
517.95,
483.15,
472.28,
1011.68,
995.0,
1053.07,
1063.91,
1320.56,
1132.03,
1163.67,
1176.82,
1216.22,
1103.78,
1129.12,
1178.71,
1050.98,
988.56,
912.38,
704.61,
516.37,
868.05,
694.34,
608.79,
556.31,
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
],
"pv_prognose_wh": [
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
8.05,
352.91,
728.51,
930.28,
1043.25,
1106.74,
1161.69,
6018.82,
5519.07,
3969.88,
3017.96,
1943.07,
1007.17,
319.67,
7.88,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
5.04,
335.59,
705.32,
1121.12,
1604.79,
2157.38,
1433.25,
5718.49,
4553.96,
3027.55,
2574.46,
1720.4,
963.4,
383.3,
0.0,
0.0,
0.0
],
"strompreis_euro_pro_wh": [
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278,
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278
],
"einspeiseverguetung_euro_pro_wh": [
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,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05
],
"preis_euro_pro_wh_akku": 0.0001,
"gesamtlast": [
676.71,
876.19,
527.13,
468.88,
531.38,
517.95,
483.15,
472.28,
1011.68,
995.0,
1053.07,
1063.91,
1320.56,
1132.03,
1163.67,
1176.82,
1216.22,
1103.78,
1129.12,
1178.71,
1050.98,
988.56,
912.38,
704.61,
516.37,
868.05,
694.34,
608.79,
556.31,
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
]
},
"pv_battery": {
"device_id": "battery1",
"hours": null,
"capacity_wh": 26400,
"charging_efficiency": 0.88,
"discharging_efficiency": 0.88,
"max_charge_power_w": 5000.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 80,
"min_soc_percentage": 15,
"max_soc_percentage": 100,
"charge_rates": null
},
"inverter": {
"device_id": "inverter1",
"hours": null,
"max_power_wh": 10000.0,
"battery_id": "battery1",
"ac_to_dc_efficiency": 1.0,
"dc_to_ac_efficiency": 1.0,
"max_ac_charge_power_w": null
},
"ev": {
"device_id": "ev1",
"hours": null,
"capacity_wh": 60000,
"charging_efficiency": 0.95,
"discharging_efficiency": 1.0,
"max_charge_power_w": 11040.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 54,
"min_soc_percentage": 0,
"max_soc_percentage": 100,
"charge_rates": null
},
"dishwasher": null,
"temperature_forecast": [
18.3,
17.8,
16.9,
16.2,
15.6,
15.1,
14.6,
14.2,
14.3,
14.8,
15.7,
16.7,
17.4,
18.0,
18.6,
19.2,
19.1,
18.7,
18.5,
17.7,
16.2,
14.6,
13.6,
13.0,
12.6,
12.2,
11.7,
11.6,
11.3,
11.0,
10.7,
10.2,
11.4,
14.4,
16.4,
18.3,
19.5,
20.7,
21.9,
22.7,
23.1,
23.1,
22.8,
21.8,
20.2,
19.1,
18.0,
17.4
],
"start_solution": [
1.0,
1.0,
1.0,
1.0,
0.0,
1.0,
0.0,
0.0,
1.0,
1.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,
0.0,
0.0,
0.0,
0.0,
0.0,
0.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,
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
],
"pv_akku": {
"device_id": "battery1",
"hours": null,
"capacity_wh": 26400,
"charging_efficiency": 0.88,
"discharging_efficiency": 0.88,
"max_charge_power_w": 5000.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 80,
"min_soc_percentage": 15,
"max_soc_percentage": 100,
"charge_rates": null
},
"eauto": {
"device_id": "ev1",
"hours": null,
"capacity_wh": 60000,
"charging_efficiency": 0.95,
"discharging_efficiency": 1.0,
"max_charge_power_w": 11040.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 54,
"min_soc_percentage": 0,
"max_soc_percentage": 100,
"charge_rates": null
}
},
"start_hour": 10,
"settings": {
"prediction_hours": 48,
"horizon_hours": 48,
"individuals": 300,
"generations": 3,
"seed": 42,
"penalties": {
"ev_soc_miss": 10,
"ac_charge_break_even": 0
},
"ev_charge_rates": [
0.0,
0.375,
0.5,
0.625,
0.75,
0.875,
1.0
],
"battery_charge_rates": null,
"self_consumption_interpolator": "scipy",
"verbose": false
},
"presentation": {
"start_datetime": {
"datetime": "2026-01-14T10:00:00+01:00",
"timezone": "Europe/Berlin"
},
"timezone": "Europe/Berlin",
"battery_device_id": "battery1",
"ev_device_id": "ev1",
"home_appliance_device_id": "homeappliance1",
"home_appliance_enabled": true,
"prediction_series": {
"pvforecast_ac_power": [
170.5,
171.0,
171.5,
172.0,
172.5,
173.0,
173.5,
174.0,
174.5,
175.0,
175.5,
176.0,
176.5,
177.0,
177.5,
178.0,
178.5,
179.0,
179.5,
180.0,
180.5,
181.0,
181.5,
182.0,
182.5,
183.0,
183.5,
184.0,
184.5,
185.0,
185.5,
186.0,
186.5,
187.0,
187.5,
188.0,
188.5,
189.0
],
"pvforecast_dc_power": [
180.5,
181.0,
181.5,
182.0,
182.5,
183.0,
183.5,
184.0,
184.5,
185.0,
185.5,
186.0,
186.5,
187.0,
187.5,
188.0,
188.5,
189.0,
189.5,
190.0,
190.5,
191.0,
191.5,
192.0,
192.5,
193.0,
193.5,
194.0,
194.5,
195.0,
195.5,
196.0,
196.5,
197.0,
197.5,
198.0,
198.5,
199.0
],
"elecprice_marketprice_wh": [
1190.5,
1191.0,
1191.5,
1192.0,
1192.5,
1193.0,
1193.5,
1194.0,
1194.5,
1195.0,
1195.5,
1196.0,
1196.5,
1197.0,
1197.5,
1198.0,
1198.5,
1199.0,
1199.5,
1200.0,
1200.5,
1201.0,
1201.5,
1202.0,
1202.5,
1203.0,
1203.5,
1204.0,
1204.5,
1205.0,
1205.5,
1206.0,
1206.5,
1207.0,
1207.5,
1208.0,
1208.5,
1209.0
],
"feed_in_tariff_wh": [
1200.5,
1201.0,
1201.5,
1202.0,
1202.5,
1203.0,
1203.5,
1204.0,
1204.5,
1205.0,
1205.5,
1206.0,
1206.5,
1207.0,
1207.5,
1208.0,
1208.5,
1209.0,
1209.5,
1210.0,
1210.5,
1211.0,
1211.5,
1212.0,
1212.5,
1213.0,
1213.5,
1214.0,
1214.5,
1215.0,
1215.5,
1216.0,
1216.5,
1217.0,
1217.5,
1218.0,
1218.5,
1219.0
],
"weather_temp_air": [
210.5,
211.0,
211.5,
212.0,
212.5,
213.0,
213.5,
214.0,
214.5,
215.0,
215.5,
216.0,
216.5,
217.0,
217.5,
218.0,
218.5,
219.0,
219.5,
220.0,
220.5,
221.0,
221.5,
222.0,
222.5,
223.0,
223.5,
224.0,
224.5,
225.0,
225.5,
226.0,
226.5,
227.0,
227.5,
228.0,
228.5,
229.0
],
"loadforecast_power_w": [
220.5,
221.0,
221.5,
222.0,
222.5,
223.0,
223.5,
224.0,
224.5,
225.0,
225.5,
226.0,
226.5,
227.0,
227.5,
228.0,
228.5,
229.0,
229.5,
230.0,
230.5,
231.0,
231.5,
232.0,
232.5,
233.0,
233.5,
234.0,
234.5,
235.0,
235.5,
236.0,
236.5,
237.0,
237.5,
238.0,
238.5,
239.0
],
"loadakkudoktor_std_power_w": [
230.5,
231.0,
231.5,
232.0,
232.5,
233.0,
233.5,
234.0,
234.5,
235.0,
235.5,
236.0,
236.5,
237.0,
237.5,
238.0,
238.5,
239.0,
239.5,
240.0,
240.5,
241.0,
241.5,
242.0,
242.5,
243.0,
243.5,
244.0,
244.5,
245.0,
245.5,
246.0,
246.5,
247.0,
247.5,
248.0,
248.5,
249.0
],
"loadakkudoktor_mean_power_w": [
240.5,
241.0,
241.5,
242.0,
242.5,
243.0,
243.5,
244.0,
244.5,
245.0,
245.5,
246.0,
246.5,
247.0,
247.5,
248.0,
248.5,
249.0,
249.5,
250.0,
250.5,
251.0,
251.5,
252.0,
252.5,
253.0,
253.5,
254.0,
254.5,
255.0,
255.5,
256.0,
256.5,
257.0,
257.5,
258.0,
258.5,
259.0
]
}
}
}
}
+982
View File
@@ -0,0 +1,982 @@
{
"expected_result": "optimize_result_1_be.json",
"parameters": {
"request": {
"ems": {
"pv_forecast_wh": [
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
8.05,
352.91,
728.51,
930.28,
1043.25,
1106.74,
1161.69,
6018.82,
5519.07,
3969.88,
3017.96,
1943.07,
1007.17,
319.67,
7.88,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
5.04,
335.59,
705.32,
1121.12,
1604.79,
2157.38,
1433.25,
5718.49,
4553.96,
3027.55,
2574.46,
1720.4,
963.4,
383.3,
0.0,
0.0,
0.0
],
"electricity_price_per_wh": [
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278,
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278
],
"feed_in_tariff_per_wh": [
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,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05
],
"price_per_wh_battery": 0.0001,
"total_load": [
676.71,
876.19,
527.13,
468.88,
531.38,
517.95,
483.15,
472.28,
1011.68,
995.0,
1053.07,
1063.91,
1320.56,
1132.03,
1163.67,
1176.82,
1216.22,
1103.78,
1129.12,
1178.71,
1050.98,
988.56,
912.38,
704.61,
516.37,
868.05,
694.34,
608.79,
556.31,
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
],
"pv_prognose_wh": [
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
8.05,
352.91,
728.51,
930.28,
1043.25,
1106.74,
1161.69,
6018.82,
5519.07,
3969.88,
3017.96,
1943.07,
1007.17,
319.67,
7.88,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
5.04,
335.59,
705.32,
1121.12,
1604.79,
2157.38,
1433.25,
5718.49,
4553.96,
3027.55,
2574.46,
1720.4,
963.4,
383.3,
0.0,
0.0,
0.0
],
"strompreis_euro_pro_wh": [
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278,
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278
],
"einspeiseverguetung_euro_pro_wh": [
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,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05,
7e-05
],
"preis_euro_pro_wh_akku": 0.0001,
"gesamtlast": [
676.71,
876.19,
527.13,
468.88,
531.38,
517.95,
483.15,
472.28,
1011.68,
995.0,
1053.07,
1063.91,
1320.56,
1132.03,
1163.67,
1176.82,
1216.22,
1103.78,
1129.12,
1178.71,
1050.98,
988.56,
912.38,
704.61,
516.37,
868.05,
694.34,
608.79,
556.31,
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
]
},
"pv_battery": {
"device_id": "battery1",
"hours": null,
"capacity_wh": 26400,
"charging_efficiency": 0.88,
"discharging_efficiency": 0.88,
"max_charge_power_w": 5000.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 80,
"min_soc_percentage": 15,
"max_soc_percentage": 100,
"charge_rates": null
},
"inverter": {
"device_id": "inverter1",
"hours": null,
"max_power_wh": 10000.0,
"battery_id": "battery1",
"ac_to_dc_efficiency": 1.0,
"dc_to_ac_efficiency": 1.0,
"max_ac_charge_power_w": null
},
"ev": {
"device_id": "ev1",
"hours": null,
"capacity_wh": 60000,
"charging_efficiency": 0.95,
"discharging_efficiency": 1.0,
"max_charge_power_w": 11040.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 54,
"min_soc_percentage": 0,
"max_soc_percentage": 100,
"charge_rates": null
},
"dishwasher": null,
"temperature_forecast": [
18.3,
17.8,
16.9,
16.2,
15.6,
15.1,
14.6,
14.2,
14.3,
14.8,
15.7,
16.7,
17.4,
18.0,
18.6,
19.2,
19.1,
18.7,
18.5,
17.7,
16.2,
14.6,
13.6,
13.0,
12.6,
12.2,
11.7,
11.6,
11.3,
11.0,
10.7,
10.2,
11.4,
14.4,
16.4,
18.3,
19.5,
20.7,
21.9,
22.7,
23.1,
23.1,
22.8,
21.8,
20.2,
19.1,
18.0,
17.4
],
"start_solution": [
1.0,
1.0,
1.0,
1.0,
0.0,
1.0,
0.0,
0.0,
1.0,
1.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,
0.0,
0.0,
0.0,
0.0,
0.0,
0.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,
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
],
"pv_akku": {
"device_id": "battery1",
"hours": null,
"capacity_wh": 26400,
"charging_efficiency": 0.88,
"discharging_efficiency": 0.88,
"max_charge_power_w": 5000.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 80,
"min_soc_percentage": 15,
"max_soc_percentage": 100,
"charge_rates": null
},
"eauto": {
"device_id": "ev1",
"hours": null,
"capacity_wh": 60000,
"charging_efficiency": 0.95,
"discharging_efficiency": 1.0,
"max_charge_power_w": 11040.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 54,
"min_soc_percentage": 0,
"max_soc_percentage": 100,
"charge_rates": null
}
},
"start_hour": 10,
"settings": {
"prediction_hours": 48,
"horizon_hours": 48,
"individuals": 300,
"generations": 3,
"seed": 42,
"penalties": {
"ev_soc_miss": 10,
"ac_charge_break_even": 1
},
"ev_charge_rates": [
0.0,
0.375,
0.5,
0.625,
0.75,
0.875,
1.0
],
"battery_charge_rates": null,
"self_consumption_interpolator": "scipy",
"verbose": false
},
"presentation": {
"start_datetime": {
"datetime": "2026-01-14T10:00:00+01:00",
"timezone": "Europe/Berlin"
},
"timezone": "Europe/Berlin",
"battery_device_id": "battery1",
"ev_device_id": "ev1",
"home_appliance_device_id": "homeappliance1",
"home_appliance_enabled": true,
"prediction_series": {
"pvforecast_ac_power": [
170.5,
171.0,
171.5,
172.0,
172.5,
173.0,
173.5,
174.0,
174.5,
175.0,
175.5,
176.0,
176.5,
177.0,
177.5,
178.0,
178.5,
179.0,
179.5,
180.0,
180.5,
181.0,
181.5,
182.0,
182.5,
183.0,
183.5,
184.0,
184.5,
185.0,
185.5,
186.0,
186.5,
187.0,
187.5,
188.0,
188.5,
189.0
],
"pvforecast_dc_power": [
180.5,
181.0,
181.5,
182.0,
182.5,
183.0,
183.5,
184.0,
184.5,
185.0,
185.5,
186.0,
186.5,
187.0,
187.5,
188.0,
188.5,
189.0,
189.5,
190.0,
190.5,
191.0,
191.5,
192.0,
192.5,
193.0,
193.5,
194.0,
194.5,
195.0,
195.5,
196.0,
196.5,
197.0,
197.5,
198.0,
198.5,
199.0
],
"elecprice_marketprice_wh": [
1190.5,
1191.0,
1191.5,
1192.0,
1192.5,
1193.0,
1193.5,
1194.0,
1194.5,
1195.0,
1195.5,
1196.0,
1196.5,
1197.0,
1197.5,
1198.0,
1198.5,
1199.0,
1199.5,
1200.0,
1200.5,
1201.0,
1201.5,
1202.0,
1202.5,
1203.0,
1203.5,
1204.0,
1204.5,
1205.0,
1205.5,
1206.0,
1206.5,
1207.0,
1207.5,
1208.0,
1208.5,
1209.0
],
"feed_in_tariff_wh": [
1200.5,
1201.0,
1201.5,
1202.0,
1202.5,
1203.0,
1203.5,
1204.0,
1204.5,
1205.0,
1205.5,
1206.0,
1206.5,
1207.0,
1207.5,
1208.0,
1208.5,
1209.0,
1209.5,
1210.0,
1210.5,
1211.0,
1211.5,
1212.0,
1212.5,
1213.0,
1213.5,
1214.0,
1214.5,
1215.0,
1215.5,
1216.0,
1216.5,
1217.0,
1217.5,
1218.0,
1218.5,
1219.0
],
"weather_temp_air": [
210.5,
211.0,
211.5,
212.0,
212.5,
213.0,
213.5,
214.0,
214.5,
215.0,
215.5,
216.0,
216.5,
217.0,
217.5,
218.0,
218.5,
219.0,
219.5,
220.0,
220.5,
221.0,
221.5,
222.0,
222.5,
223.0,
223.5,
224.0,
224.5,
225.0,
225.5,
226.0,
226.5,
227.0,
227.5,
228.0,
228.5,
229.0
],
"loadforecast_power_w": [
220.5,
221.0,
221.5,
222.0,
222.5,
223.0,
223.5,
224.0,
224.5,
225.0,
225.5,
226.0,
226.5,
227.0,
227.5,
228.0,
228.5,
229.0,
229.5,
230.0,
230.5,
231.0,
231.5,
232.0,
232.5,
233.0,
233.5,
234.0,
234.5,
235.0,
235.5,
236.0,
236.5,
237.0,
237.5,
238.0,
238.5,
239.0
],
"loadakkudoktor_std_power_w": [
230.5,
231.0,
231.5,
232.0,
232.5,
233.0,
233.5,
234.0,
234.5,
235.0,
235.5,
236.0,
236.5,
237.0,
237.5,
238.0,
238.5,
239.0,
239.5,
240.0,
240.5,
241.0,
241.5,
242.0,
242.5,
243.0,
243.5,
244.0,
244.5,
245.0,
245.5,
246.0,
246.5,
247.0,
247.5,
248.0,
248.5,
249.0
],
"loadakkudoktor_mean_power_w": [
240.5,
241.0,
241.5,
242.0,
242.5,
243.0,
243.5,
244.0,
244.5,
245.0,
245.5,
246.0,
246.5,
247.0,
247.5,
248.0,
248.5,
249.0,
249.5,
250.0,
250.5,
251.0,
251.5,
252.0,
252.5,
253.0,
253.5,
254.0,
254.5,
255.0,
255.5,
256.0,
256.5,
257.0,
257.5,
258.0,
258.5,
259.0
]
}
}
}
}
+801
View File
@@ -0,0 +1,801 @@
{
"expected_result": "optimize_result_2.json",
"parameters": {
"request": {
"ems": {
"pv_forecast_wh": [
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
8.05,
352.91,
728.51,
930.28,
1043.25,
1106.74,
1161.69,
6018.82,
5519.07,
3969.88,
3017.96,
1943.07,
1007.17,
319.67,
7.88,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
5.04,
335.59,
705.32,
1121.12,
1604.79,
2157.38,
1433.25,
5718.49,
4553.96,
3027.55,
2574.46,
1720.4,
963.4,
383.3,
0.0,
0.0,
0.0
],
"electricity_price_per_wh": [
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278,
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278
],
"feed_in_tariff_per_wh": 7e-05,
"price_per_wh_battery": 0.0,
"total_load": [
676.71,
876.19,
527.13,
468.88,
531.38,
517.95,
483.15,
472.28,
1011.68,
995.0,
1053.07,
1063.91,
1320.56,
1132.03,
1163.67,
1176.82,
1216.22,
1103.78,
1129.12,
1178.71,
1050.98,
988.56,
912.38,
704.61,
516.37,
868.05,
694.34,
608.79,
556.31,
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
],
"pv_prognose_wh": [
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
8.05,
352.91,
728.51,
930.28,
1043.25,
1106.74,
1161.69,
6018.82,
5519.07,
3969.88,
3017.96,
1943.07,
1007.17,
319.67,
7.88,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
5.04,
335.59,
705.32,
1121.12,
1604.79,
2157.38,
1433.25,
5718.49,
4553.96,
3027.55,
2574.46,
1720.4,
963.4,
383.3,
0.0,
0.0,
0.0
],
"strompreis_euro_pro_wh": [
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278,
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278
],
"einspeiseverguetung_euro_pro_wh": 7e-05,
"preis_euro_pro_wh_akku": 0.0,
"gesamtlast": [
676.71,
876.19,
527.13,
468.88,
531.38,
517.95,
483.15,
472.28,
1011.68,
995.0,
1053.07,
1063.91,
1320.56,
1132.03,
1163.67,
1176.82,
1216.22,
1103.78,
1129.12,
1178.71,
1050.98,
988.56,
912.38,
704.61,
516.37,
868.05,
694.34,
608.79,
556.31,
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
]
},
"pv_battery": {
"device_id": "battery1",
"hours": null,
"capacity_wh": 26400,
"charging_efficiency": 0.88,
"discharging_efficiency": 0.88,
"max_charge_power_w": 5000.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 80,
"min_soc_percentage": 0,
"max_soc_percentage": 100,
"charge_rates": null
},
"inverter": {
"device_id": "inverter1",
"hours": null,
"max_power_wh": 10000.0,
"battery_id": "battery1",
"ac_to_dc_efficiency": 1.0,
"dc_to_ac_efficiency": 1.0,
"max_ac_charge_power_w": null
},
"ev": {
"device_id": "ev1",
"hours": null,
"capacity_wh": 60000,
"charging_efficiency": 0.95,
"discharging_efficiency": 1.0,
"max_charge_power_w": 11040.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 5,
"min_soc_percentage": 80,
"max_soc_percentage": 100,
"charge_rates": null
},
"dishwasher": {
"device_id": "dishwasher1",
"hours": null,
"consumption_wh": 5000,
"duration_h": 2,
"time_windows": {
"windows": [
{
"start_time": "00:00:00.000000",
"duration": "2 days",
"end_time": null,
"day_of_week": null,
"date": null,
"month": null,
"locale": null
}
]
}
},
"temperature_forecast": [
18.3,
17.8,
16.9,
16.2,
15.6,
15.1,
14.6,
14.2,
14.3,
14.8,
15.7,
16.7,
17.4,
18.0,
18.6,
19.2,
19.1,
18.7,
18.5,
17.7,
16.2,
14.6,
13.6,
13.0,
12.6,
12.2,
11.7,
11.6,
11.3,
11.0,
10.7,
10.2,
11.4,
14.4,
16.4,
18.3,
19.5,
20.7,
21.9,
22.7,
23.1,
23.1,
22.8,
21.8,
20.2,
19.1,
18.0,
17.4
],
"start_solution": null,
"pv_akku": {
"device_id": "battery1",
"hours": null,
"capacity_wh": 26400,
"charging_efficiency": 0.88,
"discharging_efficiency": 0.88,
"max_charge_power_w": 5000.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 80,
"min_soc_percentage": 0,
"max_soc_percentage": 100,
"charge_rates": null
},
"eauto": {
"device_id": "ev1",
"hours": null,
"capacity_wh": 60000,
"charging_efficiency": 0.95,
"discharging_efficiency": 1.0,
"max_charge_power_w": 11040.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 5,
"min_soc_percentage": 80,
"max_soc_percentage": 100,
"charge_rates": null
}
},
"start_hour": 10,
"settings": {
"prediction_hours": 48,
"horizon_hours": 48,
"individuals": 300,
"generations": 3,
"seed": 42,
"penalties": {
"ev_soc_miss": 10,
"ac_charge_break_even": 0
},
"ev_charge_rates": [
0.0,
0.375,
0.5,
0.625,
0.75,
0.875,
1.0
],
"battery_charge_rates": null,
"self_consumption_interpolator": "scipy",
"verbose": false
},
"presentation": {
"start_datetime": {
"datetime": "2026-01-14T10:00:00+01:00",
"timezone": "Europe/Berlin"
},
"timezone": "Europe/Berlin",
"battery_device_id": "battery1",
"ev_device_id": "ev1",
"home_appliance_device_id": "homeappliance1",
"home_appliance_enabled": true,
"prediction_series": {
"pvforecast_ac_power": [
170.5,
171.0,
171.5,
172.0,
172.5,
173.0,
173.5,
174.0,
174.5,
175.0,
175.5,
176.0,
176.5,
177.0,
177.5,
178.0,
178.5,
179.0,
179.5,
180.0,
180.5,
181.0,
181.5,
182.0,
182.5,
183.0,
183.5,
184.0,
184.5,
185.0,
185.5,
186.0,
186.5,
187.0,
187.5,
188.0,
188.5,
189.0
],
"pvforecast_dc_power": [
180.5,
181.0,
181.5,
182.0,
182.5,
183.0,
183.5,
184.0,
184.5,
185.0,
185.5,
186.0,
186.5,
187.0,
187.5,
188.0,
188.5,
189.0,
189.5,
190.0,
190.5,
191.0,
191.5,
192.0,
192.5,
193.0,
193.5,
194.0,
194.5,
195.0,
195.5,
196.0,
196.5,
197.0,
197.5,
198.0,
198.5,
199.0
],
"elecprice_marketprice_wh": [
1190.5,
1191.0,
1191.5,
1192.0,
1192.5,
1193.0,
1193.5,
1194.0,
1194.5,
1195.0,
1195.5,
1196.0,
1196.5,
1197.0,
1197.5,
1198.0,
1198.5,
1199.0,
1199.5,
1200.0,
1200.5,
1201.0,
1201.5,
1202.0,
1202.5,
1203.0,
1203.5,
1204.0,
1204.5,
1205.0,
1205.5,
1206.0,
1206.5,
1207.0,
1207.5,
1208.0,
1208.5,
1209.0
],
"feed_in_tariff_wh": [
1200.5,
1201.0,
1201.5,
1202.0,
1202.5,
1203.0,
1203.5,
1204.0,
1204.5,
1205.0,
1205.5,
1206.0,
1206.5,
1207.0,
1207.5,
1208.0,
1208.5,
1209.0,
1209.5,
1210.0,
1210.5,
1211.0,
1211.5,
1212.0,
1212.5,
1213.0,
1213.5,
1214.0,
1214.5,
1215.0,
1215.5,
1216.0,
1216.5,
1217.0,
1217.5,
1218.0,
1218.5,
1219.0
],
"weather_temp_air": [
210.5,
211.0,
211.5,
212.0,
212.5,
213.0,
213.5,
214.0,
214.5,
215.0,
215.5,
216.0,
216.5,
217.0,
217.5,
218.0,
218.5,
219.0,
219.5,
220.0,
220.5,
221.0,
221.5,
222.0,
222.5,
223.0,
223.5,
224.0,
224.5,
225.0,
225.5,
226.0,
226.5,
227.0,
227.5,
228.0,
228.5,
229.0
],
"loadforecast_power_w": [
220.5,
221.0,
221.5,
222.0,
222.5,
223.0,
223.5,
224.0,
224.5,
225.0,
225.5,
226.0,
226.5,
227.0,
227.5,
228.0,
228.5,
229.0,
229.5,
230.0,
230.5,
231.0,
231.5,
232.0,
232.5,
233.0,
233.5,
234.0,
234.5,
235.0,
235.5,
236.0,
236.5,
237.0,
237.5,
238.0,
238.5,
239.0
],
"loadakkudoktor_std_power_w": [
230.5,
231.0,
231.5,
232.0,
232.5,
233.0,
233.5,
234.0,
234.5,
235.0,
235.5,
236.0,
236.5,
237.0,
237.5,
238.0,
238.5,
239.0,
239.5,
240.0,
240.5,
241.0,
241.5,
242.0,
242.5,
243.0,
243.5,
244.0,
244.5,
245.0,
245.5,
246.0,
246.5,
247.0,
247.5,
248.0,
248.5,
249.0
],
"loadakkudoktor_mean_power_w": [
240.5,
241.0,
241.5,
242.0,
242.5,
243.0,
243.5,
244.0,
244.5,
245.0,
245.5,
246.0,
246.5,
247.0,
247.5,
248.0,
248.5,
249.0,
249.5,
250.0,
250.5,
251.0,
251.5,
252.0,
252.5,
253.0,
253.5,
254.0,
254.5,
255.0,
255.5,
256.0,
256.5,
257.0,
257.5,
258.0,
258.5,
259.0
]
}
}
}
}
+801
View File
@@ -0,0 +1,801 @@
{
"expected_result": "optimize_result_2_be.json",
"parameters": {
"request": {
"ems": {
"pv_forecast_wh": [
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
8.05,
352.91,
728.51,
930.28,
1043.25,
1106.74,
1161.69,
6018.82,
5519.07,
3969.88,
3017.96,
1943.07,
1007.17,
319.67,
7.88,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
5.04,
335.59,
705.32,
1121.12,
1604.79,
2157.38,
1433.25,
5718.49,
4553.96,
3027.55,
2574.46,
1720.4,
963.4,
383.3,
0.0,
0.0,
0.0
],
"electricity_price_per_wh": [
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278,
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278
],
"feed_in_tariff_per_wh": 7e-05,
"price_per_wh_battery": 0.0,
"total_load": [
676.71,
876.19,
527.13,
468.88,
531.38,
517.95,
483.15,
472.28,
1011.68,
995.0,
1053.07,
1063.91,
1320.56,
1132.03,
1163.67,
1176.82,
1216.22,
1103.78,
1129.12,
1178.71,
1050.98,
988.56,
912.38,
704.61,
516.37,
868.05,
694.34,
608.79,
556.31,
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
],
"pv_prognose_wh": [
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
8.05,
352.91,
728.51,
930.28,
1043.25,
1106.74,
1161.69,
6018.82,
5519.07,
3969.88,
3017.96,
1943.07,
1007.17,
319.67,
7.88,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
5.04,
335.59,
705.32,
1121.12,
1604.79,
2157.38,
1433.25,
5718.49,
4553.96,
3027.55,
2574.46,
1720.4,
963.4,
383.3,
0.0,
0.0,
0.0
],
"strompreis_euro_pro_wh": [
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278,
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278
],
"einspeiseverguetung_euro_pro_wh": 7e-05,
"preis_euro_pro_wh_akku": 0.0,
"gesamtlast": [
676.71,
876.19,
527.13,
468.88,
531.38,
517.95,
483.15,
472.28,
1011.68,
995.0,
1053.07,
1063.91,
1320.56,
1132.03,
1163.67,
1176.82,
1216.22,
1103.78,
1129.12,
1178.71,
1050.98,
988.56,
912.38,
704.61,
516.37,
868.05,
694.34,
608.79,
556.31,
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
]
},
"pv_battery": {
"device_id": "battery1",
"hours": null,
"capacity_wh": 26400,
"charging_efficiency": 0.88,
"discharging_efficiency": 0.88,
"max_charge_power_w": 5000.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 80,
"min_soc_percentage": 0,
"max_soc_percentage": 100,
"charge_rates": null
},
"inverter": {
"device_id": "inverter1",
"hours": null,
"max_power_wh": 10000.0,
"battery_id": "battery1",
"ac_to_dc_efficiency": 1.0,
"dc_to_ac_efficiency": 1.0,
"max_ac_charge_power_w": null
},
"ev": {
"device_id": "ev1",
"hours": null,
"capacity_wh": 60000,
"charging_efficiency": 0.95,
"discharging_efficiency": 1.0,
"max_charge_power_w": 11040.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 5,
"min_soc_percentage": 80,
"max_soc_percentage": 100,
"charge_rates": null
},
"dishwasher": {
"device_id": "dishwasher1",
"hours": null,
"consumption_wh": 5000,
"duration_h": 2,
"time_windows": {
"windows": [
{
"start_time": "00:00:00.000000",
"duration": "2 days",
"end_time": null,
"day_of_week": null,
"date": null,
"month": null,
"locale": null
}
]
}
},
"temperature_forecast": [
18.3,
17.8,
16.9,
16.2,
15.6,
15.1,
14.6,
14.2,
14.3,
14.8,
15.7,
16.7,
17.4,
18.0,
18.6,
19.2,
19.1,
18.7,
18.5,
17.7,
16.2,
14.6,
13.6,
13.0,
12.6,
12.2,
11.7,
11.6,
11.3,
11.0,
10.7,
10.2,
11.4,
14.4,
16.4,
18.3,
19.5,
20.7,
21.9,
22.7,
23.1,
23.1,
22.8,
21.8,
20.2,
19.1,
18.0,
17.4
],
"start_solution": null,
"pv_akku": {
"device_id": "battery1",
"hours": null,
"capacity_wh": 26400,
"charging_efficiency": 0.88,
"discharging_efficiency": 0.88,
"max_charge_power_w": 5000.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 80,
"min_soc_percentage": 0,
"max_soc_percentage": 100,
"charge_rates": null
},
"eauto": {
"device_id": "ev1",
"hours": null,
"capacity_wh": 60000,
"charging_efficiency": 0.95,
"discharging_efficiency": 1.0,
"max_charge_power_w": 11040.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 5,
"min_soc_percentage": 80,
"max_soc_percentage": 100,
"charge_rates": null
}
},
"start_hour": 10,
"settings": {
"prediction_hours": 48,
"horizon_hours": 48,
"individuals": 300,
"generations": 3,
"seed": 42,
"penalties": {
"ev_soc_miss": 10,
"ac_charge_break_even": 1
},
"ev_charge_rates": [
0.0,
0.375,
0.5,
0.625,
0.75,
0.875,
1.0
],
"battery_charge_rates": null,
"self_consumption_interpolator": "scipy",
"verbose": false
},
"presentation": {
"start_datetime": {
"datetime": "2026-01-14T10:00:00+01:00",
"timezone": "Europe/Berlin"
},
"timezone": "Europe/Berlin",
"battery_device_id": "battery1",
"ev_device_id": "ev1",
"home_appliance_device_id": "homeappliance1",
"home_appliance_enabled": true,
"prediction_series": {
"pvforecast_ac_power": [
170.5,
171.0,
171.5,
172.0,
172.5,
173.0,
173.5,
174.0,
174.5,
175.0,
175.5,
176.0,
176.5,
177.0,
177.5,
178.0,
178.5,
179.0,
179.5,
180.0,
180.5,
181.0,
181.5,
182.0,
182.5,
183.0,
183.5,
184.0,
184.5,
185.0,
185.5,
186.0,
186.5,
187.0,
187.5,
188.0,
188.5,
189.0
],
"pvforecast_dc_power": [
180.5,
181.0,
181.5,
182.0,
182.5,
183.0,
183.5,
184.0,
184.5,
185.0,
185.5,
186.0,
186.5,
187.0,
187.5,
188.0,
188.5,
189.0,
189.5,
190.0,
190.5,
191.0,
191.5,
192.0,
192.5,
193.0,
193.5,
194.0,
194.5,
195.0,
195.5,
196.0,
196.5,
197.0,
197.5,
198.0,
198.5,
199.0
],
"elecprice_marketprice_wh": [
1190.5,
1191.0,
1191.5,
1192.0,
1192.5,
1193.0,
1193.5,
1194.0,
1194.5,
1195.0,
1195.5,
1196.0,
1196.5,
1197.0,
1197.5,
1198.0,
1198.5,
1199.0,
1199.5,
1200.0,
1200.5,
1201.0,
1201.5,
1202.0,
1202.5,
1203.0,
1203.5,
1204.0,
1204.5,
1205.0,
1205.5,
1206.0,
1206.5,
1207.0,
1207.5,
1208.0,
1208.5,
1209.0
],
"feed_in_tariff_wh": [
1200.5,
1201.0,
1201.5,
1202.0,
1202.5,
1203.0,
1203.5,
1204.0,
1204.5,
1205.0,
1205.5,
1206.0,
1206.5,
1207.0,
1207.5,
1208.0,
1208.5,
1209.0,
1209.5,
1210.0,
1210.5,
1211.0,
1211.5,
1212.0,
1212.5,
1213.0,
1213.5,
1214.0,
1214.5,
1215.0,
1215.5,
1216.0,
1216.5,
1217.0,
1217.5,
1218.0,
1218.5,
1219.0
],
"weather_temp_air": [
210.5,
211.0,
211.5,
212.0,
212.5,
213.0,
213.5,
214.0,
214.5,
215.0,
215.5,
216.0,
216.5,
217.0,
217.5,
218.0,
218.5,
219.0,
219.5,
220.0,
220.5,
221.0,
221.5,
222.0,
222.5,
223.0,
223.5,
224.0,
224.5,
225.0,
225.5,
226.0,
226.5,
227.0,
227.5,
228.0,
228.5,
229.0
],
"loadforecast_power_w": [
220.5,
221.0,
221.5,
222.0,
222.5,
223.0,
223.5,
224.0,
224.5,
225.0,
225.5,
226.0,
226.5,
227.0,
227.5,
228.0,
228.5,
229.0,
229.5,
230.0,
230.5,
231.0,
231.5,
232.0,
232.5,
233.0,
233.5,
234.0,
234.5,
235.0,
235.5,
236.0,
236.5,
237.0,
237.5,
238.0,
238.5,
239.0
],
"loadakkudoktor_std_power_w": [
230.5,
231.0,
231.5,
232.0,
232.5,
233.0,
233.5,
234.0,
234.5,
235.0,
235.5,
236.0,
236.5,
237.0,
237.5,
238.0,
238.5,
239.0,
239.5,
240.0,
240.5,
241.0,
241.5,
242.0,
242.5,
243.0,
243.5,
244.0,
244.5,
245.0,
245.5,
246.0,
246.5,
247.0,
247.5,
248.0,
248.5,
249.0
],
"loadakkudoktor_mean_power_w": [
240.5,
241.0,
241.5,
242.0,
242.5,
243.0,
243.5,
244.0,
244.5,
245.0,
245.5,
246.0,
246.5,
247.0,
247.5,
248.0,
248.5,
249.0,
249.5,
250.0,
250.5,
251.0,
251.5,
252.0,
252.5,
253.0,
253.5,
254.0,
254.5,
255.0,
255.5,
256.0,
256.5,
257.0,
257.5,
258.0,
258.5,
259.0
]
}
}
}
}
@@ -0,0 +1,801 @@
{
"expected_result": "optimize_result_2.json",
"parameters": {
"request": {
"ems": {
"pv_forecast_wh": [
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
8.05,
352.91,
728.51,
930.28,
1043.25,
1106.74,
1161.69,
6018.82,
5519.07,
3969.88,
3017.96,
1943.07,
1007.17,
319.67,
7.88,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
5.04,
335.59,
705.32,
1121.12,
1604.79,
2157.38,
1433.25,
5718.49,
4553.96,
3027.55,
2574.46,
1720.4,
963.4,
383.3,
0.0,
0.0,
0.0
],
"electricity_price_per_wh": [
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278,
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278
],
"feed_in_tariff_per_wh": 7e-05,
"price_per_wh_battery": 0.0,
"total_load": [
676.71,
876.19,
527.13,
468.88,
531.38,
517.95,
483.15,
472.28,
1011.68,
995.0,
1053.07,
1063.91,
1320.56,
1132.03,
1163.67,
1176.82,
1216.22,
1103.78,
1129.12,
1178.71,
1050.98,
988.56,
912.38,
704.61,
516.37,
868.05,
694.34,
608.79,
556.31,
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
],
"pv_prognose_wh": [
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
8.05,
352.91,
728.51,
930.28,
1043.25,
1106.74,
1161.69,
6018.82,
5519.07,
3969.88,
3017.96,
1943.07,
1007.17,
319.67,
7.88,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
5.04,
335.59,
705.32,
1121.12,
1604.79,
2157.38,
1433.25,
5718.49,
4553.96,
3027.55,
2574.46,
1720.4,
963.4,
383.3,
0.0,
0.0,
0.0
],
"strompreis_euro_pro_wh": [
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278,
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278
],
"einspeiseverguetung_euro_pro_wh": 7e-05,
"preis_euro_pro_wh_akku": 0.0,
"gesamtlast": [
676.71,
876.19,
527.13,
468.88,
531.38,
517.95,
483.15,
472.28,
1011.68,
995.0,
1053.07,
1063.91,
1320.56,
1132.03,
1163.67,
1176.82,
1216.22,
1103.78,
1129.12,
1178.71,
1050.98,
988.56,
912.38,
704.61,
516.37,
868.05,
694.34,
608.79,
556.31,
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
]
},
"pv_battery": {
"device_id": "battery1",
"hours": null,
"capacity_wh": 26400,
"charging_efficiency": 0.88,
"discharging_efficiency": 0.88,
"max_charge_power_w": 5000.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 80,
"min_soc_percentage": 0,
"max_soc_percentage": 100,
"charge_rates": null
},
"inverter": {
"device_id": "inverter1",
"hours": null,
"max_power_wh": 10000.0,
"battery_id": "battery1",
"ac_to_dc_efficiency": 1.0,
"dc_to_ac_efficiency": 1.0,
"max_ac_charge_power_w": null
},
"ev": {
"device_id": "ev1",
"hours": null,
"capacity_wh": 60000,
"charging_efficiency": 0.95,
"discharging_efficiency": 1.0,
"max_charge_power_w": 11040.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 5,
"min_soc_percentage": 80,
"max_soc_percentage": 100,
"charge_rates": null
},
"dishwasher": {
"device_id": "dishwasher1",
"hours": null,
"consumption_wh": 5000,
"duration_h": 2,
"time_windows": {
"windows": [
{
"start_time": "00:00:00.000000",
"duration": "2 days",
"end_time": null,
"day_of_week": null,
"date": null,
"month": null,
"locale": null
}
]
}
},
"temperature_forecast": [
18.3,
17.8,
16.9,
16.2,
15.6,
15.1,
14.6,
14.2,
14.3,
14.8,
15.7,
16.7,
17.4,
18.0,
18.6,
19.2,
19.1,
18.7,
18.5,
17.7,
16.2,
14.6,
13.6,
13.0,
12.6,
12.2,
11.7,
11.6,
11.3,
11.0,
10.7,
10.2,
11.4,
14.4,
16.4,
18.3,
19.5,
20.7,
21.9,
22.7,
23.1,
23.1,
22.8,
21.8,
20.2,
19.1,
18.0,
17.4
],
"start_solution": null,
"pv_akku": {
"device_id": "battery1",
"hours": null,
"capacity_wh": 26400,
"charging_efficiency": 0.88,
"discharging_efficiency": 0.88,
"max_charge_power_w": 5000.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 80,
"min_soc_percentage": 0,
"max_soc_percentage": 100,
"charge_rates": null
},
"eauto": {
"device_id": "ev1",
"hours": null,
"capacity_wh": 60000,
"charging_efficiency": 0.95,
"discharging_efficiency": 1.0,
"max_charge_power_w": 11040.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 5,
"min_soc_percentage": 80,
"max_soc_percentage": 100,
"charge_rates": null
}
},
"start_hour": 10,
"settings": {
"prediction_hours": 48,
"horizon_hours": 48,
"individuals": 300,
"generations": 3,
"seed": 42,
"penalties": {
"ev_soc_miss": 10,
"ac_charge_break_even": 0
},
"ev_charge_rates": [
0.0,
0.375,
0.5,
0.625,
0.75,
0.875,
1.0
],
"battery_charge_rates": null,
"self_consumption_interpolator": "scipy",
"verbose": false
},
"presentation": {
"start_datetime": {
"datetime": "2026-03-28T10:00:00+01:00",
"timezone": "Europe/Berlin"
},
"timezone": "Europe/Berlin",
"battery_device_id": "battery1",
"ev_device_id": "ev1",
"home_appliance_device_id": "homeappliance1",
"home_appliance_enabled": true,
"prediction_series": {
"pvforecast_ac_power": [
1046.5,
1047.0,
1047.5,
1048.0,
1048.5,
1049.0,
1049.5,
1050.0,
1050.5,
1051.0,
1051.5,
1052.0,
1052.5,
1053.0,
1053.5,
1054.0,
1054.5,
1055.0,
1055.5,
1056.0,
1056.5,
1057.0,
1057.5,
1058.0,
1058.5,
1059.0,
1059.5,
1060.0,
1060.5,
1061.0,
1061.5,
1062.0,
1062.5,
1063.0,
1063.5,
1064.0,
1064.5,
1065.0
],
"pvforecast_dc_power": [
1056.5,
1057.0,
1057.5,
1058.0,
1058.5,
1059.0,
1059.5,
1060.0,
1060.5,
1061.0,
1061.5,
1062.0,
1062.5,
1063.0,
1063.5,
1064.0,
1064.5,
1065.0,
1065.5,
1066.0,
1066.5,
1067.0,
1067.5,
1068.0,
1068.5,
1069.0,
1069.5,
1070.0,
1070.5,
1071.0,
1071.5,
1072.0,
1072.5,
1073.0,
1073.5,
1074.0,
1074.5,
1075.0
],
"elecprice_marketprice_wh": [
2066.5,
2067.0,
2067.5,
2068.0,
2068.5,
2069.0,
2069.5,
2070.0,
2070.5,
2071.0,
2071.5,
2072.0,
2072.5,
2073.0,
2073.5,
2074.0,
2074.5,
2075.0,
2075.5,
2076.0,
2076.5,
2077.0,
2077.5,
2078.0,
2078.5,
2079.0,
2079.5,
2080.0,
2080.5,
2081.0,
2081.5,
2082.0,
2082.5,
2083.0,
2083.5,
2084.0,
2084.5,
2085.0
],
"feed_in_tariff_wh": [
2076.5,
2077.0,
2077.5,
2078.0,
2078.5,
2079.0,
2079.5,
2080.0,
2080.5,
2081.0,
2081.5,
2082.0,
2082.5,
2083.0,
2083.5,
2084.0,
2084.5,
2085.0,
2085.5,
2086.0,
2086.5,
2087.0,
2087.5,
2088.0,
2088.5,
2089.0,
2089.5,
2090.0,
2090.5,
2091.0,
2091.5,
2092.0,
2092.5,
2093.0,
2093.5,
2094.0,
2094.5,
2095.0
],
"weather_temp_air": [
1086.5,
1087.0,
1087.5,
1088.0,
1088.5,
1089.0,
1089.5,
1090.0,
1090.5,
1091.0,
1091.5,
1092.0,
1092.5,
1093.0,
1093.5,
1094.0,
1094.5,
1095.0,
1095.5,
1096.0,
1096.5,
1097.0,
1097.5,
1098.0,
1098.5,
1099.0,
1099.5,
1100.0,
1100.5,
1101.0,
1101.5,
1102.0,
1102.5,
1103.0,
1103.5,
1104.0,
1104.5,
1105.0
],
"loadforecast_power_w": [
1096.5,
1097.0,
1097.5,
1098.0,
1098.5,
1099.0,
1099.5,
1100.0,
1100.5,
1101.0,
1101.5,
1102.0,
1102.5,
1103.0,
1103.5,
1104.0,
1104.5,
1105.0,
1105.5,
1106.0,
1106.5,
1107.0,
1107.5,
1108.0,
1108.5,
1109.0,
1109.5,
1110.0,
1110.5,
1111.0,
1111.5,
1112.0,
1112.5,
1113.0,
1113.5,
1114.0,
1114.5,
1115.0
],
"loadakkudoktor_std_power_w": [
1106.5,
1107.0,
1107.5,
1108.0,
1108.5,
1109.0,
1109.5,
1110.0,
1110.5,
1111.0,
1111.5,
1112.0,
1112.5,
1113.0,
1113.5,
1114.0,
1114.5,
1115.0,
1115.5,
1116.0,
1116.5,
1117.0,
1117.5,
1118.0,
1118.5,
1119.0,
1119.5,
1120.0,
1120.5,
1121.0,
1121.5,
1122.0,
1122.5,
1123.0,
1123.5,
1124.0,
1124.5,
1125.0
],
"loadakkudoktor_mean_power_w": [
1116.5,
1117.0,
1117.5,
1118.0,
1118.5,
1119.0,
1119.5,
1120.0,
1120.5,
1121.0,
1121.5,
1122.0,
1122.5,
1123.0,
1123.5,
1124.0,
1124.5,
1125.0,
1125.5,
1126.0,
1126.5,
1127.0,
1127.5,
1128.0,
1128.5,
1129.0,
1129.5,
1130.0,
1130.5,
1131.0,
1131.5,
1132.0,
1132.5,
1133.0,
1133.5,
1134.0,
1134.5,
1135.0
]
}
}
}
}
@@ -0,0 +1,801 @@
{
"expected_result": "optimize_result_2_full.json",
"parameters": {
"request": {
"ems": {
"pv_forecast_wh": [
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
8.05,
352.91,
728.51,
930.28,
1043.25,
1106.74,
1161.69,
6018.82,
5519.07,
3969.88,
3017.96,
1943.07,
1007.17,
319.67,
7.88,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
5.04,
335.59,
705.32,
1121.12,
1604.79,
2157.38,
1433.25,
5718.49,
4553.96,
3027.55,
2574.46,
1720.4,
963.4,
383.3,
0.0,
0.0,
0.0
],
"electricity_price_per_wh": [
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278,
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278
],
"feed_in_tariff_per_wh": 7e-05,
"price_per_wh_battery": 0.0,
"total_load": [
676.71,
876.19,
527.13,
468.88,
531.38,
517.95,
483.15,
472.28,
1011.68,
995.0,
1053.07,
1063.91,
1320.56,
1132.03,
1163.67,
1176.82,
1216.22,
1103.78,
1129.12,
1178.71,
1050.98,
988.56,
912.38,
704.61,
516.37,
868.05,
694.34,
608.79,
556.31,
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
],
"pv_prognose_wh": [
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
8.05,
352.91,
728.51,
930.28,
1043.25,
1106.74,
1161.69,
6018.82,
5519.07,
3969.88,
3017.96,
1943.07,
1007.17,
319.67,
7.88,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
5.04,
335.59,
705.32,
1121.12,
1604.79,
2157.38,
1433.25,
5718.49,
4553.96,
3027.55,
2574.46,
1720.4,
963.4,
383.3,
0.0,
0.0,
0.0
],
"strompreis_euro_pro_wh": [
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278,
0.0003384,
0.0003318,
0.0003284,
0.0003283,
0.0003289,
0.0003334,
0.000329,
0.0003302,
0.0003042,
0.000243,
0.000228,
0.0002212,
0.0002093,
0.0001879,
0.0001838,
0.0002004,
0.0002198,
0.000227,
0.0002997,
0.0003195,
0.0003081,
0.0002969,
0.0002921,
0.000278
],
"einspeiseverguetung_euro_pro_wh": 7e-05,
"preis_euro_pro_wh_akku": 0.0,
"gesamtlast": [
676.71,
876.19,
527.13,
468.88,
531.38,
517.95,
483.15,
472.28,
1011.68,
995.0,
1053.07,
1063.91,
1320.56,
1132.03,
1163.67,
1176.82,
1216.22,
1103.78,
1129.12,
1178.71,
1050.98,
988.56,
912.38,
704.61,
516.37,
868.05,
694.34,
608.79,
556.31,
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
]
},
"pv_battery": {
"device_id": "battery1",
"hours": null,
"capacity_wh": 26400,
"charging_efficiency": 0.88,
"discharging_efficiency": 0.88,
"max_charge_power_w": 5000.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 80,
"min_soc_percentage": 0,
"max_soc_percentage": 100,
"charge_rates": null
},
"inverter": {
"device_id": "inverter1",
"hours": null,
"max_power_wh": 10000.0,
"battery_id": "battery1",
"ac_to_dc_efficiency": 1.0,
"dc_to_ac_efficiency": 1.0,
"max_ac_charge_power_w": null
},
"ev": {
"device_id": "ev1",
"hours": null,
"capacity_wh": 60000,
"charging_efficiency": 0.95,
"discharging_efficiency": 1.0,
"max_charge_power_w": 11040.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 5,
"min_soc_percentage": 80,
"max_soc_percentage": 100,
"charge_rates": null
},
"dishwasher": {
"device_id": "dishwasher1",
"hours": null,
"consumption_wh": 5000,
"duration_h": 2,
"time_windows": {
"windows": [
{
"start_time": "00:00:00.000000",
"duration": "2 days",
"end_time": null,
"day_of_week": null,
"date": null,
"month": null,
"locale": null
}
]
}
},
"temperature_forecast": [
18.3,
17.8,
16.9,
16.2,
15.6,
15.1,
14.6,
14.2,
14.3,
14.8,
15.7,
16.7,
17.4,
18.0,
18.6,
19.2,
19.1,
18.7,
18.5,
17.7,
16.2,
14.6,
13.6,
13.0,
12.6,
12.2,
11.7,
11.6,
11.3,
11.0,
10.7,
10.2,
11.4,
14.4,
16.4,
18.3,
19.5,
20.7,
21.9,
22.7,
23.1,
23.1,
22.8,
21.8,
20.2,
19.1,
18.0,
17.4
],
"start_solution": null,
"pv_akku": {
"device_id": "battery1",
"hours": null,
"capacity_wh": 26400,
"charging_efficiency": 0.88,
"discharging_efficiency": 0.88,
"max_charge_power_w": 5000.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 80,
"min_soc_percentage": 0,
"max_soc_percentage": 100,
"charge_rates": null
},
"eauto": {
"device_id": "ev1",
"hours": null,
"capacity_wh": 60000,
"charging_efficiency": 0.95,
"discharging_efficiency": 1.0,
"max_charge_power_w": 11040.0,
"max_discharge_power_w": null,
"initial_soc_percentage": 5,
"min_soc_percentage": 80,
"max_soc_percentage": 100,
"charge_rates": null
}
},
"start_hour": 10,
"settings": {
"prediction_hours": 48,
"horizon_hours": 48,
"individuals": 300,
"generations": 400,
"seed": 42,
"penalties": {
"ev_soc_miss": 10,
"ac_charge_break_even": 0
},
"ev_charge_rates": [
0.0,
0.375,
0.5,
0.625,
0.75,
0.875,
1.0
],
"battery_charge_rates": null,
"self_consumption_interpolator": "scipy",
"verbose": false
},
"presentation": {
"start_datetime": {
"datetime": "2026-01-14T10:00:00+01:00",
"timezone": "Europe/Berlin"
},
"timezone": "Europe/Berlin",
"battery_device_id": "battery1",
"ev_device_id": "ev1",
"home_appliance_device_id": "homeappliance1",
"home_appliance_enabled": true,
"prediction_series": {
"pvforecast_ac_power": [
170.5,
171.0,
171.5,
172.0,
172.5,
173.0,
173.5,
174.0,
174.5,
175.0,
175.5,
176.0,
176.5,
177.0,
177.5,
178.0,
178.5,
179.0,
179.5,
180.0,
180.5,
181.0,
181.5,
182.0,
182.5,
183.0,
183.5,
184.0,
184.5,
185.0,
185.5,
186.0,
186.5,
187.0,
187.5,
188.0,
188.5,
189.0
],
"pvforecast_dc_power": [
180.5,
181.0,
181.5,
182.0,
182.5,
183.0,
183.5,
184.0,
184.5,
185.0,
185.5,
186.0,
186.5,
187.0,
187.5,
188.0,
188.5,
189.0,
189.5,
190.0,
190.5,
191.0,
191.5,
192.0,
192.5,
193.0,
193.5,
194.0,
194.5,
195.0,
195.5,
196.0,
196.5,
197.0,
197.5,
198.0,
198.5,
199.0
],
"elecprice_marketprice_wh": [
1190.5,
1191.0,
1191.5,
1192.0,
1192.5,
1193.0,
1193.5,
1194.0,
1194.5,
1195.0,
1195.5,
1196.0,
1196.5,
1197.0,
1197.5,
1198.0,
1198.5,
1199.0,
1199.5,
1200.0,
1200.5,
1201.0,
1201.5,
1202.0,
1202.5,
1203.0,
1203.5,
1204.0,
1204.5,
1205.0,
1205.5,
1206.0,
1206.5,
1207.0,
1207.5,
1208.0,
1208.5,
1209.0
],
"feed_in_tariff_wh": [
1200.5,
1201.0,
1201.5,
1202.0,
1202.5,
1203.0,
1203.5,
1204.0,
1204.5,
1205.0,
1205.5,
1206.0,
1206.5,
1207.0,
1207.5,
1208.0,
1208.5,
1209.0,
1209.5,
1210.0,
1210.5,
1211.0,
1211.5,
1212.0,
1212.5,
1213.0,
1213.5,
1214.0,
1214.5,
1215.0,
1215.5,
1216.0,
1216.5,
1217.0,
1217.5,
1218.0,
1218.5,
1219.0
],
"weather_temp_air": [
210.5,
211.0,
211.5,
212.0,
212.5,
213.0,
213.5,
214.0,
214.5,
215.0,
215.5,
216.0,
216.5,
217.0,
217.5,
218.0,
218.5,
219.0,
219.5,
220.0,
220.5,
221.0,
221.5,
222.0,
222.5,
223.0,
223.5,
224.0,
224.5,
225.0,
225.5,
226.0,
226.5,
227.0,
227.5,
228.0,
228.5,
229.0
],
"loadforecast_power_w": [
220.5,
221.0,
221.5,
222.0,
222.5,
223.0,
223.5,
224.0,
224.5,
225.0,
225.5,
226.0,
226.5,
227.0,
227.5,
228.0,
228.5,
229.0,
229.5,
230.0,
230.5,
231.0,
231.5,
232.0,
232.5,
233.0,
233.5,
234.0,
234.5,
235.0,
235.5,
236.0,
236.5,
237.0,
237.5,
238.0,
238.5,
239.0
],
"loadakkudoktor_std_power_w": [
230.5,
231.0,
231.5,
232.0,
232.5,
233.0,
233.5,
234.0,
234.5,
235.0,
235.5,
236.0,
236.5,
237.0,
237.5,
238.0,
238.5,
239.0,
239.5,
240.0,
240.5,
241.0,
241.5,
242.0,
242.5,
243.0,
243.5,
244.0,
244.5,
245.0,
245.5,
246.0,
246.5,
247.0,
247.5,
248.0,
248.5,
249.0
],
"loadakkudoktor_mean_power_w": [
240.5,
241.0,
241.5,
242.0,
242.5,
243.0,
243.5,
244.0,
244.5,
245.0,
245.5,
246.0,
246.5,
247.0,
247.5,
248.0,
248.5,
249.0,
249.5,
250.0,
250.5,
251.0,
251.5,
252.0,
252.5,
253.0,
253.5,
254.0,
254.5,
255.0,
255.5,
256.0,
256.5,
257.0,
257.5,
258.0,
258.5,
259.0
]
}
}
}
}