Files
EOS/tests/testdata
Bobby Noelte 779395cef5
Some checks failed
Bump Version / Bump Version Workflow (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
docker-build / platform-excludes (push) Has been cancelled
docker-build / build (push) Has been cancelled
docker-build / merge (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
Run Pytest on Pull Request / test (push) Has been cancelled
fix: genetic optimizer charge rates, SoC accuracy, and minor bugfixes (#949)
* record battery SOC at the start of the interval for accurate display

* map battery charge rates to GeneticOptimizationParameters and update related logic

  Instead of using the EV charge rates, the battery now has its own charge rate defined
  in the GeneticOptimizationParameters to better separate those entities.

* separate raw gene values from SOC-clamped op factors

  The genetic_*_factor columns in the OptimizationSolution dataframe now
  always carry the raw gene values (optimizer intent), while the
  battery1_*_op_mode / battery1_*_op_factor columns and FRBCInstruction
  operation_mode_factor reflect SOC-clamped effective values that can
  actually be executed given the battery's state of charge at each hour.

  Adds GeneticSolution._soc_clamped_operation_factors():
    - AC charge factor: proportionally scaled down when battery headroom
      (max_soc - current_soc) is less than what the commanded factor
      would store in one hour; zeroed when battery is full.
    - DC charge factor: zeroed when battery is at or above max SOC.
    - Discharge: blocked when SOC is at or below min SOC.

  Both optimization_solution() and energy_management_plan() pass the
  clamped values to _battery_operation_from_solution(), so the plan
  instructions the HEMS receives reflect physically achievable targets.

* ensure max AC charge power is only used if defined

* update fixtures for PV suffix + SOC-clamp algorithm changes

* handle None case for home appliance start hour in simulation

  if the hour is zero, the the home appliance wont start

* update handling of invalid charge indices in autocharge hours

  Seems to be a bug, since all invalid indexes needs to be invalidated (also the first one)

* remove double code in simulation preparation and improve comments

* update version

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
Co-authored-by: Christopher Nadler <christopher.nadler@gmail.com>
2026-03-17 12:41:15 +01:00
..