Skip to content

Fix oscillation filter for 15-min price data and improve diagnostics#30

Merged
bvweerd merged 5 commits intomainfrom
dev
Mar 22, 2026
Merged

Fix oscillation filter for 15-min price data and improve diagnostics#30
bvweerd merged 5 commits intomainfrom
dev

Conversation

@bvweerd
Copy link
Copy Markdown
Owner

@bvweerd bvweerd commented Mar 22, 2026

No description provided.

bvweerd and others added 5 commits March 22, 2026 18:26
… price data

Two bugs in _filter_oscillations caused isolated single-slot charge/discharge
with quarter-hour price data while hourly data worked correctly:

1. ref_step_h used step_durations_hours[0] (the partial first step) instead
   of the full interval step. When the optimizer runs 1-2 min before a price
   boundary, this inflated lookahead_steps from 8 to ~120, covering the entire
   36-h horizon instead of the intended 2-h window.

2. The filter broke on the *nearest* discharge found in the window. An
   intermediate discharge with a low spread caused the preceding charge to be
   removed, even when a profitable discharge existed slightly further in the
   same window.

Fix 1: use step_durations_hours[1] as ref_step_h (the representative full
interval), keeping lookahead_steps at 8 steps for 15-min data.

Fix 2: scan all discharges (charges) within the window; only suppress a
charge (discharge) step if no profitable pairing exists anywhere in the window.
True rapid oscillations with no profitable match are still correctly removed.

Adds three regression tests covering both scenarios.

https://claude.ai/code/session_01FCR1z6MBtoa5AdEtEi352T
fix: oscillation filter incorrectly removes charge blocks with 15-min…
@github-actions github-actions Bot added documentation Improvement or addition to documentation enhancement New feature or improvement bug Something isn't working as expected labels Mar 22, 2026
@bvweerd bvweerd merged commit 43f0595 into main Mar 22, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working as expected documentation Improvement or addition to documentation enhancement New feature or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants