LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating and inserting time array - DAQmx Read Continuous v.s. Finite

Hi all,

 

I have a set-up that is generating a time array and inserting it into the next column of the data. I made this originally for 2 channel continuous acquisition but I now need to apply it to both 1 and 2 channel, continuous and finite sampling. 

 

When I perform a similar thing for the finite sampling mode, it gets stuck in the innermost for loop until I stop the outer loop. I'm looking for suggestions on why it does this in the finite sampling and not in the continuous also. This is my first semester with Labview so I am still learning alot -- feel free to offer suggestions on anything else you see that could be wrong. 

 

I know another method for creating time arrays is taking the waveform components (Y and dt) and multiplying dt*i in a similar loop but I think that would cause the same issue. I did try this method but my time array was changing based on sampling rate rather than giving the total duration and I did not like that.

 

I will include screenshots of the areas in focus because this is still a very messy and complicated state machine (10 states) and I am only looking for assistance in one of them. 

 

Multi-Channel Continuous

rashelton42_0-1619488968356.png

 

Single Channel Finite Sampling

rashelton42_1-1619489010249.png

 

Recommendations on how to solve the time array issue within finite sampling would be greatly appreciated. I have the cont. sampling figured out but at a loss for the finite.

 

 

 

Much appreciated and best regards,

0 Kudos
Message 1 of 3
(719 Views)

Hi rashelton,

 


@rashelton42 wrote:

When I perform a similar thing for the finite sampling mode, it gets stuck in the innermost for loop until I stop the outer loop. I'm looking for suggestions on why it does this in the finite sampling and not in the continuous also.


THINK DATAFLOW! (This is the very basic principle of LabVIEW and you need to repeat those words every day, every hour, every minute when you are still earning LabVIEW!)

 

Due to DATAFLOW the inner loop keeps processing the same inputs again and again - until you press that "stop" button…

 


@rashelton42 wrote:

Recommendations on how to solve the time array issue within finite sampling would be greatly appreciated. I have the cont. sampling figured out but at a loss for the finite.


There is a function in the waveform functions palette which will give you an array of timestamps from your waveform…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(667 Views)

When GerdW says "Think Data-Flow", an important aspect of this (with respect to the "Continuous" vs "Finite" acquisition) is that a While Loop doesn't repeat until everything inside has a chance to run.  Suppose you sample 1000 points at 1 kHz, and pass the data to a Chart to display it.  You have a DAQmx Read connected to a Chart inside the While Loop.  Let's also assume you want to record for 10 seconds.

 

With Finite Acquisition, the "Read" takes 1 second, at which time the data are passed to the Chart to display.  Assume this takes 10 milliseconds.  Then the While Loop repeats, does another Read + Chart Display, but now you've "missed" acquiring 10 ms of data!

 

Contrast this with Continuous Acquisition.  It starts exactly the same way.  The Read takes 1 second, and the 1000 points are passed to the Chart.  But now the Read is set to Continuous, so it immediately starts acquiring the next 1000 points.  Meanwhile, the Chart plots the 1000 points, which takes the same 10 milliseconds.  So after 1.010 seconds, the While Loop repeats.  On the second loop, after 0.99 seconds, the remaining 990 points have been acquired (the first 10 were acquired at the end of the first loop while simultaneously plotting the Chart data) and passed to the Chart, so the second Loop runs slightly faster, taking exactly 1.000 seconds.  All further loops take the same 1.000 seconds, losing 0 data points.

 

Bob Schor

0 Kudos
Message 3 of 3
(646 Views)