Server Simulator Can't Distinguish Holding / Input Registers #1228
-
Hey all, I'm using the ModbusSimulatorContext class (which is a super nice module) and I noticed that it does not make distinction between different types of registers, while generally it can be the case where the same address is used differently in different . It's pretty clear I believe according to the Shouldn't we add an indicator in the setup dictionary that states the register type? Also, I would generally note that the documentation for the simulator is pretty slim and takes some guessing and experimentation to understand how it works.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 13 replies
-
Ok, after getting deeper into the code, I do see that it's possible to split the registers to sections according to their declared 'size' and the 'shared_block' parameter. |
Beta Was this translation helpful? Give feedback.
-
The simulator does allow you to use the 4 blocks defined in the modbus specification:
And self.offset[func_code] is used to get the real address. If you use "shared blocks" all functions can read the same register. With different blocks only functions of the same type read the same register. see datastore/simulator.py line 261++:
Thanks for the calling it super nice. I am working on enhancements, and if you have more specific ideas on how/what to configure with function codes, please submit a PR, or explain it a bit more detailed. To be honest, I am a hard core developer (I cried for days, when the world moved away from assembler) and documentation is a task I tend to do as rapid as possible....so if you would write some explanation etc in Markdown, I am happy to help you include them in the documentation. |
Beta Was this translation helpful? Give feedback.
The simulator does allow you to use the 4 blocks defined in the modbus specification:
And self.offset[func_code] is used to get the real address. If you use "shared blocks" all functions can read the same register. With different blocks only functions of the same type read the same register.
see datastore/simulator.py line 261++: