-
Notifications
You must be signed in to change notification settings - Fork 72
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
Bugs in optimization with Battery enabled #369
Comments
Defaults should be zero, and then I find tuning to around 0.05 or 0.10 give useful results. |
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. |
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. I'll monitor closely, through tonight's Price Spike. 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.
{
"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
} |
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'll be happy to help you guys test more if needed.
|
@davidusb-geek . Whats your thoughts on these issues? Happy to make a PR with modified defaults on request. |
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. |
Battery weights dis/charge should be 0.0 Fixes: davidusb-geek#369
Hello everyone, My problem might be related to this bug. As soon as I activate the battery in the configuration, I see the status "infeasible" for day-ahead and MPC. I have been trying to change this with various parameters for weeks, but without success. Overall, the results look promising despite the "infeasible" status. Here is my current configuration.
any ideas?
|
meanwhile I figured out that the optimizer always fail if “set_nodischarge_to_grid” is true. Now I switched it off and the optimizer works as expected :) |
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:
There may also be an issue setting SOC_final to 1
Recreate
Config.json:
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
from1.0
to0.05
seems to drag out the optimization when running day-ahead. (However it does finish)Setting
weight_battery_discharge: 0.05
andbattery_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:
Setting
battery_nominal_energy_capacity: 75000
andbattery_discharge_power_max: 8000
seems to resolve the indefinite optimization. (Although the optimization still took some time)Originally discussed on: #334
The text was updated successfully, but these errors were encountered: