PXI

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with Matlab DAQ toolbox and PXIe-1082 transmit/measurement delay

Hi Folks!

 

I was wondering of anyone could help me with my issue (i hope matlab related questions are allowed).

I am running a code with the intent on testing all of the channels of each card on my pxi chassis (4464, and 2 4461's) and to do this, I am generating a general sine wave in MATLAB and outputting it through one of the 4461's into the 4464. One problem I ran into was that the recording started about 0.1 seconds after the transmission, resulting on the captured data to be 0.1 seconds out of phase (late) of the outputted data.

atheo_0-1593115463530.png

Below is the code I am using: Notice how the foreground start is right after the data queue? Is this problem caused by that data queue command taking up 0.1 seconds, delaying the recording while the output runs? And should I look into using startBackground instead of startForeground?

 

Any advice or information is much appreciated! Thanks

 

v = daq.getVendors()
d = daq.getDevices()
deviceInfo = d(1)
get(deviceInfo)
get(deviceInfo.Subsystems(1))

 

%record + plot
s = daq.createSession('ni')
addAnalogInputChannel(s,'PXI1Slot2','ai3','Voltage');
addAnalogOutputChannel(s,'PXI1Slot5','ao0','Voltage')

%create sine wave output

output_data = sin(linspace(0,2*pi,1000)');
queueOutputData(s,output_data);
[input_data,time] = s.startForeground(); %try starting background before queing data


%
%plot output data
figure();
plot(time,output_data);
ylabel('Voltage');
xlabel('Time');
title('Output Data Queued')

 

%plot capture
figure();
plot(time,input_data);
ylabel('Voltage');
xlabel('Time');
title('Acquired Signal');

 

%set variable names:
dev1_chan3_capture = input_data;
dev2_chan0_output = output_data;

 

0 Kudos
Message 1 of 4
(2,311 Views)

The delay you would observe may be due to Filter delay on the instruments (due to the delta-sigma architecture of both DAC and ADC, filtering is required)

Based on the sampling rate, you can calculate the sample delay expected. Below snippet is for 4461 AO.

santo_13_0-1593376035969.png

Example calculation, Sample rate = 51.2 kS/s, Filter delay = 43.2 samples ~ 843.75us

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 2 of 4
(2,261 Views)

That is very helpful! Thank you!

 

I was wondering if you could send me a link to where you found that table (is it in the manual for the 4461?), and also is there some kind of equation I can use to calculate the delay? 

These tests I am running are sampled at 1KS/s, however, the device I am using has a sampling rate of 204.8KS/s

 

Thanks again!

-Alex

0 Kudos
Message 3 of 4
(2,253 Views)

These filter delays are specified in the datasheet/specification sheet for each DSA instrument (both AI and AO).

 

sampling rate = samples / time

 

rearranging them (time here can be considered as the delay time)

 

delay time = samples / sampling rate.

 

Please note that this delay is applicable to both AO and AI.

Total delay = AO delay + AI delay (assuming there is no delay in the loopback)

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 4 of 4
(2,244 Views)