LabVIEW Channel Wires

cancel
Showing results for 
Search instead for 
Did you mean: 

Stream with Replicate example - Clarify recommended buffer sizes

Solved!
Go to solution

Just tweaking the code right now and it almost works.

 

How do I accumulate size? If I have preallocated the size of the array, doing an array size function will immediately stop my collection state. I can't use the DAQmx Read property node "Total Samples Per Channel Acquired" because that would count samples under the stream state.

0 Kudos
Message 21 of 33
(5,696 Views)

You accumalate size based on the DAQmx READ data output wire - it is the one that adds to the length. of your array.  Are you doing single channel reads instead of multiple?  I would fix the size of the acquisition reads to be an integer multiple of the total and keep track of the total myself as number of acquisitions and when it equals the total integer number of acq. you are done.

 

Do not base the stop on the size of the 2D array, base it on the accumulated size from the DAQmx Read.  The 2D array should be preallocated to prevent memory manager involvement.

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 22 of 33
(5,694 Views)

Can you please show the Polymorphic dropdown of the DAQmx READ that you are using?  I cant get the snippet to work dropping it on my BD for some reason. (Dang it).

 

If you are doing Analog 1D DBL, Multiple Channels, 1Sample <- this is likely your issue, you are reading WAY too slow from the DAQmx read.  You should be reading multiple channels, multiple samples - pick a size that lets you keep up without getting the -200279 error, which is telling you that your DAQmx Read Size is too small, and not able to keep up with your DAQmx Acq task in the background.

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 23 of 33
(5,689 Views)

Hey Ryan,

 

Thanks for the prompt responses. I follow but I am not sure how to carry out what you are suggesting. Can you provide a picture to guide me in the right direction? I've attached a vi with some of your suggestions. You can ignore the count being sent up to the MH loop.

0 Kudos
Message 24 of 33
(5,686 Views)

Got this after I sent the last reply. Still not sure how to accumulate the count off the read but here is the updated vi with the polymorphic selector visible.

0 Kudos
Message 25 of 33
(5,683 Views)

Ok you are getting there.

 

Multiple channels, multiple samples is what you want.  So - now set the # samples to read to something like 1024, divide 1024 into 2048 x 10 = number of acquisitions to complete.

 

Keep track of how many reads you have done since coming into the Collect Case.  You can reset the count to 0 in the non-collecting or Init case.  When you move into collecting you just Increment +1 the number of acquisitions.  Then when you get accumulated acquisitions = number of acquisitions to complete, you are done.

 

You also need to add a Clear Task or Stop Task for the DAQmx, I didn't see one.  Might have missed it though.

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 26 of 33
(5,680 Views)

Okay I think I am really close but can't get the "elapsed time" in the MH correct. I think my calculation is off but can't figure out what is incorrect.

 

Instead of 1024, I wired in 2 because I wanted a more real time looking display during the collection state. Am I on the right path with respect to what you recommended?

0 Kudos
Message 27 of 33
(5,664 Views)

I might have messed up the comparison for stop - but you should be able to figure this out from this picture.  If 1024 samples per read is too slow an update rate (0.5 seconds per update), change it to 512 which is 0.25 seconds per read.  This will allow the code to auto adapt to the number of samples per read if you do the math based on the number of samples to read.

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 28 of 33
(5,662 Views)

I would not use 2.

The more you read at once, the better your loop is able to keep up with the background process. 128 samples per channel @ 2048 Hz is 0.0625 seconds between updates - that should be plenty fast for updating the front panel chart.

 

Base your timer on (acquisitions/total number of acquisitions) * 100% and set the indicator to be 0-100%?

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 29 of 33
(5,661 Views)

Any update?

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 30 of 33
(5,645 Views)