Fix DM spiral by preventing offset raises during anti-windup#15
Merged
Fix DM spiral by preventing offset raises during anti-windup#15
Conversation
Problem: When DM is dropping while offset is positive, raising offset makes DM drop FASTER (S1 target increases but BT25 actual can't catch up). This caused a death spiral from -747 to -1549 triggering aux heating. Changes: - Anti-windup now PREVENTS offset raises (returns early, not caps after) - Active offset REDUCTION when dm_rate < -100/h (1°C per 100/h worse) - 30-minute cooldown after anti-windup to let pump stabilize - Z1 threshold lowered from 10% to 2% for earlier intervention Based on debug.log analysis showing spirals from -53/h (mild) to -456/h (severe).
Only trigger anti-windup if offset was raised within the last 90 minutes. This distinguishes self-induced spirals from environmental DM drops. - Add ANTI_WINDUP_CAUSATION_WINDOW_MINUTES constant (90 min) - Track offset raises with _last_offset_raise_time/_last_offset_value - Add _track_offset_change() and _raised_offset_recently() methods - Skip anti-windup if offset has been stable >90 min (likely cold snap) - Add 8 unit tests for causation window feature
The base_nibe_state fixture was missing current_offset, causing TypeError when anti-windup tracking tried to compare MagicMock objects.
- Raise anti-windup layer weight from 0.5 to 0.7 to give it more influence in the blended decision (was being outvoted by other layers) - Show dynamic remaining cooldown time instead of static "30min"
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.
Problem: When DM is dropping while offset is positive, raising offset makes DM drop FASTER (S1 target increases but BT25 actual can't catch up). This caused a death spiral from -747 to -1549 triggering aux heating.
Changes:
Based on debug.log analysis showing spirals from -53/h (mild) to -456/h (severe).