Skip to content

Feat: Scale solar calibration more towards recent days - #3882

Merged
springfall2008 merged 1 commit into
mainfrom
feat/calib_scale
May 7, 2026
Merged

springfall2008 merged 1 commit into
mainfrom
feat/calib_scale

Conversation

@springfall2008

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings May 7, 2026 07:40

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

This PR adjusts Solcast PV calibration to weight recent historical days more heavily when deriving the “average day” scaling used to compute worst/best scaling bands, and updates the corresponding Solcast calibration test expectations.

Changes:

  • Add a recency-weighted average (weight = max(1.0 - 0.1*(day-1), 0.3)) when computing average_day_scaling in pv_calibration().
  • Extend PV calibration logging to include the per-day weight used.
  • Update test_pv_calibration_synthetic_values expectations/documentation to reflect the new weighted averages and resulting worst/best scaling factors.

Reviewed changes

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

File Description
apps/predbat/solcast.py Implements recency-weighted averaging for PV calibration day scaling and logs weights.
apps/predbat/tests/test_solcast.py Updates synthetic calibration test expectations/docs for the new weighting behavior.

Comment thread apps/predbat/solcast.py
# so day1=1.0, day2=0.9, day3=0.8 ... day7=0.4, day8+=0.3
worst_day_scaling = 1.0
best_day_scaling = 1.0
average_day_scaling = 0
Comment on lines 2396 to +2400
if cl is not None and cl > 0:
if e10 is not None:
expected_e10 = cl * 0.5
expected_e10 = cl * 0.519
if abs(e10 - expected_e10) > 0.05 * cl:
print("ERROR [B]: pv_estimate10 ({}) should be ~0.5×pv_estimateCL ({}) = {:.5f}".format(e10, cl, expected_e10))
print("ERROR [B]: pv_estimate10 ({}) should be ~0.519×pv_estimateCL ({}) = {:.5f}".format(e10, cl, expected_e10))
Comment thread apps/predbat/solcast.py
Comment on lines +983 to +986
weight = max(1.0 - 0.1 * (day - 1), 0.3)
average_day_scaling += scaling_factor * weight
total_weight += weight
self.log("PV Calibration: Past day {} had {} kWh of forecast PV, and actual {} kWh PV generation (weight {})".format(day, dp2(past_day_forecast[day]), dp2(past_day_actual[day]), dp2(weight)))
@springfall2008
springfall2008 merged commit d09a877 into main May 7, 2026
5 checks passed
@springfall2008
springfall2008 deleted the feat/calib_scale branch May 7, 2026 07:54
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