Datasocket works, Shared variables dont?

Hi community,
the title tells it all. I'd like to initiate a communication between the computers with shared variables. I am using the example project shipped with labview, which works fine on a local computer, but it doesnt when I try to use on different PCs. When I try to browse for the variables published on the network I dont even see that PC.
Which is quite odd, because datasocket communication works without an issue.
Can you help me out with some hints?
thanks!

Hi 1984,
Please check this paper regarding the issue. There is a step by step on how to do the communication using shared variable.
http://digital.ni.com/public.nsf/allkb/7815BCE435DCC432862575DA006FEBF8
Best regards,
TuiTui

Similar Messages

  • Datasocket and Shared Variables

    I am curious if there is any advantage to using Datasocket to read/write shared variables (as opposed to a direct read/write).  I'm specifically talking networked shared variables here.
    Is there any speed advantage to accessing shared variables thru the Datasocket functions?  Since both a direct read/write and a Datasocket PSP read/write talk to the same variable engine I assume they are equally efficient but I'm looking for confirmation here.  I've seen benchmarks for shared variable performance but none of them use DS/PSP to access the variables.
    Normally I would not even think of using Datasocket to access shared var's but where I currently work we have a large app that does this and it works great.  I suspect that this functionality only exists in LV8.x for backward compatibility and non-Windows OS compatibility and is not really meant to be used for new, Windows-based apps?   Am I off base on this?
    I am working in LV 8.5, BTW.....

    Hello Jared,
    Thank you for the reply with clarification. 
    Based on your comment, I changed the buffer parameters and also tried the programs with two different data types, previously StringArray and now String.
    In the attached LV8.6 project, you have all the programs, and shared variable library to review my tests. 
    There are two sets of two files - each set has a Write Shared Variable and Read Shared Variable file. One set is for StringArray type Shared Variable (named StrArr in the library), and the other set is for String type Shared Variable (named Str in the library).
    String Array example:
    MultipleDS-Write-SharedV-StrArr.vi / MultipleDS-Read-SharedV-StrArr.vi
    In my String Array shared variable, I use only 4 element array, each having 4 character strings - meaning 16 bytes per String Array data. I have two loops in the write file, writing to the same variable, an array of 4 strings, each loop continues until the loop index is >0. This means, sometimes, depending on the processor speed, the variable will be written 3 times or 4 times (the variable could have a new value before the loop condition is checked).
    So this means, if I have buffer of 100 bytes (16*4=64<100), it's enough for 4 such arrays (of 4 elements, each element with 4 characters) could be buffered to have sufficient time at the client (Read) program to read them. 
    I am putting 2048 bytes in buffer, which is much more than sufficient in my case. 
    The writer loops run with 200 ms to wait for each iteration. The reader loop runs with 100 ms in DS timeout and 100 ms in wait timer. This gives results without any loss. However, if I run the reader loop with 1000 ms to wait for each iteration, the data is lost. The buffer is not maintained for 2048 bytes.
    In the read program, just to make sure if all data is read or not, I am showing data in two different string indicators, showing data of each loop.
    String example:
    MultipleDS-Write-SharedV-Str.vi / MultipleDS-Read-SharedV-Str.vi 
    The String Array shared variable didn't show values in the Distributed System Manager. Hence, I created another simple variable with String datatype.
    The writer program writes strings of 4 characters, one-by-one, in two loops. Meaning, total 8 strings of 4 characters each are written in the "Str" Shared variable. 
    The reader program, however, doesn't always display all the 8 strings. Although the wait timer is not high (slow) it still misses some data usually. Data is overwritten even before the buffer is filled (in buffer, I have defined 50 strings with 4 elements in each).
    In both of the Read programs, I read using datasocket. I think thought datasocket has more ability to buffer. Earlier I had "BufferedRead" in DataSocket, which I have changed to just Read, because BufferedRead didn't give any special buffer advantage in the Shared Variable reading.
    ---- This is an update on the issue. 
    Ok, just while typing the last paragraph above, regarding datasocket, something clicked in my mind, and I changed the DataSocket functions to simple Shared variables (completely eliminating datasocket functions) in the read programs as well. And bingo, the buffer works as expected, even if I have reading loops very very slow, there is no data loss in any of the program sets. 
    The two changed Read programs are also included in the attached project - MultipleSV-Read-SharedV-Str.vi and MultipleSV-Read-SharedV-StrArr.vi
    So this means, I can completely eliminate DataSockets (not even using PSP URLs in DataSocket Open/Read functions) from my programs. 
    One question here, what will be an advantage of this (or any side effects that I should be keeping in mind)?
    Vaibhav
    Attachments:
    DataSocket.zip ‏71 KB

  • Shared variables not updating in exe

    Hi,
    I've created a project with 2 vi's, they share data via Networked Shared Variables, one vi writes while the other reads.
    The data is passed between the 2 vi's whilst running in the Labview 2009 SP1 development environment, but when I create an exe, the screen values in the reader vi do not update at all.
    In the build specification I've tried both including the vi's which reference the shared variables and the
    option to list the shared variable libaries for deployment at run time, as methods to overcome the problem.
    Please, any clues why the exe should fail to allow shared variables to pass data ?
     thanks,
    Gary. 

    Hey Gary,
    I've just created a project to replicate the issue you are having and indeed when I built the application, the Shared Variables were no longer working. This is because I hadn't deployed the Shared Variables in code; which I think may be the problem that you're having at the moment. When create a Network Published Shared Variable library in LabVIEW, it auto-deploys itself for the development environment; but this is definitely not the case for when you build an executable. Instead, you must deploy the library yourself in code.
    In the attached zip folder, please follow the following instructions and hopefully you'll be able to fix your VI:
    Unzip the folder and extract the files.
    Open up the project.
    Look at the project layout. Notice the SharedVariableLibrary.lvlib and inspect the Shared_Double variable.
    Look at how the Reader.vi and the Writer.vi interact with the variable.
    Go into the Main.vi. See that I make an Open Application Reference VI and Invoke Node to manually deploy the library in code. You'll have to change the path to this library to match the directory structure of your own computer, so just make sure it navigates to the library in the extracted folder.
    Check out the Build Specifications. I've done nothing here except ensure I only include the Main VI. Finally build the VI and run the executable. 
    You should see that this will give you a working Shared Variable setup. The Machine Name input for the Open Application Reference is blank because you only want to communicate with the localhost i.e. Your computer. Therefore by explicitly deploying all libraries you require, your VIs should be able to communicate effectively.
    Does this solve your problem?
    Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)
    Attachments:
    GlobalVariableProject Folder LabVIEW 9_0SP1.zip ‏26 KB

  • I/o server shared variable not working in deployment system ( error no-1950679034 (0x8BBB0006) (Warning))

    Hello ,
             am using shared variable from opc client in labview when am run a exe file at development system its working fine but when am running it in deployment system its not working am using same configuration file in opc server at development and deployment system error -1950679034 (0x8BBB0006) (Warning)

    First Root cause needs to be identified before any actions.
    I would suggest first check if you can access the shared variable hosted in PC from RT using other ways like using SVE API (Logos and PS protocols, Datasocket etc..)
    Check if antivirus or firewall is playing...
    Check the same experiment with some other PC if you can.
    You can also try creating another Shared Variable in RT and binding the same to the PC and try to access it...
    Since you have did all the reinstallations already
    Best Regards,
    Vijay.

  • Datasocket shared variable api

    I ran into the following the other day whilst debugging some code:
    We had a type mismatch when sending data however, when testing the DataSocket API did not return this error information, nut the Shared Variable API did.
    DS just returned default data with a change in the timestamp)
    This got me thinking:
    Is using Shared Variable API the way to go? Is it a better (more refined) API?
    Are there different reasons for using one over the other? (I do like that DS's refnum is not datatyped, which means that I have to provide the datatype on the read as opposed to the SV-API).  
    With respect to the type mismatch, I found that I could actually initialise the Variable with either datatype and it worked (only) for that datatype.
    It would only error when the other datatype was used.
    Does that mean the Variable does not know what its datatype actually is when a cluster is used?
    Cheers
    -JG
    Certified LabVIEW Architect * LabVIEW Champion

    charris wrote:
    I'm not sure I quite follow your question regarding datatypes. It looks like the error is being returned because a variable cannot contain a cluster. You can do arrays, but not clusters, so that's probably why the SV API is complaining about the type input.
    Hi Caleb
    My question was relating to the fact that if the variable is not initialized on one PC, and I try reading from it on another PC, specifying the datatype to read back, then I get an error using the SV API but no error from DataSocket.
    My use case was for a Cluster.
    I didn't check whether it was Cluster-specific or occurs for every datatype.
    I assumed Cluster-only as Clusters differ when setting up the Shared Variable.
    I.e. All standard datatypes are available in a drop-down, but you need to select Custom Control for a Cluster.
    So the last question was asking could I theoretically use any Cluster with a SV-Cluster as long it is the same when I do a Read and Write.
    I.e. When using the DS/SV-API the Shared Variable does not know (/have information on) what its datatype actually is when a Cluster is used - it relies on what datatype is used to initialize it? 
    Hope that makes sense.
    Cheers
    Jon
    Certified LabVIEW Architect * LabVIEW Champion

  • Use buffering and psp with datasocket-VIs and without any binding and shared variable node

    Hello,
    I'm using LV 8.5.
    I'm trying to develop a multiplatform (windows and mac os x) and multi-computer application. II want to get executables running on each device, communicating through the network. Communication process includes datas (such as images) and events messages (something like "Hello, I got an error" or "youyou, my work is done" or "I'm hereeeee!!!!...."). I do need a communication without any loss of data.
    I worked a lot and wanted to test a psp-based design, without any binding nor shared variable node (mac os...) using data socket VIs and SVE buffering.
    I managed to :
    - deploy shared variable library dynamically (even in an executable)
    - communicate between two PCs with datasocket VIs
    However, I never managed to enjoy buffering (even locally with one VI doing the deployment and writing datas and another one for reading).
    I worked hard (dynamic buffering setting, dynamic buffering watching like in  http://zone.ni.com/reference/en-XX/help/371361D-01/lvconcepts/buffering_data/ and in the example "DS send image" and "DS receive image" in the labview examples, trying to use "?sync=true" in the URL, etc...) but no way to get things work.
    I attached a jpeg of an example of receiver and sender. I use wait commands in both receiver and sender to test buffering
    Receiver do receive datas (the last written) but buffering doesn't work.
    Did somebody did that before ? (better than me...)
    Thanks
    Bo
    Attachments:
    Sender.JPG ‏87 KB
    Receiver.JPG ‏96 KB

    Hello,
    Indeed my problem has been solved. My error : in the While loop of the receiver VI, I always reactualize the PacketsMaxBuffer and OctetsMawBuffer parameters, what resets the buffer and make it appears ineffective.
    I now set  the PacketsMaxBuffer and OctetsMawBuffer values only once at the begining of the VI and the psp buffering works perfectly.
    Sorry for the desagreement...
    Bo

  • I want to work with shared variables. How can I add a remote pc?

    I did an aplication to work with shared variables, but I do not know how add a remote pc. I tried make it in Variable Manager, but Labview showed a error message: "Cannot Connect to Target xxxxxxxx". What can I do?

    Message Edité par JeromeL le 08-28-2007 06:44 AM
    Jérôme LIBBRECHT

  • Binding a shared variable to a NI-PSP data object does not work

    Hi,
    I want to share data between a RT-target and one or more hosts (LV 8.6.1). The network shared variables are deployed to the RT-Target.  According to NI accessing shared variables from another project or host has to be done by defining a shared variable on the host and aliasing it to the NI-PSP data object on the target.
     I did that and the host shared variable generated an error (0x8BBB0011) during runtime.
    Next I aliased to a shared variable deployed on the host from another project. This did work.
    Another thing I tried was to bind the variable from the RT-target to a display element:
    This is working !!! And as you can see the path of the NI-PSP data object is exactly the same ! So what is the difference between binding a data object to a shared variable and to a display element?
    Is there a bug in the SVE or am I missing something here?
    The host project:
    The publisher VI
    Hope, someone has an answer.
    Regards
    Matthias Quade
    Solved!
    Go to Solution.
    Attachments:
    AliasTestWrite-RT.vi ‏8 KB
    AliasTestConsumer.vi ‏8 KB

    Dear Mr. Quade,
    thank you for posting at the National Instruments Forum. There is a known issue with the path of the bound variable with LabVIEW 8.6.1
    Please download the patch for LabVIEW 8.6.1, it should solve your problem:
    http://joule.ni.com/nidu/cds/view/p/id/1255/lang/de
    Best regards from Munich
    MarianO

  • Shared variable does not work in executable

    In editor mode, the shared variables update fine.  When I build the executable, the shared variables no longer work.
    See attachment.
    Attachments:
    TestCitadel.vi ‏30 KB

    I found this note in the LV2010 help, I wonder if this could be related to your problem...
    Note  You can use scaling only for network-published
    shared variables, I/O variables, or I/O aliases. When the shared
    variable you want to scale is a network-published shared variable, it
    must have a data source. Configure a network-published shared variable
    to have a data source by placing a checkmark in the Enable Aliasing checkbox on the Variable page of the Shared Variable Properties dialog box.

  • Touch Panel Shared variable binding does not work.

    Hi,
    Is there any reason why shared variable binding is not working under Touch Panel Target?
    Is there any plan for implementing or there is some trick I should know?
    Andras

    RebeccaFo wrote:
    Hello Andras,
    which version of LabVIEW are you using? As yu can see in:
    http://digital.ni.com/public.nsf/websearch/04AAA6903A9456F08625715A0026BC57?OpenDocument
    it should work. So what for problems do you have?
    Thanks,
    Just FYI, the KnowledgeBase article linked above has been revised and moved to a new location.  See the new KnowledgeBase 58JFBGD2: Are Shared Variables Available For LabVIEW Mobile Module (Formerly PDA Modul...

  • Shared variable clusters not working as intended

    Hi All,
    I've been using shared variables to communicate between a host computer and a crio real time target.  This works well as simple variables.  I configured a cluster of shared variables to try and clean up the code a bit.
    I have a couple of problems.  If I write to a single element, using bundle, the other elements in the cluster that I do not want to write to are overwritten with some unknown default value.   Second, when the host computer program is stopped, the cluster on the RT host writes what appears to be default values to all the variables in the cluster on the RT.  The idea is to keep the RT program running in it's current state until the host computer recovers.  Of course this is impossible, if it resets all the data to default.
    It appears that I can only write to a cluster on one side and read on the other side.  I cannot read/write to the same cluster at different points on the host and target machines.  With a single shared variable, I can read/write to my hearts content on any process.  I haven't been able to find a way to solve this.
    I will post the code, but you will need a cRIO to run it.  If anyone is using clusters in shared variables, I'd be curious to see how you are doing it.
    Thanks,
    John
    Solved!
    Go to Solution.
    Attachments:
    host cluster test.vi ‏25 KB
    rt target cluster test.vi ‏25 KB
    Params 1.ctl ‏6 KB

    That makes some sense, what I can think of is you are writing to the same cluster in two different places. Each place updates both values so if the host writes B1=False and B2=True then the Rio Writes B1=False and B2=False then the variable will have the latest value of both being false.It's a loop condition.
    Even though you are only setting one value in the bundle by name the other value is coming from the cluster input to the bundle by name.
    To handle this you will need remove the input cluster to the bundle by name and replace with the shared variable read. This is where you may need a delay to ensure the variable has the most recent updated value.
    Also you still have the coercion dots. For the shared variable try linking it to the custom control instead of a undefined cluster (Next choice below in the SV setup)
    Robert Fogg
    Certified LabVIEW Architect
    Attachments:
    host cluster test.vi ‏27 KB

  • Shared variable does not work between two computers

    I am using LabVIEW 8 on Windows XP computers.
    1. On one computer I have created two projects, writeProject and readProject.
    2.  In the writeProject I have a shared variable, writeData, which is "network-published" double. In this project I have a writeData.vi which in while loop assigns a random value to the writeData variable.
    3. In the readProject I have a shared variable, readData, which is "network-published" double and is bound to the writeData variable.  This is on the same computer as the writeProject.
    4. I run both the writeData.vi and the readData.vi and all works fine.
    5. Now, I create a readProject on a diferent computer.  Perform all the steps as described above and also in tools/shared variable/register computer, I have entered the IP address of the target computer on which the writeData shared variable exists.
    6. Binding the readData variable fails in the following way.  When I browse for the source, in the "Select Source Item" dialog, I see <IP> <Populating Node...>, where <IP> is the IP address of the source computer (on which exists the writeData shared variable).  A very long time later it is still "Populating Node...".  Neddless to say, this readData.vi does not work!
    What am I doing wrong?  Or, perhapse what else do I need to do to make it work?

    Hi,
    I would suggest checking out the two KnowledgeBases I have linked below for common issues with Network Shared Variables. Let me know the results. Thanks!
    Troubleshooting Network-Published Shared Variables
    Why Are My Network Shared Variables Taking Very Long to Initialize?
    Stephanie

  • Shared variables not working on PC

    Can anyone tell from the attached screen shot, why my one shared variable is not working with the labview application I'm running on my PC. I set the variable to 48 (I thought), and yet in the NI Distributed System Manager the value doesn't changed. 
    Solved!
    Go to Solution.
    Attachments:
    shared_var_not_working.JPG ‏255 KB

    Its not likely to be a deadband problem if you haven't touched the settings. I would check it out just in case though. In the project window, right click on the shared variable>>properties and select Update Deadband. See attached image. If it's not this, I shall have to think some more about what else could cause this.
    As for ensuring it works when setting it from DSM...from your screenshot you appear to have a VI that writes to the SV. Change the code ore create a new VI so that it reads the SV and then double check that if you change the value in DSM, the VI also reads back the updated value. It may be that the number changes in DSM but does not update the SV in the VI - this would indicate a problem with the shared variable engine or the deployed variable library...Reboot PC and retry... if the problem persists let me know or attach the SV library!
    Regards,
    Dave
    Senior Software Engineer
    www.Adansor.com
    Attachments:
    SV_deadband.PNG ‏8 KB

  • Network Shared Variable: Aliasing not working

    Hello!
    I am running a cRIO 9075, which is publishing network shared variables.
    I can see and modify them within Distributed System Manager.
    Unfortunately I am not able to read/write the variables through labview.
    What I have done so far:
    Tools -> Shared Variable -> Register Computer, using the IP of the cRIO
    Adding a Variable to the project. Type = Network-Published, Enable Aliasing, choosing "Browse" to select the variable (all published variables from cRIO are shown there), Access Type = read/write. The PSP-URL is: \\192.168.10.70\WaveformManager\Op
    Trying to read the variable results code -1950679034 and the result is always the default value for that data type.
    BUT this works: using the VIs Data Communication / Shared Variable / Read/Write Variable  and typing in the same URL the Distributed System Manager is showing is showing (in my case: \\192.168.10.70\WaveformManager\Op)
    So, what am I doing wrong? Did I forget something or misunderstand how "Aliasing" works?
    Thanks!

    hi,
    in which way to you read your shared variable? If you read it before you write  a value "into" the variable it may couse this waring.
    Have you tried this?
    http://digital.ni.com/public.nsf/allkb/7DBC2C3E95AFD85C86257442005CF74C?OpenDocument

  • Datasocket Server vs. Shared Variables

    Does anyone have any thoughts on what is better - Datasocket Server vs. Shared variables?  I have a table on my application that has text indicating application status, information, warning and debug messages and would like to view it remotley over a network.  The old way was to use the datasocket server and bind it to the other control.  Is the new shared variable engine more efficient?  These machines are at different sites.
    John

    Hi John,
    It definitely seems as if you want to gauge user experience on this issue, but since you've had no response I'll chime in and give the "National Instruments view" on the DataSocket/Shared Variable debate.
    Shared Variables were created to expand the functionality of DataSocket and simplify the programming style required to pass information between networked computers. We have extensive literature on this topic and the most pertinent is linked here.
    I hope some users will post to this forum to give you a less formed response than you get from me, but I am more than willing to answer more specifically if you have any more questions regarding this issue.
    | Michael K | Project Manager | LabVIEW R&D | National Instruments |

Maybe you are looking for