Using "Contiguous batches only" causes exceptions
-
The logic for partitioning the contiguous requests doesn't account for max request sizes. This has been fixed, and will be deployed in the next release.
-
Thanks!
-
Hello,
I have telemechanique twido with modbus tcp. I noticed earlier Twido was not working with "contiguous batches only" unchecked. I did not have time to investigate what was the reason. Now i noticed this topic and installed mango 1.11. Still it does not work.
Analysed with wireshark and it seems to fail on always same point where Mango requests read at register 327 and number of registers to read is 124. There should be hundreds of readable registers beyond 327.
Thanks for the Modbus Read data tester in the datasource page. I tried reading register 0 with different numbers of registers. Seems it works upto 123 registers and then above twido gets nuts. The response is full of zeroes. I did some research and there are also other devices not supporting the modbus spec 125 register count. Some devices are supporting reading max 16 or 32 registers at time.
The optimised reading is really good feature. It speeds up the reading a lot. (from ~3.5 seconds down to ~0.8 sec). Is there a way to limit the maximum amount of registers mango is trying to read? Would it be possible to add such feature in some future version?
(making "holes" in the register map, to affect mango optimisation seems to work, but it is causing other troubles)
Thanks
-Jokke -
Hello.
I'm using version 1.10 of Mango and I need to reduce maximum number of contigous variables request. How can I do it? My Modbus slave accepts request for at maximum 32 words.
Is there a "secret" parameter to set up?Thankyou in advance
Regards -
Hello,
I checked the sources and for me it looks the register limit of 125 is defined in the code. I am not sure it could be over written somehow but maybe mlohbihler can tell this.
(edit)
You can use the "holes in registermap" to work around this. If every 33th (adresses 32, 65, 97...) register is not configured to be read then the query is limited to 32 registers.I have not tried, but maybe an other workaround could be to configure 2 datasources. One handling registers 0 to 31 and from 64 to 95 and so on... then the second datasource hanling 32 to 63 and 96 to 127 and so on... Idea is to split the register to chunks of 32 and divide between 2 datasources.
(/edit)
BR
-Jokke -
Hello Jokke and thakyou for your help.
Unfortunately I can't setup multiple datasources because, after I setup the first one, in the second one I can't choose (for obvious reasons) the same serial interface..
I tried with "holes in registermap" solution, but I can't use this because my device datamap is filled from holding register 130 to 192 without holes and there are all wanted values there.I the meanwhile I downloaded Modbus4J source code and I have found the piece of code to change in order to reduce maximum number of registers asked on one read. Unfortunately after I compile the code and insert it on Mango WEB-INF/lib folder, Mango doesn't start.. It doesn't find a ModbusMaster class. Surely Mango is built using a "modded" version of this library..
Is there a way to get this customized version, modify the constants on top of ModbusUtils.java file and use it on my application? (question to Serotonine technicians)
Thankyou again
-
Are you sure that modbus4j compiled successfully? Does the ModbusMaster.class file class exist!
-
It is certainly the case that Modbus4J has evolved along with Mango. Off hand i couldn't tell you whether the current Modbu4J code corresponds with your version of Mango, but as Craig noted ModbusMaster has been in there since the beginning, so maybe it can't be found because of a referenced class, a failing static initializer, or bad compilation.
Anyway, regarding max request sizes, how complicated can this get exactly? The spec provides different max size for input ranges (2000), and register ranges (125). So, i assume a device that supports something else could also have two different sizes. There is also a max write count (120), which presumably could also be different.
Also, would this be something that should be set at the master level, or per device?
-
The difference between specs and real devices is abysmal a lot of times!
In fact the device I'm polling is not the first one I've found that behaves like this.. :?Surely, depending on every different device firmware, these params should be at device level but, looking at Mango datasource structure, probably it is too difficult to implement it at that level.. If you need help on modbus protocol, please contact me. We are fieldbus experts and we have a lot of experience on modbus protocol.
In order to solve my current problem, can you send me a modbusutils.class with MAX_REGISTER set at 16 words?
Thankyou very much
-
Because Modbus4J is continuously evolving, i recommend against using a separate branch of the project. Stay tuned as we may end up dealing more permanently with this issue.
-
Update: the setting of max batch sizes has been added to Modbus4J and Mango.