Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

now/ current values are not updated in real time - alpha =1 #347

Open
purcell-lab opened this issue Sep 28, 2024 · 2 comments
Open

now/ current values are not updated in real time - alpha =1 #347

purcell-lab opened this issue Sep 28, 2024 · 2 comments

Comments

@purcell-lab
Copy link
Contributor

Describe the bug
When alpha = 1 p_load_forecast should reflect the current/ now value of power_load_no_var_loads

However there appears to be a constant variance (calling high frequency MPC every minute)
image

power_load_no_var_loads = 2450 W, but p_load_forecast = 1007W

2024-09-28 15:42:30,450 - web_server - INFO - Passed runtime parameters: {'prod_price_forecast': [-0.04, -0.02, 0.05, 0.08, 0.11, 0.12, 0.11, 0.1, 0.1, 0.08, 0.08, 0.08, 0.1, 0.12, 0.1, 0.1, 0.08, 0.08, 0.08, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.08, 0.08, 0.08, 0.06, 0.05, 0.03, -0.02, -0.02, -0.03, -0.04, -0.04, -0.04, -0.04, -0.04, -0.04, -0.04, -0.04, -0.04, -0.04, -0.04, -0.02, -0.02, -0.02], 'load_cost_forecast': [0.05, 0.21, 0.29, 0.33, 0.36, 0.37, 0.36, 0.35, 0.35, 0.33, 0.33, 0.2, 0.22, 0.24, 0.23, 0.22, 0.2, 0.2, 0.2, 0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.2, 0.2, 0.2, 0.18, 0.17, 0.15, 0.09, 0.09, 0.08, 0.05, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.05, 0.05, 0.07, 0.07, 0.07], 'prediction_horizon': 47, 'alpha': 1, 'beta': 0, 'soc_init': 0.961, 'def_start_penalty': [1, 1, 1, 1], 'def_current_state': [0, 0, 0, 0], 'def_start_timestep': [0, 0, 0, 0], 'def_end_timestep': [0, 0, 29, 0], 'def_total_hours': [2, 1, 0, 4], 'soc_final': 0.08}
2024-09-28 15:42:30,450 - web_server - INFO -  >> Setting input data dict
2024-09-28 15:42:30,450 - web_server - INFO - Setting up needed data
2024-09-28 15:42:30,452 - web_server - INFO - Retrieve hass get data method initiated...
2024-09-28 15:42:30,664 - web_server - INFO - Retrieving weather forecast data using method = scrapper
2024-09-28 15:42:32,696 - web_server - INFO - Retrieving data from hass for load forecast using method = naive
2024-09-28 15:42:32,697 - web_server - INFO - Retrieve hass get data method initiated...
2024-09-28 15:42:33,340 - web_server - INFO -  >> Performing naive MPC optimization...
2024-09-28 15:42:33,340 - web_server - INFO - Performing naive MPC optimization
2024-09-28 15:42:33,344 - web_server - INFO - Perform an iteration of a naive MPC controller
2024-09-28 15:42:33,651 - web_server - INFO - Status: Optimal
2024-09-28 15:42:33,651 - web_server - INFO - Total value of the Cost function = 3.82
2024-09-28 15:42:33,779 - web_server - INFO - Passed runtime parameters: {}
2024-09-28 15:42:33,779 - web_server - INFO -  >> Setting input data dict
2024-09-28 15:42:33,779 - web_server - INFO - Setting up needed data
2024-09-28 15:42:33,780 - web_server - INFO -  >> Publishing data...
2024-09-28 15:42:33,780 - web_server - INFO - Publishing data to HASS instance
2024-09-28 15:42:33,787 - web_server - INFO - Successfully posted to sensor.p_pv_forecast = 1940.97
2024-09-28 15:42:33,790 - web_server - INFO - Successfully posted to sensor.p_load_forecast = 1007.63
2024-09-28 15:42:33,793 - web_server - INFO - Successfully posted to sensor.p_pv_curtailment = 0.0
2024-09-28 15:42:33,798 - web_server - INFO - Successfully posted to sensor.p_hybrid_inverter = -1876.59
2024-09-28 15:42:33,801 - web_server - INFO - Successfully posted to sensor.p_deferrable0 = 0.0
2024-09-28 15:42:33,804 - web_server - INFO - Successfully posted to sensor.p_deferrable1 = 0.0
2024-09-28 15:42:33,809 - web_server - INFO - Successfully posted to sensor.p_deferrable2 = 0.0
2024-09-28 15:42:33,813 - web_server - INFO - Successfully posted to sensor.p_deferrable3 = 0.0
2024-09-28 15:42:33,818 - web_server - INFO - Successfully posted to sensor.p_batt_forecast = -3817.55
2024-09-28 15:42:33,821 - web_server - INFO - Successfully posted to sensor.soc_batt_forecast = 99.64
2024-09-28 15:42:33,825 - web_server - INFO - Successfully posted to sensor.p_grid_forecast = 2884.22
2024-09-28 15:42:33,829 - web_server - INFO - Successfully posted to sensor.total_cost_fun_value = 4.0
2024-09-28 15:42:33,832 - web_server - INFO - Successfully posted to sensor.optim_status = Optimal
2024-09-28 15:42:33,836 - web_server - INFO - Successfully posted to sensor.unit_load_cost = 0.05
2024-09-28 15:42:33,840 - web_server - INFO - Successfully posted to sensor.unit_prod_price = -0.04

A similar issue with p_pv_forecast.
image

To Reproduce
To reproduce run high frequency MPC without specifying power or solar in the payload.

Expected behavior
p_pv_forecast should be set to match sensor_power_photovoltaics
p_load_forecast should be set to match sensor_power_load_no_var_loads

For example on another EMHASS instance, where load_power_forecast & pv_power_forecast are included in the payload, the values match exactly.

Apex_1727503066620

Home Assistant installation type

  • Home Assistant Supervised

Your hardware

  • OS: HA OS
  • Architecture: amd64

EMHASS installation type

  • Add-on
@davidusb-geek
Copy link
Owner

What seems to be odd if the load forecast? p_load_forecast = 1007.63
What is the load forecast method that you are using? The load forecast won't necessarily be the power_load_no_var_loads. If for example using the ML forecaster it will be a different value

@purcell-lab
Copy link
Contributor Author

Load forecast method is naive.

Which from my understanding is just the last 24/48 hours replayed..

With alpha=0,beta=1 I expect
load_forecast = power_load_no_var_loads(n-48)

With alpha=1,beta=0 I was expecting
load_forecast = power_load_no_var_loads(now)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants