Why shared variable generates events when I write constant value?

Hello all,
I'm using LV 8.5 with DSC packet.
I modified "DSC Events Demo".vi and made a test. I noticed that only variable which work okay is double typed. Why this code generate events all the time when I write constant values to shared variables? Double is okay, but string and boolean types not work okay. Is there any other people how have noticed same symption?
Attachments:
modified_dsc_event_demo1.zip ‏391 KB

You may get an initial event on startup which is normal.  Also make sure that you have not enabled timestamp change events.

Similar Messages

  • Generate event when stack changed

    I have a task develop a class Stack that generate event when you add new element ? Develop a class Stack is not a problem, what means event that apears when a new element is added ?[                                                                                                                                                                                                                                                                                                                                                                                               

    That about awt / swing ..or I can to apply listeners
    to My Stack ?Sorry, I thought there were also non-GUI examples there. Apparently not.
    It's probably the intention to implement the observer pattern into your code.
    Here's a small demo of how this can be done:import java.util.List;
    import java.util.ArrayList;
    class Main {
        public static void main(String[] args) {
            MagazinePublisher publisher = new MagazinePublisher();
            Subscriber carl = new Subscriber("Carl");
            Subscriber pete = new Subscriber("Pete");
            Subscriber zeke = new Subscriber("Zeke");
            publisher.registerObservers(carl);
            publisher.registerObservers(pete);
            // whenever the state of the 'publisher' changes, it's
            // subscribers should be notified
            publisher.notifyObservers();
            publisher.registerObservers(zeke);
            publisher.notifyObservers();
            publisher.removeObservers(pete);
            publisher.removeObservers(carl);
            publisher.notifyObservers();
    interface MyObserver {
        void update(int edition);
    interface MySubject {
        void registerObservers(MyObserver mo);
        void removeObservers(MyObserver mo);
        void notifyObservers();
    class MagazinePublisher implements MySubject {
        List<MyObserver> observers;
        int edition;
        public MagazinePublisher() {
            observers = new ArrayList<MyObserver>();
            edition = 1;
        public void notifyObservers() {
            for(MyObserver mo : observers) {
                mo.update(edition);
            edition++;
        public void registerObservers(MyObserver mo) {
            observers.add(mo);
        public void removeObservers(MyObserver mo) {
            observers.remove(mo);
    class Subscriber implements MyObserver {
        String name;
        public Subscriber(String n) {
            name = n;
        public boolean equals(Object o) {
            return this.name.equals(((Subscriber)o).name);
        public void update(int e) {
            System.out.println(name+" recieved a copy of the "+e+" edition!");
        // hashCode() and other methods ...
    }Details about this design pattern:
    http://en.wikipedia.org/wiki/Observer_pattern
    or Google, of course:
    http://www.google.com/search?hl=en&q=Observer+pattern&btnG=Google+Search
    Good luck!

  • 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

  • In the shared variable properties box, when enabling aliasing, what is the difference between binding to a project variable vs. to a psp url

    In the shared variable properties box, specifically with regard to a the target being an rt target, when enabling aliasing, what is the difference between binding to a project variable vs. to a psp url?

    The difference is in the type of variable you are binding it to.  A project variable is a variable that lives within the specific project in which it was created.  A PSP URL is an address using the Publish-Subscribe Protocol (PSP).  You can learn more about PSP URLs here: http://zone.ni.com/reference/en-XX/help/371361G-01/lvconcepts/using_datasocket_technology/#Specifyin...
    PSP URLs will enable it to communicate between different machines and also between projects which may or may not be open.  The project variable will exist within the project.
    Julian R.
    Applications Engineer
    National Instruments

  • Re: shared variable: create programmatically then read/write

    I programatically create and destroy Shared Variables using these subVIs (see enclose llb file for Add Variable Connection.vi and Delete Variable Connection.vi).  But it seems to take a long time to run each subVI.  This might be tolerable for a single Shared Variable, but it gets rather lengthy if several need to be created or destroyed.  The user specifies how many depending on how they are using the application.  Is there a more efficient way of doing this?
    Also, after a Share Variable is "created," it can take a while before it is usable for reading and writing in another part of the application.  Is there a way to determine a Share Variable is ready prior to using Search Variable Container and Open Variable Connection functions to find and use it?

    Ummm, nothing attached. Also mention, when you do post, what version so that people won't waste time downloading when they don't have the appropriate version installed.
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • Why my full name appears when I write a review for an app?

    When I write a review for an app, my full name appears! I would like to use a pseudo but it seems that I can't!
    Does somebody have/had the same problem?

    I just wrote a review to see what happens.  The name under your review will be the same name as it appears in this forum.  Only way to change that is to create a new forum account with the name you would like to appear in the reviews.

  • How to catch an event when the user change values in the project information dialog

    hi,
    i would like to know how to catch an event in my C# code when the user change values in the project information dialog?
    taskChange doesn't catch these changes.
    thanks.
    Thanks, Sharon.

    You need to write save button event handler for project information dialog. Link is having same functionality described. 
    http://blogs.msdn.com/b/husainzgh/archive/2011/08/01/hooking-into-the-project-detail-page-ribbon-save-button-without-overriding-out-of-box-functionality-in-project-web-access-for-project-server-2010.aspx
    http://www.projectserver2010blog.com/2010/01/sharepoint-2010-webpart-client-server.html
    kirtesh

  • Generate event when file contents change

    I should be informed (an event should be generated) when contents of a file changes .
    How should I implement this using java

    I did something along the lines in one of my projects. Basically it came down to the following:
    Create a FileChangeMonitor class that can register listeners for changes in certain files. This class starts a thread that checks the timestamps of the registered files once in a while. When a change is detected, an event will be fired to the listener.
    I can send you the code, but I first have to find the correct backup CD it is on...
    Cheers,
    --Arnout                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Why is page generating request when clicked on menu?

    Hello,
    I am using JDeveloper 11.1.1.4.0
    Here is the sequence of activities in my application:
    1. User works on screen1
    2. He clicks on menu item, to go to screen2
    On the server it is observed that
    3. A request for screen1 is received. Then is received the request for screen2.
    Why is request for screen1 received on server?
    How do I ensure that request for screen1 is not sent to server?
    Regards,
    Amar

    Amar,
    This is how JSF works - events post back to the same page, even though you may end up navigating. This is called the "postback" pattern if you'd like to read more about it.
    John

  • Why are bookmarks generated intermittently when PDF created using EXCEL VBA?

    I have Windows 7 installed and Acrobat Pro 9 installed. There is an EXCEL application that creates PDFs successfully. Howver, bookmarks are generated sometimes and sometimes they are not generated. This happens without changing any code. I am at my wits end and would appreciate any assistance. Here is the code:
    Function PDF_PRINTING_2007()
    Dim V_NBR_OF_RPTS As Integer
    Dim stdPrinter As String
    Dim Prints, z, n As Integer
    Dim pdfile, pdtitle As Boolean
    Dim V_RPT_ARRAY(800) As String
    Dim V_RPT_PAGES_ARRAY(800) As Long
        Application.ScreenUpdating = False
        V_NBR_OF_RPTS = 0
        Erase V_RPT_ARRAY
        Erase V_RPT_PAGES_ARRAY
        V_PLANT_SUMMARY = ""
        Sheets("TABLE OF CONTENTS").Activate
        V_TOC_LAST_ROW = Cells(65536, 7).End(xlUp).Row
        V_TOC_ROW = 5
        Do Until V_TOC_ROW > V_TOC_LAST_ROW
            If Cells(V_TOC_ROW, 7) = "Y" Then
                V_RPT = Cells(V_TOC_ROW, 2).Value
                If V_RPT = "PLANT SUMMARY" Then
                    V_PLANT_SUMMARY = "Y"
                End If
                If V_RPT = UCase("SUMMARY CAGE & HOIST") Or V_RPT = UCase("PLANT SUMMARY") Then
                Else
                    V_NBR_OF_RPTS = V_NBR_OF_RPTS + 1
                    V_RPT_ARRAY(V_NBR_OF_RPTS) = V_RPT
                    V_RPT_PAGES_ARRAY(V_NBR_OF_RPTS) = Cells(V_TOC_ROW, 6)
                End If
            End If
            V_TOC_ROW = V_TOC_ROW + 1
        Loop
        Sheets("SYS - USER INTERFACE").Activate
        V_RPT_PERIOD = Cells(1, 1)
        V_PLANT_NBR = Cells(1, 2)
        V_PLANT_NAME = Cells(1, 3)
        Set AcroApp = CreateObject("AcroExch.App")
        Set PDBookmark = CreateObject("AcroExch.PDBookmark")
        Set avDoc = CreateObject("AcroExch.AVDoc")
        Set pdDoc1 = CreateObject("AcroExch.PDDoc")
        Set pdDoc2 = CreateObject("AcroExch.PDDoc")
        'Print Worksheets to PDF Files
        stdPrinter = Application.ActivePrinter
        'Commented out next line for Acrobat 8.x - 1/29/2008 - CR24709 and WP25089
        ' Application.ActivePrinter = "Acrobat PDFWriter on LPT1:"
        AppendIni ("C:\temp\Sheet1.pdf")
        'Commented out next line for Acrobat 8.x - 1/29/2008 - CR24709 and WP25089
        'Sheets("COVER SHEET").PrintOut
        'Added the next 3 lines for Acrobat 8.x - 1/29/2008 - CR24709 and WP25089
        Sheets("COVER SHEET").Activate
        PageSetupFitToPage
        SaveToPDF ("C:\temp\Sheet1.pdf")
        pdDoc1.Open ("C:\temp\Sheet1.pdf")
        pdDoc1.SetInfo "Title", "Cover Sheet"
        pdDoc1.Save 1, "C:\temp\Sheet1.pdf"
        pdDoc1.Close
    ' The "TABLE OF CONTENTS" worksheet contains color.  Reset it to black and white.
        Application.DisplayAlerts = False
        On Error Resume Next
        Worksheets("SYS - PDF WS").Delete
    'EOB change for Priority #12--Arial named range dialog box error
    '  Comment out alert below
    '    Application.DisplayAlerts = True
    'EOB change for Priority #12 end
        Sheets("TABLE OF CONTENTS").Copy Before:=Sheets("SYS - USER INTERFACE")
        ActiveSheet.Name = "SYS - PDF WS"
    'EOB change for Priority #12--Arial named range dialog box error
    '  insert alert below
        Application.DisplayAlerts = True
    'EOB change for Priority #12 end
        Sheets("TABLE OF CONTENTS").Activate
        V_TOC_ROW = 5
        Do Until V_TOC_ROW > V_TOC_LAST_ROW
            If Cells(V_TOC_ROW, 7) = "Y" Then
                V_RPT_NAME = Cells(V_TOC_ROW, 2)
                Cells(V_TOC_ROW, 2).Clear
                Cells(V_TOC_ROW, 2) = V_RPT_NAME
            End If
            V_TOC_ROW = V_TOC_ROW + 1
        Loop
        Cells.Select
        Selection.Font.Color = vbBlack
        Selection.Interior.Color = vbWhite
         AppendIni ("C:\temp\Sheet2.pdf")
         'Commented out next line for Acrobat 8.x - 1/29/2008 - CR24709 and WP25089
         'Sheets("TABLE OF CONTENTS").PrintOut
         'Added the next 3 lines for Acrobat 8.x - 1/29/2008 - CR24709 and WP25089
         Sheets("TABLE OF CONTENTS").Activate
         PageSetupFitToPageWidth
         SaveToPDF ("C:\temp\Sheet2.pdf")
         pdDoc2.Open ("C:\temp\Sheet2.pdf")
         pdDoc2.SetInfo "Title", "Table of Contents"
         pdDoc2.Save 1, "C:\temp\Sheet2.pdf"
         pdDoc2.Close
        Application.DisplayAlerts = False
        Worksheets("TABLE OF CONTENTS").Delete
        Sheets("SYS - PDF WS").Copy Before:=Sheets("TEMPLATE TBL OF CONTENTS")
        ActiveSheet.Name = "TABLE OF CONTENTS"
        Worksheets("SYS - PDF WS").Delete
        Application.DisplayAlerts = True
        Prints = 3
        If V_PLANT_SUMMARY = "Y" Then
            Sheets("PLANT SUMMARY").Activate
            Sheets("PLANT SUMMARY").PageSetup.LeftFooter = Now()
            Sheets("PLANT SUMMARY").PageSetup.CenterFooter = "#" & V_PLANT_NBR & " " & V_PLANT_NAME & Chr(13) & V_RPT_PERIOD
            'Sheets("PLANT SUMMARY").PageSetup.RightFooter = "Page 1"
            'eob change start here--Change #9 comment out page numbers
            'Sheets("PLANT SUMMARY").PageSetup.RightFooter = "Page " & Prints
            'eob change end
            AppendIni ("C:\temp\Sheet" & Prints & ".pdf")
            'Commented out next line for Acrobat 8.x - 1/29/2008 - CR24709 and WP25089
            'Sheets("PLANT SUMMARY").PrintOut
            'Added the next 2 lines for Acrobat 8.x - 1/29/2008 - CR24709 and WP25089
             Sheets("PLANT SUMMARY").Activate
             SaveToPDF ("C:\temp\Sheet" & Prints & ".pdf")
             pdDoc2.Open ("C:\temp\Sheet" & Prints & ".pdf")
             pdDoc2.SetInfo "Title", "PLANT SUMMARY"
             pdDoc2.Save 1, "C:\temp\Sheet" & Prints & ".pdf"
             pdDoc2.Close
            Prints = Prints + 1
        End If
        V_RPT = 1
        On Error Resume Next   'DO NOT REMOVE THIS LINE
        Do Until V_RPT > V_NBR_OF_RPTS
        v_sheet_name = V_RPT_ARRAY(V_RPT)
            Sheets(v_sheet_name).Activate
            Sheets(v_sheet_name).PageSetup.LeftFooter = Now()
            Sheets(v_sheet_name).PageSetup.CenterFooter = "#" & V_PLANT_NBR & " " & V_PLANT_NAME & Chr(13) & V_RPT_PERIOD
            'eob change start here--Change #9 comment out page numbers
            'Sheets(v_sheet_name).PageSetup.RightFooter = "Page " & Prints
            'eob change end
            AppendIni ("C:\temp\Sheet" & Prints & ".pdf")
            'Commented out next line for Acrobat 8.x - 1/29/2008 - CR24709 and WP25089
            'Sheets(V_SHEET_NAME).PrintOut
            'Added the next 2 lines for Acrobat 8.x - 1/29/2008 - CR24709 and WP25089
             If v_sheet_name = "EXPLANATION OF PLANT VARS" Then
               PageSetupFitToPageWidth
             End If
             SaveToPDF ("C:\temp\Sheet" & Prints & ".pdf")
             pdDoc2.Open ("C:\temp\Sheet" & Prints & ".pdf")
             pdDoc2.SetInfo "Title", v_sheet_name
             pdDoc2.Save 1, "C:\temp\Sheet" & Prints & ".pdf"
            Sheets(v_sheet_name).DisplayPageBreaks = False
            Prints = Prints + 1
            pdDoc2.Close
            V_RPT = V_RPT + 1
        Loop
        Kill ActiveWorkbook.Path & "\New Costbook.pdf"
        'Consolidate PDF Files
        On Error GoTo Err1
        pdfile = avDoc.Open("C:\temp\Sheet1.pdf", "Window Title")
        Set pdDoc1 = avDoc.GetPDDoc
        AcroApp.MenuItemExecute ("NewBookmark")
        pdtitle = PDBookmark.GetByTitle(pdDoc1, "Untitled")
        pdtitle = PDBookmark.SetTitle("Cover Sheet")
        pdDoc1.Save 1, ActiveWorkbook.Path & "\New Costbook.pdf"
        For z = 2 To Prints
            n = pdDoc1.GetNumPages()
            pdDoc2.Open ("C:\temp\Sheet" & z & ".pdf")
            If pdDoc2.GetNumPages() <> 0 Then
                pdDoc1.InsertPages n - 1, pdDoc2, 0, pdDoc2.GetNumPages(), False
                Set avPageView = avDoc.GetAVPageView()
                avPageView.GoTo (n)
                AcroApp.MenuItemExecute ("NewBookmark")
                pdtitle = PDBookmark.GetByTitle(pdDoc1, "Untitled")
                pdtitle = PDBookmark.SetTitle(pdDoc2.GetInfo("Title"))
                pdDoc2.Close
                pdDoc1.Save 1, "C:\temp\Sheet1.pdf"
            Else
                pdDoc2.Close
            End If
        Next z
        avPageView.GoTo (0)
        pdDoc1.SetPageMode (3)
        pdDoc1.Save 1, ActiveWorkbook.Path & "\New Costbook.pdf"
        pdDoc1.Close
        Set AcroApp = Nothing
        Set PDBookmark = Nothing
        Set avDoc = Nothing
        Set pdDoc1 = Nothing
        Set pdDoc2 = Nothing
        Application.ScreenUpdating = True
        Sheets("SYS - USER INTERFACE").Activate
        AppActivate "Microsoft Excel"
        MsgBox "File Saved As: " & ActiveWorkbook.Path & "\New Costbook.pdf", vbInformation
        Application.ActivePrinter = stdPrinter
        Kill "C:\temp\Sheet*.pdf"
        Exit Function
    Err1:
        AppActivate "Microsoft Excel"
        MsgBox Err.Description
        Application.ActivePrinter = stdPrinter
    End Function

    Acrobat Scripting Forum http://forums.adobe.com/community/acrobat/acrobat_scripting
    or more likely
    Acrobat SDK Developer Forum http://forums.adobe.com/community/acrobat/acrobat_sdk

  • Coercion problem when using Shared Variable

    I have a curious coercion problem when using Shared Variables.  I want to share the state of a State Machine, which is an enum saved as a control (typedef) called TYPE State (see attached).  I create a shared variable called State and define it as a Custom Control, using the just-mentioned typedef.  So far, so good.  I've attached three simple VIs -- the first one, Init State, simply wires a constant to the input of the Shared Variable to initialize it -- the wired constant is, of course, defined by the typedef.  However, the Get State and Set State, meant to wire an indicator (for reading the state) or control (for setting it), develop coercion dots when wired into the Shared Variable.  Why?  How do I get rid of the dot?  [I suppose I could abandon my typedef and custom control, but the beauty of typedefs and custom controls is that it "enforces" rules, lets you use enums for clarity, keeps the code "honest", etc. -- I'd hate to give that up just to get rid of a dot!].
    On a related note, the code seems to work.  This is much too simplistic to do anything, but if you open Set State and Get State, set the state to anything, run it (it immediately stops, of course), then run Get State, you'll see the chosen state appear in the indicator.  So it does appear to work.  The "error" (coercion dot) may, I suppose, be a "bug" in Labview because it can't figure out the mapping of the (very simple!) Custom Control, but if so, I hope it gets fixed quickly!
    Bob Schor
    Attachments:
    Coercion Problem1.zip ‏38 KB

    Hello Bob,
    I am also seeing this behavior, I will escalate this question to our LabVIEW developers and post again here no later than next Tuesday, November 27th as National Instruments will be closed for the remainder of this week.
    If this issue does turn into a product suggestion, I would suspect the workaround would to live with the coersion dot for the time being.
    Enjoy the holiday
    Regards,
    Erik J.
    Applications Engineer
    National Instruments

  • DSC - Event triggering for Single Process Shared Variables

    Hello,
    I understand how to set up a Value Change Notification for Network Published Shared Variables so that an event will trigger when that particular Shared Variable changes. However, I can't figure out how to do the same for Single Process Shared Variables. Is this even possible? Can someone shine a light on this, please?
    Thanks in advance.
    - James Pham
    Solved!
    Go to Solution.

    VRspace4,
    Hello! It is not possible to enable alarming for Single Process Shared Variables. A workaround to setup a Value Change Notification would be to create a network shared variable that reads from your Single Process Variable, but at that point in time it might be worth just replacing your variable with a networked shared variable.
    Ben Sisney
    FlexRIO V&V Engineer
    National Instruments

  • Modbus Ethernet read and write to a Eurotherm 6180XIO Modbus server using LV8.2 shared variables

    I am having EXTREME difficulty trying to establish communications with a Modbus device using LV8.2 shared variables.  The device is a Eurotherm 6180XIO Datalogger configured as a Modbus master.  The PC and a cFP-1804 are slaves.  All IP addresses are set correctly.  This approach using shared variables would seem simple, but I can't find any examples or proper guidance on how to get it working.  I am trying to avoid having to mess around with TCP/IP, OPC, or any other old-fashioned method.
    I have read many threads on related topics but none directly apply to this situation.  I have created a library containing a Modbus I/O server and shared variables bound to read and write holding registers.  I have followed all recommended tips for creating such variables but I can neither read or write data.  All data types are U16 due to Modbus protocol limitations.  I have also applied the LV x10 factor in the most significant digit in the register offset (6 digits instead of 5).
    I have a cFP-1804 on the same network which reads into the datalogger OK.  The registers I use are 31000 (for CH0 on module 0, 31002 for CH1, etc) and the data can be read as FLOAT32.  I have updated the firmwate on the 1804 to the latest level.  I cannot even get shared variables to read SGL values.  Using registers 301001 for CH0 and 301002 for CH1 I can only read U16 values, and not a 2-word SGL.
    Third party Modbus simulation software is able to write to and read from registers very easily, but not LabVIEW.
    Some questions are:
    - do I use a Modbus master or slave as an I/O server in the library as a target for binding the shared variables?
    - is there some other wierd translation in register offsets between LabVIEW and traditional Modbus?
    - is this actually possible using shared variables or am I wasting my time?

    Sending the whole 60-character string using a string or array would be the most efficient.  I have tried both methods, and these only cause the datalogger to flag a message log but no text is displayed.
    For a string variable, I have used the following binding "My Computer\Modbus Test.lvlib\ModbusServer6180\442305", where ModbusServer6180 is a Modbus I/O server configured with the logger IP address, and 42304 is the register offset at the start of the text block in the logger.  I need to write to 30 consecutive registers starting with this one.  I am not using buffering and have not enabled single writer.
    Can anyone confirm whether this method should work in 8.2?
    Does the string need a special termination character?

  • Peculiar behavior of Shared Variable RT FIFO

    I'm trying to "leverage" the enhanced TCP/IP and Shared Variable properties of LabView 8.5.  My application involves (among other things) doing continuous sampling (16 channels, 1KHz/channel) using 6-year-old PXIs (Pentium III) and streaming data to the host.  I developed a small test routine that was more than capable of handling this data rate, even when I had the host put a 20msec wait between attending to the PXI (to simulate other processing on the host).  To do this, I enabled the "RT FIFO" property of the Shared Variable (which was an array of 16 I16 integers) and specified a buffer size of 50 (that's 50 arrays).  Key to making this work was figuring out the "error codes" associated with the SV RT FIFO, particularly the one that says the FIFO is empty (so don't save the "non-data" that is present).
    Flush with success, I started developing a more realistic routine that involves rather more traffic between Host and Remote, including the passing back and forth of "event" data.  These include, among other things, "state variables" to enable both host and remote to run state machines that stay "in sync"; in addition, the PXI also acquires digital data (button pushes, etc.) which are other "events" to be sent to the Host and streamed to disk.  I developed the dual state-machine model without including the "analog data" machine, just to get the design of the Host/Remote system down and deal with exchanging digital data through other Shared Variables.  Along the way, I decided to make these also use an RT FIFO, as I didn't want to "miss" any data.  One problem I had noticed when using Shared Variables is the difficulty of telling "is this new?", i.e. is the variable present one that has been already read (and processed) or something that needs processing.  I ended up adopting something of a kludge for the events by including an incrementing "event ID" that could be tested to see if it was "new".
    Today, I put the two routines together by adding the "generate 16-channels of integer data at 1 KHz and send it to the Host via the Shared Variable" code to my existing Host/Remote state machine.  I used exactly the same logic I'd previously employed to monitor the RT FIFO associated with this Shared Variable (basically, the Host reads the SV, then looks at the error code -- a value of -2220 means "Shared Variable FIFO Read Buffer Empty", so the value you just read is an "old" value, so throw it away).  Very sad -- my code threw EVERYTHING away!  No matter how slowly the Host ran, the indicator always said that the Shared Variable FIFO Read Buffer was empty!  This wasn't true -- if I ignored the flag, and saved anyway, I saw reasonable-looking data (I was generating a sinusoid, and I saw numbers going up and down).  The trouble was that I read many more points than were actually generated, since I read the same values multiple times!
    Looking at the code, the error line coming into the Shared Variable (before it was read) was -2220, and it remained so after it was read.  How could this be?  One possibility is that my other Shared Variables were mucking up the error line, but I would have thought that the SV Engine handling reading my "analog data" SV would have set the error line appropriately for my variable.  On a hunch, I turned of the RT FIFO on the two Event shared variables, and wouldn't you know, this more-or-less fixed it!
    But why?  What is the point of having a shared variable "attached" to an error line and having it return "Shared Variable FIFO Read Buffer Empty" if it doesn't apply to its own Read Buffer?  This seems to me to be a very serious bug that renders this extremely useful feature almost worthless (certainly mega-frustrating).  The beauty of the new Shared Variable structure and the new code in Version 8.5 is that it does seem to allow better and faster communication in real-time using TCP/IP, so we can devote the PXI to "real-time" chores (data acquisition, perhaps stimulus generation) and let the PC handle data streaming, displays, controls, etc.
    Has anyone been successful in developing a data-streaming application using shared variables between a PXI and and PC, particularly one with multiple real-time streams (such as mine, where I have an analog stream from the PXI at 16 * 1KHz, a digital stream from the PXI at irregular intervalus, but possibly up to 300 Hz, and "control" information going between PC and PXI to keep them in step)?  Note that I'm attempting to "modernize" some Version 7 code that (in the absence of a good communication mechanism) is something of a nightmare, with data being kept in PXI memory, written on occasion to the PXI hard drive (!), and then eventually being written up to the PC; in addition, because the data "stayed" on the PXI, we split the signal and ran a second A/D board in the PC just so we could "see" the signal and create a display.  How much better to get the PXI to send the data to the PC, which can sock it away and take samples from the data stream to display as they fly by on their way to the hard drive!
    But I need to get Shared Variables (or something similar) working more "understandably" first ...
    Bob Schor

    Bob,
    The error lines passed into and out of functions are just just clusters with a status boolean, an error code, and an error string, and are not "attached" to a particular function as you describe in your post.  Most functions have an error in input and an error out output, and most functions will simply do nothing except pass through the error cluster if the error in status is True (to verify this for yourself, double click on a function such as a DAQmx Read or Write and look at the block diagram.  If there is an error passed in, no read/write occurs).  This helps prevent unwanted code from  executing when an error does arise in your program.  By wiring the error cluster from your other shared variables to your analog data variable, you're essentially telling LabVIEW that these functions are related and that your analog data variable depends requires that the other shared variables are functioning properly.  The error wire is a great way to enforce the flow of your program, but you must always consider how it will affect other functions if an error does arise.
    Anyways, it's great that you have things more or less working at the moment.  Keep us all updated!

  • Network shared variables lose binding

    Hello,
    I am developing an application in LabVIEW that uses network shared variables to transmit data between two PC's on the same subnet. The shared variables work fine when running the VI's in development mode, however, when i build the vi's into an executable I find that they no longer work. Here is what I have found so far:
    I deploy the shared variable library on the publisher machine (also happens to be the development machine) through an invoke node in the executable. NI distributed system manager confirms that this does deploy and indeed updates as it should.
    For the executable on the subscriber PC I created a second shared variable library (same project) with the same shared variables and bound them to the respective shared variables from the first library by selecting enable aliasing, then bind to PSP URL and browsing to the shared variable I wish to bind it to (e.g. \\hallnet-ellm2\shared variable library\serial Number). The machines listed under browse were listed by name so when I tried this initially and it did not work I manually changed the name of my machine in the URL box to the IP address of the publisher hoping that would fix it in case the subscriber could not resolve the publishers machine alias. So now my bind URL read \\192.168.0.1\shared variable library\serial Number.
    As part of the executable on the subscriber I deploy this second shared variable library. NI distributed system manager confirms that this deploys but under quality for an individual variable it has a list of issues (see attached) and the bound variable is not updating. At this point the publisher shared variables are still functioning fine. By clicking on 'edit variable' I can see that the variable on the subscriber is still bound but the PSP URL is now \\localhost\shared variable library\serial number. Changing the PSP URL on the subscriber to \\192.168.0.1\shared variable library\serial number enables the variable to update as expected.However by this time my executable has already picked up the error and does not function.
    I think that the issue lies with the bind URL used on the subscriber as for some reason it does not keep the binding configured in the project and instead changes to 'localhost'. Why is this? Should it not stay bound to the address specified in the project?
    I have tried changing the IP addresses in the aliases file so that
    [My Computer]
    My Computer=localhost 
    becomes
    [My Computer]
    My Computer=ip of local machine
    This did not help.
    The shared variable libraries are included in the build spec to go into the support files directory and they are successfully deployed from there on both publisher and subscriber.
    I am using LabVIEW 8.6 on Windows XP
    Thanks for any help you may be able to offer,
    Lee
    Attachments:
    distributed system manager.JPG ‏74 KB

    Hi Lee,
    I hope you are well.  Thank you for your post.  Your application sounds very interesting.
    Looking at your issue I was wondering, have you tried lowering your firewalls, as this may be causing the problem.
    Also, another option would be to setup a private network.  Do you have access to any routers that you could use to link the two machines independent of your IT's infrastructure?
    The other thing to try is two other computers entirely.  Again, it would be ideal to take them off the network you are on, but it's something to try if my prior suggestion doesn't work.  It should work on the original two machines though, and it's likely that different computers won't solve your problems because I suspect the network.
    Remember that the client variables must know the location of the variables on the server, so you can't move the server exe around without changing this value.
    Make sure to set the network location in the "Bind to Source" option for the client variables.
    It is also possible to write a separate piece of code to install on every machine that is responsible for deploying the library and by doing so eliminate the need for programmatically deploying the variables in the original application.  However, this won't really help you, because the variables you use in the application have to be the same as the ones deployed in the library, so if you change the library, they'll no longer be linked and they won't receive data.  You'd have to create a separate exe for every binding source you wanted to link to, and then have a second, known library for the sake of communication locally on the computer between the ‘deployer’ and the actual application.  The main application could then be assigned the responsibility of launching the correct ‘deployer’' if it sees it needs to switch to a different variable binding source.  This method is not the most streamlined or effective, but it might work.
    Just to let you know, you will need to use the DSC toolkit.
    Please find below some knowledge base links that I think you will find helpful in your application.
    Using Shared Variables in Executables
    How do I Programmatically Change the Data Binding Source for Shared Variables?
    I hope this information helps and if you can give these suggestions a go and let me know how you get on, that would be great.
    Kind regards,
    Prashant M
    Applications Engineer
    NI UK & Ireland

Maybe you are looking for