10-01-2008 07:52 PM
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
10-02-2008 07:13 PM
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
10-02-2008 08:21 PM
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)
10-03-2008 05:59 PM
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.
10-05-2008 02:04 PM
A "LIST" of network vaiables should do the job.
then use "for each" when using bufferedWriter.write
10-06-2008 10:02 AM
10-08-2008 09:22 AM
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.