Can ModbusSlaveSimulator be modified?

Hi everyone,

We are developing a new Battery storage system and would like it to be usable with OpenEms. We will use Modbus TCP. Modbus TCP server is not implemented yet, and I tried to use ModbusSlaveSimulator.java and Bridge Modbus/TCP (from Implementing a device :: Open Energy Management System) just for testing purposes. But as I see, only three register addresses can be used, that already implemented in ModbusSlaveSimulator. Any added registers don’t work.

Is it possible to modify ModbusSlaveSimulator for testing purposes, and if not, how can I test written logic without implemented Modbus TCP server?

Thanks in advance!
Mykola

Hi Mykola,

welcome to the OpenEMS Community and sorry for the late response.

You can easily extend the ModbusSlaveSimulator in the file io.openems.edge.bridge.modbus/test/io/openems/edge/bridge/modbus/ModbusSlaveSimulator.java. For example to add more Dummy-Registers, just add lines to the createProcessImage() method (see openems/io.openems.edge.bridge.modbus/test/io/openems/edge/bridge/modbus/ModbusSlaveSimulator.java at develop · OpenEMS/openems · GitHub)

Does that answer your question?

Regards,
Stefan

Hi, Stefan

Thanks for your response! Yes, I tried to add more Dummy-Registers to createProcessImage() method, but wasn’t able to read values from them. I honestly don’t know why.
But we have already implemented Modbus TCP server, so my question is not actual.

Regards,
Mykola