Giter VIP home page Giter VIP logo

Comments (4)

purcell-lab avatar purcell-lab commented on May 29, 2024 1

You can pass the run hours for each optimisation run, that will achieve this desired effect.

I have been playing around with different variables to modify the run hours dynamically.

You can see some switches and external temperature as well as costs that sometimes will drive the total_hours to zero.

"def_total_hours [EV 11 kW]": {{ state_attr('sensor.duka_charging_rate_sensor','time_left')|int(2)}}
"def_total_hours [EV@home 11 kW]": {{(is_state('binary_sensor.duka_charger', 'on') | abs) * ((100-states('sensor.duka_battery')|int(0))/11)|int(0)}}
"def_total_hours [Pool Filter 1.4 kW]": 4
"def_total_hours [HVAC humidity 4 kW]": {{max(0,(state_attr('climate.family','current_humidity')|int(0) - 60)/10)|int(0)}}
"def_total_hours [HVAC temp 4 kW]": {{max(0,(state_attr('climate.bedroom','current_temperature')|float(0) -
                                        state_attr('climate.daikin_ap46401','temperature')|float)|int(0))}}
"def_total_hours [HVAC No People 4 kW]": {{states('zone.home')}}
"def_total_hours [Pool Heater 5 kW]": {{states('input_number.pool_temperature_set_point')|int - 
                                   states('input_number.pool_temperature')|int}}
"def_total_hours_ev": "{{(is_state('binary_sensor.duka_charger', 'on') | abs) * 
                          min(((100-states('sensor.duka_battery')|int(0))/11)|int(0), ((state_attr('sensor.amber_general_forecast', 'forecasts')|
                          selectattr('descriptor','eq','extremely_low')|list|count)/4))|int(0)}}"              
"def_total_hours_hvac": "{{(state_attr('weather.location_hourly','forecast')[:24]|selectattr('temperature','gt',24)|
                            map(attribute='temperature')|list|count)}}"
"def_total_hours [EV 11 kW]": 2
"def_total_hours [EV@home 11 kW]": 2
"def_total_hours [Pool Filter 1.4 kW]": 4
"def_total_hours [HVAC humidity 4 kW]": 0
"def_total_hours [HVAC temp 4 kW]": 0
"def_total_hours [HVAC No People 4 kW]": 1
"def_total_hours [Pool Heater 5 kW]": 4
"def_total_hours_ev": "2"              
"def_total_hours_hvac": "3"

I then call this using the following shell command:

\"def_total_hours\":[{{states('sensor.def_total_hours_pool_filter')
          }},{{states('sensor.def_total_hours_pool_heatpump')
          }},{{states('sensor.def_total_hours_ev')
          }},{{states('sensor.def_total_hours_hvac')
          }},{{states('sensor.def_total_hours_hws')
          }}]}' http://localhost:5000/action/naive-mpc-optim"
\"def_total_hours\":[6,6,2,3,6]}' http://localhost:5000/action/naive-mpc-optim"

from emhass.

davidusb-geek avatar davidusb-geek commented on May 29, 2024

Hi, we will take Mark's reply as the solution to this. Indeed this use case was the goal when providing the possibility to pass some of the configuration parameters at runtime, in order to update them on the go.

You can pass these parameters also with the dayahead-optim end point.

You can also pass all these parameters at runtime:

  • num_def_loads for the number of deferrable loads to consider.

  • P_deferrable_nom for the nominal power for each deferrable load in Watts.

  • def_total_hours for the total number of hours that each deferrable load should operate.

  • treat_def_as_semi_cont to define if we should treat each deferrable load as a semi-continuous variable.

  • set_def_constant to define if we should set each deferrable load as a constant fixed value variable with just one startup for each optimization task.

  • solcast_api_key for the SolCast API key if you want to use this service for PV power production forecast.

  • solcast_rooftop_id for the ID of your rooftop for the SolCast service implementation.

from emhass.

gieljnssns avatar gieljnssns commented on May 29, 2024

@purcell-lab can you show me your automatisations in HA that fire your naive-mpc-optim and dayahead-optim
How often do they fire?
Is it possible to show all your EMHASS configs? Also your EMHASS configuration file?
In the naive-mpc-optim you need to pass battery data?

When applying this controller, the following runtimeparams should be defined:
prediction_horizon for the MPC prediction horizon. Fix this at at least 5 times the optimization time step.
soc_init for the initial value of the battery SOC for the current iteration of the MPC.
soc_final for the final value of the battery SOC for the current iteration of the MPC.
def_total_hours for the list of deferrable loads functioning hours. These values can decrease as the day advances to take into account receding horizon daily energy objectives for each deferrable load.

I do not have batteries.

from emhass.

davidusb-geek avatar davidusb-geek commented on May 29, 2024

If you don't have a battery, no need to provide the SOC parameters at runtime. From the documentation :

:param soc_init: The initial battery SOC for the optimization. This parameter is optional, if not given soc_init = soc_final = soc_target from the configuration file.
:param soc_final: The final battery SOC for the optimization. This parameter is optional, if not given soc_init = soc_final = soc_target from the configuration file.

from emhass.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.