fix: automatic optimization start solution
Some checks failed
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
Close stale pull requests/issues / Find Stale issues and PRs (push) Has been cancelled

The automatic optimization did not use the start solution from the
last energy management run. Make it use it.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
This commit is contained in:
Bobby Noelte
2025-11-02 17:43:38 +01:00
parent fca29127cb
commit 9feae49950

View File

@@ -212,6 +212,12 @@ class GeneticOptimizationParameters(
logger.error("ev_soc_miss penalty function parameter unknown - defaulting to 100.")
cls.config.optimization.genetic.penalties["ev_soc_miss"] = 10
# Get start solution from last run
start_solution = None
last_solution = ems.genetic_solution()
if last_solution and last_solution.start_solution:
start_solution = last_solution.start_solution
# Add forecast and device data
interval = to_duration(cls.config.optimization.interval)
power_to_energy_per_interval_factor = cls.config.optimization.interval / 3600
@@ -615,6 +621,7 @@ class GeneticOptimizationParameters(
eauto=electric_vehicle_params,
inverter=inverter_params,
dishwasher=home_appliance_params,
start_solution=start_solution,
)
except:
logger.exception(