Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency of reading addresses of holding registers base-1 vs base-0 #147

Open
an3l opened this issue Apr 24, 2021 · 0 comments
Open

Comments

@an3l
Copy link

an3l commented Apr 24, 2021

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):
opc good reading
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 Problem with holding registers encoded as float #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'))
2021-04-24 12:54:08,551 DEBUG   modbus.execute  MainThread      -> 1-3-7-225-0-2-149-73
2021-04-24 12:54:08,600 DEBUG   modbus.execute  MainThread      <- 1-3-4-67-102-0-0-15-168
bytearray(b'\x03\x04Cf\x00\x00')
2021-04-24 12:54:08,601 INFO    rtu_master_example_anel.main    MainThread      (230.0,)

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).
image
image

@an3l an3l changed the title Inconsistency of reading addresses of holding registers Inconsistency of reading addresses of holding registers base-1 vs base-0 Apr 25, 2021
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

No branches or pull requests

1 participant