Browse Source

Add the calibration from ADC to the actual current using linear least square fit

git-svn-id: https://bucket.mit.edu/svn/nilm/zoom@7715 ddd99763-3ecb-0310-9145-efcb8ce7c51f
tags/zoom-1.0
waritw 12 years ago
parent
commit
734d631667
14 changed files with 11141 additions and 1 deletions
  1. +24
    -0
      pc/data/20090722/computeI.m
  2. +56
    -0
      pc/data/20090722/loadlog.asv
  3. +50
    -1
      pc/data/20090722/loadlog.m
  4. +1001
    -0
      pc/data/20090722/test-0000
  5. +1001
    -0
      pc/data/20090722/test-0010
  6. +1001
    -0
      pc/data/20090722/test-0020
  7. +1001
    -0
      pc/data/20090722/test-0030
  8. +1001
    -0
      pc/data/20090722/test-0040
  9. +1001
    -0
      pc/data/20090722/test-0050
  10. +1001
    -0
      pc/data/20090722/test-0060
  11. +1001
    -0
      pc/data/20090722/test-0070
  12. +1001
    -0
      pc/data/20090722/test-0080
  13. +1001
    -0
      pc/data/20090722/test-0090
  14. +1001
    -0
      pc/data/20090722/test-0100

+ 24
- 0
pc/data/20090722/computeI.m View File

@@ -0,0 +1,24 @@
function [b]= computeI()

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
d01 = load('./test-0100');
d02 = load('./test-0090');
d03 = load('./test-0080');
d04 = load('./test-0070');
d05 = load('./test-0060');
d06 = load('./test-0050');
d07 = load('./test-0040');
d08 = load('./test-0030');
d09 = load('./test-0020');
d10 = load('./test-0010');
d11 = load('./test-0000');


x = [d01(:,2);d02(:,2);d03(:,2);d04(:,2);d05(:,2);d06(:,2);d07(:,2);d08(:,2);d09(:,2);d10(:,2);d11(:,2)];

y = [ones(length(d01),1)];
y2 = [y*100;y*90;y*80;y*70; y*60;y*50;y*40;y*30;y*20;y*10;y*0];

A = [x ones(length(x),1)];

b = A\y2;

+ 56
- 0
pc/data/20090722/loadlog.asv View File

@@ -0,0 +1,56 @@
data=load('log');
dac=data(:,1);
adc=data(:,2);
t=1:size(data,1);
calib=1.385419;
length(t)

% adc to actual current in (A/ADC count)
scale = 2.619482881297628/1000;

%% get the dc value
t=50:100;
dc = mean(dac(t)-calib*adc(t));
% extract the part for the light and pc
t=1080020:1080290; plot(t,dac(t)-calib*adc(t));
tx = (t - t(1))*1/8000; % in min

figure(1); plot(tx*1e3, (dac(t) - calib*adc(t) - dc)/calib*scale,'lineWidth',2); grid on;
xlabel('Time (ms)');
ylabel('Measured current (A)');

axEnd = tx(end)*1e3;
ax = axis;
axis([ax(1) axEnd ax(3) ax(4)]);


%%

t=100090:100358;
figure(2);
tx = (t - t(1))*1/8000; % in second
plot(tx*1e3,(dac(t)-calib*adc(t) - dc)/calib*scale,'lineWidth',2); grid on;
axEnd = tx(end)*1e3;
ax = axis;
axis([ax(1) axEnd ax(3)*2 ax(4)*2]);
xlabel('Time (ms)');
ylabel('Measured current (A)');


%% Keithley stuff
t=1590000:1680000;
tx = (t - t(1))*1/8000/60; % in second
figure(3); plot(tx,dac(t)-calib*adc(t) - dc);
xlabel('Time (s)');
ylabel('Measured current (dac count)');
axEnd = tx(end);
ax = axis;
axis([ax(1) axEnd ax(3) ax(4)]);


figure(4); plot(tx,dac(t)-calib*adc(t) - dc);
axEnd = tx(end);
ax = axis;
axis([ax(1) axEnd -1700 -1550]);
xlabel('Time (s)');
ylabel('Measured current (dac count)');

+ 50
- 1
pc/data/20090722/loadlog.m View File

@@ -1,8 +1,57 @@
data=load("log");
data=load('log');
dac=data(:,1);
adc=data(:,2);
t=1:size(data,1);
calib=1.385419;
length(t)

%% adc to actual current in (A/ADC count)
scale = computeI/1000;
scale = scale(1); % just the gain part only

%% get the dc value
t=50:100;
dc = mean(dac(t)-calib*adc(t));
% extract the part for the light and pc
t=1080020:1080290; plot(t,dac(t)-calib*adc(t));
tx = (t - t(1))*1/8000; % in min

figure(1); plot(tx*1e3, (dac(t) - calib*adc(t) - dc)/calib*scale,'lineWidth',2); grid on;
xlabel('Time (ms)');
ylabel('Measured current (A)');

axEnd = tx(end)*1e3;
ax = axis;
axis([ax(1) axEnd ax(3) ax(4)]);


%%

t=100090:100358;
figure(2);
tx = (t - t(1))*1/8000; % in second
plot(tx*1e3,(dac(t)-calib*adc(t) - dc)/calib*scale,'lineWidth',2); grid on;
axEnd = tx(end)*1e3;
ax = axis;
axis([ax(1) axEnd ax(3)*2 ax(4)*2]);
xlabel('Time (ms)');
ylabel('Measured current (A)');


%% Keithley stuff
t=1590000:1680000;
tx = (t - t(1))*1/8000/60; % in second
figure(3); plot(tx,dac(t)-calib*adc(t) - dc);
xlabel('Time (s)');
ylabel('Measured current (dac count)');
axEnd = tx(end);
ax = axis;
axis([ax(1) axEnd ax(3) ax(4)]);


figure(4); plot(tx,dac(t)-calib*adc(t) - dc);
axEnd = tx(end);
ax = axis;
axis([ax(1) axEnd -1700 -1550]);
xlabel('Time (s)');
ylabel('Measured current (dac count)');

+ 1001
- 0
pc/data/20090722/test-0000
File diff suppressed because it is too large
View File


+ 1001
- 0
pc/data/20090722/test-0010
File diff suppressed because it is too large
View File


+ 1001
- 0
pc/data/20090722/test-0020
File diff suppressed because it is too large
View File


+ 1001
- 0
pc/data/20090722/test-0030
File diff suppressed because it is too large
View File


+ 1001
- 0
pc/data/20090722/test-0040
File diff suppressed because it is too large
View File


+ 1001
- 0
pc/data/20090722/test-0050
File diff suppressed because it is too large
View File


+ 1001
- 0
pc/data/20090722/test-0060
File diff suppressed because it is too large
View File


+ 1001
- 0
pc/data/20090722/test-0070
File diff suppressed because it is too large
View File


+ 1001
- 0
pc/data/20090722/test-0080
File diff suppressed because it is too large
View File


+ 1001
- 0
pc/data/20090722/test-0090
File diff suppressed because it is too large
View File


+ 1001
- 0
pc/data/20090722/test-0100
File diff suppressed because it is too large
View File


Loading…
Cancel
Save