Closed realrushen closed 5 months ago
You have shared block false, so you only have 20 input registers not 28. Input registers can be addressed as 1 to 20.
Please look at the simulator documentation where we explain the difference between the memory model and the addressing model.
I will make a test case, based on your config file....but at least 28 is clearly illegal since it's a memory address one too high.
We have a rather large test set of both shared / non-shared (please see test_simulator.py) that have not found any problems, but I will try to add the problems you describe.
You have shared block false, so you only have 20 input registers not 28. Input registers can be addressed as 1 to 20.
If I have only 20 input registers, why i can read them? My expectations was that they should not exist, and server should respond with Illegal Data Address exception response.
We have a rather large test set of both shared / non-shared (please see test_simulator.py) that have not found any problems, but I will try to add the problems you describe.
As i can see it has only "shared blocks": True
configuration. I cant find in code where you change that parameter. It seems that the case of "shared blocks": False" has not been tested yet.
Look in test_simulator.py, we change shared to false in the code.
The problem is that you read with a starting address that are legal and a count, that takes you into illegal terretory, that is something we do not test. And please remember you claim the register layout is false, which it is not, since you totally forgot register 0.
PR #1967 adds a test, of the address range (0, max_register and max_register+1), just to be sure.
Versions
Pymodbus Specific
Description
I'm using datastore simulator example with modified demo_config that you can see below. With this configuration im expecting that server will create 2 blocks: holding registers with addres 1-8 and input registers with address 1-20. All registers should have uint16 type with default value 1.
When im runing script im getting exception:
If i change
"uint16": [[1, 28]]
touint16": [[1, 27]]
server starting and listeting to requests.Then im trying to request one input register from address 1 with modpoll, but it doesn't exist:
But from address 2 with count 27 it returns full block of data:
Code and Logs