LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

queue multiplexing without repeat data plotting

Is there a simple way to implement a queue multiplexor that will not plot the same data point multiple times??

Say for example you have 3 queues feeding data (like the queue multiplexor example) into a queue that combines the data and graphs it.  If you autoscale the queue multiplexor example, you can see that if the current data is 1 for source 1, 2 for source 2 and 3 for source 3, the graph will plot in order: dequeue element, 1, plot 1, dequeue element, 2, plot 1,2, dequeue element, 3, plot 1,2,3.

So you end up with 1 being plotted 3 times, 2 plotted 2 times, and so on.

Is there a way to not plot the data points multiple times, since the "consumer" part of the queue can dequeue only 1 element at a time.

Kenny
Kenny

0 Kudos
Message 1 of 6
(3,255 Views)
Kenny,

If you look at the queue multiplexor example I think you'll find that each data point is only plotted once.  Once it is removed from the queue the only place that each data point exists in memory is in the chart history.

In other words the queue does not know where each point came from.  It simply maintains a list of values which are removed one by one in order.  For each iteration of the consumer loop in the queue multiplexor example one point is removed from the front of the queue and added to the chart (which, as it is a chart, remembers the previous values written to it in prior loop iterations).

I think that perhaps I am not understanding your question fully -- if this is the case could you please clarify what it is that you are trying to do.

Regards,

Simon H
Applications Engineer
National Instruments
0 Kudos
Message 2 of 6
(3,231 Views)
Sorry, I was looking at the wrong queue multiplexor.  I was looking at the version that polts each of the sources differently, which was modified by someone else in the forum.
 
I attached it below, but I am thinknig that the problem is that the array gets plotted each time, but only one element changes each iteration.  So there may not be a way to accomplish this.  But if you have some ideas, that would be much appreciated.
 
Saved in LV 8.0.1
 
Kenny
Kenny

0 Kudos
Message 3 of 6
(3,210 Views)
Kenny,

There are two ways I can think of to make LabVIEW do what I think you want - neither of them are pretty nor would I really recommend them.  

One involves using an array shift register for each graph which stores all previous values.  Each loop iteration tags the new value onto the appropriate array and then resizes all of the arrays to be the size of the smallest array and writes all the data to a waveform graph.  Such an approach is inefficient (you need to build arrays inside a loop and you replot all points every loop iteration).

The other way would be to use the buffer along with a case structure to effectively store values until one from each source has been dequeued and then pass all three points to the waveform chart at the same time.

Normally when solutions start looking this ugly there is a more elegant solution to be found if you approach the problem in a different way.  Why are you having all three producers write to the same queue if you want to preserve their individual identity?  Why not have three separate queues with three separate dequeues in the while loop?  That way you know which producer each point came from and the while loop will wait for exactly one point from each queue before updating the chart.

Regards,

Simon H
Applications Engineer
National Instruments
0 Kudos
Message 4 of 6
(3,190 Views)

I suppose that I could go to multiple queues and different waveform graphs.

I was trying to use the multiplexor to keep all the data points on the graph for comparision.  But I guess that since the data sources may be independent (one will acquire 2 times a min, another 1 per min, etc) it will be tough to use the multiplexor.  It would just be nice and clean with the multiplexor vs 4 queues.

Kenny

0 Kudos
Message 5 of 6
(3,175 Views)
Kenny,

As long as you use the waveform graph (as opposed to a waveform chart) you can have different plots with different sampling rates plotted alongside each other.  The important thing to remember is that the timing data in the waveform must be preserved.

With this in mind I modified the modified example you posted to do just that.  You can adjust the "Time between iterations" of each producer loop to simulate the difference in sampling rates.  Take a look at what I did and see if it would be applicable to your application.

Disclaimer:
It's late and I wrote this example as I wanted to prove to myself what I was about to suggest you try did in fact work.  This code isn't guaranteed to do anything in particular nor do we make a habit of writing specific examples.


I hope this helps,

Simon H

Message 6 of 6
(3,156 Views)