apache / plc4x

PLC4X The Industrial IoT adapter
https://plc4x.apache.org/
Apache License 2.0
1.26k stars 400 forks source link

[Feature Request][MODBUS]: Build a QueryOptimizer for PLC4J Modbus #1671

Open chrisdutz opened 3 months ago

chrisdutz commented 3 months ago

What would you like to happen?

The modbus spec seems to provide limits for the size of packets. However in contrast to the other protocols, is this limit not related to the size of the packet, but by the number of registers/coils.

Please refer to: https://www.modbus.org/docs/Modbus_Application_Protocol_V1_1b3.pdf, page: 11

It should be simple to implement a query-optimizer for Modbus to automatically handle this. The Siemens S7 QueryOptimizer might help with inspiration.

Programming Languages

Protocols

chrisdutz commented 3 months ago

So it seems that the limitations are:

Max 2000 coils in one request (Page 11) Max 125 registers in one request (Page 15)

chrisdutz commented 3 weeks ago

So luckily I need to implement this feature for my $job ;-) Making good progress, however I'm only going to implement this for reading ... writing would possibly open pandora's box with evil issues, which I do not want to do.

chrisdutz commented 3 weeks ago

img_v3_02ed_6339cbe1-6087-420a-a1e5-8b4a1a69112g So this is the first rough draft ... now I gotta add a bit more of testing to everything ... but more than 10 times faster reads is quite an optimization ;-)

glcj commented 3 weeks ago

Excellent work, I will run tests, those times are excellent!

chrisdutz commented 3 weeks ago

Ok ... the changes are merged ... now I think it makes sense to wait another week for some feedback.