Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does my AI acquisition slow down to my frequency measurement rate?

I'm using Labview/Daqmx to program my SCXI 1520 and TC modules while at the same time using the multifunction capabilities of the E-card controlling the SCXI.  This has been fairly easy until I wanted to use the frequency and counter measurements (outputs/DIO works great).  I'm using a waveform with buffered acquisition for the read on the AI channels and obviously there is no waveform for the frequency measurement so I'm just combining the signals using the dynamic data.  This works great when my input frequency is higher than my acquisition frequency.  When my input frequency is lower than my acquisition frequency the acquisition slows down to that frequency and the AI read falls behind (buffer fills while waiting for another frequency measurement).  I'm assuming the frequency read is not keeping up with AI read.  I understand that as the frequency is reduced it takes more time to calculate the frequency.  So how do I "read" the frequency measurement at the same rate as the AI data?  I'm fine with using the last frequency measurement until a new frequency measurement is available but I can't even seem to be able to do that.
 
An example of the problem is measurement of vehicle pedal force (AI channel) with pulse input for vehicle speed.  Assuming 100 Hz acquisition and the vehicle stopped or going slow (very slow pulse train) I should be able to acquire data at 100 Hz even if I just use the last data point for the frequency channel until another point is available.
 
 
Please help, thanks.
0 Kudos
Message 1 of 5
(4,369 Views)

Hello,

Just to clarify, you have one task set up for frequency measurement and another one set up for just analog input, and when you reduce the expected frequency range on your frequency task, the sampling rate of the analog input task seems to be reducing as well?

Could you also clarify the following statement please. " I'm using a waveform with buffered acquisition for the read on the AI channels and obviously there is no waveform for the frequency measurement so I'm just combining the signals using the dynamic data. "

Thank you,

Raajit Lall

Applications Engineer

National Instruments

Raajit L
National Instruments
0 Kudos
Message 2 of 5
(4,343 Views)
The problem was that the Frequency Read command was waiting for data to become available and holding up the AI Read that was contained within the same while loop.  So at low frequencies, those below my acquisition frequency, the AI buffer starts filling and overruns.  I have changed my Frequency Read so that it uses the previous value if there are no points currently available.  All is well as far as that goes.
 
To address the second issue, in DAQmx there is no option to output the Frequency Read as a waveform, and so it is difficult to merge the frequency data with my AI data (no time-base for the frequency reads).  I have created a waveform out of the frequency data by using the time values from my AI read but I don't think this is a great way to go.  What is the best way to align the frequency data (without a time base) to my AI waveform data?
 
Thanks.
0 Kudos
Message 3 of 5
(4,336 Views)

Basically, the very fact that you're *doing* a frequency read suggests that you don't know the expected freq ahead of time, and probably suggests that it can vary.  The waveform datatype assumes a constant interval between samples which wouldn't generally be true for frequency measurement, and that's why you can't use it.  Since the actual timestamps of the frequency measurements are NOT the same as those in the analog waveform, it's likely a mistake to pretend they are.

My method is to create my own array of "timestamps" for the frequency data.  Create a For loop with a shift register initialized to 0 from outside the loop.  Let your freq array auto-index the loop.  On each element, perform (1/x).  Add result to the left-hand shift register value and write it to both the right-hand shift register and to an auto-indexing output.  When the loop completes, the output array will hold timestamps that correlate to your freq measurements.  From there you can choose whether to display on an X-Y Graph, or whether to perform some interpolations to calculate freqs at the analog sample times or vice versa.

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 4 of 5
(4,331 Views)
I'm doing something similar with regard to the shift registers but I think your version of events is better since it will get a correct time stamp.
 
Thanks
0 Kudos
Message 5 of 5
(4,324 Views)