Notifiers VS Queues

Hello all!
I have a pretty simple question... what is the main difference between notifiers and queues?  Which should I use in which case?  Are queues preferable to pass data?  Anyways, you get the point!
Thanks in advance!
Yohan

OK, not so little of an application. The single loop construct is fine if you're doing a single UI VI since in this case you're not really doing much. In your case you're probably going to need some form of state machine construct, which is where the producer/consumer architecture will come into play. It will give you the flexibility to adjust and expand the program in the future.
As for whether you should use notifiers or queue, that's a call that you will need to make. If your consumer loop is going to be performing a background process you need to use queues. For example, I created a LabVIEW-based test executive for the RF testing we're doing here since we don't have (and are unwilling to buy) TestStand. It uses a producer/consumer architecture with the consumer running a test sequence as well as responding to messages placed in the queue by event handler in the producer loop. Since the consumer loop is running a backgroung process you can't use notifiers in this case. Very simple framework, but extremely efficient, robust, and easy to modify. My suggestion is to use queues as in most cases you end up needing to expand the program in the long run. You don't really lose anything by using queues, and really gain quite a bit.
To the rest of the community: Perhaps someone else may be able to provide additional tips?
Message Edited by smercurio_fc on 05-30-2006 03:36 PM

Similar Messages

  • Difference between notifiers and queues

    Hi, I have a question about notifiers and queues. I try to do a moving average for 6 min, having data with a sampling rate of 25 us. I use a producer/ consumer architecture. The producer loop reads 3 DMA Fifos from my FPGA vi and writes them in three diferent queues. Each queue is beeing read again in three consumer loop, one for each queue. I thought this might be faster??!! If I limit my queue to a certain size than after some minutes I get a timeout error, if I say 0 ms for timeout. I wanted to make sure that nothing will get lost. If I don't limit my queue size ( -1) after 10 minutes I get a message that I don't have enough memory to operate. I also can see that that in Task manager the page file is getting bigger and bigger until 2 gb. So from this poit of view I would assume that my average calculation is to slow and data has to be stored inbetween. So my consumer loop is to slow. Well I don't have any idea how to make my code faster. I also do a cascade for the averaging and the average is beeig calculated adding the new value and subtract the oldest value in the array.
    Than I tryed using the notifiers. As I read you can not size a notifier. But what happens if  the consumer loop is slower than the producer loop? Do I loose data? When using notifiers I don't get any error messages, like don't have enough memory . So what is the diference between notifiers and queues?
    Has also someone any idea how to make the code faster ?
    Thanks
    Attachments:
    mittel_Fifo1+2+3_gra_notif.vi ‏274 KB

    Check the number of elements in the queue when running your vi, so you can see if your queue is running full.
    Furthermore, your code looks a bit 'dirty'. From that I guess, there is still a lot of improvements that can be made to get the performance you need.
    Take a look at the 'ptbypt Mean.vi' (I don't remember the exact name).
    Felix
    www.aescusoft.de
    My latest community nugget on producer/consumer design
    My current blog: A journey through uml

  • Notifiers and queues advice

    in my opinion i feel confortable with states machines typdef, using cluster of variants, and even jki.
    iam trying to incorporate the synchronization palette to my programing,
    As a result i developed a small program with queues and notifiers added; but it turned out to be a disapointment.
    In short it happened because I didnt have the needed understanding.
    here iam attaching the program and dependencies.
    iside there will be 341D8003-505 and 341D8003-505_1
    341D8003-505 was my first attempt at using the queues (fail) i believe i tried to use them like a state machine but wrongly (i think it couldnt update on the state machine) and also wrong using of notifiers.
    341D8003-505_1 was the second variant which failed as well because of wrong use of notifiers.
    i will appreaicate any advice in this matter. 

    Caluctra,
    This is a timely topic for me, as I recently had a discussion with a couple of very experienced LV programmers about this very Palette.
    The crux of our discussion is that not all of the tools there are used very often:
    1. Queues: One of the most powerful and often used tools in the LabVIEW toolbox
    2. Notifiers: Often used, and very powerful, but used for very specific things.
    3. Semaphores: Almost never used by anyone I had discussed this with.
    4. Rendezvous: No one could recall ever using one. In 18 years of LV development, I have never used, nor seen used, a Rendezvous.
    5. Occurrences: Used rarely and in very special ways.
    So, this is probably a good indication as to how useful each of these tools are. Therefore, if I were you, I'd concentrate my efforts on Queues and Notifiers first. You'll soon see that most of what is done out there is done with these two tools.
    There are a couple of excellent starting points to introduce you to these tools, and to show you how they are used:
    LabVIEW ships with a couple of excellent starting point references for Queues:
    If you go to "File", then "New" from within LabVIEW, find the following examples:
    File/New/VI/From Template/Frameworks
    /Producer/Consumer Design Pattern (Data) (A)
    /Producer/Consumer Design Pattern (Events) (B)
    /Queued Message Handler (C)
    (A) This is a great starting point to see how you can use Queues to pass data between loops.
    (B) This design pattern is used everywhere, and is one of the most common you will see out there (probably)
    (C) Another common framework for machine control.
    AMC Toolkit
    NI Publishes a great tool called the Asynchronous Message Communication Toolkit. If you download and install this toolkit, there are a couple of really good examples in there for a Queue-Driven Message State Machine.
    http://zone.ni.com/devzone/cda/epd/p/id/6091
    If you need some more specific guidance, please let me know. I hope this was at least a little helpful.
    Wes Ramm
    Cyth UK
    Wes Ramm, Cyth UK
    CLD, CPLI

  • How to insert queue element from C

    I want to insert a single queue element into a LabView Queue from C (from a DLL).
    The only thing I found is How to set an Labview-Occurence from C. I assume that I have to do that in 2 steps: 1. copy the string data into the queue with a push/pop command. 2. Set the Occurence from the queue to notify waiting queue elements.
    I only need to know how to realize this in the exactly way. (internals of Queue handling, Queue structure, example code, ....)
    I'm using LabView 6.0.2 with WinNT 4.0
    Thank's for help.
    Robert

    Robert,
    You currently cannot access Queue elements from external code. We hope to add this feature to a future version.
    Marcus Monroe
    National Instruments

  • Why not to store notifier reference in global

    Hi all,
    I am working with notifiers and queues in multiple VIs. I have strange behaviours, when I store the queue and notifier references in global variables.
    I have read some entries in this forum, and some says, it is a "bad idea", that "should not be done", to store the refs in globals.
    Can anybody tell me, what is the real background?
    regards
    mitulatbati
    Solved!
    Go to Solution.

    Besides that globals are simply evil (just slightly an over the top statement as I really advocate to minimize the use of globals to nothing more than a status boolean or sometimes some single skalar value), all LabVIEW refnums employ some garbage collection.
    The reason to use globals usually implies that you want to create the according resource at one place and use it someplace else. But that often does not work with LabVIEW refnums if the producer and consumer are not in the same VI hierarchy (for instance you create the resource in a startup VI and then spawn a plugin VI that continues while the startup VI terminates). All LabVIEW refnums are automatically disposed at the moment the top level VI in whose hierarchy the refnum was opened goes idle. So at the time your plugin VI gets to work, the refnum and its object has been already disposed and is therefore invalid.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Need suggestion on error treating strategy

    I tried to construt a projec by LabVIEW. It consists of ActiveX controls, Signal Acquiring control, Signal Analysis, etc. And I architecture it with state machine. Synchoronization technique was introduced into the project to sychronize the UI Response and corresponding Background Operations, or to protect the Critical Section shared by some operations. In the end it run.
    But something I haven't realized. That's the exception treating mechanism. How should I organize the error treating in a 'big' project? Something  like the exception-catch-throw mechanism, or anything else?
    Till now, what I hnew about the error treating in LabVIEW is like 'combining error'.
    Any  ideas and demos are appreciated!
    And Thanx ahead.
    Edward

    HI, Dynamik,
    Thanx for your great ideas. But I'm not sure about something.
    1, "Write an event-logger to capture-to-disk program-events "
    Does it mean I should register error event to treat errors? To synchronize the error treating, with 'notifier' or 'queue' ? 
     Before LabVIEW, my tool is Visual C++. And some mechanics/methodology  impact on my thoughts. Maybe I was being trapped!   So, I'm not sure that whether the error treatment be dealed serially or parallel?
    2, "Check for errors frequently (always), beware that native functions and sub-VIs can handle existing errors in undesireable ways.  Some functions will execute even if there's already an error wired in, and may REPLACE the original error with a new error if the function fails.  This can be very misleading when debugging.  Other functions will NOT execute if there's an error wired in - even if you want them to.  It's common to Not wire the error-cluster to Task&Refnum Close functions (using some other data dependency to determine proper execution order.)"
    How to 'Check for Errors' ? Wire all error out serially or combine them? Sorry for my not sure about it.
    If any demo is available , that'll be wonderful! The examples of LabVIEW doesn't involved anything on it.
    Thank you, Dynamik, again. Great idea you gave me!

  • Stop whole program with one button

    Hi, I've written a program for reading some values out of a measurement instrument. Now i want to have one button which stops the entire program no matter in which loop or which subVI the program is in. I have a subvi to make a connection to the device and i can't get out of this when he is trying to make that connection. Also the stopbutton i've used now is only read when the program is in a specific while loop. Can is solve this problem. I've attatched my program.
    Attachments:
    oplossing2.vi ‏74 KB

    You will need to use global variables to communicate between VIs. Don't make it a habit since using them can lead to race conditions and synchronization problems, so I would recommend that you look into functional global variables, semaphores, notifiers and queues. The Help document in LabVIEW has detailed explanations on each one of them.
    You will need to call a subVI in parallel if you want to continue with the execution of other tasks in your mainVI. I have created a quick example which shows the use of a global variable and using a subVI in parallel.
    Message Edited by Adnan Z on 02-17-2009 04:31 PM
    Adnan Zafar
    Certified LabVIEW Architect
    Coleman Technologies
    Attachments:
    Example.zip ‏13 KB

  • Which is the best structure for start/stop data logging?

    Hi everybody,
    hope I can explain my problem good enough that anyone can help me:
    I have a VI which continuely shows on a graph the voltage of a Analog Input of a DAQ device. Now I want to allow the user to start/stop with a click on a button data logging. Means that a second loop writes to a selected path every ms the data to a spreadsheet file.
    At the moment my VI works like this:
    You run the VI and Labview asks you one time for the file path, then you can start and stop the data logging. But you can do it only one time. If you want to log a certain time later another file, you have to close and open the whole VI again which is not very professional...
    My target is:
    It is onlyl necessary to start the VI one time. Then you can select a new file path, log data, select another file path, logging data again....and so on...
    Which programm structure is necessary, can anyone help me as a labview beginner with that issue? I attached the VI if someone just wants to edit that...
    Thank you for your help!! Markus
    Attachments:
    Logging voltage.vi ‏93 KB
    screenshot.JPG ‏98 KB

    @NaruF1 and GerdW
    you are right, there is a mistake, both loop rates should be the same (10 ms) :-)
    @NaruF1
    yes you understood correctly that the file dialog should appear every time the user wants to start writing a new log-file. The voltage we measure is a analog signal, so there will be several interesting periods we want to save for a later analysis in Excel.
    To your 2nd point: if it works with a array it will be fine. But it must be possible to log data for lets say 5 minutes, so the array won´t be too large? (5 min @ 10  ms loop rate will be 30000 rows..
    attached is the VI, saved as LV2009..
    Thanx a lot!
    @GerdW
    ..you ask why I didn´t create a structure like you recommended with notifiers or queues? The simple answer would be that I am not familiar with all this.. just began to write my first Labview programm. I will have al look to the LV help with all that stuff... Thank you a lot
    Attachments:
    Logging voltage.vi ‏80 KB

  • Start stop while loop with tab control

    I want to be able to start and stop a while loop by entering and leaving a tab.  I am using an event structure to do so but it doesn't seem elegant or the right way to do this.  The only way I was able to get it to kind of work is by unchecking the lock front panel box in the event structure.  I have attached a sample vi of what I have so far.
    Solved!
    Go to Solution.
    Attachments:
    Loop test.vi ‏16 KB

    The problem is that you can't even stop the program by hitting the stop button until you leave the tab, which is not a friendly user interface.
    Event structures should just handle basic user events.  Any given event case should not take a long time to run.  While you are in the diagnostics tab, your code is stuck in that while loop.  Although fixing the lock front panel allows you to do other things, the LabVIEW is just queuing up all of those other UI events (like Stop button value change) and can't handle them until the inner while loop stops and allows the outer while loop to iterate again.
    You should have a parallel while loop to handle the waveform graph.  You can use notifiers or queues or an action engine FGV (see Ben's Action Engine Nugget) to pass the starting or stopping of the waveform graph update to the parallel while loop.

  • Design Suggestions for Multiple DaqMX Task Streaming App?

    I'm working on a LabVIEW application in which I'm streaming high-speed data to disk from multiple PXI devices simultaneously.  Each device has its own DaqMX task, and all tasks stream to the same file.  The PXI device configuration (which devices are in the chassis, which slots they're in, and which channels to read from each device) is determined at runtime.
    Does anyone have a suggestion for a design model for this?  To make matters worse, I'd like to be able to specify a channel to monitor its data during the streaming.  I'm thinking the Producer-Consumer model is the basic approach, and I'm at the point where I have an array of DaqMX tasks, one for each device.  I could probably extend that array to be an array of clusters containing:
       1) DAQ Command (e.g. Initialize, Start, Stop, Acquire, etc)
       1) Task ID
       2) Control reference to 2-D array (where each DaqMX read can be stored)
       3) Array of channel names (to allow selection of channel to be monitored
    This could be passed as notifier data, to a data collection subVI, but the part I'm struggling with is finding the best way to run X number of tasks in parallel, where X is not known until runtime.
    Any suggestions would be appreciated.

    Thanks for the input.  With regards to the file format, the decision has been made by my superiors not to use TDMS - unfortunate, but NI hasn't provided the information to write a MatLab file reader, which is a requirement.  So, I've created a custom file format tailored to the needs of my application, but generic enough to be used for other apps. With it, I've been able to stream 8 channels at 800KHz (4 channels each from 2 PXI-6120s) without breaking a sweat.  However, the performance varies greatly depending on which slots the cards are in (but that's a whole different discussion - see the PXI forum for that one).  Once NI solves that one, I'll feel a lot more comfortable.
    I have already made reentrant subVIs that can perform a specific DAQ task.  The problem with a for loop is that the VI sits and wait for a start trigger, then acquires the streaming data.  I can't start the next VI because I'm in the first one.  I thought about creating a data collection VI, and this VI would start up to 6 other VIs in parallel, based on how many and which cards were present.  It's a bit messy, because each slot can contain one of two devices, so I'd need to check which type it was before calling it.  I'm thinking I'll have to create the task list and the references to the data in the main GUI loop, and then pass this using a notifier or queue to the data collection loop. 

  • Labview version problem?

    Hello guys,
    I have made a subVI that controls the rpm % of a wind tunnel vane. This consists in adquiring 2 values of data within 30 seconds and compare both to see the uniformity of the flux. I use a Labview 2011 version. The problem occurs when i use this subvi in a 2012 version. The 30 seconds turn to 1 minute... I want to ask if its possible for this to be a version problem.

    I'm concerned that you are reading a file and then reading it again 3 seconds later.  This tells me you are looking for when the other process stops writing data.  File IO is a terrible way to share data.  Use a Notifier or Queue instead.  Much more efficient.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Spawn loops at runtime

    Hi,
    I want to program a timed loop that spawns new parallel processes (e. g. while loops) at specific points in time. It's kind of a C++ loop that dynamically creates thread objects at certain interation points and calls the thread member function start() immediately. The loop can continue iteration after spawning a thread, regardless of the threads runtime.
    At the moment placing a number of LabView while loops that are waiting for a start signal (via notifier or queue) from a main loop is the best way I can think of. But this approach is fixed in number.
    Is there something I can do via VI references?

    I managed it to open and call two instances of the same VI (CallMe.vi). These two instances get different input values (Wait Time). The CallMe.vi block diagram shows a double run arrow instead of a simple white arrow and both CallMe.vi instances terminate at different times according to their different Wait Time input values. I had to check "invariant execution" in the CallMe.vi VI settings.
    Is this a or the correct way to dynamically call different instances of the same VI or various VIs without having to wait for their termination?

  • Communication between VIs

    I have 2 VI's which are run at the same time and I need to share data between the 2 I've managed to do it using variables but I have found that it is fairly machine dependant due to how Labview stores and accesses variables.  Is there a way to do this other than with variables???
    Thanks,
    Matt.

    What do you mean by "variables"?
    Anyway, try communicating with Notifiers or Queues. Look up examples.
    Richard

  • Related to ms-access

    hi,
    i have a button in a vi, called retrieve.
    so whenever I click that particular button, list box is getting opened and in that list box i was able to retrieve values from the ms-access table. so whenever i click one value from that list box, that particular value should appear in a vi where retrieve button is there. how can i do this?
    below is my attached vi.
    please check the code in the attahced vi.
    InAdvance Thanks
    Regards
    Soundarya
    Attachments:
    list.vi ‏118 KB
    systemslno.vi ‏17 KB

    Hi Soundarya,
    wait for a "mouse-click" or "value change" event of your listbox, then read it's value.
    Send this value to the main loop by using a global (beware of race conditions), FGV, notifier, or queue...
    Btw. this is not at all related to ms-access... How should others find this thread when searching for similar problems?
    And why don't you stick with your original thread(s)?
    Message Edited by GerdW on 07-29-2009 09:29 AM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Control and simulation - SMP

    I am using a LabVIEW Real-Time 2012 and a Desktop RIO for some real-time 
    simulations. The CPU has four cores. I have a problem when I try to run 
    multiple control & simulation loops in parallel on different cores. I have 
    manually assigned different cores to the loops and they are running, but not at 
    the same time. I need them to have exactly the same simulation time, 
    synchronized to the CPU. Is this possible?
    Thanks a lot!
    Best regards,
    Sinkva

    Hi Sinkva,
    You can use notifiers or queues to 'trig' synchronous execution of loops, have a look at this white paper:
    Application Design Patterns: Producer/Consumer
    http://www.ni.com/white-paper/3023/en/
    Make sure you are not entering the next iteration in the master loop until all slave loops have finished the current iteration (the slowest loop will set the timing).
    Best regards,
    Robert P-F
    Applications Engineer
    National Instruments Sweden

Maybe you are looking for

  • PC Powers off when downloading through iTunes

    This is totally weird, and 100% replicatable. I initially discovered this when I got support to help me recover some lost music. It showed up in my downloads section. It started to download, then instantly my PC is powered off. No blue screen, no err

  • Cd not opening up

    cant run cd for my daughter (disney maths) on imac...it says dosent support classic environment..can anybody help me with this.i have a imac 10.6.6

  • SE 30 BAR chart Recommended run times?

    Hi Experts,                   I have been searching for Recommended  ABAP ,DATABASE and SYSTEM Ratio in SE30 Bar chart. I never come across any document who  explained properly about this , Can Any body help regarding this . I also want to know why S

  • Can you copy Classic Planning Applications?

    Hi, Is it possible to take an existing Classic Planning application, and make a copy (or duplicate version) of it? For Essbase applications, this is a simple process in EAS, just right click the application and hit Copy. However, while this method wi

  • How to create BPM process instances?

    I need to use java to create new BPM 11.1.1.5 process instances. How to connect to bpm and use API? Can anyone paste detail code sources?