mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-08-31 12:46:38 +00:00
feat(optimization): schedule any number of flexible consumers
Replace the single hourly "dishwasher" home appliance with a list of flexible consumers (home_appliances). Each consumer defines its load either as an explicit power profile (energy-preservingly resampled onto the optimization slot grid, incl. 15-min and non-integer interval ratios) or the flat consumption_wh/duration_h fallback, and runs ONCE or DAILY within its time windows and the optimization horizon. - ConsumerScheduleMode + shared load-definition validation (XOR of profile/fallback, reject negative/NaN/inf, unique device_id) - ApplianceGeneLayout: variable appliance gene block (index into allowed_start_slots), ONCE/DAILY calendar-day based, no snapping - per-device output: result.home_appliance_energy_wh, appliance_starts (absolute local times), per-device solution columns and DDBC RUN/OFF instructions on state transitions only - deprecate dishwasher/washingstart/Home_appliance_wh_per_hour with backward-compatible mapping and explicit conflict rejection - max_home_appliances is now an upper bound only; no demo appliance and no on/off behaviour - docs, openapi.json, CHANGELOG and optimize_result_2* fixtures updated; new tests/test_homeappliance.py covers the mandatory test matrix Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
c59bf1b486
commit
67cf6f7d8a
@@ -54,7 +54,7 @@ def genetic_simulation(config_eos) -> GeneticSimulation:
|
||||
battery=akku,
|
||||
)
|
||||
|
||||
# Household device (currently not used, set to None)
|
||||
# Flexible consumer (fixed start at slot 2 for this deterministic test)
|
||||
home_appliance = HomeAppliance(
|
||||
HomeApplianceParameters(
|
||||
device_id="dishwasher1",
|
||||
@@ -65,6 +65,7 @@ def genetic_simulation(config_eos) -> GeneticSimulation:
|
||||
optimization_hours=config_eos.optimization.horizon_hours,
|
||||
prediction_hours=config_eos.prediction.hours,
|
||||
)
|
||||
home_appliance.build_load_curve([2])
|
||||
|
||||
# Example initialization of electric car battery
|
||||
eauto = Battery(
|
||||
@@ -246,7 +247,7 @@ def genetic_simulation(config_eos) -> GeneticSimulation:
|
||||
prediction_hours=config_eos.prediction.hours,
|
||||
inverter=inverter,
|
||||
ev=eauto,
|
||||
home_appliance=home_appliance,
|
||||
home_appliances=[home_appliance],
|
||||
)
|
||||
|
||||
# Init for test
|
||||
@@ -259,7 +260,6 @@ def genetic_simulation(config_eos) -> GeneticSimulation:
|
||||
simulation.dc_charge_hours[start_hour] = 1.0
|
||||
simulation.bat_discharge_hours[start_hour] = 1.0
|
||||
simulation.ev_charge_hours[start_hour] = 1.0
|
||||
simulation.home_appliance_start_hour = 2
|
||||
|
||||
return simulation
|
||||
|
||||
@@ -362,8 +362,8 @@ def test_simulation(genetic_simulation):
|
||||
|
||||
# Check home appliances
|
||||
assert (
|
||||
sum(simulation.home_appliance.get_load_curve()) == 2000
|
||||
), "The sum of 'simulation.home_appliance.get_load_curve()' should be 2000."
|
||||
sum(simulation.home_appliances[0].get_load_curve()) == 2000
|
||||
), "The sum of 'simulation.home_appliances[0].get_load_curve()' should be 2000."
|
||||
|
||||
assert (
|
||||
np.nansum(
|
||||
|
||||
Reference in New Issue
Block a user