Merged
Conversation
Some batteries (e.g. Marstek Venus A) reduce charge/discharge power near SoC extremes. Adds four optional config fields per battery subentry: - high_soc_charge_threshold_pct / high_soc_max_charge_kw - low_soc_discharge_threshold_pct / low_soc_max_discharge_kw The DP precomputes per-state power limits and skips actions that exceed them, so backward induction naturally front-loads discharge before the battery enters the derated zone. The zero-grid controller applies the same limits in real time. Defaults disable derating for existing configs. Synced to analyzer.js and simulate_diagnostics.py per CLAUDE.md. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- test_battery_model: max_charge_at_soc / max_discharge_at_soc boundary tests, from_subentry round-trip, and aggregate_battery_configs suite - test_optimizer: new TestSocDependentDerating class — verifies derated power is not exceeded near extremes and full power is available at mid-SoC; regression test that unrelated configs are unaffected - ALGORITHM.md: Section 2 battery config table, Section 3.2 action grid note, Section 6 backward pass pseudocode and derating explanation, Section 11 numerical considerations row Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Description
Adds SoC dependent power limits (e.g. lower max power above 95% SoC)
Type of change
fix:Bug fix (patch version bump)feat:New feature (minor version bump)feat!:/BREAKING CHANGE:Breaking change (major version bump)chore:/docs:/ci:Maintenance or documentation (no version bump)Checklist
feat:,fix:,chore:, etc.)devbranch (notmain, unless this is a hotfix)Screenshots / Logs (optional)