LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can somebody explain the behavior of these notifiers

Hey guys,

 

I have been experimenting with notifiers before I used them in a new project. (It's funny that I already had the same introduction in my mind as this post while searching for more info)

 

So I was editing the LabVIEW 2013 example to try to understand its behavior but then I came across this weird behavior that I cannot understand.

 

If you run the attached VI, everything seems to work as expected and you can see Notification Loop updating with values from

Notifier Loop 1 and Notifier Loop 2. However, when you press the "switch" button and change the wait time of the Notification Loop, things start acting weird.

 

1.First the value of Notifier Loop 2 never updates any more. I thought this had to with aliasing but changing the values of Notifier 2 Loop delay doesn't change anything unless its value is less than Notifier 1 Loop Delay.

 

2.More importantly, now the values from Notifier Loop 2 is appearing in Notifier Loop 1.

 I inserted an increment function in Notifier 2 Loop so that the sine graph would have an offset be easier to differentiate.

Now Notifier 1 is a sine wave that has a bit of offset instead of Notifier 2.

 

Whats going on?

 

0 Kudos
Message 1 of 6
(2,656 Views)

I have no real experience with the wait on multiple primitive, but looking at the the help I see that the notification output is defined as "an array of the last messages the notifiers receive...". My understanding is that this means that the primitive looks at all the notifiers and only outputs values for those notifiers which have a new value. Because you're reading faster than you're writing, you always get only one value (which is why the second one is flat) and that value is the value of the last notifier which was updated, which is why it jumps like that.

 

This becomes a bit more clear if you cancel the interpolation on the first plot:

 

Wait on Multiple Notifiers modified_FP.png


___________________
Try to take over the world!
0 Kudos
Message 2 of 6
(2,629 Views)

Thanks for your response.

 

Changing the interpolation does indeed make things clear. Two graphs are combined into one channel!

That kinda explains why the notification 2 graph is completely flat.. but it still doesn't explain why this is happening.

 

Another thought, even though I am reading faster than I am writing, the notification 2 is still getting updated, just at a slower rate.

So there should be atleast an intermitten update of notification 2 as well right?

 

This is so weird..

 

0 Kudos
Message 3 of 6
(2,568 Views)

@doradorachan wrote:

...but it still doesn't explain why this is happening.

You're going to have to explain what "this" is.

 


...even though I am reading faster than I am writing

You're not reading faster than you are writing. I can't look at the code now, but I believe you had an infinite timeout on the W4MN primitive. That should cause it to wait until there is a notification it hasn't seen, thereby slowing the loop to the rate of the faster generator. You should be able to see that if you time the loop. And my understanding is that you *are* seeing the slower updates from the second generator, which is why you're seeing two waveforms.


___________________
Try to take over the world!
0 Kudos
Message 4 of 6
(2,557 Views)


@doradorachan wrote:

...but it still doesn't explain why this is happening.


You're going to have to explain what "this" is.


I am talking about how Notification 1 graph is representing both Notifications. Two sets of notifiers should be coming out separately but it doesnt.

You can check the array size and see that the array size of the notifications changes from 2 to 1 when Notification Loop runs faster.  I have attached another modified VI to explain this.

 


@tst wrote:

You're not reading faster than you are writing. I can't look at the code now, but I believe you had an infinite timeout on the W4MN primitive. That should cause it to wait until there is a notification it hasn't seen, thereby slowing the loop to the rate of the faster generator. You should be able to see that if you time the loop. And my understanding is that you *are* seeing the slower updates from the second generator, which is why you're seeing two waveforms.


That's exactly my point. There is an infinite timeout on the W4MN and I have False attached to "ignore previous" which means that every notification should pass along the data. Now that I know for a weird reason both notifiers data are combined into one graph, I can see that Notifier Loop 2 is indeed updating the values correctly. The only problem is that It is being updated as the wrong notifier

0 Kudos
Message 5 of 6
(2,545 Views)

I'll quote my original reply:

 

I have no real experience with the wait on multiple primitive, but looking at the the help I see that the notification output is defined as "an array of the last messages the notifiers receive...". My understanding is that this means that the primitive looks at all the notifiers and only outputs values for those notifiers which have a new value.

 

To be specific, the code gets to the W4MN and sees no new notifications, so it waits. Once one of the generators sends a notification, it says "oh, there's a new one, here it is" (and presumably outputs a reference to that notifier in the first output). The only case where you will see two notifications is if both happened to send a notification between the time it finished running and the time it started running again.

 

If you want something that gives you a current value from all notifiers, you might need something else. Maybe the W4MN with history would do it, maybe you would need to preview the notifier, maybe you would need a single element queue and preview that or any other option you can think of.


___________________
Try to take over the world!
0 Kudos
Message 6 of 6
(2,517 Views)