From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Efficiency of Bound Variables to Modbus I/O Server

Hello,

 

I have two questions about the efficiency of using I/O Servers/Shared Variables as a means to access Modbus Registers.

 

Background: I'm using a RT Desktop Target as a Modbus Master to access 9 slave PLCs each with approx. 4-6 registers over RS-485. The Modbus configuration was done using an I/O Server and bound variables on the shared variable engine. I'm connected to the RT Target through my personal laptop. When the Modbus libraries are deployed the update times seem to be very efficient (~200ms) as viewed through the Distributed Systems Manager. As soon as I run the VI (which  consists of a timed loop that reads/writes the shared variable nodes bound to the individual registers) the update times slow down significantly. (~5sec) Again, these update times are observed watching the trend of the I/O server "updating" tag in the Distributed Systems Manager.

 

I understand I'm being somewhat vague as to the other Modbus parameters but this is just to preface my two main questions:

 

Question #1: Are the shared variable nodes that are placed on the back panel opening and closing a connection at each iteration, causing the slow down? Would I be better off reading/writing these variables programmatically through the Modbus Library whereas I can open/close the connections outside of timed loop?

 

Question #2:  Is there any dropoff in performance by running/deploying this VI manually onto the RT Target though the project folder on my laptop rather than just setting the VI to run at startup on the RT Target.  (i.e. does it hinder performance to access the VI on my laptop while its running on the target.)

 

0 Kudos
Message 1 of 2
(2,464 Views)

Hey,

 

In general, the update rate of DSM is not necessarily indicative of the actual update rate of the variable.  There are various factors that can affect the upate rate of DSM, including the other processes at work, the DSM scan rate, network latency, etc.  You should not rely on this update rate to indicate how your PLC values are actually changing.

 

Q1:  Generally speaking, using the Modbus API or LV DSC to open/close outside of your loop is a good practice, though I don't suspect that you should see a massive jump in the true update rate of the variables from using shared variable nodes.  Are the actual values on the PLC updating more slowly - i.e. are your outputs actually changing more slowly?  If so, try using the Modbus API and see if your performance increases.

 

Q2:  Yes, deploying your code to an RT target and monitoring the front panel will not be as efficient, though it may or may not actually affect the performance of your code.  For example, if your timed loop does not have a very fast loop rate and you don't have much code in it, it could still execute on time.  That said, deploying it as an EXE and then using some networking protocol to send your data back to a host would be more efficient.

David R
Systems Engineer
National Instruments
Message 2 of 2
(2,425 Views)