Repository navigation
Fix DC charge rate calculation for export freeze - #3723
springfall2008 merged 1 commit into
Conversation
DC charge rate calculation was always using the max battery rate even the slot was set to freeze export. Calculate the charge rate using the minimum battery rate if the slot should be export freezing, the same as AC charge rate
|
Tested the change locally and it seems to be good (Freeze export works as expected during the planning phase when the hybrid flag = true). |
There was a problem hiding this comment.
Pull request overview
Fixes export-freeze behavior in the prediction engine for hybrid (DC-coupled) inverters by ensuring DC charge-rate calculation respects export-freeze slots, aligning it with the existing AC charge-rate behavior. This addresses incorrect plan/UI behavior when a slot is manually set to “force export freeze” (issue #3657).
Changes:
- For hybrid inverters in ECO mode, compute the effective DC charge-rate using
battery_rate_minduring export-freeze slots instead of always usingbattery_rate_max_charge_dc. - Feed the adjusted DC charge-rate setting into
get_charge_rate_curve_cached(...)to ensure the curve calculation reflects freeze behavior.
| if inverter_hybrid: | ||
| charge_rate_now_dc = battery_rate_max_charge_dc | ||
| # Freeze mode | ||
| if set_export_freeze and export_window_active and export_limit_now < 100.0 and (export_limit_now == 99.0 or set_export_freeze_only): |
There was a problem hiding this comment.
The export-freeze activation predicate is now duplicated again for the DC path (same logic already exists earlier for charge_rate_now). Consider computing a single boolean (e.g., export_freeze_active) once per step and reusing it here and in the AC path to avoid future divergence, and to document what export_limit_now == 99.0 / < 100.0 mean.
| if inverter_hybrid: | |
| charge_rate_now_dc = battery_rate_max_charge_dc | |
| # Freeze mode | |
| if set_export_freeze and export_window_active and export_limit_now < 100.0 and (export_limit_now == 99.0 or set_export_freeze_only): | |
| export_freeze_active = ( | |
| set_export_freeze | |
| and export_window_active | |
| and export_limit_now < 100.0 | |
| and (export_limit_now == 99.0 or set_export_freeze_only) | |
| ) | |
| if inverter_hybrid: | |
| charge_rate_now_dc = battery_rate_max_charge_dc | |
| # Freeze mode | |
| if export_freeze_active: |
| if set_export_freeze and export_window_active and export_limit_now < 100.0 and (export_limit_now == 99.0 or set_export_freeze_only): | ||
| charge_rate_now_dc = battery_rate_min # 0 | ||
|
|
||
| charge_rate_now_curve_dc = ( | ||
| get_charge_rate_curve_cached(soc, battery_rate_max_charge_dc, soc_max, battery_rate_max_charge_dc, battery_charge_power_curve_tuple, battery_rate_min, battery_temperature, battery_temperature_charge_curve_tuple) | ||
| get_charge_rate_curve_cached(soc, charge_rate_now_dc, soc_max, battery_rate_max_charge_dc, battery_charge_power_curve_tuple, battery_rate_min, battery_temperature, battery_temperature_charge_curve_tuple) | ||
| * battery_rate_max_scaling |
There was a problem hiding this comment.
This change adjusts hybrid/DC behaviour for export-freeze slots, but the existing model tests cover export-freeze only for non-hybrid scenarios. Please add a regression test case exercising a hybrid inverter with discharge=99 (freeze exporting) and confirm the DC charge-rate limiting behaves as expected (i.e., does not use the max DC charge rate in the freeze slot).
DC charge rate calculation for hybrid inverters was always using the max battery rate even when the slot was set to freeze export. Calculate the charge rate using the minimum battery rate if the slot should be export freezing, the same as AC charge rate.
Fixes #3657