Programati​c Access to network published shared variable - Knowlege Nugget

Wanted to Share a coding problem I have just resolved:
I have been trying to debug the code above.
It worked for one device and not the other (Identical devices: DevA,DevB)
It has been throwing an error, unable to access variable.
I resolved the problem by changing by changing the timeout to something > zero
Hope this helps future travellers
This seems onlt yo be a problem during the first connection to the variable,
Subsequent reads don't seem to need it.
It is almost as though it needs time to troll through the project shared variable database to finde the reference the first time through.
iTm - Senior Systems Engineer
uses: LABVIEW 2012 SP1 x86 on Windows 7 x64. cFP, cRIO, PXI-RT

Ben wrote:
Since I don't use shared varibales I have to ask...
Is there a timestamp returned that reveals the state of the variable?
Ben
The timestamp is only available on the reads.  It returns the timestamp of when the variable was written to.
One more thing to watch out for (we recently got bit by this).  The NPSV is actually written to a buffer (8kB?).  The variable is published either when the buffer is filled or 10ms has passed.  There is a command to flush the buffer to avoid this 10ms delay.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines

Similar Messages

  • Network-Published Shared variable access

    How can I deny the writing access to a network-published shared variable from all the network machines, except the machine where the vaiable was deploied??

    Hi Idilio,
    Which version of LabVIEW do you use? Do you use DSC? Where precisely do you specify your security options?
    Cordially,
    .mrLeft{float:left} .mrInfo{border-left:solid 1px #989898;font-size:x-small;color:#989898}
    Mathieu R.  
      CTD - Certified TestStand Developer / Développeur TestStand Certifié  
      CLAD - Certified LabVIEW Associate Developer  

  • Does a network published shared variable drop the waveform attributes?

    I have the analog input source for a waveform on one NI chassis. The trigger to begin the trend is on another NI chassis. Both of them feed data to a remote Windoze host. I would like to know how I can pass the waveform attributes, ie. Plot Names from the source machine to the Windoze host using a network published shared variable. I am using LV8.0. My two remote chassis are both running RTOS.
    I can see that when I set up the DAQ assistant and named my aquired signals, that these names are passed to a waveform chart on the same block diagram. I can use them to update the Plot Names on my front panel. However, when I create an "Array of Double Waveform based" network published shared variable, and then read that variable from the Windoze host there are no attributes attached. The waveform shows up just fine.
    I would like to be able to have the attributes update the plot name when I change the plot. I will have about 20 plots and I only want to display them a few at a time. I also want the user to be able to select which one they want to look at.

    Hello,
    I think you posted the same question to another thread, received an answer, and have now moved on.  Anyway, the workaround to the problem is to peform flatten to string and unflatten from string operations on the waveform before and after sending it to the shared variable respectively.  See the attached screenshot for the specifics.
    I hope this helps!
    Best Regards,
    JLS
    Best,
    JLS
    Sixclear
    Attachments:
    Workaround Screenshots.JPG ‏206 KB

  • Problems writing to network published shared variable hosted on rt (set as modbus slave for crio)

    Hello Ni Forums
    This is my first post on this forum and I have been using labview for about 8 months now
    I have a problem regarding writing data to modbus registers through an i/o server set as a modbus slave for my 9074 hardware.After I have completed building project and deploying the variables and following instructions from here , it yields no result but a line zeros. I have the Ni DSM open and modbus master setup to see whether the data is actually being read/written from the respective sides which both yield the same line of zeros as well.  What I am actually trying to write to is an array of single precision floating data. The registers are structured from ranges F40000-F46534 for 10 elements or have them for range AF40001L1-AF46534L1 of item AF40001L10 where it is an array of length 10. (Referenced ranges here)
    I know 1 thing for sure, the modbus connection works and is ready for data requests, I tested this through NI DSM and manually set data for and my master received them . 
    System and Project specifications
    Windows 7 OS
    Labview Full Development System 2011
    No Labview DSC module but I am using the real time module as referenced by one of the documents
    This project is a real time application with fpga mode (not scan interface mode)
    The master and slave are the same subnet and network
    Modbus Connection Type: TCP
    9074 compact rio 8 slots
    9234 module x3 
    9221 module x1
    9472 module x1
    Shared Variable Engine service running on windows os and rtos system 
    Used this  guide to learn about the modbus protocol as I searched all over the internet to learn about modbus 
    I already having Modbus IO Server software installed on the crio through ni max version 1.8 for NI RIO 4.0
    attached file(s)
    Image of Crio software specifications
    Image of the Data being written into variable in rt block diagram
    Short Version of the problem: Why is the io variable not being written into with properly converted data?

    The data can have zeros but not all of them will be zeros and I have another program (on local computer for database storage)that is recieving the same data through TCP and they are not zeros. 
    If a machine is running and is active then the data that will be collected should not be zero , it should infact  be some analog value > 0.
    I will look into the function you described
    How do you view the errors in the IO server subfolders ?
    Is it the modbus register called error status that returns an error code if so that value is currently 0 
    Regards mzamstl
     

  • Test network published shared variable

    Hi,
    I want to share data from a main VI to other VI´s on network (different PC´s) however i want to test it using a single PC. Is possible to make that test using a main VI and trying to share variables "on network" to receiver VI...?

    Absolutely!
    When in doubt, try it out.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Problems with communication across a network using shared variables

    I have two programs(projects) running on two different computers connected with a LAN. I am using LabVIEW 8.0, and the DSC-module. The program on one of the computers have measurements that I want to collect and show on the program running on the other computer on the network. I choose the indicator where I want to show the data, select ''Properties'', ''Data binding'', ''Shared Variable Engine (NI-PSP)'', ''Network Items'' and then browse for a Network...but the problem is that in my ''Network Neighborhood'' There is only one computer...and that is the one I am one...not the computer on my Network that I want to communicate with....
    Have anyone any suggestions on how to solve this?
    Kind regards Mari

    Mari,
    Check this link regarding trouble shooting network-published shared variables:
    http://digital.ni.com/public.nsf/websearch/6E37AC5435E44F9F862570D2005FEF25?OpenDocument
    This might be a firewall issue, so I would check that first.
    Frode

  • How do you synchroniz​e accesses to a LabVIEW Shared Variable?

    I would like to create an ad-hoc weather station program (I'll explain more in a bit).  I am using LabVIEW 8.0 Full Edition, and I would like to share data over a network between stations with the LabVIEW Shared Variable.  Here's what I want to be able to do:
    A node would start up, and begin publishing data to a network via a shared variable.
    The shared variable is an array of clusters
    The cluster information would hold things like:
    Station Name
    Station Location
    Weather information cluster (temperature, rainfall, windspeed, wind direction, etc...)
    Timestamp of last update
    When a new node would like to enter, it would bind to the shared variable, grow the array, and add its information.
    If a node's Station Name and Station Location is already in the shared variable, it would merely update the information in the cluster.
    Viewing nodes could pop in, bind to the shared variable, and read/display the information at any time. 
    I am trying to enumerate problems with this before implementing, and I have run into a stinker of a problem that I am not sure how to solve.  How do I synchronize accesses to the LabVIEW Shared Variable?  If I read the variable, modify it, and write it back, I will undoubtedly run into a race condition where 2 nodes attempt to update its data and I will lose the data written by the first node - Node A reads, Node A modifies, Node B reads, Node A writes, Node B Modifies, Node B Writes, and thus the modifications made by Node A are lost.  In my specific application losing some data isn't critical, but if not remedied this type of problem could cause massive amounts of data to be lost when there are numerous nodes, and that is definitely not acceptable. 
    Does anyone have any recommendations on how to synchronize the read-modify-write operations on the data in the Shared Variable?
    -Danny

    Wendy,
    I am afraid Semaphores are not network-shared objects (to my knowledge), they are system-level objects that use operating-system synchronization mechanisms.  If I were synchronizing on a single machine, a semaphore might be a valid mechanism; as an aside, most user-mode semaphores are designed to synchronize within a single process - to synchronize between processes you need to store the semaphore in the Kernel, and to synchronize over a network you would need a network node to handle serialization of requests.  My Shared Variable is published over a network, and to my knowledge there are no network-published synchronization mechanisms available - mostly because there is no way to currently perform an atomic test-and-set on the Shared Variable (am I correct?) and there isn't a mechanism for blocking access to a Shared Variable from another network device/machine (or is there?).  I've been looking for some way to implement an atomic test-and-set but I am running into a wall; I know that if I select the "single writer" attribute of the Shared Variable I can get LabVIEW to force a single writer allowing me to have an atomic "set", but I need more than that.
    If only there was a network-shared Semaphore or some way to block other network accesses to the Shared Variable I would be in business - something like what I want doesn't exist, does it?
    Thanks!
    -Danny
    Message Edited by texasdiaz on 02-23-2006 02:52 AM

  • Can I use the timestamp of a Network published global variable to reduce network traffic?

    I would like to use a couple of network-published global variables that will contain large clusters of data.  I want to host them on one device but read them from several - consider a distributed control system.  The data will update very infrequently, but, when it does, I want all my HMIs to know quickly.  I can have all the HMIs just read the data 4x/second (that would be fast enough) but I was wondering if there is a more elegant solution (still using global variables).  If I read only the timestamp 4x/second from each of the HMIs, compare it to the last read, and then poll the whole variable only if the timestamps are different, will that require less resources than just grabbing the whole variable every time?  In other words, does reading the timestamp use the same amount of resources as reading the whole variable?
    With really simple code, assuming the "Setup Data" cluster is quite large, does....
    ...get me any advantage over...
    Solved!
    Go to Solution.

    mark3545 wrote:
    So that means they are already doing what I want anyway, right?  If the reader only gets updated when the writer changes it, I can poll it as often as I want without increasing traffic, correct?
    That is correct.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Bug: Built Real-Time app won't run if it accesses a typedef'ed shared variable node

    Hello,
    I finished developing a Real-Time program that uses typedef'ed (clusters and enums) networked shared variables (SVs). It works fine when I run the program in Development mode. However, when I built and deployed it as a start-up app, it refuses to start. The VI monitor in the Distributed System Manager says that the VIs that use those SV nodes (and the top-level VI that references them) have "Bad" status, and the rest are "Idle".
    To get my built program to run, I had to disconnect all the variables from the typedefs. Deleting the SV nodes made the program run too, but that's not an option.
    Has anyone else encountered this?
    Platform: LabVIEW 2012 (32-bit), NI cRIO-9076

    Yes. See the following thread.
    Paolo
    LV 7.0, 7.1, 8.0.1, 2011

  • Access denied error for shared variables in application builder

    I'm trying to use SVs in my app.  I build an exe using app builder.  When I run my VI from the project, it works fine.  When I run from the app exe, I get an access denied error (-2147024891) trying to write a value to a SV.  My SV lib is hosted on my computer (it's a local SVE).  I've disabled autodeploy and my VI calls deploy library on the lvlib file before I try to use it.  What could I be dong wrong?

    Hi knicewar!
    Thank you for posting on the discussion forums!  What are you refering to when you say SVs?  Here is a KnowledgeBase article discussing the same error, although I am not sure it will be a direct application to your VI, since I am unsure what you mean by SV.  
    Kristen H.

  • Shared Variable programatic access error -1967362038

    I am trying to read/write about 300 tags from a AB ControlLogix 5561 processor from Labview 2011 on windows XP SP2 through RSLinx Classic OEM OPC Server.
    At first, I tried to do everything through front panel data binding through Datasocket, but I've seen that it becomes slow/unreliable when the bound control count reaches beyond 100 tags or so. Wrong values are read/written, some controls just won't bind intially or lose thier binding...it's really odd. So, I've put all of my faith in Labview's DSC module to solve all of my problems.  
    I installed it on a development system, played around with the programmatic access VI's using the NI's test OPC server and everything worked great. It really looked like the answer to all of my problems but upon installing it on the target system I can't get it to work the same way! 
    I've created a library of simply 3 bound variables to the PLC through an IO server pointing at the local instance of RSLinx. I am able to browse the PLC tag structure, so at least the link through RSLinx is working to some extent.
    Fairly often, when running the seach variable container vi on that library, I get error -1967362038 with explaination  "IAK_SHARED". When this error occurs, the same error shows up in the distributed system manager and the shared variables can no longer be read. I can't seem to pin down a pattern but happens every few minutes or roughly ever 3rd or 4th time I start the vi. When it happens, the only way I've found to get things working again is to undeploy and redeploy the library, while watching it in the distributed system manager, then continually loop the search variable container VI for a few seconds and eventually, the variable comes back to life.
    Does this sound like an issue with RSLinx? One of the previous posts related to this error mentioned that it may be due to some corrupt files in MAX?
    Other network published shared variables (non-OPC) seem to be OK so I think this is a problem related to the DSC module.  
    I rebooted twice immediately after the DSC installation.
    I have uninstalled SQL Server 2005 and the DSC module and reinstalled both. Twice.
    What could be causing this error?
    Would it be worth while to port over to the NI OPC Server?

    Hi pjrose,
    First, I notice that this post is pretty similar to a service request that one of my colleagues has been working on. Are you working with another NI Applications Engineer on this issue?
    That said, the issue could very well be related to the DSC module. I doubt that the error is a MAX corruption error, at least at present. One thing that would be worth checking would be the connections on your network. Additionally, what are the types of variables that you are accessing, and how specifically are you coding the access to them? If you could post an example of how you're accessing them, that would be helpful.
    Best,
    Dan N
    Applications Engineer
    National Instruments 

  • Not able to access Network Shared Variable when deployed in PC

    Initially, when we deploy a Network Published Shared Variable in PC and try to access the same (Read/Write) from RT, we get an error/warning "-1950679023". But when we access the same variable from the PC, it works fine. In the distributed system manager, we can see the variable getting deployed. Also the value changes in Distributed System Manager if we write a value from PC. The attached image "Shared variable Issue.png" will give more understanding of this issue. 
    The other way round it works fine i.e deploying in RT side and accessing from both RT and PC is working fine. 
    We also see that the network adapter settings is not loading properly in MAX, if at all we install any software in RT. With no software installed, it loads properly. 
    The following were the steps that we tried to solve the issue. 
    1.Flushing the entire NI software and Re- installing again 
    2.Formatting the RT(PXI). 
    3.Removing the EtherCAT Card and testing. 
    4.Checked the network properties of the RT network. 
    5.Checked the IP/Subnet/Gateway settings. 
    6.Checked Firewall Settings, If Shared Variable Engine is accessible.
    Attachments:
    Shared variable Issue.png ‏491 KB

    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.

  • How can I change my Shared Variable from "I/O Variable" to "Network Published"

    Hello,
    I have an application that is using a series of NI wireless sensor nodes.  I am trying to programmatically access shared variables.  Right now the only method I have found to access the data from the shared variables is datasocket read.  I am on labview 8.6.1 so I don't have as many shared variable options as newer versions of labview.  I do think there is a way to access properties for the shared variables, but I'm not sure about how to change the nodes channel properties to "Network-Published".  Do i need to remove the node from the project and bring it back in with the new settings?  When i have done this in the past i have run into naming conflicts.  I would appreciate any ligtht that can be shed on this issue that will help me create a vi that operates quicker.

    Any Shared Variable that has “I/O Variable” for its Variable Type (see screenshot of the Shared Variable Properties below) refers to any channel of data (such as Analog Input or Output or Digital Input or Output) directly from a module channel.  In other words, this is how you directly get the raw reading straight from (or to!) a specific module channel.
    You cannot edit the Variable Type to Network Published.  You can check “Enable Network Publishing” as above, which allows this Variable to be accessed from a VI on a Host VI.  You could also create a separate Network-Published Shared Variable which you can wire directly to the I/O Variable on the Target VI if you wish.
    Best,
    Ryan C.
    Applications Engineer
    National Instruments

  • How can I use an Access front end and Access button to control a LabView Shared variable boolean?

    My company has invested a lot of money on the office network to write many many access databases and front ends. I'm looking for a way to tie a button on an access front end to toggle a LabView boolean shared variable to notify me when they changed something on their side of the network. I'm not seeing anything that helps on a web or forum search. They don't like the idea of a separate labview control that they have to push a button on to let me know.
    Thanks
    Solved!
    Go to Solution.

    Hi Patrick,
    While this is not the intended purpose of Network-Published Shared Variables, you might be able to accomplish this by writing separate accessor VIs for reading from and writing to the variable, making sure to wire the inputs and outputs. Then, you could build a DLL, making sure that you include the accessor VIs as Exported VIs and include the DLL Library in the Always Included section of the DLL Build Specifications. During this process, you will define the function prototype, which will provide the function call, required parameters, and return values. Once the DLL is created, you can then call it and its functions from another programming language (C, C++, C#, VB, etc.). This may or may not work, but it is the only way that I can think of at this point. I have included some references that may help you in this process.
    Building a Shared Library in LabVIEW (White Paper)
    Calling LabVIEW VIs from Other Programming Languages (White Paper)
    Calling LabVIEW DLL From C# (Forum with Examples)
    I hope this helps.
    Regards,
    Mike Watts
    Product Marketing - Modular Instruments

  • Using network shared variables in two computers connected via a network switch

    let me start by saying im a rookie to the programming environment but i have used Labview a couple of times to understand the basics,  i have a computer and a laptop (both using vista), both of them with Labview Full development System (Student ed. with Mathscript) installed, so what im tryin to do is to use the built in microphone located in the laptop to aquire sound and then use a Shared Variable to transfere the sound signal from the laptop to the computer, the laptop and the computer are connected to a network via a network switch and ethernet cables,  so far i nothing worked, i can manage to create the shared variable in the laptop and use it there but it doesnt appear in the computer, im not sure whats the problem i have even disabled firewalls in both systems, help from anyone wil be appreciated.....

    Hi Lukie,
    This KB should be of some assistance to you.
    Trouble shooting network published shared variables
    Also the following link gives some instructions on the use of shared variables.
    http://zone.ni.com/reference/en-XX/help/371361B-01/lvhowto/bind_to_source/
    I hope this is of some assistance, let me know if you have any more problems.
    All the best,
    Message Edited by mickeyw on 08-05-2008 12:29 PM
    Mike W
    Applications Engineer
    National Instruments UK&Ireland

Maybe you are looking for

  • ERROR IN ACTIVATING INFO OBJECT

    GETTING AN ERROR WHEN I TRIED ACTIVATING THE INFOOBJECT. ERROR I GOT IS, " ERROR GENERATING MASTER DATA ROUTINES."

  • How do you fix the home button on a iphone 4

    iphone will not cut on. power button and home button are not working, and the phone is not dead

  • Problem in REM Backflush in Repetetive Mfg

    Hi i got the following error when i try to run the REM BACKFLUSH in repetitive process. (MFBF) " Update control of movement type is incorrect (entry 131 _ _ _ F) Message no. M7226 Diagnosis The system could not find entry 131 _ _ _ F in any of the mo

  • Oracle 10g XE

    I have installed oracle 10g XE & then created a new database manually named "WS". Database service created using ORADIM now how can i change "OracleXETNSListener" to "OracleWSTNSListener " ? Thanks Engr.M.K Chowdhury

  • Missing album/folder frame

    I've been using iPhoto 5 for some time and have never had this problem. I can see my film rolls in the library fine, all are intact, all folders on my computer are in the same location they've been for the last 2 years with no changes. However, I can