Modbus Data Source Polling
-
Mango 3.5.6 all latest
Could someone possibly discuss (or link to) the mango modbus polling protocol? Specifically, we have a number of datapoints within a modbus datasource, which is a PLC.
These points are variously read and set (via settable) - assume at 1 second intervals for reads, and on change for sets. What is the protocol v/v:
-
priority (read before write...), collisions...;
-
connection duration (does it use web sockets or keep-alive?);
-
range (how does it split up requests - ie, if requesting, say, 40001 - 40005 and 40101 - 40110, will it read the whole block 40001 - 40110 to conserve overhead - how about different register types - does it make multiple requests within a connection?)
Related, is it advisable to use a mango publisher / PLC as master instead of settable points if those data points are only to be written to (read) by the PLC?
Assume the protocol is documented somewhere, but lots of digging didn't turn anything up. Thank you.
-
-
Mango uses Modbus4J library which we also develope and you can find here if you wanted to look deep into the code. https://github.com/infiniteautomation/modbus4j
On your question about how requests are split up, it will depend on if you have "Use contiguous batches" set and your max register read setting. I think the help popup on the Modbus Data Source might have a little more information on this.
You would use a Publisher if you want another Modbus Master to be able to read and write to Mango where Mango is the slave. I think it would be fine to use whichever method is more convenient for you.
-
Super. Thank you. Does anyone know if there is a relatively easy way to initiate a single modbus TCP write request upon, say, a variable change or event (as Master, of course)?
-
Hi bullitbd,
Through Mango? Any set to a modbus point through Mango's interface will result in that register getting a write request. Whether the function code for write multiple or write single register is used is determined by the "Use multiple writes only" setting on the data source.
If you meant in the Modbus4J code, you can see there are WriteRegisterRequest and WriteRegistersRequest, as well as the WriteCoilRequest and WriteCoilsRequest: https://github.com/infiniteautomation/modbus4j/tree/master/src/com/serotonin/modbus4j/msg
-
Thank you Phil. So, if I wanted to use a Modbus point to ONLY WRITE (infrequently), would I set up a separate data source that polls once a month / whatever and it's point is write-only?
-
You would set the "Write type" to "Write only" on the modbus point, then the data source won't actually send any requests for that point. So, if all the points on the data source (for that slave) are that way, then the polling interval doesn't really matter (unless there are other points on other devices), but I too would set it very long if I didn't really intend to poll.
-
@phildunlap Thank you.