Skip to content

Improve Peakfilter: filter energy exceeding 50 years#3574

Open
ndrsnhs wants to merge 2 commits into
openWB:masterfrom
ndrsnhs:improve-peak-filter
Open

Improve Peakfilter: filter energy exceeding 50 years#3574
ndrsnhs wants to merge 2 commits into
openWB:masterfrom
ndrsnhs:improve-peak-filter

Conversation

@ndrsnhs

@ndrsnhs ndrsnhs commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

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

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 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),
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