I want to store a large number (upto 10 digits long, its a Unix timestamp) in my OpenEMS component. I am currently storing the value in the holding input register but I see very odd values in the OpenEMS channels.
Currently, I use FC3ReadRegisterTask to read the register and it is using a SignedWordElement. However, I see very wrong and reduced values in the channel.
How should I be storing such large values, in terms of the Modbus element, the Task and Element? Alternatively, is there a way to send the unix timestamp to the OpenEMS Edge instance?
There are couple of things - the signed vs unsigned and also size of raw byte sequence used to store/read register. For modbus both sides must assume same representation. For large values, such as java.lang.Long, you need 64 bits which translates to 4 modbus registers, each having 16 bits. As far I remember WORD will cover 32 bit values (2 registers), what you might need is DWORD (double word) which will span over 4 registers.
Final remark - the unsigned representation of Long will exceed range defined by java, so you need to map unsigned value to BigInteger.
as ldywicki explained, you need a Modbus table provided by the hardware manufacturer. This should give you sufficient information to find out how many registers or WORDs are to be combined to a single value.