Skip to content

fix(near equals power solver): Invalid behavior for limits#3447

Open
parapluplu wants to merge 1 commit intoOpenEMS:developfrom
parapluplu:feat/neareq_power_solver_fix
Open

fix(near equals power solver): Invalid behavior for limits#3447
parapluplu wants to merge 1 commit intoOpenEMS:developfrom
parapluplu:feat/neareq_power_solver_fix

Conversation

@parapluplu
Copy link
Contributor

This fixes an error where a charge limit was set for a single ess inside a cluster. The power solver disrespected this, and set a value outside of the limit. For details see unit test part #4 of `testNearEqualDistribution in io.openems.edge.ess.core/test/io/openems/edge/ess/core/power/PowerComponentTest.java. Without this fix, this test fails and charges higher than the allowed -1900.

Testing: Unit tests, also tested in a setup with a power plant with 12 ESS in total stacked in two layers of ESS clusters. First layer is an cluster of 3 Edge2Edge ESS, second layer is a Cluster of 4 EssGenericManagedSymmetric each.

@codecov
Copy link

codecov bot commented Nov 27, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

❌ Your patch check has failed because the patch coverage (50.00%) is below the target coverage (75.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #3447      +/-   ##
=============================================
+ Coverage      59.62%   59.63%   +0.01%     
  Complexity       112      112              
=============================================
  Files           2894     2894              
  Lines         124658   124644      -14     
  Branches        9343     9342       -1     
=============================================
- Hits           74318    74313       -5     
+ Misses         47522    47520       -2     
+ Partials        2818     2811       -7     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This fixes an error where a charge limit was set for a single ess inside a cluster. The power solver disrespected this, and set a value outside of the limit.
For details see unit test part `OpenEMS#4` of `testNearEqualDistribution in io.openems.edge.ess.core/test/io/openems/edge/ess/core/power/PowerComponentTest.java. Without this fix, this test fails and charges higher than the allowed -1900.

Testing: Unit tests, also tested in a setup with a power plant with 12 ESS in total stacked in two layers of ESS clusters. First layer is an cluster of 3 Edge2Edge ESS, second layer is a Cluster of 4 EssGenericManagedSymmetric each.
@parapluplu parapluplu force-pushed the feat/neareq_power_solver_fix branch from e1cb6f3 to 4c5a3f1 Compare November 27, 2025 09:31
@parapluplu
Copy link
Contributor Author

parapluplu commented Nov 27, 2025

Could somebody explain to me we codecov/patch is failing with a 50% diff target? I've basically removed code and added tests. The contrary should happen and 50% is waaaaay out of line

@Sn0w3y
Copy link
Collaborator

Sn0w3y commented Nov 27, 2025

Could somebody explain to me we codecov/patch is failing with a 50% diff target? I've basically removed code and added tests. The contrary should happen and 50% is waaaaay out of line

TBH i never understood codecov here :D

@parapluplu
Copy link
Contributor Author

I'd like to publish another merge request, that improves the null handling of the power solver in general. However, as it builds on top of this change, I would like to make my life easier and merge this one before publishing the other one.
Also they are different kind of changes, why I want to keep them seperated as commits. Is there any chance the change in this merge request gets merged?

@parapluplu
Copy link
Contributor Author

parapluplu commented Dec 17, 2025

701d7b8

This was merged 7 hours ago with the back port merge and creates conflicts for this pull request. So if this merge request does not get any further traction I will drop this topic and will keep the changes and follow up changes in our internal repo since this now creates significant overhead.

I've also changed the null handling to optionals, which makes it much more explicit and enforces correct handling whenever touching the values. Seems like Fenecon decided to go for a approach with using a constant instead of Optionals https://github.com/OpenEMS/openems/blob/develop/io.openems.edge.ess.core/src/io/openems/edge/ess/core/power/optimizers/KeepAllNearEqual.java#L27

I would prefer a more modern approach provided by java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants