Confusion about the simulator setup regarding holding and input registers #2531
-
I'm trying to make the simulator work for my application, and figure out how to properly use it. https://pymodbus.readthedocs.io/en/latest/source/library/simulator/config.html pymodbus 3.8.2 I've changed the setup dict to this: demo_config = {
"setup": {
"co size": 1,
"di size": 0,
"hr size": 1,
"ir size": 0,
"shared blocks": False,
"type exception": False,
"defaults": {
"value": {
"bits": 0x0000,
"uint16": 0,
"uint32": 0,
"float32": 0,
"string": "",
},
"action": {
"bits": None,
"uint16": None,
"uint32": None,
"float32": None,
"string": None,
},
},
},
"invalid": [],
"write": [],
"bits": [
{"addr": 0, "value": 0x00A3},
],
"uint16": [
{"addr": 1, "value": 3124},
],
"uint32": [],
"float32": [],
"string": [],
"repeat": [],
} And ran the following commands: client.read_coils(address=0, count=8).bits
client.read_holding_registers(address=0, count=1)
client.read_input_registers(address=0, count=1) with the following results: [True, True, False, False, False, True, False, True]
ReadHoldingRegistersResponse(dev_id=1, transaction_id=2, address=0, count=0, bits=[], registers=[3124], status=1)
ReadInputRegistersResponse(dev_id=1, transaction_id=3, address=0, count=0, bits=[], registers=[3124], status=1) In terms of the received values, the coils read makes sense. However, I'd expect the the I'd appreciate knowing if this is the intended behaviour, and if there's a way to make the holding and input registers distinct. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You have defined shared false which makes the register setup a lot more complicated. In non shared mode registers are defined with the sizes as offset, that is There are no exception when addressing outside the range, so I assume the problem is that you need to define the size of the input registers. |
Beta Was this translation helpful? Give feedback.
-
We are working on a new configuration concept that is a lot easier to use. |
Beta Was this translation helpful? Give feedback.
You have defined shared false which makes the register setup a lot more complicated.
In non shared mode registers are defined with the sizes as offset, that is
reg0 is coil
reg1 is holding
and there are no input registers in your definition.
There are no exception when addressing outside the range, so I assume the problem is that you need to define the size of the input registers.