Skip to content

Implements VirtualMeter on PvInverterCluster#3085

Merged
sfeilmeier merged 9 commits intoOpenEMS:developfrom
chpoulter:feature/PvClusterVirtualMeter
Dec 22, 2025
Merged

Implements VirtualMeter on PvInverterCluster#3085
sfeilmeier merged 9 commits intoOpenEMS:developfrom
chpoulter:feature/PvClusterVirtualMeter

Conversation

@chpoulter
Copy link
Copy Markdown
Contributor

Added VirtualMeter interface to PvInverterCluster. This allows to configure, if values are added to the sum. Otherwise you end up with doubled values, as the sum will take the cluster as a normal pvInverter.

Made MeterType on the way configurable ... maybe useful for something.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2025

Codecov Report

❌ Patch coverage is 12.50000% with 7 lines in your changes missing coverage. Please review.

❌ Your patch status has failed because the patch coverage (12.50%) 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    #3085      +/-   ##
=============================================
- Coverage      59.76%   59.75%   -0.00%     
  Complexity       105      105              
=============================================
  Files           2951     2952       +1     
  Lines         127746   127747       +1     
  Branches        9552     9551       -1     
=============================================
- Hits           76332    76327       -5     
+ Misses         48515    48514       -1     
- Partials        2899     2906       +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.

boolean enabled() default true;

@AttributeDefinition(name = "Meter-Type", description = "Production meter (=default)")
MeterType meterType() default MeterType.PRODUCTION;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this ever be anything else than PRODUCTION? If we don't set it here, we might have to add it in UI isProducer(), though: https://github.com/OpenEMS/openems/blob/develop/ui/src/app/shared/components/edge/edgeconfig.ts#L582

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay true ... I guess in most cases this will be PRODUCTION. I think there is PRODUCTION returned as default in ManagedSymmetricPvInverter interface anyway, so we could drop this completely. To be honest, I cannot remember anymore, why I added it.

MeterType meterType() default MeterType.PRODUCTION;

@AttributeDefinition(name = "Add to Sum?", description = "Should the data of this cluster be added to the Sum?")
boolean addToSum() default true;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Energy Storage Systems this is identified via MetaEss Interface. We should establish similar approaches for the same logic throughout OpenEMS, don't you think? Maybe addToSum() is in fact the most flexible approach - see #3238. I am open for discussion.

Copy link
Copy Markdown
Contributor Author

@chpoulter chpoulter Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looks like the VirtualMeter interface was just created for this use case. I would suggest to implement it in SymmetricEss (and everywhere else needed) and test for it before the switch once bailing out if needed. I'm not really sure about the other PR. As the result value is hardcoded in the interface to true, there is nothing won for existing meters. Of course you could overwrite it and return false in an own meter, but then you could also just implement existing VirtualMeter interface and no change of SumImpl is needed. But maybe I did not get the idea.

EDIT: Maybe the name should be changed or a new interface added, as it seems to refer to the MeterVirtualAdd and MeterVirtualSubstract.

@chpoulter
Copy link
Copy Markdown
Contributor Author

I did not see further discussion, so I just added the interface and adopted sum calculation. Was this the solution, which you had in mind?

chpoulter and others added 3 commits November 7, 2025 20:20
- Remove unnecessary VirtualMeter interface
- Implement new `SumOptions` directly in `MetaEss` interface
- Code cleanup
- Set default for `addToSum` to `false`
Copy link
Copy Markdown
Contributor

@sfeilmeier sfeilmeier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@sfeilmeier sfeilmeier merged commit 26afb9d into OpenEMS:develop Dec 22, 2025
6 of 7 checks passed
@chpoulter chpoulter deleted the feature/PvClusterVirtualMeter branch January 3, 2026 13:36
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