differential data channels with data/instrumentation toolbox not matching NI MAX

11 Ansichten (letzte 30 Tage)
hi all.
ok, here is the problem at hand. We had a system setup to do 7-8 differential measurements at the same time and log data and record it at the same time. Id swear the system was working 100%, ie, we were getting outputs that we expected from sensors that were integrated into it. A few weeks ago, the system has to be rewired after sitting idle for about a 2 weeks.
Because I would have swore the system was working 100%, I am somewhat perplexed at what Im seeing. When a 0.5Hz 5V PP squarewave (from FG)is passed into AI0+/AIO-, Im seeing this similar waveform on all the channels (AI1-7) with only small differences (ie 5-10mV between them, they are not exactly the same). These other channels are not connected to anything! The only connection are the 2 wires for the input and the common. What makes me think this is a software issue is that if I go into NI MAX, I can scope each channel as a differential pair and then get the correct response on AI0/AI0- with the same hardware configuration. In NI MAX, the other channels do show a small lack of isolation (maybe 0.7V PP) but this is expected and this leakage is reduced the further away I get from AIO. Im getting 10VPP on each of the channels with the MATLAB software though so this is unexpected and does not match MAX.
This waveform that shows up on the other channels (not connected channels) is repeatable with another AI module. Also, it is repeatable when I reference the the low end of the differential (AI0-) to the common/reference although I get some noise.. It is also repeatable on all the other channels such as if I apply 5V PP to AI3 instead, it will show up on AI0 or AI2.
Id swear this code was working, just not sure what changed or if something broke during a rewiring process.. Ive tried running the old code that we knew works months ago and it seems to have the same problem where the other channels show up. Im also thinking it could be that if we hook up the rest of the wires like the system was before, it may mask whatever is occurring .. So the channels may all appear to have functional hardware or who knows, maybe this is normal.
if I put in a DC voltage on AI3, I appear to get the proper DC response on that one channel, but all voltage channels appear to follow the DC voltage to a degree or so although they are not connected.
if I put a DC voltage on AI3 while the FG is running on AI0, I get the correct DC response on AI3 and correct response on AI0 (the FG) but all the other channels follow the FG within 10mV
Why does this not happen in MAX.. I wanted to log data from all channels and sort it later, but if they follow, or ghost real data, its not legitimate.
Software of relevance A. MATLAB Version 8.4 (R2014b) B. Data Acquisition Toolbox Version 3.6 (R2014b) C. Instrument Control Toolbox Version 3.6 (R2014b) Signal Processing Toolbox Version 6.22 (R2014b) Hardware of relevance A. CompactDAQ Chassis NI cDAQ-9188XT B. Thermocouple module: DAQ 9211 Module C. AI module:DAQ 9206 Module
Im not sure if we are using it in differential model correctly, I don't see the input type specified
Really could use some help on this. Thanks in advance. Ill post some of the core coding but not really sure it is the issue
% Key Code Areas
function configure_daq(~,~)
figure_position = get(gcf,'Position');
h = waitbar(0,'Initializing DAQ');
d = daq.getDevices();
% Thermocouple DAQ Object
waitbar(1/3,h,'Initializing Thermocouple DAQ Object');
s1 = daq.createSession('ni');
s1.addAnalogInputChannel(d(1).ID,[0:3],'Thermocouple');
set(s1.Channels,'Units','Fahrenheit');
set(s1.Channels,'ThermocoupleType','K');
rate_limit = get(s1,'RateLimit');
set(s1,'Rate',rate_limit(2)); % set to maximum speed
fprintf('Created DAQ Object for %s\n',s1.Channels(1).Device.Model);
% Voltage DAQ Object
waitbar(2/3,h,'Initializing Thermocouple DAQ Object');
s2 = daq.createSession('ni');
s2.addAnalogInputChannel(d(2).ID,[[0:7] [16:23]],'Voltage');
rate_limit = get(s2,'RateLimit');
set(s2,'Rate',rate_limit(2)); % set to maximum speed
fprintf('Created DAQ Object for %s\n',s2.Channels(1).Device.Model);
% Common Settings
%set([s1 s2],'DurationInSeconds',120);
set(s1,'IsContinuous',true)
set(s2,'IsContinuous',true)
% Use External Trigger to Synchronizer
% s3 = daq.createSession('ni');
% addTriggerConnection(s1,'External','cDAQ9188XT-1A894FA/PFI0','StartTrigger');
% addTriggerConnection(s2,'External','cDAQ9188XT-1A894FA/PFI0','StartTrigger');
% c1 = s1.Connections(1);
% c2 = s2.Connections(1);
% c1.TriggerCondition = 'RisingEdge';
% c2.TriggerCondition = 'RisingEdge';
% Thermocouple Data File Logging and Realtime Plot
%addlistener(s1,'DataAvailable',@(src, event)identify(src, event, fid1));
addlistener(s1,'DataAvailable',@(src, event)logDataToFile(src, event, fid1));
addlistener(s1,'DataAvailable',@(src, event)update_fifo(src, event));%, fig_obj.subplot1);
addlistener(s1,'DataAvailable',@(src, event)update_ui_text_fields(src, event,fid1));
s1.NotifyWhenDataAvailableExceeds = 2; % 0.5 sec update rate
% Thermocouple Data File Logging and Realtime Plot
%addlistener(s2,'DataAvailable',@(src, event)identify(src, event, fid2));
addlistener(s2,'DataAvailable',@(src, event)logDataToFile(src, event, fid2));
addlistener(s2,'DataAvailable',@(src, event)update_fifo(src, event)); %, fig_obj.subplot2));
addlistener(s2,'DataAvailable',@(src, event)update_ui_text_fields(src, event,fid2));
s2.NotifyWhenDataAvailableExceeds = 7500; % 0.5 sec update rate
close(h);
end
function [] = start(obj,event)
if isempty(fid1) || isempty(fopen(fid1))
fprintf('Open files first\n');
return;
end
if isempty(s1)
fprintf('Initialize DAQ First\n');
return;
end
axes(fig_obj.subplot1);
cla(gca); drawnow;
axes(fig_obj.subplot2);
cla(gca); drawnow;
s1.startBackground();
fprintf('Started %s\n',s1.Channels(1).Device.Model);
s2.startBackground();
fprintf('Started %s\n',s2.Channels(1).Device.Model);
end
function [] = stop(obj,event)
if isempty(s1)
return;
end
s1.stop();
fprintf('Stopped %s\n',s1.Channels(1).Device.Model);
s2.stop();
fprintf('Stopped %s\n',s2.Channels(1).Device.Model);
pause(1);
clear_fifo();
close_files();
end
function open_file(obj,event)
% Create new files
[filename,pathname] = uiputfile('*.bin');
if isequal(filename,0) || isequal(pathname,0)
return;
end
file_time_stamp = datestr(now,'yyyymmdd_HHMMSS');
filename1 = [filename(1:end-4) '_celltemp_' file_time_stamp '.bin'];
filename2 = [filename(1:end-4) '_cellvolt_' file_time_stamp '.bin'];
fid1 = fopen(fullfile(pathname,filename1),'w');
fprintf('Opened %s for writing\n',filename1);
fid2 = fopen(fullfile(pathname,filename2),'w');
fprintf('Opened %s for writing\n',filename2);
end
function close_files(obj,event)
if ~isempty(fid1)
fclose(fid1);
fclose(fid2);
fprintf('Closed Files\n');
end
end
function update_fifo(obj, event) %, subplot_handle)
fifo_depth = 5; % minutes
fifo_depth = fifo_depth*60; % seconds
%Nsamples = numel(event.TimeStamps); % samples returned from event
fs = obj.Rate; % sample rate
fifo_depth_samples = floor(fifo_depth*fs);
Ndec = 1000; % decimation factor for cell voltage plot
switch obj.Channels(1).Device.Model
case 'NI 9211'
cell_temp_time = [cell_temp_time ; event.TimeStamps];
cell_temp = [cell_temp ; event.Data];
if size(cell_temp,1) > fifo_depth_samples
cell_temp = cell_temp(end-fifo_depth_samples:end,:);
cell_temp_time = cell_temp_time(end-fifo_depth_samples:end);
end
case 'NI 9206'
cell_volt_time = [cell_volt_time ; event.TimeStamps(1:Ndec:end)];
cell_volt = [cell_volt ; event.Data(1:Ndec:end,:)];
if size(cell_volt,1) > fifo_depth_samples
cell_volt = cell_volt(end-fifo_depth_samples:end,:);
cell_volt_time = cell_volt_time(end-fifo_depth_samples:end);
end
end
if ~pause_display
plotRealTimeData(obj.Channels(1).Device.Model, event); %,subplot_handle);
end
end

Antworten (2)

Vinod
Vinod am 25 Nov. 2015
This could be because of rewiring. During the rewiring process, one of the wires may be inducing a signal in an adjacent wire or perhaps termination is not correct on certain channels?
Also, check your grounding - did you ground all the hardware correctly, including your termination and breakout boxes?
If you know your code worked perfectly before rewiring and failed after rewiring, I would start with this assumption.

Esteban Bagdy
Esteban Bagdy am 6 Nov. 2017
Did you ever find an actual solution for this? I am having a similar problem where NI MAX reads the signals 100% correctly while Matlab is off by ~10%.

Kategorien

Mehr zu Instrument Connection and Communication finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by