fix(driver): ferroamp aggregates battery across N ESOs - #295
Merged
Conversation
Single-slot `eso_data` cache reflected only the most-recently-published ESO. At a 2×ESO site this halved bat_w; the controller's grid-chase loop fed on the wrong number and dispatch stuck ~190 W of import against a 0 W grid target. Switch to a per-ESO map keyed by `id`, sum DC power across all live ESOs, average ubat / SoC / DC-link voltage, sum ibat and Wh counters, and surface per-ESO faults via worst-of. Backward-compatible: messages without `id` land under a synthetic key, so single-ESO setups behave identically. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
@frahlg please have a test-drive with this driver in your system too and merge if its working. Tested on a ferroamp site with 2 ESO's which fixed lots of incorrect reportings |
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.
Summary
ferroamp.luacached only the most-recently-published ESO in a singleeso_dataslot, so the battery power readout was the per-unit number instead of the cluster aggregate. On a 2×ESO site this halvedbat_w; the controller's grid-chase loop fed on the wrong number and dispatch stuck ~190 W of import against a 0 W target.eso_data_by_idkeyed on each ESO'sidfield. Sum DC power across all live ESOs (cell-monitorubat × ibat), average voltage / SoC / DC-link, sum currents and Wh counters, surface per-ESO faults via worst-of relay/faultcode.idfield land under a synthetic key, so single-ESO firmware and sims keep behaving identically.eso_countdiagnostic metric so operators can see how many ESOs the driver is summing.How it was discovered
Live debugging session on a 2×ESO (
21030026+23010216) Ferroamp install:bat_wehub.pbat(aggregate DC)ubat × ibatAfter the fix the same site shows ratio
1.00between 42 andehub.pbat, and the grid chase converges normally.Test plan
go test ./internal/drivers/ -run Ferroamp -v— 8 existing tests + 2 new (TestFerroampDriverSumsBatteryPowerAcrossMultipleESOs,TestFerroampDriverSurfacesPerESOFaultsWorstOf)go test ./...— full suite greenbat_wmatchesehub.pbat1:1 over multiple snapshots; dispatch target tracks delivered discharge; grid converged insidegrid_tolerance_w.🤖 Generated with Claude Code