LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Where is Flush Stream?

Solved!
Go to solution

Not sure where the correct place is to put this comment, but I've been playing with the new stream feature in LV2016 in place of a queue. I have noticed a glaring omission. There is no flush stream capability. I find this function invaluable when building any type of queue if I wanted to dump all data in the queue at once. Case in point, I'm sampling data from a ADC into a queue. Then in another process I'm reading that data. I want to change the sample parameters and then start reading again. I need to flush all the data in the queue with the old sample rate (or whatever) when I reprogram the new settings.

 

Apparently this can't be done with a stream. I can't even do a read multiple (get an error code 1059) when I try and create that function while having a read or write (single) stream. I guess it is back to the queue for me until this gets fixed.

0 Kudos
Message 1 of 8
(3,695 Views)

Instead of Flush Queue, I tend to use a FOR loop or While loop to dequeue the elements until it is either empty or I have read X data points.  What this does is avoid the memory reallocation from flushing the queue (which actually deallocates the memory) and then building up the elements in the queue.  I imagine you could do the same for the Stream Channel.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 8
(3,675 Views)

I thought about doing that. But nothing is free. The 2 issues I see with this method are 1) it requires another parallel loop running in my code dequeuing and processing data that I don't need. (Not really that big of a deal other than having to rewrite the code I already have.) But more importantly 2) there is sometimes a delay in the data due to the queue filling up because of fast sample rates and the amount of processing I am doing to the data. My computer doesn't quite keep of with the processing. So whenever I want to change parameters that I'm testing. The data in the queue in of the wrong sample rate and my program errors out. Waiting for all the data to clear out of the queue could be as long as 5-6 seconds in some cases. IMO it is much better to flush the data in a single cycle and start with new data whenever I need to change parameters.

0 Kudos
Message 3 of 8
(3,664 Views)

@Skydyvr wrote:

Not sure where the correct place is to put this comment...


The best place would be here - https://decibel.ni.com/content/groups/channelwires?view=discussions

 

As far as I understand, you could also modify all the code or create your own channel (I'm not sure if you can inherit to get the stream functionality for free), but that would require you to manage your own code.


___________________
Try to take over the world!
0 Kudos
Message 4 of 8
(3,630 Views)

Thanks for the link. I tried to post there, but NI prevented me from doing so:

ChannelWiresError.PNG

0 Kudos
Message 5 of 8
(3,616 Views)
Solution
Accepted by topic author Skydyvr

You may have to join the group first.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 8
(3,612 Views)

@Skydyvr wrote:

Thanks for the link. I tried to post there, but NI prevented me from doing so:

 


And if joining doesn't work, this is the place to ask - http://forums.ni.com/t5/Feedback-on-NI-Discussion-Forums/bd-p/130

Technically this isn't the forums, but they'll know what to do.


___________________
Try to take over the world!
0 Kudos
Message 7 of 8
(3,603 Views)

Thanks for walking me through the steps. 🙂 I'll move the conversation over to those discussions.

0 Kudos
Message 8 of 8
(3,599 Views)