Repository navigation
Feat: Scale solar calibration more towards recent days - #3882
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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 computingaverage_day_scalinginpv_calibration(). - Extend PV calibration logging to include the per-day weight used.
- Update
test_pv_calibration_synthetic_valuesexpectations/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. |
| # 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 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))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.