Skip to content

Implement Kostal Plenticore devices#3118

Merged
sfeilmeier merged 11 commits intoOpenEMS:developfrom
iseeberg79:device/kostal-plenticore-pr
May 13, 2025
Merged

Implement Kostal Plenticore devices#3118
sfeilmeier merged 11 commits intoOpenEMS:developfrom
iseeberg79:device/kostal-plenticore-pr

Conversation

@iseeberg79
Copy link
Copy Markdown
Contributor

Over the past few weeks, @deadrabbit87 and I have been working on a proper solution for Kostal Plenticore hybrid inverters. We examined the existing implementation for Kostal PV inverters and meters, but it did not work properly in conjunction with battery control - at least in our scenarios.

This PR implements support for Kostal Plenticore devices in OpenEMS Edge, adding components for grid meter, PV inverter, and energy storage system (ESS)

New Features:
Added support for Kostal Plenticore grid meter (KSEM)
Added support for Kostal Plenticore PV inverter
Added support for Kostal Plenticore energy storage system

Compatible with PIKO IQ/PLENTICORE, based on KOSTAL Interface description MODBUS (TCP) (2.3, 03/2025). Tested with Kostal Plenticore hybrid-inverters (usually PV+Battery) and additional PV generators (not focused at here). It should be okay to be used with G1/G2 and G3 inverters - G1 may have trouble using battery-control (modbus based).

The implementation is able to control the battery power by implementing the ManagedSymmetricEss interface, tested using the Time-of-Use and optimizeGridCharge Controllers, showing correct results and complete information about production& consumption in live and history UI as well.

The external control via modbus needs to be enabled on the inverter using a service code (device requirement).

The implementation is still ongoing, but a solid first version has been completed as we use it in production for some weeks now.

Happy to discuss the implementation and to contribute to the project.

@iseeberg79
Copy link
Copy Markdown
Contributor Author

@deadrabbit87 fyi

@Sn0w3y
Copy link
Copy Markdown
Collaborator

Sn0w3y commented May 8, 2025

Just one Question from my Side - why didn't you use SunSpec?

https://www.photovoltaikforum.com/core/file-download/79166/

image

@iseeberg79
Copy link
Copy Markdown
Contributor Author

iseeberg79 commented May 9, 2025

I tried initially but it did not work in detail. I know about the models and Kostals abilities. For DC power openEMS actually does not read model 160 (see waiting Fronius PR).

Some implementations seem to need adjustments to deliver the right semantics to be used in UI live/history widgets. For example the meter needed inversion or not all values are available. Probably it's also our actual missing openEMS knowledge which led into errors and our conclusions.

In addition sunspec implemented by Kostal does not allow to control - is read only.

For different installations (KSEM via inverter or direct) it's komplex to re-use.

We ended up by mixing the models, overwriting methods and decided not to go for sunspec at the end, as interpretion of data was not right in any detail.

This way we achieved the implementation to be correct for our different installations and the battery finally to be controllable.

It might be possible using sunspec as well... not in chapter #1 ;-)

@iseeberg79 iseeberg79 marked this pull request as ready for review May 10, 2025 07:47
@sfeilmeier
Copy link
Copy Markdown
Contributor

Thank you! At first sight it looks very good, even though not all coding guidelines are met yet, I believe (https://openems.github.io/openems.io/openems/latest/contribute/coding-guidelines.html)

I don't know when I have time to do a review. Will appreciate if somebody could do a first detailed review or directly edit.

For reference I am linking the community thread as well: https://community.openems.io/t/kostal-plenticore-hybrid/6772/8

- Eclipse Autoformat + Organize Imports
- Standardize Factory-PIDs
- Add enabled-check to handleEvent
- Cleanup unused comments
- etc.
@sfeilmeier
Copy link
Copy Markdown
Contributor

I took some time to fix according to our coding guidelines. I do not own a Kostal Plenticore, so cannot validate functionality. Also I did not read through the entire logic. Some comments on my changes:

  • I merged the KOSTAL bundles for PIKO and PLENTICORE into one io.openems.edge.kostal; PIKO might be quite outdated, though.
  • Applied Eclipse Autoformat + Organize Imports
  • Standardized Factory-PIDs
  • Add enabled-check to handleEvent()
  • Cleanup unused comments
  • Applied the tools/prepare-commit.sh script

I believe modbus definition in KostalGridMeterImpl could be simplified, but did not touch it.

I am merging this PR to avoid it becoming outdated again. If you find future improvements, just place another PR.

Thanks for supporting OpenEMS! 🚀🤘

@codecov
Copy link
Copy Markdown

codecov bot commented May 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ There is a different number of reports uploaded between BASE (5c5cd5b) and HEAD (987113e). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (5c5cd5b) HEAD (987113e)
java 1 0
Additional details and impacted files
@@              Coverage Diff               @@
##             develop    #3118       +/-   ##
==============================================
- Coverage      58.51%   26.88%   -31.63%     
==============================================
  Files           2576      296     -2280     
  Lines         110776     7860   -102916     
  Branches        8167     1205     -6962     
==============================================
- Hits           64805     2112    -62693     
+ Misses         43574     5654    -37920     
+ Partials        2397       94     -2303     
🚀 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.

@sfeilmeier sfeilmeier merged commit 19e568e into OpenEMS:develop May 13, 2025
5 of 7 checks passed
@iseeberg79
Copy link
Copy Markdown
Contributor Author

iseeberg79 commented May 13, 2025

Thank you for the adjustments made and for merging. Took us a lot of time, happy to support the project.

The existing PV-inverter/Meter should get reviewed as I am unsure about superseeding it. Here some comments from others are welcome to be able to decide about. Perhaps the other is supporting other or older hardware.

Happy about initial completion.

@deadrabbit87
Copy link
Copy Markdown
Contributor

Thanks a lot for merging this PR!

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.

4 participants