mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-11-25 15:06:20 +01:00
fix(genetic): plan the running slot only for the remaining time
A run within a slot (e.g. 10:45 with hourly slots) planned slot 0 as a full slot, although the SoC is measured at the run time. Slot 0 now moves only the remaining part of the slot energy: battery, EV and inverter energy caps, SoC power limit tables and the slot's PV and load forecast are scaled by first_slot_fraction; efficiency curves are read at the power of that part. The plan's SoC headroom clamp of the AC charge factor uses the same part, and the GENETIC result reports first_slot_fraction. A run on a slot boundary is unchanged. Additional changes Pin GENETIC test start times to the full hour; their results now depend on seconds within the slot Document first_slot_fraction for consumers of GENETIC results Refs: #1543 Signed-off-by: SchaafAlexander <86607129+SchaafAlexander@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Assisted-by: Claude Code (claude-opus-5-5)
This commit is contained in:
committed by
Bobby Noelte
co-authored by
Claude Opus 5.5
parent
7e10f64048
commit
0bf9f50b97
@@ -510,7 +510,7 @@ def _full_charge_parameters(hours: int, **battery_extra) -> GeneticOptimizationP
|
||||
|
||||
def test_full_charge_slot_resolution(config_eos: ConfigEOS):
|
||||
_optimizer_config(config_eos, 24)
|
||||
ems_eos.set_start_datetime(to_datetime().set(hour=0, minute=0))
|
||||
ems_eos.set_start_datetime(to_datetime().set(hour=0, minute=0, second=0, microsecond=0))
|
||||
optimization = GeneticOptimization(fixed_seed=1)
|
||||
optimization._slot0_datetime = optimization.ems.start_datetime
|
||||
slot0 = optimization._slot0_datetime
|
||||
@@ -530,7 +530,7 @@ def test_full_charge_slot_resolution(config_eos: ConfigEOS):
|
||||
|
||||
def test_maximum_soc_before_deadline_counts(config_eos: ConfigEOS):
|
||||
_optimizer_config(config_eos, 24)
|
||||
ems_eos.set_start_datetime(to_datetime().set(hour=0, minute=0))
|
||||
ems_eos.set_start_datetime(to_datetime().set(hour=0, minute=0, second=0, microsecond=0))
|
||||
optimization = GeneticOptimization(fixed_seed=1)
|
||||
optimization.simulation.battery = MagicMock(spec=Battery)
|
||||
optimization.simulation.battery.current_soc_percentage.return_value = 40.0
|
||||
@@ -555,7 +555,7 @@ def test_maximum_soc_before_deadline_counts(config_eos: ConfigEOS):
|
||||
def _run(config_eos: ConfigEOS, **battery_extra) -> list[float]:
|
||||
hours = 24
|
||||
_optimizer_config(config_eos, hours)
|
||||
ems_eos.set_start_datetime(to_datetime().set(hour=0, minute=0))
|
||||
ems_eos.set_start_datetime(to_datetime().set(hour=0, minute=0, second=0, microsecond=0))
|
||||
CacheEnergyManagementStore().clear()
|
||||
solution = GeneticOptimization(fixed_seed=42).optimize_ems(
|
||||
parameters=_full_charge_parameters(hours, **battery_extra), start_hour=0, ngen=40
|
||||
|
||||
Reference in New Issue
Block a user