Skip to content

Conversation

@springfall2008
Copy link
Owner

Copilot AI review requested due to automatic review settings December 22, 2025 08:58
Copy link
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 fixes a bug in the Fox API battery schedule logic where the force discharge SOC (fdSoc) could be set lower than the minimum SOC on grid (minSocOnGrid/reserve), which would cause incorrect battery behavior. The fix ensures fdSoc is always at least as high as the reserve level by using max(soc, reserve).

Key changes:

  • Applied max(soc, reserve) to fdSoc in discharge schedules to prevent it from being lower than reserve
  • Removed unused getMinSocOnGrid method
  • Updated test expectations to verify the fix works correctly

Reviewed changes

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

File Description
apps/predbat/fox.py Fixed discharge schedule to ensure fdSoc is never lower than reserve using max(soc, reserve), and removed unused getMinSocOnGrid method
apps/predbat/tests/test_fox_api.py Updated test assertion from fdSoc == 10 to fdSoc == 15 to verify the fix correctly applies max(soc, reserve) when soc=10 and reserve=15

@springfall2008 springfall2008 merged commit 9a35c93 into main Dec 22, 2025
1 check passed
@springfall2008 springfall2008 deleted the fixes21 branch December 22, 2025 09:03
iangregory pushed a commit to iangregory/batpred that referenced this pull request Dec 24, 2025
…08#3104)

* Fix issue where fdSoc can not be less than minSocOnGrid

* Version bump
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