MatLab & National Instruments sampling rate issue

3 visualizaciones (últimos 30 días)
Agate Utane
Agate Utane el 20 de Dic. de 2019
Respondida: Agate Utane el 24 de Feb. de 2020
Hello!
I am using MatLab for modal test data acquisition and processing. I use a session based interface and data acquisition toolbox; I have connected my laptop to a National Instruments data card (NI-9234: https://www.ni.com/en-gb/support/model.ni-9234.html); I connect my force transducer ( https://www.bksv.com/en/products/transducers/vibration/Vibration-transducers/force-transducers/8230 ) and 3-axial accelerometer ( https://www.pcb.com/products?model=356a01 ) to this data card.
I have found that when I change the sampling frequency, my FRF (frequency response function) shifts along the frequency axis i.e. for different sampling rates my FRF has different response in respect to frequency. It is illustrated in the image below (legend shows different sampling rates). Theoretically, that should not be the case as the same modes must occur at the same natural frequencies (all curves in the image have to overlay). Just to add, sampling rate is the only parameter I change, all other test parameters remain the same.
I have tried several options:
  • I checked my script using a Simulink model which generates excitation and response. For simulated data, the FRF does not change depending on the sampling rate, which means my MatLab script and the way I calculate the FRF is correct;
  • In the raw test data I noticed inconsistent time step, which means that the actual sampling rate is not what I set it to be and the actual rate is not consistent during the test;
  • Even with a re-calculated actual sampling rate I was not able to acquire FRFs that overlap;
  • In the NI-9234 data sheet I noticed an equation to calculate the sampling rates that the hardware supports, so I used those in my tests, and that still did not solve the issue.
Has anyone else come across a similar issue, please? Any ideas of how to solve this would be much appreciated!
acc_comparison.png
This is the code I use to acquire and process the test data:
%% %-----SESSION SETUP-----%
clc %clear command window
clearvars %clear all variables from the workspace
close all %delete all figures
% This code is for modal test data acquisition only.
% Direction explanation: X - tangential(T), Y - radial(R), Z - lateral(L).
daq.getDevices %display connected devices
session_1=daq.createSession('ni'); %create session for a specific vendor
fs=input('Choose a sampling rate [51200/25600/12800/10240/6400/5120/3200/2560/2048]: '); %[Hz]
t=60; %test duration [s]
session_1.Rate=fs;
n=fs*t; %total number of data points
%add input channels to the session
addAnalogInputChannel(session_1,'Dev1','ai0','IEPE'); %force transducer
addAnalogInputChannel(session_1,'Dev1','ai1','Accelerometer'); %accelerometer X
addAnalogInputChannel(session_1,'Dev1','ai2','Accelerometer'); %accelerometer Y
addAnalogInputChannel(session_1,'Dev1','ai3','Accelerometer'); %accelerometer Z
%current in Amps used to excite accelerometer/force transducer
session_1.Channels(1).ExcitationCurrent=0.002;
session_1.Channels(2).ExcitationCurrent=0.002;
session_1.Channels(3).ExcitationCurrent=0.002;
session_1.Channels(4).ExcitationCurrent=0.002;
%% %-----VARIABLES-----%
acc_sensitivity=0.005; %accelerometer sensitivity [V/g]
ft_sensitivity=0.1085; %force transducer sensitivity [V/N]
%sets accelerometer sensitivity in V/g
session_1.Channels(2).Sensitivity=acc_sensitivity;
session_1.Channels(3).Sensitivity=acc_sensitivity;
session_1.Channels(4).Sensitivity=acc_sensitivity;
%add output channels to the session
addAnalogOutputChannel(session_1,'Dev3',0,'Voltage');
%% %-----EXCITATION SIGNAL SETUP-----%
pd=makedist('Normal','mu',0,'sigma',1); %pd-probability distribution % create normal distribution with mean of 0 and standard deviation of 1
white_noise= random(pd,[n 1]);
norm_factor=max(white_noise);
output_data=white_noise./norm_factor;
figure(1)
plot(output_data);
title('White noise excitation signal')
xlabel('Data points')
ylabel('Normalised white noise magnitude')
queueOutputData(session_1,output_data); %prepare the output signal for application
%% %-----DATA ACQUISITION-----%
[data,time]=session_1.startForeground(); %start data acquisition
g=9.81; %gravitational acceleration [ms-2]
a=data(:,2:4).*g; %acceleration [ms-2]
f=data(:,1)./ft_sensitivity; %force transducer voltage conversion to force [N]
figure(2)
subplot(2, 2, 1)
plot(time,f);
title('Force transducer signal')
xlabel('Time (s)')
ylabel ('Force (N)')
subplot(2, 2, 2)
plot(time,a(:,1));
title('Accelerometer - X signal')
xlabel('Time (s)')
ylabel ('Acceleration (m/s^2)')
subplot(2, 2, 3)
plot(time,a(:,2));
title('Accelerometer - Y signal')
xlabel('Time (s)')
ylabel ('Acceleration (m/s^2)')
subplot(2, 2, 4)
plot(time,a(:,3));
title('Accelerometer - Z signal')
xlabel('Time (s)')
ylabel ('Acceleration (m/s^2)')
%% %-----TRANSFER FUNCTIONS & COHERENCE-----%
% %actual sampling rate calculation
% time_step=diff(time);
% fs=mean(1./time_step);
%basic accelerance transfer function acquisition (input, output, window, noverlap, nfft, fs)
[acc_X,freq]=tfestimate(f,a(:,1),[],[],[],fs);
[acc_Y,]=tfestimate(f,a(:,2),[],[],[],fs);
[acc_Z,]=tfestimate(f,a(:,3),[],[],[],fs);
direction=input('Choose direction of interest [X/Y/Z]: ','s');
if direction=='X'
acc=acc_X;
elseif direction=='Y'
acc=acc_Y;
else
acc=acc_Z;
end
figure(3)
plot(freq, abs(acc))
str=sprintf('Accelerance for %c direction versus frequency',direction);
title(str)
xlabel('Frequency (Hz)')
ylabel('|Accelerance| (ms^{-2}/N)')

Respuesta aceptada

Agate Utane
Agate Utane el 24 de Feb. de 2020
If anyone was following this post, I investigated this issue further by contacting National Instruments and MathWorks technical support teams. Turns out that there is a bug in MatLab that causes data disruption at certain sampling rates when NI-9234 is used. MathWorks informed me that the development team is investigating this bug now, so hopefully it will get fixed soon!
Thank you!

Más respuestas (0)

Categorías

Más información sobre Simultaneous and Synchronized Operations en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by