08-18-2014 05:10 PM
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
Solved! Go to Solution.
08-18-2014 05:28 PM
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
08-18-2014 06:28 PM
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...
08-19-2014 09:06 AM
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
08-19-2014 06:44 PM
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
08-20-2014 09:08 AM
Lynn,
This is extremely helpful.
Thanks for taking the time to modify my code and document how it works.
- Matt