Modbus connection


kanber

Recommended Posts

Hi,

 

I have 5 machine communication with modbus tcp. Every machine has 185 tags. when all machine is only communication is normal. but when customer close 3 or 4 machine modbus trying to get tag information and waiting for time about. because of that online machine data updating very very slow.

Is there any solution for that?

Link to comment
Share on other sites

Do you have the 5 machines on the same Timing / Offset?  With TCP you can put each machine on a different Offset which will force them onto a different thread.  That should keep one machine that is down from holding up the others. 

The other option is to add some script to disable machines that are down.  How you do that depends on how you are polling, script vs channel Timing.

Link to comment
Share on other sites

Yes, timing = 1 / offset=0

I will change it for machine 1 offset =0.01, 2=0.02, 3=0.03, 4=0.04, 5=0.05. Am I correct?

I added a script when timeout I change 184 channel timing=0, only one channel timing is 1, if communation is online ı set all other timing to 1. 

Because I need at least one channel to understand when communication online again.

Link to comment
Share on other sites

Yes, that is what I am proposing.

There are a couple alternatives:

1) you can put the inputs from each machine in its own channel group, then use a little script to trigger the reads using channel.readGroup():

while(1)
   channel.readGroup("myGroup1")
   delay(1)
endwhile

You could create a sequence for each group.

Or, you could create a variable that enables/disables each group:

while(1)
   if (myGroup1Enabled)
      channel.readGroup("myGroup1")
   endif
   if (myGroup2Enabled)
      channel.readGroup("myGroup2")
   endif
   delay(1)
endwhile

It'd be more efficient though to have each group in its own sequence, even if you added the ifs().  This is because you are TCP and DAQFactory can communicate with each simultaneously.  If you were in multidrop serial (i.e. RS485), either locally or via TCP through a serial to ethernet converter, then this wouldn't work because the hardware would limit you.

Note that you could make the myGroupEnabled variables manually controller, or automatically disable if there is no comms by looking at the timestamp on one of your channels and comparing it to systime().  You could even go so far as change the rate, for example, poll a group at 1 second interval if all is well, but if it times out, switch to 60 second interval until it comes back online.  Really it is up to you, and what is best depends on your use case, which is why DAQFactory doesn't do it automatically.  It just keeps retrying.

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.