Western PA LabVIEW Users

cancel
Showing results for 
Search instead for 
Did you mean: 

Occurrences vs. Notifiers

All,

I'm curious to get your opinion on the use of occurrences vs. notifiers.

Clearly the following are true:

- notifiers have more functionality

- notifiers can pass data

These are good reasons to use notifiers; but they are not in and of themselves reasons to avoid the use of occurrences.

Does anyone have any thoughts on why NI recommends against the use of occurrences?

http://zone.ni.com/reference/en-XX/help/371361F-01/glang/generate_occurrence/

"Generate Occurrence Function


Owning Palette: Occurrences Functions

Requires: Base Package

Generates an occurrence that you can pass to the Wait on Occurrence and Set Occurrence functions.

Note  National Instruments encourages you to use the Notifier Operations functions in place of occurrences for most operations."

Please post your thoughts and opinions!

-Evan

0 Kudos
Message 1 of 6
(16,847 Views)

Have you ever tried to create an array of unique Occurences?

Its easy with Notifiers but try to do it with Occurences.

See this Nugget for my Nugget on generating Occurences.

http://forums.ni.com/attachments/ni/130/3101/6/pipe-1.jpg

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 6
(9,351 Views)

In my programming I've had few occasions where I've had a need to use either, but the few situations where I have, I've always used notifiers.  Notifiers just seem more flexible.  If in the future you decide you need to pass data the infrastructure is already there.  I'm sure there is less overhead with an occurence and I'm sure that is probably a consideration but unless you're running on an FPG or RT system it probably won't make much difference.

I've never really seen occurences used by others too often.  Although if you look on Lava there is an Active Object Example in the code repository that uses occurences.

The thing that stuck out to me on the link Evan posted was this:

"For example, if you place a Generate Occurrence function inside of a loop, the value produced by the Generate Occurrence function is the same for every iteration of the loop."

I haven't had a chance to read Ben's post yet, but I will in minute.  My guess his post has a lot to do with what I quoted above.

Sam Taggart
CLA, CPI, CTD, LabVIEW Champion
DQMH Trusted Advisor
Read about my thoughts on Software Development at sasworkshops.com/blog
GCentral
0 Kudos
Message 3 of 6
(9,351 Views)

Hi Everyone,

I've compiled the information you have responded with, and talked to some folks in R&D. Essentially you're both right. To be sure, there is nothing wrong inherently with occurrences, but to new LV programmers, the use of Notifiers will prevent possibly difficult situations in future revisions of a program (refer to #3 below).

1. Notifiers carry information.

- Even though you don't think you'll need to pass information about an event today, you may want to in the future. Using notifiers from the outset will protect you in the future.

2. Notifiers have more functionality.

- There is a notifier palette which gives you access to capabilities like wait on multiple notifications, get status, among others.

3. Generating occurences within a loop only returns a single occurrence.

- Creating multiple occurrences must be done either manually (by placing multiple generate occurences on the block diagram) or through VI server which significantly complicates the problem.

4. Notifiers can do absolutely everything that occurrences can do.

Thanks for your input!


Evan

0 Kudos
Message 4 of 6
(9,351 Views)

What was Tomi referring to here?

In my own experiment, the notifier appears to be faster.

That said, I created a simple "continue_Execution" framework (basically "Wait for Flag" and "Set Flag") based on occurrences because I wasn't sure what problem Tomi was referring to since the link he referenced is dead (see my link above).  Before I release it to the community, I'd like confirmation that there are not performance or reentrancy considerations.  For my case, I do not need to pass data.

Thanks,

Jason


Certified LabVIEW Architect
TestScript: Free Python/LabVIEW Connector

One global to rule them all,
One double-click to find them,
One interface to bring them all
and in the panel bind them.
0 Kudos
Message 5 of 6
(9,351 Views)

Aforementioned Wait for Flag / Set Flag now available for download.


Certified LabVIEW Architect
TestScript: Free Python/LabVIEW Connector

One global to rule them all,
One double-click to find them,
One interface to bring them all
and in the panel bind them.
0 Kudos
Message 6 of 6
(9,351 Views)