Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Network Variables

anyone have pseudocode (or a code snippet) which illustrates how

to write to multiple network variables with one buffered writer ?

 

 

the "shipped" examples in measurement studio show 

how to publish data to one network variable.....this is easy

 

 

but how to publish data to hundreds of network variables? 

with measurement studio...

 

thanks

 

Philip Newman
General Dynamics
Electric Boat
0 Kudos
Message 1 of 7
(4,815 Views)

Hi Philip,

 

I would like to get more information regarding the application you are trying to build. Are you trying to have hundreds of variables read from one network shared variable? If so, you may be able to simply bind multiple variables to the same network variable. However, if you want to have one buffered writer, but have the ability to write to different network variables each with a different value, the solution may be a bit more complex. Perhaps you can give me a small example that illustrates your application. 

 

Here's some additional documentation that might help answer your question. 

 

Adding Network Variables to a Measurement Studio Windows Application

View the 90-Second Network Variable Express Demo

S_Hong
National Instruments
Applications Engineer
0 Kudos
Message 2 of 7
(4,789 Views)

NetworkVariables={ NV1, NV2, NV3, etc....}  ' an array

NetworkVariValues={0.001, 2.31, 3.43, etc.} 'an array

 

one network variable for each pressure sensor in my system, for example

 

then publish the data on an opc (network variable) server

 

bufferedWriter.write(networkVariables, NetworkVariValues) ' this writes an array of network variables and their associated values

 

 

I have a lot of Network Variables (OPC tags) to write to

and having hundreds of bufferedWriters is not practical.

 

 

------------------------------

 

...and then on the network variable subscriber side, i need an array of network variables to be returned..

( the array should includes only network variables for which values have recently changed)

Philip Newman
General Dynamics
Electric Boat
0 Kudos
Message 3 of 7
(4,786 Views)

Hi penewman,

 

According to the Measurement Studio Help, it does not look like you can overload the function by passing in an array of network variables as one of your arguments. Currently, I believe the only way to write to hundreds of network variables is to write them out one at a time using a loop structure. However, let me do a bit of research and see if I can find another workaround to this problem.

S_Hong
National Instruments
Applications Engineer
0 Kudos
Message 4 of 7
(4,768 Views)

A "LIST" of network vaiables should do the job.

then use "for each"   when using   bufferedWriter.write

0 Kudos
Message 5 of 7
(4,747 Views)
While we are talking about this, does NV have any limits (ie number of variables, data rate of those variables across the network or some combination of both) that were built into the program or is that more hardware dependent?
0 Kudos
Message 6 of 7
(4,723 Views)

After doing a bit of research, I believe that looping through the different network variables may be the only solution to this problem. However, if you would like, you may create your own function which simply loops the variables for you and have it take in an array as one of its arguments. So I think you're on the right track here.

 

As for performance issues regarding network variables, there's actually a nice white paper on this topic on our website. Note that although this white paper talks about LabVIEW shared variables, the performance considerations are exactly the same as for Measurement Studio network variables.

 

I hope this helps answer your question.

S_Hong
National Instruments
Applications Engineer
0 Kudos
Message 7 of 7
(4,683 Views)