I tried experimenting with Schneider PM2200
Modbus register list is here.
There are couple of problems when using this library:
Wrong address compared to vendor register address list - base-1 vs base -0 addressing setup:
Based on register list on address 1837 should be year, however I fetch the year information using this library from address -1 (1836) - so it means library is not reading correctly according to the specification:
logger.info(master.execute(1, cst.READ_HOLDING_REGISTERS, 1836, 1))
2021-04-24 12:54:08,434 INFO modbus_rtu.__init__ MainThread RtuMaster com3 is opened
2021-04-24 12:54:08,449 INFO rtu_master_example_anel.main MainThread connected
2021-04-24 12:54:08,449 DEBUG modbus.execute MainThread -> 1-3-7-44-0-1-68-183
2021-04-24 12:54:08,496 DEBUG modbus.execute MainThread <- 1-3-2-7-229-123-255
bytearray(b'\x03\x02\x07\xe5')
2021-04-24 12:54:08,497 INFO rtu_master_example_anel.main MainThread (2021,)
Using the address (from vendor register list - 1837) I have read from Matrikon OPC client and got correct value, where 1836 address is also correct reading (cause of last meter reading - value from 0-2):
Is there any way to say the script which addressing we are using ?
Reading string value:
Based on that register list on address 50 (holding register) should be meter model (in utf-8). Because of previous problem with wrong address on address 49 I read the string, but bytearray() has a argument of char where struct.unpack() breaks - I will raise PR based on this.
logger.info(master.execute(1, cst.READ_HOLDING_REGISTERS, 49, 3,data_format='>s'))
Reading the float values:
P.S. Not sure is this related to https://github.com/ljean/modbus-tk/issues/93
Again shift in address - on address 2017 (instead of 2018) I can read the value (nominal voltage 230.0 V):
logger.info(master.execute(1, cst.READ_HOLDING_REGISTERS, 2017, 2, data_format='>f'))
Using Matrikon OPC client on correct address (2018) I cannot see the value (where on 2017 is the again correct value- frequency of 50Hz). Note: when adding the 2018 address tag quality of frequency data is wrong, while when showing only 2017 address it ok (what may be something related to Matrikon reading of floats).
I tried experimenting with Schneider PM2200 Modbus register list is here. There are couple of problems when using this library:
Wrong address compared to vendor register address list - base-1 vs base -0 addressing setup: Based on register list on address 1837 should be
year
, however I fetch theyear
information using this library from address -1 (1836) - so it means library is not reading correctly according to the specification:logger.info(master.execute(1, cst.READ_HOLDING_REGISTERS, 1836, 1))
Using the address (from vendor register list - 1837) I have read from Matrikon OPC client and got correct value, where 1836 address is also correct reading (
cause of last meter reading
- value from 0-2): Is there any way to say the script which addressing we are using ?Reading string value: Based on that register list on address 50 (holding register) should be meter model (in utf-8). Because of previous problem with wrong address on address 49 I read the string, but
bytearray()
has a argument of char wherestruct.unpack()
breaks - I will raise PR based on this.logger.info(master.execute(1, cst.READ_HOLDING_REGISTERS, 49, 3,data_format='>s'))
Reading the float values: P.S. Not sure is this related to https://github.com/ljean/modbus-tk/issues/93 Again shift in address - on address 2017 (instead of 2018) I can read the value (nominal voltage 230.0 V):
logger.info(master.execute(1, cst.READ_HOLDING_REGISTERS, 2017, 2, data_format='>f'))
Using Matrikon OPC client on correct address (2018) I cannot see the value (where on 2017 is the again correct value- frequency of 50Hz). Note: when adding the 2018 address tag quality of frequency data is wrong, while when showing only 2017 address it ok (what may be something related to Matrikon reading of floats).