Dynamic Device Creation based on Modbus - EssDcCharger

Hello,

I am creating a device implementation for the AMPT String Optimizer / ESS DC Charger:
https://www.ampt.com/products/string-optimizers/

This is a system where there are DC-DC converters for each solar string (MPPT trackers) connected to a common DC bus of the ESS. I think the OpenEMS API / Nature that best represents this is EssDcCharger.

The Modbus interface for the system is provided by an AMPT communications unit. This communicates wirelessly with the distributed DC-DC converters and provides all data in one interface.

You can see product information here:
https://www.ampt.com/products/ampt-cu/

And the instructions containing Modbus protocol here:

The Modbus protocol returns data on a per-string basis, and the number of strings is dynamic depending on how many optimizers are connected with the communications unit.

I see two ways to approach the implementation:

  1. Implement a dynamic system where a device implementing EssDcCharger is instantiated per string / optimizer. This would require the devices to be created dynamically depending on the value N (number of strings) that is read in the opening Modbus block.
  2. Add logic into the device implementation to represent all strings together as a single EssDcCharger. This would sum the current and power across all strings and represent this as a single device.

To my mind, approach 1 would provide enhanced data visibility as the performance of different strings would be more easy to visualise. However, the implementation would be more complex.

I would like to get the community’s views on this question and whether this approach is practical.

Has anyone implemented something like this before?