Jump to content

One Master with 15 Slaves


Recommended Posts

  • MVP 2023

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.

Link to comment
Share on other sites

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:

Modbus.PNG

2. Create "Master Call" data table:

Config.PNG

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.

Link to comment
Share on other sites

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:

Modbus.PNG

2. Create "Master Call" data table:

Config.PNG

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.

Link to comment
Share on other sites

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.

  • Upvote 2
Link to comment
Share on other sites

  • MVP 2023

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?

Link to comment
Share on other sites

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:

Modbus.PNG

2. Create "Master Call" data table:

Config.PNG

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.

Link to comment
Share on other sites

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.

  • Upvote 1
Link to comment
Share on other sites

  • MVP 2023

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?

Link to comment
Share on other sites

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.


  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...