Browse Source

Remove crappy data from the beginning of log-locked

Add script to make a histogram.
Looks pretty good: 93% of points are within ±5mA (14 bits)
99.9% of points are within ±10mA (13 bits)


git-svn-id: https://bucket.mit.edu/svn/nilm/zoom@8115 ddd99763-3ecb-0310-9145-efcb8ce7c51f
tags/zoom-1.0
jim 12 years ago
parent
commit
2e991709ee
3 changed files with 23 additions and 8 deletions
  1. BIN
      pc/data/20091104/log-locked.gz
  2. +14
    -0
      pc/data/20091104/makehist.m
  3. +9
    -8
      pc/data/20091104/process.txt

BIN
pc/data/20091104/log-locked.gz View File


+ 14
- 0
pc/data/20091104/makehist.m View File

@@ -0,0 +1,14 @@
a=load("log-locked");
len=size(a,1)
keith=a(:,3);
calib=a(1,4)
dac=a(:,5);
adc=a(:,6);
lookup=load("../../../firmware/lookup.inc");
meas=-(lookup(dac + 1)/64 - calib * adc);
keith_amps = keith * 50; # 50 turns
p = polyfit(meas, keith_amps, 1)
meas_amps = meas * p(1) + p(2); # calibration fit
err_amps = keith_amps - meas_amps;

[n, x] = hist(err_amps*1000, [-15:0.5:15], 1);

+ 9
- 8
pc/data/20091104/process.txt View File

@@ -1,6 +1,6 @@
Some processing thoughts:

grep ^1 log | tail -n +125 > log-locked
zcat log.gz | grep ^1 | tail -n +200000 > log-locked

octave:

@@ -9,20 +9,20 @@ octave:
t=1:10000;
keith=a(:,3);
calib=a(1,4)

dac=a(:,5);
adc=a(:,6);
meas=-(dac - calib * adc);
plot(keith(t),meas(t))
plot(keith(t),meas(t)) # should be linear

p = polyfit(keith, meas, 1)
plot(t,keith(t) * p(1) + p(2),t,meas(t)) # should match

plot(t,keith(t) * p(1) + p(2),t,meas(t))
t=1:len;
plot(t,keith(t) * p(1) + p(2) - meas(t))
plot(t,keith(t) * p(1) + p(2) - meas(t)) # absolute error (units=dac)
axis([0 len -1 1])

Range is something like +- 0.5 over the entire range (of "DAC values")
This gives log(1024 / 0.5) / log(2) = 11 bits
This gives log(1024 / 1.0) / log(2) = 10 bits
No good!
Now let's convert the DAC values to their more-accurate value using the lookup table

@@ -31,10 +31,11 @@ Now let's convert the DAC values to their more-accurate value using the lookup t
meas=-(lookup(dac + 1)/64 - calib * adc);
p = polyfit(keith, meas, 1)
t=1:len;
plot(t,keith(t) * p(1) + p(2) - meas(t))

plot(t,keith(t) * p(1) + p(2) - meas(t)) # absolute error (units=dac)
axis([0 len -0.3 0.3])

Now closer to +- 0.1
Now closer to +- 0.05
This gives log(1024 / 0.1) / log(2) = 13.3 bits




Loading…
Cancel
Save