davidusb-geek / emhass

emhass: Energy Management for Home Assistant, is a Python module designed to optimize your home energy interfacing with Home Assistant.
MIT License
314 stars 62 forks source link

Bugs in optimization with Battery enabled #369

Open GeoDerp opened 3 weeks ago

GeoDerp commented 3 weeks ago

Thanks to @kcoffau and @purcell-lab, there seems to be possibly a few bugs in the battery optimization that either freezes the optimization or generates incorrect output. Version: 0.11.x

Parameter issues

According to @kcoffau:

"battery_maximum_state_of_charge": 1,

  • I had an issue with setting 1, and had to set to 0.99

"battery_minimum_state_of_charge": 0,

  • I had an issue with setting 0, and had to set 0.01

"set_battery_dynamic": true,"

  • i could never get this to work. Did you want to try disabling for troubleshooting?

"weight_battery_charge": 1," "weight_battery_discharge": 0.05"

  • both of these values after the last release i was getting very obscure behaviour. I set them both to "0" and it resolved it.

_There may also be an issue setting SOCfinal to 1

Recreate

Config.json:

{
  "logging_level": "INFO",
  "costfun": "profit",
  "optimization_time_step": 30,
  "historic_days_to_retrieve": 2,
  "method_ts_round": "nearest",
  "continual_publish": false,
  "data_path": "default",
  "set_total_pv_sell": false,
  "lp_solver": "default",
  "lp_solver_path": "empty",
  "set_nocharge_from_grid": false,
  "set_nodischarge_to_grid": false,
-   "set_battery_dynamic": true,
+ "set_battery_dynamic": false,
  "battery_dynamic_max": 0.9,
  "battery_dynamic_min": -0.9,
-  "weight_battery_discharge": 0.05,
+  "weight_battery_discharge": 1.0,
-   "weight_battery_charge": 1,"
+  "weight_battery_charge": 1.0,
  "sensor_power_photovoltaics": "sensor.power_photovoltaics",
  "sensor_power_load_no_var_loads": "sensor.power_load_no_var_loads",
  "sensor_replace_zero": [
    "sensor.power_photovoltaics" 
  ],
  "sensor_linear_interp": [
    "sensor.power_photovoltaics",
    "sensor.power_load_no_var_loads"
  ],
  "load_negative": false,
  "set_zero_min": true,
  "number_of_deferrable_loads": 2,
  "nominal_power_of_deferrable_loads": [
    3000.0,
    750.0
  ],
  "operating_hours_of_each_deferrable_load": [
    4,
    0
  ],
  "weather_forecast_method": "scrapper",
  "load_forecast_method": "naive",
  "delta_forecast_daily": 1,
  "load_cost_forecast_method": "hp_hc_periods",
  "start_timesteps_of_each_deferrable_load": [
    0,
    0
  ],
  "end_timesteps_of_each_deferrable_load": [
    0,
    0
  ],
  "load_peak_hour_periods": {
    "period_hp_1": [
      {
        "start": "02:54"
      },
      {
        "end": "15:24"
      }
    ],
    "period_hp_2": [
      {
        "start": "17:24"
      },
      {
        "end": "20:24"
      }
    ]
  },
  "treat_deferrable_load_as_semi_cont": [
    true,
    true
  ],
  "set_deferrable_load_single_constant": [
    false,
    false
  ],
  "set_deferrable_startup_penalty": [
    0.0,
    0.0
  ],
  "load_peak_hours_cost": 0.1907,
  "load_offpeak_hours_cost": 0.1419,
  "production_price_forecast_method": "constant",
  "photovoltaic_production_sell_price": 0.1419,
  "maximum_power_from_grid": 9000,
  "maximum_power_to_grid": 9000,
  "pv_module_model": [
    "CSUN_Eurasia_Energy_Systems_Industry_and_Trade_CSUN295_60M"
  ],
  "pv_inverter_model": [
    "Fronius_International_GmbH__Fronius_Primo_5_0_1_208_240__240V_"
  ],
  "surface_tilt": [
    30
  ],
  "surface_azimuth": [
    205
  ],
  "modules_per_string": [
    16
  ],
  "strings_per_inverter": [
    1
  ],
  "inverter_is_hybrid": false,
  "compute_curtailment": false,
  "set_use_battery": true,
-  "battery_discharge_power_max": 15000,
+  "battery_discharge_power_max": 8000,
- "battery_charge_power_max": 11000, 
+  "battery_charge_power_max": 8000,
-  "battery_discharge_efficiency": 0.95,
+ "battery_discharge_efficiency": 0.99,
-  "battery_charge_efficiency": 0.95,
+ "battery_charge_efficiency": 0.99,
- "battery_nominal_energy_capacity": 40500,
+  "battery_nominal_energy_capacity": 75000,
-  "battery_minimum_state_of_charge": 0,
+ "battery_minimum_state_of_charge": 0.1
-  "battery_maximum_state_of_charge": 1,
+ "battery_maximum_state_of_charge": 0.9,
-  "battery_target_state_of_charge": 0.98
+ "battery_target_state_of_charge": 0.1
}

Red does not work, Green does.

A few notes

From my testing with day-adhead and MPC without any runtime parameters

set_battery_dynamic From my testing from above set_battery_dynamic: true does not seem cause any errors.

weight_battery_discharge Setting weight_battery_discharge from 1.0 to 0.05 seems to drag out the optimization when running day-ahead. (However it does finish)

Setting weight_battery_discharge: 0.05 and battery_discharge_power_max: 15000, battery_charge_power_max: 11000 & battery_nominal_energy_capacity: 40500 dragged the optimization out indefinitely? : And you can start seeing errors such as:

Cbc0012I Integer solution of -97.666041 found by rounding after 4395288 iterations and 102888 nodes (446.33 seconds)
Cbc0010I After 103000 nodes, 9764 on tree, -97.666041 best solution, best possible -99.860237 (446.49 seconds)
Cbc0010I After 104000 nodes, 10059 on tree, -97.666041 best solution, best possible -99.785695 (455.48 seconds)
Cbc0010I After 105000 nodes, 9830 on tree, -97.666041 best solution, best possible -99.785695 (458.14 seconds)
...

Setting battery_nominal_energy_capacity: 75000 and battery_discharge_power_max: 8000 seems to resolve the indefinite optimization. (Although the optimization still took some time)

Originally discussed on: https://github.com/davidusb-geek/emhass/pull/334

purcell-lab commented 2 weeks ago

weight_battery_discharge should not default to 1 ($/ kWh) it goes infeasible almost immediately.

Defaults should be zero, and then I find tuning to around 0.05 or 0.10 give useful results.

purcell-lab commented 2 weeks ago

"battery_maximum_state_of_charge": 1,

  • I had an issue with setting 1, and had to set to 0.99

"battery_minimum_state_of_charge": 0,

  • I had an issue with setting 0, and had to set 0.01

Understood, I can setup as a workaround.

However my battery does go to 100% and 0% and EMHASS reports infeasible if SOC is above or below its desired limits.

purcell-lab commented 2 weeks ago

OK, making progress and now running successfully on 0.11.2..

weight_battery_discharge: 0 was what was required for functionality.

battery_dynamics is functioning correctly. battery_min = 0 & battery_max =1 are also functioning correctly.

I'll monitor closely, through tonight's Price Spike.

image

The new 'live logs' in HA 2024.11 is great for live monitoring of EMHASS cycles, not if they could just get that into a Lovelace card.

image

2024-11-08 15:29:00,188 - web_server - INFO - Passed runtime parameters: {'load_cost_forecast': [0.07, 0.11, 0.31, 0.44, 1.15, 1.76, 1.99, 1.89, 1.8, 1.59, 0.87, 0.48, 0.29, 0.28, 0.28, 0.27, 0.26, 0.26, 0.25, 0.24, 0.23, 0.23, 0.23, 0.22, 0.22, 0.22, 0.22, 0.22, 0.22, 0.21, 0.18, 0.15, 0.13, 0.12, 0.11, 0.1, 0.07, 0.06, 0.06, 0.06, 0.06, 0.06, 0.07, 0.07, 0.08, 0.1, 0.11, 0.12, 0.13, 0.14], 'prod_price_forecast': [-0.01, 0.02, 0.06, 0.18, 0.82, 1.38, 1.59, 1.5, 1.42, 1.22, 0.57, 0.22, 0.16, 0.15, 0.15, 0.15, 0.14, 0.13, 0.12, 0.12, 0.11, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.09, 0.06, 0.03, 0.01, 0.0, -0.0, -0.01, -0.01, -0.02, -0.03, -0.03, -0.03, -0.03, -0.02, -0.01, -0.0, 0.01, 0.02, 0.03, 0.04, 0.05], 'prediction_horizon': 48, 'alpha': 0, 'beta': 1, 'num_def_loads': 6, 'def_total_hours': [7, 0, 2, 0, 7, 0], 'def_end_timestep': [0, 0, 47, 0, 26, 0], 'P_deferrable_nom': [1000, 6333, 11520, 5500, 600, 11520], 'def_current_state': [1, 0, 0, 0, 1, 0], 'def_start_penalty': [1, 1, 1, 1, 1, 1], 'treat_def_as_semi_cont': [1, 1, 0, 0, 1, 0], 'set_def_constant': [0, 0, 0, 0, 0, 0], 'soc_init': 0.99, 'soc_final': 1}
2024-11-08 15:29:00,188 - web_server - INFO -  >> Setting input data dict
2024-11-08 15:29:00,188 - web_server - INFO - Setting up needed data
2024-11-08 15:29:00,191 - web_server - WARNING - warning `days_to_retrieve` is set to a value less than 9, this could cause an error with the fit
2024-11-08 15:29:00,191 - web_server - WARNING - setting`passed_data:days_to_retrieve` to 9 for fit/predict/tune
2024-11-08 15:29:00,195 - web_server - INFO - Retrieve hass get data method initiated...
2024-11-08 15:29:01,504 - web_server - INFO - Retrieving weather forecast data using method = scrapper
2024-11-08 15:29:05,158 - web_server - INFO - Retrieving data from hass for load forecast using method = naive
2024-11-08 15:29:05,159 - web_server - INFO - Retrieve hass get data method initiated...
2024-11-08 15:29:07,126 - web_server - INFO -  >> Performing naive MPC optimization...
2024-11-08 15:29:07,126 - web_server - INFO - Performing naive MPC optimization
2024-11-08 15:29:07,158 - web_server - INFO - Perform an iteration of a naive MPC controller
2024-11-08 15:29:09,357 - web_server - INFO - Status: Optimal
2024-11-08 15:29:09,358 - web_server - INFO - Total value of the Cost function = 44.07
2024-11-08 15:29:10,131 - web_server - INFO - Passed runtime parameters: {'custom_unit_load_cost_id': {'entity_id': 'sensor.unit_load_cost', 'unit_of_measurement': '$/kWh', 'friendly_name': 'Load Cost'}, 'custom_unit_prod_price_id': {'entity_id': 'sensor.unit_prod_price', 'unit_of_measurement': '$/kWh', 'friendly_name': 'Prod Price'}}
2024-11-08 15:29:10,132 - web_server - INFO -  >> Setting input data dict
2024-11-08 15:29:10,132 - web_server - INFO - Setting up needed data
2024-11-08 15:29:10,134 - web_server - WARNING - warning `days_to_retrieve` is set to a value less than 9, this could cause an error with the fit
2024-11-08 15:29:10,134 - web_server - WARNING - setting`passed_data:days_to_retrieve` to 9 for fit/predict/tune
2024-11-08 15:29:10,137 - web_server - INFO -  >> Publishing data...
2024-11-08 15:29:10,138 - web_server - INFO - Publishing data to HASS instance
2024-11-08 15:29:10,170 - web_server - INFO - Successfully posted to sensor.p_pv_forecast = 1089.0
2024-11-08 15:29:10,202 - web_server - INFO - Successfully posted to sensor.p_load_forecast = 468.27
2024-11-08 15:29:10,220 - web_server - INFO - Successfully posted to sensor.p_pv_curtailment = 0.0
2024-11-08 15:29:10,239 - web_server - INFO - Successfully posted to sensor.p_deferrable0 = 1000.0
2024-11-08 15:29:10,257 - web_server - INFO - Successfully posted to sensor.p_deferrable1 = 0.0
2024-11-08 15:29:10,276 - web_server - INFO - Successfully posted to sensor.p_deferrable2 = 0.0
2024-11-08 15:29:10,294 - web_server - INFO - Successfully posted to sensor.p_deferrable3 = 0.0
2024-11-08 15:29:10,315 - web_server - INFO - Successfully posted to sensor.p_deferrable4 = 600.0
2024-11-08 15:29:10,334 - web_server - INFO - Successfully posted to sensor.p_deferrable5 = 0.0
2024-11-08 15:29:10,354 - web_server - INFO - Successfully posted to sensor.p_batt_forecast = 0.0
2024-11-08 15:29:10,381 - web_server - INFO - Successfully posted to sensor.soc_batt_forecast = 99.0
2024-11-08 15:29:10,413 - web_server - INFO - Successfully posted to sensor.p_grid_forecast = 979.27
2024-11-08 15:29:10,434 - web_server - INFO - Successfully posted to sensor.total_cost_fun_value = 46.45
2024-11-08 15:29:10,450 - web_server - INFO - Successfully posted to sensor.optim_status = Optimal
2024-11-08 15:29:10,469 - web_server - INFO - Successfully posted to sensor.unit_load_cost = 0.07
2024-11-08 15:29:10,487 - web_server - INFO - Successfully posted to sensor.unit_prod_price = -0.01
{
  "battery_charge_efficiency": 0.95,
  "battery_charge_power_max": 11000,
  "battery_discharge_efficiency": 0.95,
  "battery_discharge_power_max": 15000,
  "battery_dynamic_max": 0.9,
  "battery_dynamic_min": -0.9,
  "battery_maximum_state_of_charge": 1,
  "battery_minimum_state_of_charge": 0,
  "battery_nominal_energy_capacity": 40500,
  "battery_target_state_of_charge": 0.1,
  "compute_curtailment": true,
  "continual_publish": false,
  "costfun": "profit",
  "delta_forecast_daily": 2,
  "end_timesteps_of_each_deferrable_load": [
    0,
    0,
    0,
    0,
    0,
    0
  ],
  "historic_days_to_retrieve": 2,
  "inverter_is_hybrid": false,
  "load_cost_forecast_method": "hp_hc_periods",
  "load_forecast_method": "naive",
  "load_negative": false,
  "load_offpeak_hours_cost": 0.09,
  "load_peak_hour_periods": {
    "period_hp_1": [
      {
        "start": "02:54"
      },
      {
        "end": "15:24"
      }
    ],
    "period_hp_2": [
      {
        "start": "17:24"
      },
      {
        "end": "20:24"
      }
    ]
  },
  "load_peak_hours_cost": 0.31,
  "logging_level": "INFO",
  "lp_solver": "COIN_CMD",
  "lp_solver_path": "/usr/bin/cbc",
  "maximum_power_from_grid": 50000,
  "maximum_power_to_grid": 30000,
  "method_ts_round": "first",
  "modules_per_string": [
    29,
    21
  ],
  "nominal_power_of_deferrable_loads": [
    1340,
    5000,
    11500,
    4000,
    600,
    11500
  ],
  "number_of_deferrable_loads": 6,
  "operating_hours_of_each_deferrable_load": [
    4,
    2,
    0,
    0,
    3,
    0
  ],
  "optimization_time_step": 30,
  "photovoltaic_production_sell_price": 0.05,
  "production_price_forecast_method": "constant",
  "pv_inverter_model": [
    "SolarEdge_Technologies_Ltd___SE7600A_US__208V_",
    "SolarEdge_Technologies_Ltd___SE7600A_US__208V_"
  ],
  "pv_module_model": [
    "Advance_Power_API_M370",
    "Advance_Power_API_M370"
  ],
  "sensor_linear_interp": [
    "sensor.apf_generation_entity",
    "sensor.power_load_no_var_loads"
  ],
  "sensor_power_load_no_var_loads": "sensor.power_load_no_var_loads",
  "sensor_power_photovoltaics": "sensor.apf_generation_entity",
  "sensor_replace_zero": [
    "sensor.apf_generation_entity",
    "sensor.power_load_no_var_loads"
  ],
  "set_battery_dynamic": true,
  "set_deferrable_load_single_constant": [
    false,
    false,
    false,
    false,
    false,
    false
  ],
  "set_deferrable_startup_penalty": [
    5,
    1,
    0,
    1,
    10,
    0
  ],
  "set_nocharge_from_grid": false,
  "set_nodischarge_to_grid": false,
  "set_total_pv_sell": false,
  "set_use_battery": true,
  "set_zero_min": true,
  "start_timesteps_of_each_deferrable_load": [
    0,
    0,
    0,
    0,
    0,
    0
  ],
  "strings_per_inverter": [
    1,
    1
  ],
  "surface_azimuth": [
    90,
    270
  ],
  "surface_tilt": [
    18,
    10
  ],
  "treat_deferrable_load_as_semi_cont": [
    true,
    true,
    false,
    false,
    true,
    false
  ],
  "weather_forecast_method": "scrapper",
  "weight_battery_charge": 0,
  "weight_battery_discharge": 0.05
}
mk2lehe commented 2 weeks ago

Seeing similar issues related to battery weights. I also notice the soc_init value doesn't seem to be handled correctly.

Testing weight_battery_discharge: 0 and weight_battery_charge: 1 gives very interesting result, not as expected. I use rest_command: for mpc (for testing purpose I set load_power_forecast to 550W)

I'll be happy to help you guys test more if needed.

  trigger_mpc_forecast_dummy_load_power:
    url: http://localhost:5000/action/naive-mpc-optim
    method: POST
    content_type: "application/json"
    payload: >-
      {
      "prediction_horizon":{{((state_attr('sensor.nordpool', 'raw_today') | map(attribute='value') | list  + state_attr('sensor.nordpool', 'raw_tomorrow') | map(attribute='value') | list ))[now().hour:][:24] |count}},
      "soc_init":{{states.sensor.sh80rt_a2290552450_battery_level_soc.state|float(0.6)|round(0)/100}},
      "soc_final":0.6,
      "load_cost_forecast":{{((state_attr('sensor.nordpool', 'raw_today') | map(attribute='value') | list  + state_attr('sensor.nordpool', 'raw_tomorrow') | map(attribute='value') | list))[now().hour:][:24] |tojson}},
      "prod_price_forecast":{{((state_attr('sensor.nordpool', 'raw_today') | map(attribute='value') | list  + state_attr('sensor.nordpool', 'raw_tomorrow') | map(attribute='value') | list))[now().hour:][:24] |tojson}},
      "delta_forecast":2,
      "alpha": 1,
      "beta": 0,
      "def_total_hours":[0, 0],
      "def_end_timestep":[0, 0],
      "load_power_forecast":{{ ([550] * ((state_attr('sensor.nordpool', 'raw_today') | map(attribute='value') | list + state_attr('sensor.nordpool', 'raw_tomorrow') | map(attribute='value') | list))[now().hour:][:24] | count) | tojson }}
      }
{
    "logging_level": "DEBUG",
    "costfun": "profit",
    "optimization_time_step": 60,
    "historic_days_to_retrieve": 2,
    "method_ts_round": "first",
    "continual_publish": false,
    "data_path": "default",
    "set_total_pv_sell": false,
    "lp_solver": "COIN_CMD",
    "lp_solver_path": "empty",
    "set_nocharge_from_grid": false,
    "set_nodischarge_to_grid": false,
    "set_battery_dynamic": false,
    "battery_dynamic_max": 0.9,
    "battery_dynamic_min": -0.9,
    "weight_battery_discharge": 0,
    "weight_battery_charge": 1,
    "sensor_power_photovoltaics": "sensor.sh80rt_a2290552450_mppt_total_power",
    "sensor_power_load_no_var_loads": "sensor.house_consumption_power",
    "sensor_replace_zero": [
        "sensor.sh80rt_a2290552450_mppt_total_power"
    ],
    "sensor_linear_interp": [
        "sensor.sh80rt_a2290552450_mppt_total_power",
        "sensor.house_consumption_power"
    ],
    "load_negative": false,
    "set_zero_min": true,
    "number_of_deferrable_loads": 2,
    "nominal_power_of_deferrable_loads": [
        300,
        75
    ],
    "operating_hours_of_each_deferrable_load": [
        4,
        0
    ],
    "weather_forecast_method": "scrapper",
    "load_forecast_method": "naive",
    "delta_forecast_daily": 1,
    "load_cost_forecast_method": "hp_hc_periods",
    "start_timesteps_of_each_deferrable_load": [
        0,
        0
    ],
    "end_timesteps_of_each_deferrable_load": [
        0,
        0
    ],
    "load_peak_hour_periods": {
        "period_hp_1": [
            {
                "start": "02:54"
            },
            {
                "end": "15:24"
            }
        ],
        "period_hp_2": [
            {
                "start": "17:24"
            },
            {
                "end": "20:24"
            }
        ]
    },
    "treat_deferrable_load_as_semi_cont": [
        true,
        true
    ],
    "set_deferrable_load_single_constant": [
        true,
        true
    ],
    "set_deferrable_startup_penalty": [
        0,
        0
    ],
    "load_peak_hours_cost": 0.1907,
    "load_offpeak_hours_cost": 0.1419,
    "production_price_forecast_method": "constant",
    "photovoltaic_production_sell_price": 0.1419,
    "maximum_power_from_grid": 13800,
    "maximum_power_to_grid": 13800,
    "pv_module_model": [
        "CSUN_Eurasia_Energy_Systems_Industry_and_Trade_CSUN295_60M"
    ],
    "pv_inverter_model": [
        "Fronius_International_GmbH__Fronius_Primo_5_0_1_208_240__240V_"
    ],
    "surface_tilt": [
        27
    ],
    "surface_azimuth": [
        225
    ],
    "modules_per_string": [
        25
    ],
    "strings_per_inverter": [
        1
    ],
    "inverter_is_hybrid": true,
    "compute_curtailment": false,
    "set_use_battery": true,
    "battery_discharge_power_max": 5000,
    "battery_charge_power_max": 5000,
    "battery_discharge_efficiency": 0.95,
    "battery_charge_efficiency": 0.95,
    "battery_nominal_energy_capacity": 9600,
    "battery_minimum_state_of_charge": 0.1,
    "battery_maximum_state_of_charge": 1,
    "battery_target_state_of_charge": 0.6
}
2024-11-09 14:37:45,510 - web_server - INFO - Launching the emhass webserver at: http://0.0.0.0:5000
2024-11-09 14:37:45,510 - web_server - INFO - Home Assistant data fetch will be performed using url: http://supervisor/core/api
2024-11-09 14:37:45,510 - web_server - INFO - The data path is: /share
2024-11-09 14:37:45,510 - web_server - INFO - The logging is: DEBUG
2024-11-09 14:37:45,516 - web_server - INFO - Using core emhass version: 0.11.2
waitress   INFO  Serving on http://0.0.0.0:5000
2024-11-09 14:37:57,117 - web_server - INFO - Passed runtime parameters: {'prediction_horizon': 24, 'soc_init': 0.87, 'soc_final': 0.6, 'load_cost_forecast': [1.013, 1.354, 1.545, 1.637, 1.644, 1.642, 1.624, 1.506, 1.339, 1.336, 0.917, 0.775, 0.767, 0.725, 0.762, 1.014, 0.994, 1.033, 1.175, 1.253, 1.267, 1.317, 1.278, 1.214], 'prod_price_forecast': [1.013, 1.354, 1.545, 1.637, 1.644, 1.642, 1.624, 1.506, 1.339, 1.336, 0.917, 0.775, 0.767, 0.725, 0.762, 1.014, 0.994, 1.033, 1.175, 1.253, 1.267, 1.317, 1.278, 1.214], 'delta_forecast': 2, 'alpha': 1, 'beta': 0, 'def_total_hours': [0, 0], 'def_end_timestep': [0, 0], 'load_power_forecast': [550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550]}
2024-11-09 14:37:57,117 - web_server - INFO -  >> Setting input data dict
2024-11-09 14:37:57,117 - web_server - INFO - Setting up needed data
2024-11-09 14:37:57,141 - web_server - WARNING - warning `days_to_retrieve` is set to a value less than 9, this could cause an error with the fit
2024-11-09 14:37:57,141 - web_server - WARNING - setting`passed_data:days_to_retrieve` to 9 for fit/predict/tune
2024-11-09 14:37:57,142 - web_server - WARNING - lp_solver=COIN_CMD but lp_solver_path=empty, attempting to use lp_solver_path=/usr/bin/cbc
2024-11-09 14:37:57,143 - web_server - INFO - Retrieve hass get data method initiated...
2024-11-09 14:37:58,826 - web_server - INFO - Retrieving weather forecast data using method = scrapper
2024-11-09 14:38:00,147 - web_server - INFO -  >> Performing naive MPC optimization...
2024-11-09 14:38:00,148 - web_server - INFO - Performing naive MPC optimization
2024-11-09 14:38:00,160 - web_server - INFO - Perform an iteration of a naive MPC controller
2024-11-09 14:38:00,209 - web_server - DEBUG - Deferrable load 0: Proposed optimization window: 0 --> 0
2024-11-09 14:38:00,209 - web_server - DEBUG - Deferrable load 0: Validated optimization window: 0 --> 0
2024-11-09 14:38:00,211 - web_server - DEBUG - Deferrable load 1: Proposed optimization window: 0 --> 0
2024-11-09 14:38:00,211 - web_server - DEBUG - Deferrable load 1: Validated optimization window: 0 --> 0
2024-11-09 14:38:01,508 - web_server - INFO - EMHASS server online, serving index.html...
2024-11-09 14:38:02,937 - web_server - INFO - Status: Optimal
2024-11-09 14:38:02,937 - web_server - INFO - Total value of the Cost function = 46.24

image

GeoDerp commented 1 week ago

@davidusb-geek . Whats your thoughts on these issues? Happy to make a PR with modified defaults on request.

mk2lehe commented 1 week ago

As added input, not being sure if related, changing costfun to self-consumption seemed to resolve all issues. However p_batt went "unstable" (alternating charging and discharging) tonight when load/price_cost_forecast went negative. So I tried added a value in both lists entries so it never goes negative, and the strange p_batt behaviour disappeared and went back to normal.