Repository navigation
ferroamp 2.2.0: cap at the EnergyHub limit, scale by measured delivery, report each ESO - #299
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
6bf9c9a to
2c5aa88
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6bf9c9a897
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| last_delivered_w = delivered | ||
| last_delivered_ms = now |
There was a problem hiding this comment.
Timestamp delivery samples by telemetry arrival, not poll time
When ESO messages pause after a command, this block reuses the cached pre-command power but stamps it with the current poll time. The learning gate then treats it as a settled response to the new setpoint. Using the Lua harness, three ESOs reporting 3000 W total before a 6000 W discharge request, followed by a poll without MQTT messages at 3500 ms, causes the next request to publish 9000 W. A responsive battery can therefore exceed Core's requested power solely because telemetry was delayed. Preserve the measurement's actual arrival time and require a post-settle telemetry sample before learning.
AGENTS.md reference: AGENTS.md:L39-L42
Useful? React with 👍 / 👎.
| if not err then last_control_mode = "discharge" end | ||
| if not err then | ||
| last_control_mode = name | ||
| last_cmd_ms = now |
There was a problem hiding this comment.
Allow learning across repeated refreshes of the same setpoint
When battery commands arrive less than three seconds apart, every successful publish resets last_cmd_ms, so the settled-sample condition can never pass—even if the same setpoint has been applied continuously. In the Lua harness, refreshing a 4000 W discharge request once per second while receiving fresh 3000 W measurements leaves the command at 4000 W indefinitely. This preserves the steady shortfall that the new feedback loop is intended to correct. Keep the settling window across unchanged setpoint refreshes, or track an eligible command/sample pair separately.
Useful? React with 👍 / 👎.
| name = "Ferroamp EnergyHub", | ||
| manufacturer = "Ferroamp", | ||
| version = "2.1.2", | ||
| version = "2.2.0", |
There was a problem hiding this comment.
Mark the new control loop experimental until hardware verification
Version 2.2.0 introduces measured-delivery scaling, but DRIVER.verification_status remains production with verification dated 2026-04-18. That evidence predates this control algorithm, and the commit explicitly states that it has not been hardware-tested. AGENTS.md requires the control path to remain experimental until an owner confirms it on real hardware and records the report in tested_devices; retain control availability but update the verification status until that evidence exists.
AGENTS.md reference: AGENTS.md:L34-L38
Useful? React with 👍 / 👎.
The EnergyHub refuses any setpoint above its limit ("Max allowed power
level is 18000.0 W.") and keeps the old one. An up-scaled 24 kW charge
held one 3-ESO site at ~8.9 kW for half an hour. The driver now learns
the limit from that refusal, or takes it from config `ehub_max_w`, and
never sends more.
The same site showed that N_eso / N_active is a guess. With one ESO at
its limit (faultcode 520) the other two delivered about half the on-wire
setpoint, so 1.5x left the pack near 75% of target; with a tapering unit
still counted as active the pack gave ~82% at 1.0x. Core anchors its
slew on measured battery power, so a steady shortfall became a fixed gap
below target. The driver now measures delivery: once a command has had
3 s to act, the next one moves the scale halfway towards on-wire /
delivered, and straight down on over-delivery. It starts from the
N_eso / N_active estimate, stays within [1, min(2.0, estimate x 1.5)],
starts only on a shortfall above 5%, and forgets on a refused command,
a direction flip, idle or stale data.
Multi-ESO sites also get power, SoC and fault code per ESO
(eso_<id>_w, eso_<id>_soc, eso_<id>_faultcode), plus
eso_dispatch_on_wire_w and ehub_max_w.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
2c5aa88 to
9f4caaa
Compare
…2176) Moves the pin to srcfl/device-drivers 5eb7189d, which brings: - ferroamp 2.2.0 (srcfl/device-drivers#299): never sends the EnergyHub a setpoint above the limit the hub reports when it refuses one, or above ehub_max_w; scales by what the ESOs measurably deliver instead of guessing an even split; reports power, SoC and fault code per ESO. - solaredge_pv 1.2.3 and solaredge_legacy 0.3.4 (srcfl/device-drivers#298): read the serial only once the inverter answers, and ask again every five minutes after three misses, so a restart while the inverter sleeps no longer leaves the forecast identity pending until the next restart. Planner PV curtailment accepts only reviewed Ferroamp source hashes. 2.2.0's pplim commands are byte for byte those of 2.1.2, so its hash joins the list. Two Core tests run the new behaviour under Core's Lua 5.1: the cap learned from the refusal, and the measured scale with per-ESO metrics. Both fail on 2.1.2. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Problem
A help file from a site with three ESOs (two on 17.5 kWh Pylontech, one on a smaller PSM pack) showed two faults in the battery path.
nakwithMax allowed power level is 18000.0 W.and keeps its previous setpoint. With one ESO full, a 16 kW charge was scaled to 24 kW on the wire, refused, and the pack sat near 8.9 kW for half an hour. The log shows 972 such refusals in a week.Change
ehub_max_w, and never sends more. The lower of the two wins.Other transaction in progress), a direction flip, idle or stale data.eso_<id>_w(site sign),eso_<id>_soc(fraction) andeso_<id>_faultcode, pluseso_dispatch_on_wire_wandehub_max_w. The help file then shows which unit stands still and why.The
curtailandcurtail_disablepaths are unchanged.Tests
drivers/tests/lua_harness/test_ferroamp_delivery.luareplays the site:make test-driver ID=ferroamp: 167 passed, 16 skipped.make check: 5572 passed, 927 skipped.go test ./internal/drivers/) pass with this file bundled, under Core's Lua 5.1. They caught atonumber()call that Lua 5.5 accepts and Lua 5.1 does not, now fixed.No hardware test yet. The site owner can confirm on the next beta.
Paired change
Core allows planner PV curtailment only for reviewed Ferroamp source hashes (
go/internal/drivers/pv_generation_limit.go). The FTW pin PR that bundles this version adds its hash, since the pplim commands are unchanged.🤖 Generated with Claude Code