You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e20beca
Browse filesBrowse the repository at this point in the historyBrowse files
fix(inverter): average battery power across each SoC step in find_charge_curve
find_charge_curve() walks target_minute over the minutes the battery spends at
each 1% of SoC, but read battery_power at the fixed trigger minute instead. That
made total_power accumulate the same reading total_count times, so
average_power = total_power / total_count
reduced algebraically to abs(battery_power[minute]) for any period length - a
single instantaneous sample rather than the mean the surrounding code and naming
describe. The loop's two break guards indexed the trigger minute for the same
reason, so charge_rate and battery_power were only ever tested on the period's
first minute and the walk could run on past the point where full-rate charging
had actually stopped.
Index target_minute in all three places, so the curve is built from the mean
power over each genuinely sustained full-rate step.
The existing fixtures hold battery power constant for a whole charging session,
where the mean equals any single sample, which is why this went unnoticed. The
new test varies power within each step: steps below 93% draw a steady 2600W
while steps above average 1040W but read 2600W at either end, so a curve built
from one sample of a step comes out flat and only an averaged curve shows the
taper.
Measured against 21 days of real history this moves 6 of 14 curve points, by up
to 0.08, in both directions.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments