Fix/ess cluster power distribution v1 - #3946
sfeilmeier merged 2 commits into
Conversation
…ution When EssCluster is used as ess.id in a controller (e.g. Controller.Symmetric.Balancing), the V1 power distribution solver failed with "Coefficient for [essCluster0,ALL,ACTIVE] was not found" because: 1. Inverters were created for MetaEss wrappers that have no physical inverter, causing the solver to operate on a non-existent entry. 2. Member ESS IDs (ess0, ess1) were never registered in the Coefficients, so MetaEss constraints (cluster = ess0 + ess1) could not be built. Fix: skip MetaEss instances during Inverter creation, and expand their member IDs into the Coefficients set. The rest of the pipeline (ConstraintUtil.createMetaEssConstraints, Solver.applySolution) already handles MetaEss correctly and needs no changes. Closes OpenEMS#3752
- testNoInverterForMetaEss: verifies that MetaEss wrappers do not get their own Inverter entry in the V1 power distribution - testMemberCoefficientsRegisteredWhenOnlyClusterInEsss: verifies that member ESS IDs of a MetaEss are registered in Coefficients even when only the cluster itself is listed in esss (the core of issue OpenEMS#3752)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3946 +/- ##
==============================================
+ Coverage 27.79% 55.88% +28.10%
- Complexity 0 19348 +19348
==============================================
Files 318 3705 +3387
Lines 9502 173325 +163823
Branches 1596 14256 +12660
==============================================
+ Hits 2640 96845 +94205
- Misses 6727 72642 +65915
- Partials 135 3838 +3703 🚀 New features to boost your workflow:
|
|
Relation to issue #3500 Issue #3500 describes the
This PR addresses a third, related root cause that is not covered by #3500: This PR and #3500 are complementary and do not conflict — they touch different methods in |
Summary
Controller.Symmetric.Balancing(and other controllers using the V1 powerdistribution) silently fails when
Ess.Clusteris used asess.id. Thescheduler cycle logs repeated errors like:
Coefficient for [essCluster0,ALL,ACTIVE] was not found
Coefficient for [essCluster0,ALL,REACTIVE] was not found
Meanwhile
ctrlBalancing0/StatereportsOk— no setpoints are applied tothe underlying physical ESS components.
Root Cause
The V1 power distribution (
Data.updateInverters()) had two related gapswhen a
MetaEsswrapper (e.g.EssCluster) was present in the ESS list:Phantom Inverter: An
Inverterentry was created for theMetaEssitself, even though it has no physical inverter and its
applyPower()intentionally throws
"should never be called".Missing member coefficients: Only the cluster's own ID was added to
the
Coefficientsset. The member IDs (ess0,ess1, …) were neverregistered, so
ConstraintUtil.createMetaEssConstraints()could notbuild the
cluster = ess0 + ess1constraint — causing the"Coefficient not found" error at runtime.
Note: The V2 power distribution (
BALANCEstrategy) already handlesMetaEsscorrectly via itsVirtual/Actualentry pattern. This fixbrings V1 to the same level.
Fix
Two small changes in
io.openems.edge.ess.core/…/power/v1/Data.java(updateInverters()):MetaEssduringInvertercreation — only physical ESSinstances get an
Inverterentry.MetaEssmember IDs into theCoefficientsset — member IDsare resolved via
MetaEss.getEssIds()and added alongside the cluster ID.No other changes are needed:
ConstraintUtil.createMetaEssConstraints()andSolver.applySolution()already handleMetaEsscorrectly once thecoefficients are in place.
Tests
Two new test cases added to
DataTest:testNoInverterForMetaEss— asserts that aMetaEssdoes not produce anInverterentry.testMemberCoefficientsRegisteredWhenOnlyClusterInEsss— asserts thatmember ESS IDs are registered in
Coefficientseven when only the clusteritself appears in the ESS list (the exact failure scenario of Controller.Symmetric.Balancing accepts Ess.Cluster but fails with missing power coefficients #3752).
Checklist
./gradlew :io.openems.edge.ess.core:test)io.openems.edge.ess.coreBALANCEstrategy behaviour unchangedCloses #3752