MVP 2023 Flex727 Posted October 19, 2012 MVP 2023 Report Posted October 19, 2012 I have a project that I'm working on where I will need to communicate with about 15 slaves. I will be using a V570 for all 16 PLCs and communication must take place over Ethernet, but protocol is at my discretion. Can someone suggest the best way to accomplish this? It would be nice to complete the survey of all 15 slaves within a second or two, if possible, however, I'm thinking opening and closing sockets, four at a time, may take longer than that with MODBUS IP. I would, though, prefer to use MODBUS IP unless there is a protocol that dramatically improves this communication situation. Thanks for your help.
linxchas Posted October 19, 2012 Report Posted October 19, 2012 If all of your V570's in one LAN, you can scan slaves with resolution of up to 60 per second using modbus over UDP. That's mean full survey of 15 controllers will take no more than 1/4 of second Here is logical steps: 1. Configure Modbus in the master as Follow: 2. Create "Master Call" data table: 3. Call next slave on some "start" condition and every time previous modbus session completed (modbus "function in progress" = 0) 4. Prior to call "modbus read registers" load destination IP from "Master Call" table to Slave IP variable (in my example MI914) and increment index of slave to call. Reset index if greater than 15 This the most simple setup. Note, that Unitronics network card does not have an ARP buffer, so every time you call next slave, network card broadcasts ARP request. Running the master at maximum resolution will create significant load on the network. It's OK if network is dedicated to your application, In case if its a common corporate network, your network admin won't be happy from such traffic. This way you can set a delay timer between sessions and adjust the resolution to appropriate level.
linxchas Posted October 19, 2012 Report Posted October 19, 2012 If all of your V570's in one LAN, you can scan slaves with resolution of up to 60 per second using modbus over UDP. That's mean full survey of 15 controllers will take no more than 1/4 of second Here is logical steps: 1. Configure Modbus in the master as Follow: 2. Create "Master Call" data table: 3. Call next slave on some "start" condition and every time previous modbus session is completed (modbus "function in progress" = 0) 4. Prior to call "modbus read registers", load destination IP from "Master Call" table to Slave IP variable (in my example MI914) and increment index of slave to call. Reset index if greater than 15 This the most simple setup. Note, that Unitronics network card does not have an ARP buffer, so every time you call next slave, network card broadcasts ARP request. Running the master at maximum resolution will create significant load on the network. It's OK if network is dedicated to your application, In case if its a common corporate network, your network admin won't be happy from such traffic. This way you can set a delay timer between sessions and adjust the resolution to appropriate level.
Damian Posted October 19, 2012 Report Posted October 19, 2012 I would recommend using 3 sockets total for the Modbus TCPIP and communicating to 5 slaves on each socket. Make a sequencer to Connect Socket Write a block of holding registers Wait for Write comple Read a block of holding registers Wait for Read complete Close Socket Index pointers to next Slave and repeat Wit a V570 expect about a 120ms access cycle per slave for each socket. Therefore your total cycle will probably be around 600ms using three sockets. If you can live with up to 2 seconds, by all means simplify your code and put them all on one socket. With 15 slaves you will probably be just shy of 2 seconds if you avoid artificial time delays. The above suggestions also assume you both send and recieve your data all in one contiguous block of data. If you have to perform multiple read and writes per every socket connect instance then your times will suffer. 2
MVP 2023 Flex727 Posted October 19, 2012 Author MVP 2023 Report Posted October 19, 2012 Thank you, Damian. That's actually a bit quicker cycle than I thought. I had assumed there was no way to complete the survey of all 15 slaves in less than 2 sec, even using multiple sockets. I also may not have to write to the slaves (not sure yet). I assume if I only need to read a vector of several contiguous MIs from each slave that this will also speed things up?
Damian Posted October 19, 2012 Report Posted October 19, 2012 If all of your V570's in one LAN, you can scan slaves with resolution of up to 60 per second using modbus over UDP. That's mean full survey of 15 controllers will take no more than 1/4 of second Here is logical steps: 1. Configure Modbus in the master as Follow: 2. Create "Master Call" data table: 3. Call next slave on some "start" condition and every time previous modbus session completed (modbus "function in progress" = 0) 4. Prior to call "modbus read registers" load destination IP from "Master Call" table to Slave IP variable (in my example MI914) and increment index of slave to call. Reset index if greater than 15 This the most simple setup. Note, that Unitronics network card does not have an ARP buffer, so every time you call next slave, network card broadcasts ARP request. Running the master at maximum resolution will create significant load on the network. It's OK if network is dedicated to your application, In case if its a common corporate network, your network admin won't be happy from such traffic. This way you can set a delay timer between sessions and adjust the resolution to appropriate level. What 3rd party Ethernet based controllers have you used that support Modbus over UDP? I have never seen any that don't require TCP and the socket dance.
linxchas Posted October 20, 2012 Report Posted October 20, 2012 No 3rd party controllers. Unitronics perfectly support ModBus over UDP. I am using it in many applications. Just initiate ports to UDP and skip "connect/disconnect" calls. ModBus has it own transactional logic and check sum, so there is no needs for TCP, especially in local network for master-slave type of communication. 60 reads per second - proven fact. It may be faster for small applications, because in LAN where round trip time less than 1ms, the main factor for speed is a scan time. 1
Damian Posted October 20, 2012 Report Posted October 20, 2012 I just realized i had not read the orignal post very well. All of your slaves are V570s as well. I understand where linxchas is coming from now although the solution is definitely specific to using all Vision controllers as slaves.
MVP 2023 Flex727 Posted October 21, 2012 Author MVP 2023 Report Posted October 21, 2012 Thanks also, linxchas. I have used UDP Raw before successfully, but have been hesitant to use it when the PLC is attached to a customer network. MODBUS UDP sounds like it would be useful to me in this situation because of the speed and simplicity. Should I infer that it will coexist harmoniously with a standard TCP/IP intranet as long as I keep the polling rate to about 100ms or so?
linxchas Posted October 22, 2012 Report Posted October 22, 2012 Here, what I'd do in you application: In addition to Modbus channel described above, create notification channel using another socket in both master and slaves and UDP RAW protocol. In the slave program - create detector: "Data has changed". Each time detector raising resulting bit - send "request to call" (R2C) flag to the master with slave ID using notification channel. In the "MasterCall" table add column "Request to Call". Each received R2C place as a flag in that column to corresponding row. In the Modbus read logic add one condition - read slave only if R2C flag in "MasterCall" = 1 and reset flag after, otherwise go to next slave. Read all slaves once per 2-60 sec (depend of specific application requirements) anyway in order to check connectivity and compensate possible data collision in notification channel. This way you can significantly reduce traffic as well as reduce latency in delivering updated information. Master will scan your "MasterCall" table with resolution of PLC scan time and will call slaves only if they have a new data. 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now