Improve Peakfilter: filter energy exceeding 50 years#3574
Open
ndrsnhs wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an additional plausibility check in PeakFilter to drop imported/exported energy counter readings that exceed the maximum physically possible energy over 50 years at configured max power.
Changes:
- Add a “50-year max energy” threshold (
max_power * 24 * 365 * 50) to filter implausibly large imported/exported total energy readings. - Extend unit tests with scenarios around very large exported energy values near/over the 50-year threshold.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
packages/modules/common/utils/peak_filter.py |
Adds 50-year maximum energy plausibility filter for imported/exported totals. |
packages/modules/common/utils/test_peak_filter.py |
Adds/extends test cases for the new plausibility behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+59
to
+63
| max_energy = max_power * 24 * 365 * 50 | ||
| if imported is not None and imported > max_energy: | ||
| log.debug(f"PeakFilter: Unplausibler importierter Zählerstand: {imported / 1000}kWh. " | ||
| f"Maximal mögliche Energiemenge in 50 Jahren: {max_energy / 1000}kWh.") | ||
| imported = None |
Comment on lines
+77
to
+78
| Params("Imp/ Exp Speicher - Export ~ 40Y", ComponentType.BAT, | ||
| 1000, 400000000, 400, 1005, 400000000, 1005, 400000000), |
| Params("Imp/ Exp Speicher - Werte invalide", ComponentType.BAT, 1000, 500, 400, 1300, 800, None, None), | ||
| Params("Imp/ Exp Speicher - Import invalide", ComponentType.BAT, 1000, 500, 400, 1300, 505, None, 505), | ||
| Params("Imp/ Exp Speicher - Export invalide", ComponentType.BAT, 1000, 500, 400, 1005, 800, 1005, None), | ||
| Params("Imp/ Exp Speicher - Export > 50Y", ComponentType.BAT, 1000, 500000000, 400, 1005, 500000000, 1005, None), |
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.
Zählerstande filtern die größer sind als die maximal mögliche Energiemenge in 50 Jahren
Formel:
max. Leistung × 24 h/Tag × 365 Tage/Jahr × 50 Jahre