LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use notifications to send data from different sources to thesame chart?

Solved!
Go to solution

Hi,

I am using the "Continuous Measurement and Logging" template project that ships with LV 2013.

It is extremenly helpful for figuring out messaging between the acquire, graph, and log loops. (Thanks NI!)

 

I've run into a snag however.

I would like to modify it so that my graphing loop receives data notifications from two acquisition sources via notifiers.

 

I'm having trouble getting data from both sources to display on the same chart.

I've isolated the issue in the attached vi.

 

Here's what happens:

1. I create data from 2 parallel loops and send the data to a third parallel loop with notifiers.

2. The third loop receives data from only one of the loops because one of the receiving notifiers just times out instead of receiving data.

 

Can someone suggest how I can fix this?

 

Thanks.

 

- Matt

0 Kudos
Message 1 of 6
(3,224 Views)

Just use one notifier. Then you just have one Wait on notifier in the Data Display Loop. See below for why one queue may be better than one notifier.

 

It appears that you want to keep the channels separate. You could use waveform attributes to do that. Or you could create a cluster of the waveform and a channel number and send that via the notifier. 

 

Queues are lossless while notifiers could lose data if both loops wrote to the notifier before the display loop read both. I would replace the notifeirs with a single queue unless the occasional loss of a data point is acceptable.

 

You do not need or want a Wait in the Data Display loop. Use the timeout on the Dequeue. Of course then you need to put the stop information in the queue also.

 

Lynn

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

Just to demonstrate there are always multiple ways to address the same problem, I would use a user-defined event (UDE). Events also exhibit a queuing behavior, plus in my experience many UI loops end up being event driven anyway, and a UDE would fit in better than a queue or notifier.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 6
(3,197 Views)

Lynn,

Thanks for your response.

I'm not quite sure what you mean about using waveform attributes to allow me to use a single notifier and keep the waveforms seperate.

Could you modify my original vi to demonstrate this?

 

Thanks.

 

- Matt

0 Kudos
Message 4 of 6
(3,173 Views)
Solution
Accepted by topic author Matt3581321

Here is my modification of your VI. I put notes on the block diagram to explain the changes. It uses a queue for the data transfer to avoid loss of data. It uses a notifier to stop the loops. All local variables and Value property nodes have been eliminated.

 

The way the loops are stopped will likely leave some data in the queue. No more than one or two iterations of each of the data acquisition loops. If you need to guarantee that all data has been displayed (or saved in a real application), then you need to stop the acquisition loops first and read the queue until you know it is empty and both of the other loops have stopped. Then stop the display loop and release the queue and notifier.

 

Lynn

0 Kudos
Message 5 of 6
(3,142 Views)

Lynn,

This is extremely helpful.

Thanks for taking the time to modify my code and document how it works.

 

- Matt

0 Kudos
Message 6 of 6
(3,115 Views)