Skip to content

Test cleanup#3953

Merged
springfall2008 merged 1 commit into
mainfrom
copilot/fix-soc-string-to-float-error
May 22, 2026
Merged

Test cleanup#3953
springfall2008 merged 1 commit into
mainfrom
copilot/fix-soc-string-to-float-error

Conversation

@springfall2008
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings May 22, 2026 13:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts the soc_kw-based test data generation to better support find_battery_size() calibration and refactors Inverter.find_battery_size() to parse SOC history via minute_data() (including deriving SOC% from soc_kw history).

Changes:

  • Updated test_find_battery_size soc_kw history generation so charge windows reach a full charge at least once (improving soc_max inference).
  • Refactored Inverter.find_battery_size() to parse soc_percent/soc_kw history into minute-indexed dicts and compute SOC% consistently before estimation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
apps/predbat/tests/test_find_battery_size.py Tweaks soc_kw mock history generation to ensure a full charge is observed and clarifies intent in comments.
apps/predbat/inverter.py Refactors find_battery_size() history parsing, including deriving SOC% from soc_kw history using minute_data().

Comment thread apps/predbat/inverter.py
Comment on lines +713 to +725
soc_kw_minute, _ = minute_data(
soc_kw_data[0],
self.base.max_days_previous,
self.base.now_utc,
"state",
"last_updated",
backwards=True,
clean_increment=False,
smoothing=False,
divide_by=1.0,
scale=1.0,
required_unit="kWh",
)
Comment on lines 135 to +139
else:
battery_power = 0
if hour == 1 or hour == 17:
current_soc_kwh = battery_size_kwh * 0.20
# Reset to near-empty before each charge session
if hour == 17:
current_soc_kwh = battery_size_kwh * 0.05
@springfall2008 springfall2008 merged commit 5140116 into main May 22, 2026
2 checks passed
@springfall2008 springfall2008 deleted the copilot/fix-soc-string-to-float-error branch May 22, 2026 13:57
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.

2 participants