LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

what is the burden of network-published shared variable on a network

I dont need all my shared variables to be network-published ones as single process ones are enough for most of my application. However, I could definitely use the programatic access and data binding that are available only to the network-published shared variables.

In a previous application, we had a few hundreds network-published shared variables and communication between quite a few PC & cRIO which, according to the IT guys, was a very heavy burden on the network.

 

My question is then, what if I use a few hundreds network-published shared variables instead of single process ones in a application that will run on a single PC and that will not communicate with any other PC. Would that affect the network and how?

 

Thank you for your help.

0 Kudos
Message 1 of 8
(3,209 Views)

Hi Woss. I can't answer your question with any authority but felt compelled to throw in my twopenneth nonetheless.

 

I wrote a large project using many network shared variables specifically because I wanted the programatic access features of them (no actual network traffic needed). On the surface it all worked well, but there were a few major problems which have put me off this technique and would steer me towards other solutions if I had to do a similar job again.

 

First I have had nightmares trying to deploy the finished application as an exe (with installer) to a different machine than the one it was developed on. Everything seems fine (builds, installs) but reports it can't access the shared variables when it runs. Sometimes. I am sure there are good reasons for this and lots of fiddling with the build options has 'fixed' the problem only for it to return on the next build/deploy update. Getting it working has been a lottery. Quite likely its my fault but the point is, it has been a nightmare and debugging it has been difficult with very little clue in the documentation and even a few stumped NI engineers.

 

Other issues include horredous latency in updates leading to nasty and unexpected race conditions. You can set the value of an SV, pipe the error in to some other function (ie. do some other stuff) and then out and into a SV read node and read the same variable you just set and get the 'old' value. NI say it may take up to 10ms to update a variable. My measurements indicate it is actually around 20ms. There is a flush buffers vi which I had to use liberally to avoid problems but even using this was not exactly bomb-proof. I even had to put waits in here and there to guarantee updates. YUK - kludgy programming at its worst (hangs head in shame!). This whole area is a minefield so tread carefully!

 

If I had to do it again I would seriously think about other alternatives for programatic access of variables. Use variant properties perhaps, the NI Current Value Table reference library, or a home grown FGV solution.

 

Maybe I've just been burned by my own poor programming technique and lack of knowledge about installers and deployment, but I would now think twice.

0 Kudos
Message 2 of 8
(3,179 Views)

SVs are built on TCP.  How often would you be sending the TCP packets back and forth?

0 Kudos
Message 3 of 8
(3,154 Views)

I had one or two NSVs in a LabVIEW Real-Time project that also used Network Streams to "stream" analog data from a PXI straight to the PC's disk (stopping along the way to provide a Front Panel Chart of the data being saved).  The original code had a few Housekeeping Variables passed from Remote (RT) to Host a few times per second.  While doing the initial testing and debugging of my code, I found that removing the NSV feature "fixed" some mysterious timing glitches I was experiencing.  I'm not using them now ...

 

Bob Schor

0 Kudos
Message 4 of 8
(3,141 Views)

Woss wrote:

My question is then, what if I use a few hundreds network-published shared variables instead of single process ones in a application that will run on a single PC and that will not communicate with any other PC. Would that affect the network and how?


On a single machine, using network-published shared variables should have no effect on the network outside that PC. When two applications on the same machine communicate over TCP, they can use a dedicated "loopback" network interface so no packets ever leave the machine. Connecting to localhost (127.0.0.1) will use this interface, and the operating may be smart enough to route other connections to addresses that it uses back to the loopback interface as well (that gets into technical details that I've never investigated). Of course this assumes that the shared variable engine is on the same machine as the application; if it isn't, then you'll of course be loading the network even though only one application uses the shared variables.

0 Kudos
Message 5 of 8
(3,123 Views)

Thank you all for your insight.

Nathand do you have any idea about the latency through this loopback compared to using single process SV? and would a large amount of network published SV affect it?

0 Kudos
Message 6 of 8
(3,093 Views)

Latency over the loopback connection is extremely low. The Nagle algorithm is disabled on loopback connections (which is the logical thing to do) so at worst sending is simply a copy from the send buffer to the receive buffer, and quite possibly that copy isn't even necessary. So it's fast, and it would require enormous numbers of variables (more than you could reasonably track) to slow it down. How many shared variables are you using, and why do you need so many? If the number of shared variables is causing you problems, it sounds like maybe you're sharing more data than is necessary.

0 Kudos
Message 7 of 8
(3,056 Views)

I have a main vi that needs to communicate with a bunch of 3rd party devices through modbus/profibus/OPC/whatever protocol. I need to poll those every couple 100 ms for some, every few hours for others and in between for the rest. If there is a change between polls, this main vi populate the corresponding SV.

As I often read the same data from similar devices (for example energy analyser with V1/2/3, V12/23/31, I1/2/3, P, Q, S, freq, PF, etc..) I woud like to programatically access the SVs according to the device name/site instead of having to wire them all.

 

The data obtained is then displayed in subvis through subpanel or pop-up.

I often have to display the same data in different subvi (think overview vi -> site vi -> process vi -> vi for more detailed part of a process + pages for alarm/data/etc..) For this reason, if I could bind SV to indicators, I could just copy-paste this indi left and right with having to wire it to the corresponding SV nor worry about wrong wiring and triple checking all the time.

Other time, instead of wiring the 15+ data from 10+ similar devices, I could just write a subvi that, depending on the device name, can programatically access all the SV of that device and display them.

 

 

0 Kudos
Message 8 of 8
(3,014 Views)