Machine Vision

Showing results for 
Search instead for 
Did you mean: 

Modbus TCP with Vision Builder is Slow

Thanks for this information. I am running VBAI on several machines and have identified this as an opportunity to reduce cycle time. Are you saying that for VBAI 2013, there is no way to change the default 200 ms?

0 Kudos
Message 21 of 33

Correct. It also doesn't look like older VBAI versions used that token either. Can you verify that using an older version of VBAI and changing that INI token actually had an affect or was it the Wait that caused the inspection to work better?




0 Kudos
Message 22 of 33



I double checked the code, and the ini key Brad mentioned should work. Please give it a try and let us know.



0 Kudos
Message 23 of 33

Thanks for looking.  The ini file I attached a couple posts ago, which is what I think Brad has suggested, has no effect on the loop rate.  It stays fixed at 200 ms.

0 Kudos
Message 24 of 33

From your post, it looks like you're running VBAI on Windows, correct?

What does this registry file read:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\National Instruments\Vision Builder AI\CurrentPath

The modbus server uses this key to locate the ini file where we're looking for the information. The ini file you want to modify is

<CurrentPath>\Vision Builder System Config.ini

As Brad mentioned, we then read the Server_PrivLoopRate key in the Devices section.


So, if in that file, you had



Server_PrivLoopRate = 50


This should decrease the loop rate to 50 ms.



0 Kudos
Message 25 of 33

The path in the registry key matches the path to the ini file I had attached.  I am sure it is the right ini, because if I change any of the prepopulated keys, it takes effect.  I have demonstrated this by toggling the "Server_ServerEnabled" and "Server_On" between "True" and "False", and observing that the Modbus server either starts or does not start at the VBAI application launch.


In the event that something else was limiting my loop rate to 200 ms, I also tried increasing the rate to 1000 ms to see if I could slow the loop rate down.  It had no effect.

0 Kudos
Message 26 of 33

How are you measuring it?

On Windows, the modbus server is a separate executable that listen on port 502 and updates some shared memory at the loop rate specified.

VBAI only reads and writes that memory when the Modbus step is called. Changing the loop rate only changes the loop rate of the server.

It will not affect the loop rate of the VBAI inspection whatsoever. The only thing that will change is that the values that the Modbus step reads from the VBAI registers should be updated more frequently, and hence if your inspection runs faster than the Modbus Server loop rate, you should see them updated more frequently in VBAI. But you will not get a faster number of parts/s in VBAI.


Hope that makes sense.



0 Kudos
Message 27 of 33


Agreed, the VBAI loop rate will not be affected.  I'm measuring the amount of time it takes for my controller to send a request and receive a response from the Modbus server.  I measure this on all the devices I communicate with via TCP/IP or by RS232.  So, for instance, even if my VBAI inspection rate is 30 fps, my controller is limited to reacting at a rate of 5 fps, since that is the fastest I can get the data from VBAI through the Modbus server and to the controller.  As I said before, it surprised me that it was so slow, because I'm able to get much faster speeds from my other Modbus TCP devices.  I've got some rough buffering schemes in my VBAI inspection to deal with this, but it would be great to simplify it by increasing the server loop rate.

0 Kudos
Message 28 of 33

Let me do some similar tests. I'll get back to you either tomorrow or the beginning of next week.

0 Kudos
Message 29 of 33



I got to the bottom of it. The information about the ini file that Brad gave you was for the unreleased version of VBAI 2014. Sorry about that.

And we're likely to change it so that the Device Manager does not overwrite or erase the key.

To specify the loop rate of the Vision Builder AI Modbus Server in VBAI 2013 SP1 and below, add the following section to the main VBAI ini file:

C:\Program Files (x86)\National Instruments\Vision Builder AI 2013\Vision Builder.ini


LoopRate = 50


(Loop rate you want in ms).


I tested it and it works. Let me know if that works for you.


Best regards,



Message 30 of 33