fix: feedforward numeric corrections to switch arrays and freeze integrator when saturated#6
Open
bvweerd wants to merge 1 commit into
Open
Conversation
…grator when saturated Two control-loop hardening fixes: 1. Switch-array hysteresis acted on the residual from before this cycle's numeric-array correction. An export that the numeric arrays had just fully curtailed could still toggle a switch array off — a double compensation that swings the grid to import. The watts absorbed by numeric arrays (and by each switch toggle) are now fed forward into the residual used for subsequent switch decisions. 2. The PID integrator kept accumulating while no actuator could absorb the output (all arrays settling or saturated, no switch toggled), winding up towards the output clamp and causing an overshoot once headroom returned. The integrator is now frozen for the next cycle whenever the PID output moved nothing. https://claude.ai/code/session_01RUWpwxbGsgR3PoLHLq4Djz
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
Fix
_distribute_to_numeric_arraysnow returns the unabsorbed remainder; the watts actually absorbed are fed forward into the residual used for switch-array decisions, and each switch toggle also updates the residual for subsequent switches.Tests
tests/test_control_loop_hardening.py: switch array stays on when numeric curtailment already absorbed the export, still toggles when nothing else can absorb, integrator stops growing while saturated, and control resumes normally when headroom returns. Full suite: 139 passed.https://claude.ai/code/session_01RUWpwxbGsgR3PoLHLq4Djz
Generated by Claude Code