From: wrath_of_con on
Hello,
 
Two Shared Variable Questions:
 
First-
 
I'm trying to get a better understanding of what is meant by the following note from NI documents regarding Shared Variables:
 

"If you are using a network-published Shared Variable node that is configured to read data, you must run each Shared Variable node before the node subscribes and starts receiving buffered values. If a buffer for a network-published shared variable overflows, the data is lost, and LabVIEW does not return an error."
What is meant by "run each Shared Variable"?
 
Second-
 

Anyone know of a way to "clear out or empty" old, buffered values stores in a Shared Variable?
 

Thank you in advance.

- Con

 
From: wrath_of_con on
I guess there are a few of ways to look at this...
1) The answer to my questions are so obvious to others that they must think I am trying to be funny just to ask? (I am sincere)
2) No one else knows?
3) No one else cares?
From: wrath_of_con on
otoro wrote:My interpretation on "you need to run each variable node" is to deploy the library that contained the variables before running the VI. I do not know how to reset the buffer, but i am curious on why you want to reset the buffer ? I think if you undeploy the variable that would  clear out the buffer



Thank you for your post. 
As far as needing to deploy the variable to wherever is hosting the variable, I understand that.  However, it seems as if they (NI) could have easily used those words rather than saying "run each variable node".  So I am just looking for clarification from them.
Here's a reason for wanting to clear out that buffer:  I have a RT application ("RT-app") that populates a Buffered Shared Variable hosted on some other computer.  I have a second application ("2nd-app") that reads that Buffered Shared Variable while running.  When I run "2nd-app" the first data read it gets is the last value still in the Buffered Shared Variable (which is actually data from a previous RT-app run).  So I want to be able to clear out the Shared Variable at start up to get rid of any previous data still in it.
Any ideas?
As far as deploying/undeploying shared variables: Is this to be done only during development or can one deploy/undeploy shared variables programmatically during code execution?
Thanks again!
From: wrath_of_con on
I just found some info on deploying/undeploying libraries:
Application Control | Library.Deploy Library Method

Shared Variables and Stand-Alone Applications or Shared Libraries

If you plan to distribute a stand-alone application that uses shared variables, do not include the .lvlib file in an LLB or in the executable. Use the <a href="http://zone.ni.com/reference/en-XX/help/371361A-01/lvdialog/vi_settings_tab/" target="_blank">Source Files Setting</a> page of the <a href="http://zone.ni.com/reference/en-XX/help/371361A-01/lvdialog/build_app_or_dll_db/" target="_blank">Application Properties</a> dialog box to change the Destination of the .lvlib file to a destination outside the executable or LLB. You can deploy the shared variables in two ways:

- Write the application so that it programmatically deploys shared variables at start time. Call the Deploy Library Method in the top-level VI of the application. In the Library Path input of the method, use the relative path to the .lvlib file that contains the shared variable.
- Manually deploy the shared variables to the computer or target Shared Variable Engine before running the built application.


If you plan to distribute a shared library (DLL) that uses shared variables, do not include the .lvlib file in the DLL. Use the <a href="http://zone.ni.com/reference/en-XX/help/371361A-01/lvdialog/source_settings_dll_page/" target="_blank">Source Files Setting</a> page of the <a href="http://zone.ni.com/reference/en-XX/help/371361A-01/lvdialog/dll_settings_db/" target="_blank">Shared Library Properties</a> dialog box to change the Destination of the .lvlib file to a destination outside the DLL.
Here's a link where the above was copied from:
<a href="http://zone.ni.com/reference/en-XX/help/371361A-01/lvconcepts/project_variables/" target="_blank">http://zone.ni.com/reference/en-XX/help/371361A-01/lvconcepts/project_variables/</a>
I'm still wondering if deploying/undeplying the library is the best way to go. Or is
On a side note: I'm still debating whether or not to use datasocket with a "psp://..." URL to publish and subscribe to the variables.&nbsp; When I use the Shared Variables my applications seem to "get choppy" when the application first starts running.
&nbsp;
From: Prashanth on
Hi There,
You can programmatically deploy shared variables&nbsp;without the DSC module. This can be done by utilizing the Deploy Library method of the Invoke Node. To find the Deploy Library method:

- On the block diagram, right click to bring up the programming palette and go to Programming ? Application Control and place the Invoke Node on the block diagram
- Using the hand tool, click on Method and select Library ? Deploy Library
- Use the Path input to the Deploy Library invoke node to point to the library(s) containing your shared variables


<img height="537 alt=" src="http://digital.ni.com/public.nsf/websearch/04D9A85B6967EE87862571140065EEC6/$FILE/Deploy_Library.jpg" width="598">

You can also&nbsp;programmatically deploy shared variables&nbsp;on the shared variable engine on a RT target, but you would have to deploy it from the host vi running&nbsp;on a windows machine. To accomplish this all you have to do is give the IP address of the RT controller where you want to deploy it to in the Invoke Node. Hope this helps!

Regards,Prashanth VApplications EngineerNational Instruments


SVdeploy.zip:
http://forums.ni.com/attachments/ni/170/202815/1/SVdeploy.zip