Jump to content

How Efficient are Notifiers?


Recommended Posts

Hi All,

I am currently architecting a program where I have multiple parallel services running for a robotics application e.g. mapping and motion control. I am finding myself using a lot of notifiers to pass control signals between them for example I have a global e-stop notifier and check its status for a value. The reason I have gone for this is to a)Avoid local variables as I can pass notifier references easily into the 'sub-VIs' which are my services and can then be passed down to sub-VIs in them. b)Avoid shared variables, I am using shared variables for data e.g. my global 2D Pose but want maximum reliability for items like my E-Stop system and dont entirely trust shared variables for these.

However I don't know too much about how they work under the hood. Am I correct in thinking that they have a low overhead and high reliability and speed of update? Also how do data references compare? Will be interested to hear everyones thoughts on this.

Regards,

James

EDIT: I should also mention this code will be deployed on RT. As such should I use data references? I wonder because the in place structure blocks the reference to avoid race conditions but this is non deterministic, I am only writing in 1 place and reading at multiple others so wonder if there is a good alternative?

Edited by James Mc
Link to comment

Am I correct in thinking that they have a low overhead and high reliability and speed of update?

Yes, you are correct. If you have many notifiers and continually look them up by name, you will pay a penalty for that, but if you wire the notifier references directly, they are very fast and reliable.

Our application has dozens of parallel while loops (sometimes hundreds) and most of them wait in an idle state until data is received on a queue or a notifier.

EDIT: I should also mention this code will be deployed on RT. As such should I use data references? I wonder because the in place structure blocks the reference to avoid race conditions but this is non deterministic, I am only writing in 1 place and reading at multiple others so wonder if there is a good alternative?

I think we would need to know more about your application. Notifiers are themselves references, but with a built-in trigger for catching updates. However there is no protection from a race condition or a missed update. If you are streaming data to multiple readers I would use one queue for each recipient and have the single writer looping through the array of queues every time there is a new update it needs to broadcast.

Edited by jdunham
Link to comment

EDIT: I should also mention this code will be deployed on RT.

If you using RT and need deterministic code, I would avoid notifiers. There is nothing wrong with Shared Variables (i.e. RT FIFO enabled SV's). If you really don't like Shared Variables then use RT FIFO's. Also, Type2 Globals can be used deterministically if the VI is set to subroutine priority and "Skip Subroutine Call if Busy" is selected.

Here are some good links at NI with info about RT FIFOs & Shared Variables.

Real-Time FIFO Frequently Asked Questions

Notifiers cause a lot of jitter, use single-element RT-FIFOs instead.

Monitor for Empty State in RT FIFO Enabled Shared Variable

Real-Time FIFO for Deterministic Data Transfer Between VIs

Avoiding Shared Resources

Link to comment
If you using RT and need deterministic code... There is nothing wrong with Shared Variables (i.e. RT FIFO enabled SV's). If you really don't like Shared Variables then use RT FIFO's. Also, Type2 Globals can be used deterministically if the VI is set to subroutine priority and "Skip Subroutine Call if Busy" is selected.

thumbup1.gif

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.