Skip to content

Fix DC charge rate calculation for export freeze - #3723

Merged
springfall2008 merged 1 commit into
springfall2008:mainfrom
daviessm:fix_hybrid_inverter_export_freeze
Apr 2, 2026
Merged

springfall2008 merged 1 commit into
springfall2008:mainfrom
daviessm:fix_hybrid_inverter_export_freeze

Conversation

@daviessm

@daviessm daviessm commented Apr 2, 2026 •

Copy link
Copy Markdown
Contributor

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

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
@WyndStryke

Copy link
Copy Markdown

Tested the change locally and it seems to be good (Freeze export works as expected during the planning phase when the hybrid flag = true).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_min during export-freeze slots instead of always using battery_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.

Comment on lines 930 to +933
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):

Copilot AI Apr 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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:

Copilot uses AI. Check for mistakes.
Comment on lines +933 to 938
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

Copilot AI Apr 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot generated this review using guidance from repository custom instructions.
@springfall2008
springfall2008 merged commit c8b5272 into springfall2008:main Apr 2, 2026
5 checks passed
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

Successfully merging this pull request may close these issues.

Manual export freeze slots not displayed correctly at 100% SoC

4 participants