Skip to content

"typical" load forecast method fails with maximum_power_from_grid as vector (list) #705

@mk2lehe

Description

@mk2lehe

Describe the bug
The typical load forecast method crashes when maximum_power_from_grid is configured as a time-varying list/array instead of a single scalar value. This prevents using the typical method with dynamic grid limits for peak shaving strategies. naive method works without failing, and likely also mlforecaster methods (untested).

To Reproduce
Set "load_forecast_method": "typical", and pass "maximum_power_from_grid" as an array. Call for example /action/naive-mpc-optim

Expected behavior
The typical forecast method should handle time-varying maximum_power_from_grid the same way the naive method does, applying the appropriate limit for each time step.

Home Assistant installation type
Home Assistant OS

Your hardware
RPi5
Architecture: aarch64

EMHASS installation type
Add-on, v16.1

Configuration
"load_forecast_method": "typical",
"maximum_power_from_grid": [13800, 13800, ..., 3500, 3500, ..., 13800] // 96 values

Log results
The optimization fails with:
File "/app/src/emhass/forecast.py", line 1383, in _get_load_forecast_typical
forecast_tmp = forecast_tmp * self.plant_conf["maximum_power_from_grid"] / 9000
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ValueError: Unable to coerce to Series, length must be 1: given 96

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions