Weird delay reading shared variables

Hello,
I'm working on a project were I'm monitoring some prodution lines. I'm using DSC module's OPC server to connect to PLCs on the production line and I've created bound variables on my labview project of the PLC's tags.
On my project I have one main VI were I show information about the production lines and were I can access several subVIs were I show other information about those lines. Then I have a VI that is running in background were I'm reading about 50 shared variables from the PLC and where I'm registering some data in a MySQL database, datalogging data on the Citadel database and registering alarms.
The problem I'm having is that on the VI that runs in background I noticed a delay reading the variables that are reading containers weights from the production line. It seems that all the other shared variables don't suffer any delay, only the weight variables start having some delay when the values are increasing. It also seems like that, when I'm only running that VI alone, without running the main VI, there isn't any kind of delay. I'm reading the shared variables as shared variable nodes.
Can anybody help me understand what's happening and how can I fix this delay? The VI that runs in background is time critical and a weird delay like that messes up my data.
Solved!
Go to Solution.

Hi Mateus23,
The shared variable has various buffering capabilites, including integration with the Real-Time FIFO feature in LabVIEW Real-Time.
I guess that the buffering settings are causing the unexpected behavior.
Check these resources:
Buffered Network-Published Shared Variables (whitepaper)
Shared Variables Properties Dialog
   - Network Page
   - Real-Time FIFO Page
~~

Similar Messages

  • Read shared variable using D/3 DCS

    This is a rather odd question..  I think it can be done, but I have not yet figured how.
    A client has a DCS System (I believe from NovaTech), which communicates with a database.
    They use a different PC to get data from a cFP using Shared Variables.
    There is mention of data being sent over a Modbus Interface.
    They want to know if it is possible to read the Shared Variables directly using their DCS System.  If the DCS was from NI, it would probably be easier to accomplish.  However, I am not at all acquainted with the NovaTech product, but I believe there must be a way to innterface to it.  Probably using Data Sockets and/or PSP Protocol.
    I realize the above is rather obscure...  I have sent an email requesting more info and I am preparing the next email.  I figured that I'd better do some background investigation and ask proper questions.
    Has anyone attempted such a thing or similar?  How about reading Shared Variables from Non-NI software?  I did find some threads discussing reading/Writing (to/from) Shared Variables using LabWindows-CVI, but I suspect this will be quite different.  Maybe I'm wrong.. 

    Thanks Christian.
    I will continue in this thread after I find out more details from the client.
    RayR

  • How to read shared variables inside event structure ?

    Hi,
    I have a problem that my shared variables do not update inside event structure. The program(s) I am trying to get working is seen in the attached screenshot. It works as follows:
    0. I start the vi that is unsquared.
    1. I write a string to a shared variable using vi in red square. I make sure that its updated using write-wait-read.
    2. I run the other vi (blue square), this changes the boolean shared variable.
    The unsquared vi has been running the whole time, it has event structure bind to boolean shared variable change (the one in blue vi). After I have runned the blue vi, the unsquared vi should change the indicator values to match the ones in red vi. However I have to start the blue vi multiple times to get it to change, sometimes even 6 times.
    Also, when I change the value in red vi to a third value and start blue vi multiple times, the unsquared vi shows all the variables. I.e. I put "cat" to red then start red, put "mouse" to red then start red,... and then start clicking blue... Unsqured shows cat, mouse,..., dog (dog is the default).
    How can I force the shared variable to update inside event sructure. I want the current value of the variable, not some historical values.
    Attachments:
    Screenshot-5.png ‏108 KB

    Found the buffering... disabling it solved the problem... thanks.
    FYI, there is another solution that I just found out... attached. Adding timeout to the event structure and the variable read outside the event structure... This makes the shared variable strings (one that is read outside and the otherone that is read inside) different.
    Could someone explain why the variables are in different state even if they are used in the same place and looped with 10ms intervals?
    Juha
    Attachments:
    Screenshot-6.png ‏110 KB

  • Unable to read shared variable in signal express

    Dear all,
    I am trying to read a shared variable with data type 'Array of Double Waveform' and the signal express gives a network variable error stating
    "The data type of specified shared variable xxxxxx is not supported".
    could any one explain why is this not supported or suggest a work around.
    Munir.
    Attachments:
    Untitled-1.jpg ‏66 KB

    Hi Munir,
    the datatype you want to use is not supported in Signal Express. So if you choose this datatype you always get this error massage. As a work around I can recomment you to take the Double Waveform datatype this is supported, create a shared variable for each array element (waveform) and read this variable in Signal Express. This should help you out.
    If you got any questions feel free to ask me.
    Regards
    TomBaum

  • Can not read shared variable on cRIO, error -1950678968 nitaglv

    Hardware setup:
    Laptop
    Laptop connected via USB to a frammer garber. 
    Laptop IP: 192.168.0.2
    NI vision calculating a diameter and setting a network varaible
    cRIO
    cRIO connected to the laptop
    cRIO IP: 192.168.0.1
    Project has the shared variable in the cRIO library
    NI vision writes to the variable on the cRIO.  I can see the variable properly updating in system manager on the cRIO.  I can also run a VI in my computer that shows the variable properly updating.  But......   When I read the variable with a VI running on the cRIO, I get the folowing error and the variable never updates:
    Error -1950678968 occurred at Shared Variable in Main.vi
    Possible reason(s):
    LabVIEW:  Failed to load nitaglv, which is required for Network-Published Shared Variables.
    This error or warning occurred while reading the following Shared Variable:
    \\NI-cRIO-OASIS\cRIOVariableLib\BubbleDiameterFromVision
    \\192.168.0.1\cRIOVariableLib\BubbleDiameterFromVision
    (I do not get any errors at deloyment)
    So everything (NI Vision, a VI deployed on the laptop, NI Distributed System Manager) can see the variable on the cRIO being updated by the NI Vision.... Except for a VI running on the cRIO.
    I have verified that I have Network Variable Engine and Variable Client Support for RT installed on the cRIO.  I have tried reinstalling all s/w on the cRIO.  Tried rebooting all. And talked in a nice, positive, reassuring voice to the chassis.

    Hi!
    I just had the same issue with my cRIO 9073 using NI RIO 3.6.0.
    The problem is not caused by a corrupted project, but the improper installation of the OS on the target. There is nothing you can do using the SW installation wizard in MAX, as it does not matter if you intall a full RIO SW, minimal or custom.
    You have to install the full install or a custom one with Shared Variable support. Then you have to FTP to the cRIO, and manually edit the "ni-rt.ini" file located in the root of the controller.
    Make sure you have a line in the "[MODULE VERSIONS]" section which shows the version of the nitaglv.out file. (The problem is caused because this dll is not loaded when you try to access a SV) Mine looks like nitaglv.out=6.3
    Then you have to insert "nitaglv.out;" without quotes to the [LVRT] section's StartupDLLs key's value. I did it after the taggerrt.out name. So my key entry now looks like this:
    [LVRT]
    StartupDLLs=nisysapirpc.out;NiViSrvr.out;NiRioRpc.out;taggerrt.out;nitaglv.out;sysstatepublisher.out;
    memoryChecking=False
    LABVIEWRTDir=/c/ni-rt/system
    PATH=/c/ni-rt/system/;/c/ni-rt/;
    CDIntervalTicks=55
    WebServer.Enabled=FALSE
    RTTarget.VIPath=/c/ni-rt/startup
    RTTarget.IPAccess=+*
    RTEnetRcvMode=2
    RTCPULoadMonitoringEnabled=True
    RTTarget.ApplicationPath=/c/ni-rt/startup/startup.rtexe
    server.tcp.access="+*"
    RTTarget.LaunchAppAtBoot=True
    RTTarget.EnableFileSharing=True
    server.tcp.serviceName="Main Application Instance/VI Server"
     After you are done with the editing, you have to save the file, and overwrite the original one. You have to reboot the controller for the modification to take effect.
    After this you will be able to host your variables on the cRIO and also read/write them from the application running on that same target.
    I hope this will help for you too.
    Regards,
    Peter

  • Reading shared variables

    hi ,
    im having problems reading a shared variable value from a vi ,
    i created a project library , periodic i/o server deployed it. created the shared variables i needed . bound them , created my new vi  draged the shared variable i wanted to read , just a time value , set it to a indicator , then ran the two vi s the triangle has apeared on both the main vi and the hmi vi ,and is green , no conflicts arose , but the hmi vi isnt displaying the data ,
    both vi s are on the same computer , have i missed somthing ,?

    Hi Vadajooz,
    Good Morning and I hope your well today.
    I was wondering how you got on with your application and if you still require support?
    If so, I would be interested to know what version of LabVIEW you are using?
    I would make two simple VIs, one to write to the variable and one to read from the variable. 
    1. Create the bound variable.
    2. Deploy the library,  make sure it appears in the Distributed System Manager (DSM - LabVIEW 8.6+) or Variable Manager (LabVIEW 8.5 - ).
    3. Run the writer VI, for example, just have a switch (true/false) and when you change the switch state does the status update in the DSM or Variable Manager?
    4. If so, then run the reader VI, is the status matching the writer and there DSM/Variable Manager. 
    *DSM/Variable Manager can be found by going to tools>>... in the VI toolbar. 
    If you are still having problems,
    A. There is a known issue with bound variables in LabVIEW 8.6 - so I can inform you on this if you are using it.
    B. I would confirm that the variable is deployed - to do this right-click the library and select Deploy All. 
    C. Make sure you write to the variable before reading from it.
    D. Add error cluster indicators and note any errors you see.
    E. Please attach your simple (test) project - so we can confirm its correct. 
    I hope this helps, 
    Kind Regards
    James Hillman
    Applications Engineer 2008 to 2009 National Instruments UK & Ireland
    Loughborough University UK - 2006 to 2011
    Remember Kudos those who help!

  • Reading shared variables in C.

    Hello all,
    How would I recognize the value of a LabVIEW shared variable within the C programming of an mbed microcontroller (LPC1768). We have created a connection between the mbed and LabVIEW, but can't tell if the shared variable we created is actually being passed to the mbed.
    Thanks,
    Joe Maness

    If you extend your LabVIEW by the Measurement Studio option you'll get a licenced .net component called NetworkVariables, which allows to access the shared variables engines processes and it's variables.
    I don't no the IDE / Compiler you use to program your controller, but if it's able to handle .net / COM you have all options to access the SVE and there's no need to involve LabVIEW.
    Feel free to ask more
    Christian

  • Is Shared Variable Engine with LV8 an OPC server ?

    Hello
    Is the shared variable engine with LV8 an OPC server ?
    Does any OPC client can acces to Variable Engine OPC server an read shared variable ?
    Can I build an installer and deploy my application with Variable Engine OPC server on other PC without LV8.
    Thank you 

    Hi
    You can communicate between an OPC serveur and LV8 and use shared variable. To deploy an LV8 exe application, you must have the run time engine installed on the PC without installing LV8. You can create a setup with LV 8 in which you can integrate the run time engine.
    Kamal
    NIF

  • Shared Variable Engine

    Hi,
    What happens to network variables stored in the RT machine after a restart(after calling RT restart). I am experiancing weid behaviour.
    They seem to reset to a default value and I checked in the project via their propertis, Initial values is not set, and there are no callers at the start of the VI.
    Anyone has any ideas for this? Or at least tell me if values should persist after restart or reset?
    Thank you very much,
    Mihai

    Hi,
    I use shared variables stored on a PXI RT embedded controller.
    After a reboot, the variables are not set to the default value corresponding to their data type structure but to a "no known value" state (I don't know how it's exactly labelled in english, as I use a french version of LabVIEW).
    I noticed that if you try to read a shared variable in a "no known value" state using the "read variable" VI, you just get a warning. If you use the "read variable with timeout" VI, the code waits for a modified value of the variable, but once the shared variable has been initialized (ie has a known value) no stop occurs at the first reading with the "read variable with timeout" VI (even with an infinite timeout), as the current value of the variable when the code is launched is viewed as a "new" value.
    Not sure that this message will help you
    I've also experienced strange behaviours in reading shared variables : I've posted here a message in the french section af the forum, but without answer ; I plan to repost it here after new tests.
    Best regards,
    HL

  • Shared Variable Crashing LabVIEW

    This is just one of those projects that has a brick wall at every turn so far. Two computers running LV2009. Computer A hosts Data Write Shared Variable. Computer B hosts Data Read Shared Variable. Data Read is bound to Data Write. Everything was working fine, and then late yesterday afternoon, I don't think I had changed anything on the shared variable, I start up my VI on Computer B, and LV crashes. The VI starts to run until the first execution of Data Read, and then poof, everything open in LV dissapears. The problem is one hundred percent repeatable since then.
    Here is what I know:
    1. An error indicator hooked to Data Read shows -1950679034 (Shared Variable has no value) for about a second before the crash. Everything stops executing as soon as the warning appears.
    2. The Data Write is single writer, but it is also occasionally read in the VI that it is written in. It is not being read when the crash happens. I can however perform the read on Computer A without incident.
    3. Not sure if this is related, but if I open the VI on Computer B, and then open the project, I am not able to drag Data Read from the project onto the block diagram. I also cannot perfrom any operations on the Shared Variable (like right click, ignore timestamp). I have to close the VI and reopen it from the project. Thinking back, this problem may have started when I opened the VI without opening the project.
    I am torn between abandoning Shared Variables and trying to figure this out. I would definetely prefer to use the Shared Variable, especially because I need some buffering. I'm guessing I can buffer things some other way. Not sure if I can remotely access a queue, or ... ?
    Solved!
    Go to Solution.

    I looked at STM, but I think the Data Socket VI's may be a better fit for me. It seems like Data Socket and shared variables are sort of intertwined, but I'm hoping DS doesn't suck as much as the SV seems to so far.
    I think NIC means network interface card? Anyway, I don't really know how many I have. The Data Writer is on a PXI8108 with Windows, the reader is an old crappy Dell that I inherited with the desk.
    I'm also not sure about the logos.ini file you referred to.
    My intention is to transmit an array of double waveform that is about 15 - 20 channels acquired at 100 - 1000 Hz. I think the Data Socket looks like the simplest way to do this, and I could live with 100 Hz if speed is a problem, but I sort of don't think it will be. I'll try tomorrow unless somebody has a better suggestion.
    By the way, I saw in another post a similar problem with Shared Variables that is supposedly fixed with the new patch for 2009, but I'm not sure I trust SV's because this will, for about thirty seconds of its lifetime, be one of the most critcal applications I've written, so I want confidence that it will work for those thirty seconds.

  • 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 variable sampling rate

    Hi, I would want to read some shared variable on the network at 1KHz on SignalExpress but I'm actually limited at 200Hz on it.
    Is there any possibility or not?
    Thanks.

    Hi pattegain,
    I'm not sure reading shared variables published on the network at 1kHz is possible. 
    I suggest you to read this :
    Buffered Network-Published Shared Variables: Components and Architecture
    http://zone.ni.com/reference/en-XX/help/371268P-01/expresswb/read_shared_variable_se/
    However, I tried the Shared Variable Examples (Reader and Writer) and I have been able to run the Reader with 0,002 sec (500Hz) as Sample Period parameter. Did you test those examples?
    Regards,
    Jérémy C.
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    Travaux Pratiques d'initiation à LabVIEW et à la mesure
    Du 2 au 23 octobre, partout en France

  • Problem Sharing Variables between 2 machines

    I am having problems trying to create a project that would share variables between multiple computers. I am using Labview 8.2.1 (I am new to 8.2.1 and Shared Variable).
    here is what i did:
    1. I created the project with Client and Server VI's and a library containing shared variables, which both of them call
    2. I placed this project onto 2 computers (XP on a local workgroup, no firewall, see each other).
    3.  On one of the computers I bound all shared variables to their counterparts on the other computer
    The system is "almost working"
    The problems are:
    - I initially used wrong type variables for few items. I then modified the variables in both VI's and Shared Variable libraries and repeated the Steps 1-3 above.
    But the sysrtem has some sort of a buffer somwhere, because it keeps bringing the old types of shared variables back (when I monitor them using Shared Variable Monitor).
    - When I do binding to source, the system shows wrong variable types (for example DBL instead of U8).
    - It takes almost a second to write and read shared variable (my network is quite fast)
    I saw that the Labview Example with Server and multiple Clients uses 2 sets of shared variable and they bind - separate sets (different names) fro client and server within the same project. Do I have to do this or is this done just to simplify bindinga nd future distribution?
    Is there a buffer/setup/file that I need to clear to get rid of "old" shared variable assignements? (I tried undeploy/deploy - does not help...)
    Thank you very much,
    Gleb.

    Hi Gleb,
    It sounds like the shared variable is not getting completely undeployed from the shared variable engine.  I would recommend opening the shared variable manager and undeploying the library from there just to see that it is no longer in the engine.  Then, redeploy the library and rebind your variables to the host library that you have deployed.
    It is not necessary to have different sets of variables for client and host.  The important part of the variable is what it is bound to, not necessarily what it is named.  So just undeploy your variable, double check the settings of the host variable, then redeploy using the variable manager and rebind your client variables. 
    I hope this helps,
    Brian Coalson
    Software Engineer
    National Instruments

  • Analoge shared variable read Problem

    Can any body help me in reading analogue shared variable read in LabVIEW 2009 dynamic event structure. I have tried to read the above tag through Tag Reader VI but i have experienced too much delay in first read for real data i.e. Plant data from PLC. when this particular VI executes it take minutes to display the data. if some needs its code i can provide it. Thanks in advance

    This seems to be a LabVIEW problem, so please post it over in the LabVIEW forum.
    (the feedback forum is for problems with the website itself)
    LabVIEW Champion . Do more with less code and in less time .

  • Labview is reading zero from shared variable

    Hello everyone 
    -I have a problem in labview shared variable cause it reads only zero value for all inputs and outputs and timers in S-1200 ...etc
    but in NI OPC server using quick client it reads the correct value but when adding them in labview project they are not reading the correct value and only retruing zero
    any suggestions 
    Thanks

    Hi,
    I recently finished the commisioning of the system I started to work upon. Hence the delay to come back to this thread.
    During the commissioning of the system, I was concentrating on finalizing the system functionality and was using only the PC#1. Now when all the system functions were finalized, we duplicated the changes to PC#2 and started the operation.
    What we observed when the PC#2 was started, was that if we were to open the same HMI page as in PC#1, the operation of the HMI was very sluggish. When we selected a different page for both PC#1 and PC#2, the HMI operation was good,  all operations seemed to happen in real time!!
    To give a background of the HMI, we have a subpanel to which the desired HMI page/screen is loaded. This loads a VI related to the HMI page.
    Here, I am guessing that when I load the same page in both the PCs, the read/write operations to the shared variable(it is the same in both PC, and is deployed in a library on the cRIO) are some how hindered due both PCs trying to access the same network resource from different locations.
    Is this guess correct? Any work arounds or solutions? Do I need to post any more information?
    Thanks in advance,
    Regards

Maybe you are looking for

  • Most of my music has been lost, how can i get it back?

    almost all of my music has been lost randomly when i openned my iTunes and i can't find a way to get it back!

  • Quicktime NOT working

    After last update, Quicktime NOT working / crashes constantly. I do video editing as part of business, this is screwing up my life. I can't delete QT, can't update, repair, fix or solve in anyway I can think of. HELP PLEASE!!! In case info needed, I

  • User Getting Error on Setup

    Hi All, I am currently rolling out excahnge and getting users all hooked up. All seemed to be going fine until 1 machine as the following issue. The name cannot be resolved. The Connection to microsoft Exchange is unavailable. Outlook must be online

  • Query Related problem

    Dear All , I am new to BI . I am facing one problem please help me . There is report which shows the period wise cumulative balance of G/L accounts for entered company code , Fiscal year and Ledger type entered on selection screen . As of on the sele

  • When the imac is turned on, the only thing on the screen is folder with flashing ?

    When I turn on my imac ihave a gray screen with a small folder in the center and a flashing ? and face.  What does this mean and how do I get out of that screen?