davidusb-geek / emhass-add-on

The Home Assistant Add-on for EMHASS: Energy Management Optimization for Home Assistant
MIT License
88 stars 26 forks source link

Time limit for deferrable loads (add-on) #70

Closed michaelpiron closed 8 months ago

michaelpiron commented 8 months ago

This pull request corresponds with a new feature in the emhass repository: https://github.com/davidusb-geek/emhass/pull/153

This pull request introduces a new parameter, allowing the user to specify a time limit for each deferrable load (in MPC optimization).

The new parameter in the optimizer, called def_end_timestep, is defined as "The timestep before which each deferrable load should operate." The optimizer will get an extra constraint stating that the deferrable load should not consume any energy after the specified timestep. If a value of 0 (or negative) is provided, no extra constraint is added.

Example: "def_end_timestep": [3,0] This is the case of two deferrable loads, whereby the first load should operate in the first three timesteps of the optimization window. The second load can use the complete optimization window (cf the value of 0).

There's also a check that the available timeframe until def_end_timestep is > the timesteps needed to run the load for the specified operating hours (def_total_hours). If not, the def_end_timestep is updated automatically to respect that constraint.