LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

clear a buffer

I have a buffer that is generating 5 min worth of data and feed it to a queue. The data is later dequeued into a seperate while loop and plot in a graph.

My goal is programmatically refresh the buffer. I tried to used flush queue after the data is being enqueued, it did not work because after the flush the buffer adds last previous data set plus a new one into the queue. I want the buffer to start back at zero, meaning get rid of all the previous data and enqueue in new ones in the queue. Flushing the queue does not work

 

Thanks

0 Kudos
Message 1 of 16
(6,198 Views)
Flushing the queue *does* empty the queue of all elements. Of course if you have something that is still enqueuing after the flush then those items will still go into the queue.
 
Perhaps you can post some code to show what is happening?
 
Are you using a chart to display the data - do you mean the clearing the chart history? You can clear that programmatically by wiring an empty array to the 'history data' property.

LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 16
(6,184 Views)

I am using a waveform graph but wiring a constant into it does not solve the issue. At the next iteration, the buffer enqueue about 30000 samples again.

0 Kudos
Message 3 of 16
(6,179 Views)

Are you wiring an empty constant?

 

"Perhaps you can post some code to show what is happening?" - It is almost impossible to help you without you posting your VI or a screenshot of the code - anything else is just guessing/speculation.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 16
(6,168 Views)

here's a screenshot of the code

 

Admin Note - Attachments removed per user's request

0 Kudos
Message 5 of 16
(6,123 Views)
  • What does the circular buffer do? What is the input value?
  • What is the value of the upper input to periodic random noise and why is it not an integer?
  • Why do you use a 2D array if all you ever use is one row?
  • What determines the loop rate of the upper loop? Seems to run as fast as the computer allows.

 

Please attach your actual VI and subVIs, we cannot debug pictures.

0 Kudos
Message 6 of 16
(6,079 Views)

Ritch,

     Please do not attach Screen Shots, attach actual VIs.  In order to test/query/understand a Screen Shot, we have to actually create the VI "by hand" ourselves, something that is a little bit unreasonable for you to ask of us if you are asking for our help.  Help us to help you by providing your effort to us and attaching the VI.

 

     Note that if you want to attach just part of a VI, you can attach a Snippet, which "looks like" a picture, but can be dragged onto a Block Diagram and become LabVIEW code.

 

Bob Schor

0 Kudos
Message 7 of 16
(6,026 Views)

I actually prefer people to post pictures - most of the time it's fairly easy to see what's wrong and it means I don't have to make sure I have the latest version of LabVIEW installed. When people post VIs I have to make sure I have the right version installed, download the VI (which is often missing dependencies anyway) and then wait for LabVIEW for open.

 

Agree that snippets are probably best though.

 

In this case, I would imagine that the circular buffer VI is holding an amount of data which doesn't get cleared when you flush the queue. If you were to enqueue an waveform constant with no data in the top loop I think that would clear the graph. You will need to see if there is a way to 'reset' the circular buffer vi (have an extra 'reset?' input and when true, clear the data inside the VI).


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 8 of 16
(6,017 Views)

All, here are the attached Vis

 

Admin Note - Attachments removed per user's request

0 Kudos
Message 9 of 16
(5,989 Views)

Here's the buffer.vi vi

 

Admin Note - Attachments removed per user's request

0 Kudos
Message 10 of 16
(5,985 Views)