LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dynamically controlling array size and finding min max

Hi all, 

       I am doing high speed data acquisition (max about 50kS/s, NI9239). I want to be able to create a min/max filter where in I can set or control the sample size for which min/max has to be found. My thinking is if I could create and control the array size and stream the data in, that would solve the problem. One of the other problem in doing it is, Say if I am recording data at 50kS/s but I wanna set the sample size to find min/max is 1000, I am not sure how to time and buffer that enormous (49000samples will be waiting plus another 50000 samples would start  stacking up per second) data. 

 So primary question is how to stream the data to create desired number of sample set, manage the buffer and synchronize the acquired data. I am attaching my data acq vi with this post. 

any ideas on how to approach this problem? 



------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
0 Kudos
Message 1 of 5
(2,737 Views)

Hi,

 

In your DAQ loop, you can put the data in a queue (let's called it a process queue, PQue).  Then, you can create another loop (Loop Q) that process the PQue.  Loop Q would get the queue status from the PQue and see how many elements are on there.  If the number of elements have exceeded the number of elements you want to use for calculating min/max, dequeue rapidly in the Loop Q for the number of elements you want and find your min/max. 

 

Yik

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 2 of 5
(2,712 Views)

Yik,

      Thanks for the reply. I tried as you suggested but encountered a problem. when I enque the acquired data at say 50kSamples/s, the que gets 50000 samples at a time. Say if I am looking for the size of 5000 samples my case selector would be "Number of element in que = 5000". But the condition never turns true as at any instance the "number of element in que > 5000". So my que would not deque exact number of samples I want. 

any other ideas? 

 

 

-Nilesh 



------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
0 Kudos
Message 3 of 5
(2,676 Views)
Why can't you wait until the size of the queue is >=5000, then only dequeue 5000 elements?
0 Kudos
Message 4 of 5
(2,660 Views)

For your read operation, you can change the number of sample per channel to be the number of points that you need in order to calculate the min/max.  Then, you know that you need to do a min/max for each queue element, which is a 2d array.  Is that what you are getting at?

 

Yik

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 5 of 5
(2,645 Views)