add processing and part measurements

This commit is contained in:
acereca 2018-05-15 10:00:00 +02:00
parent 01f8510bbd
commit ff72ec211c
12 changed files with 4374 additions and 0 deletions

4
.gitignore vendored
View File

@ -27,3 +27,7 @@
data/log.csv
data/ea_control.py
data/labcontrol
data/raspi-i2c/i2c2.py
data/raspi-i2c/i2c
data/m03_poticalib/poticalib_ana.py
data/m02_adccalib_48/adccalib_48.py

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -0,0 +1,101 @@
from labcontrol.ea import EA_PS8080
from labcontrol.ea import EA_EL9080
from labcontrol.ea import EA_interface
import time
# Setup
maxpower = 2000
psvolt = 48.0
steps = 40
settletime = 10
measures = 4
measuretime = .5
# defines
stepwidth = maxpower/psvolt/steps
starttime = time.time()
def identify(devlist):
outdict = {}
for dev in devlist:
devid = EA_interface(dev).write(12, 0, [])
if "PS" in devid[1]:
devtype = "ps"
else:
devtype = "el"
outdict[devtype] = {"id":devid[1][:-1], "address":dev, "type":devtype}
return outdict
def init(tree):
for dev, dat in tree.iteritems():
if dat['type'] == "el":
devobj = EA_EL9080(tree[dev]['address'])
else:
devobj = EA_PS8080(tree[dev]['address'])
#devobj.interface.debug_output = False
devobj.remote(True)
time.sleep(1)
if dat['type'] == "el":
devobj.set_current(0)
devobj.enable(True)
else:
devobj.set_current(maxpower/psvolt)
devobj.set_voltage(48)
devobj.output(True)
tree[dev]['dev'] = devobj
def deinit(tree):
for dev, dat in tree.iteritems():
if tree[dev]['type'] == "el":
tree[dev]['dev'].enable(False)
else:
tree[dev]['dev'].output(False)
tree[dev]['dev'].remote(False)
tree[dev]['dev'].close()
def measurement(devicetree):
print("starting Measurement (approx {}s)".format(steps*(settletime + measures*measuretime)))
log = "time,set_curr,set_volt,act_curr_ps,act_curr_el\n"
devicetree['ps']['dev'].set_current(stepwidth*steps)
for i in range(1, steps):
steppos = i*stepwidth
try:
devicetree['el']['dev'].set_current(steppos)
time.sleep(settletime)
act_el = 0
act_ps = 0
for m in range(0, measures):
act_el += devicetree['el']['dev'].get_actual_values()['i']
act_ps += devicetree['ps']['dev'].get_actual_values()['i']
time.sleep(measuretime)
act_ps = act_ps/measures
act_el = act_el/measures
log_new= "{:.3f},{:.3f},{:.1f},{:.3f},{:.3f}\n".format(
time.time()-starttime,
steppos,
48.0,
act_ps,
act_el
)
log += log_new
except Exception as e:
print type(e)
print e
print(log)
with open('./log.csv', 'w') as f:
f.write(log)
if __name__ == "__main__":
devicetree = identify(["/dev/ttyUSB0","/dev/ttyUSB1"])
print(devicetree)
init(devicetree)
init(devicetree)
measurement(devicetree)
deinit(devicetree)

View File

@ -0,0 +1,40 @@
time,set_curr,set_volt,act_curr_ps,act_curr_el
16.357,1.042,48.0,0.870,1.047
28.546,2.083,48.0,1.839,2.031
40.752,3.125,48.0,2.835,3.031
52.939,4.167,48.0,3.939,4.141
65.100,5.208,48.0,4.965,5.172
77.241,6.250,48.0,6.054,6.250
89.367,7.292,48.0,7.062,7.258
101.493,8.333,48.0,8.149,8.352
113.651,9.375,48.0,9.159,9.359
125.777,10.417,48.0,10.262,10.461
137.903,11.458,48.0,11.272,11.477
150.061,12.500,48.0,12.248,12.453
162.235,13.542,48.0,13.335,13.531
174.425,14.583,48.0,14.325,14.531
186.615,15.625,48.0,15.408,15.609
198.805,16.667,48.0,16.385,16.625
210.979,17.708,48.0,17.470,17.703
223.169,18.750,48.0,18.464,18.672
235.342,19.792,48.0,19.433,19.656
247.532,20.833,48.0,20.515,20.734
259.738,21.875,48.0,21.505,21.734
271.944,22.917,48.0,22.586,22.820
284.150,23.958,48.0,23.561,23.797
296.355,25.000,48.0,24.697,24.938
308.546,26.042,48.0,25.685,25.906
320.736,27.083,48.0,26.790,27.016
332.925,28.125,48.0,27.771,28.000
345.115,29.167,48.0,28.752,28.977
357.289,30.208,48.0,29.832,30.078
369.479,31.250,48.0,30.844,31.078
381.670,32.292,48.0,31.934,32.156
393.859,33.333,48.0,32.917,33.164
406.049,34.375,48.0,34.020,34.250
418.223,35.417,48.0,35.041,35.281
430.413,36.458,48.0,36.191,36.422
442.602,37.500,48.0,37.209,37.438
454.793,38.542,48.0,38.183,38.422
466.983,39.583,48.0,39.244,39.492
479.172,40.625,48.0,40.246,40.500
1 time set_curr set_volt act_curr_ps act_curr_el
2 16.357 1.042 48.0 0.870 1.047
3 28.546 2.083 48.0 1.839 2.031
4 40.752 3.125 48.0 2.835 3.031
5 52.939 4.167 48.0 3.939 4.141
6 65.100 5.208 48.0 4.965 5.172
7 77.241 6.250 48.0 6.054 6.250
8 89.367 7.292 48.0 7.062 7.258
9 101.493 8.333 48.0 8.149 8.352
10 113.651 9.375 48.0 9.159 9.359
11 125.777 10.417 48.0 10.262 10.461
12 137.903 11.458 48.0 11.272 11.477
13 150.061 12.500 48.0 12.248 12.453
14 162.235 13.542 48.0 13.335 13.531
15 174.425 14.583 48.0 14.325 14.531
16 186.615 15.625 48.0 15.408 15.609
17 198.805 16.667 48.0 16.385 16.625
18 210.979 17.708 48.0 17.470 17.703
19 223.169 18.750 48.0 18.464 18.672
20 235.342 19.792 48.0 19.433 19.656
21 247.532 20.833 48.0 20.515 20.734
22 259.738 21.875 48.0 21.505 21.734
23 271.944 22.917 48.0 22.586 22.820
24 284.150 23.958 48.0 23.561 23.797
25 296.355 25.000 48.0 24.697 24.938
26 308.546 26.042 48.0 25.685 25.906
27 320.736 27.083 48.0 26.790 27.016
28 332.925 28.125 48.0 27.771 28.000
29 345.115 29.167 48.0 28.752 28.977
30 357.289 30.208 48.0 29.832 30.078
31 369.479 31.250 48.0 30.844 31.078
32 381.670 32.292 48.0 31.934 32.156
33 393.859 33.333 48.0 32.917 33.164
34 406.049 34.375 48.0 34.020 34.250
35 418.223 35.417 48.0 35.041 35.281
36 430.413 36.458 48.0 36.191 36.422
37 442.602 37.500 48.0 37.209 37.438
38 454.793 38.542 48.0 38.183 38.422
39 466.983 39.583 48.0 39.244 39.492
40 479.172 40.625 48.0 40.246 40.500

View File

@ -0,0 +1,45 @@
#! /usr/bin/python3
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.ioff()
plt.style.use('bmh')
data = pd.read_csv("./log_2kw_direct.csv")
print(data)
#plt.errorbar(
# data['time'],
# data['act_curr_ps'],
# yerr=data['act_curr_ps']*.002,
# label="Spannungsquelle Ausgang",
# fmt='.'
#)
#plt.errorbar(
# data['time'],
# data['act_curr_el']-.125,
# label="Elektronische Last Eingang",
# fmt='.'
#)
data['act_curr_el'] = data['act_curr_el']-.125
meandist = np.mean(data['act_curr_el'] - data['act_curr_ps'])
plt.bar(data['set_curr'], (data['act_curr_el']-data['act_curr_ps']-meandist), .2, aa=True)
data['nom_max_delta_i'] = np.sqrt(2*(data['set_curr']*.002)**2)
plt.errorbar(
data['set_curr'],
data['nom_max_delta_i'],
fmt='.'
)
plt.errorbar(
data['set_curr'],
-data['nom_max_delta_i'],
fmt='.'
)
plt.ylabel('$\Delta$I/A')
plt.xlabel('I$_{set}$/A')
plt.legend()
plt.savefig("2kw_direct.png")

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,61 @@
#! /usr/bin/python3
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
lognum = 2
plt.ioff()
plt.style.use('bmh')
plt.figure(figsize=(19.2,10.8))
data = pd.read_csv("./log_poticalib_ana_{:02d}.csv".format(lognum))
print(data)
#plt.errorbar(
# data['time'],
# data['act_curr_ps'],
# yerr=data['act_curr_ps']*.002,
# label="Spannungsquelle Ausgang",
# fmt='.'
#)
#plt.errorbar(
# data['time'],
# data['act_curr_el']-.125,
# label="Elektronische Last Eingang",
# fmt='.'
#)#
data['val_poti'] = data['val_poti'].map(lambda x: int(x, base=16))
data['r_bcu/kohm'] = 2*4.7+1/(1/data['r_restheo/kohm']+1/75)
data['v_bcutheo/v'] = 0.7+0.7*30.1/(data['r_bcu/kohm']+6.49)
plt.errorbar(
data['r_bcu/kohm'],
data['v_keith/v'],
yerr=data['dv_keith/v'],
label="V$_{Keith,IV8A}$",
fmt='.'
)
plt.errorbar(
data['r_bcu/kohm'],
data['v_pit/v'],
yerr=data['dv_pit/v)'],
label="V$_{PIT,IV8A}$",
fmt='.'
)
plt.plot(
data['r_bcu/kohm'],
data['v_bcutheo/v'],
label="V$_{BCU,O}$"
)
plt.xlabel('$R_{BCU,Set}$/k$\Omega$')
plt.ylabel('V$_{1V8A}$/V')
plt.title("PowerIt Calibration: Analog Potentiometer")
plt.legend()
#-plt.savefig("2kw_direct.png")
plt.savefig("adccalib_{:02d}.eps".format(lognum), format='eps', dpi=1000)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
elapsetime/s,val_poti,r_restheo/kohm,dr_restheo/kohm,v_keith/v,dv_keith/v,v_pit/v,dv_pit/v)
37.121,0x000,0.000,0.0195,2.0217,0.0000,2.015,0.000
58.041,0x040,2.500,0.0195,1.8467,0.0000,1.981,0.000
88.620,0x080,5.000,0.0195,1.7196,0.0000,1.757,0.000
122.717,0x0c0,7.500,0.0195,1.6239,0.0000,1.625,0.000
1 elapsetime/s val_poti r_restheo/kohm dr_restheo/kohm v_keith/v dv_keith/v v_pit/v dv_pit/v)
2 37.121 0x000 0.000 0.0195 2.0217 0.0000 2.015 0.000
3 58.041 0x040 2.500 0.0195 1.8467 0.0000 1.981 0.000
4 88.620 0x080 5.000 0.0195 1.7196 0.0000 1.757 0.000
5 122.717 0x0c0 7.500 0.0195 1.6239 0.0000 1.625 0.000

View File

@ -0,0 +1,33 @@
elapsetime/s,val_poti,r_restheo/kohm,dr_restheo/kohm,v_keith/v,dv_keith/v,v_pit/v,dv_pit/v)
18.399,0x000,0.0000,0.0195,2.0217,0.0000,2.0239,0.0004
30.491,0x008,0.3125,0.0195,1.9960,0.0000,1.9983,0.0003
42.618,0x010,0.6250,0.0195,1.9719,0.0000,1.9743,0.0002
55.085,0x018,0.9375,0.0195,1.9486,0.0000,1.9509,0.0002
67.380,0x020,1.2500,0.0195,1.9267,0.0000,1.9290,0.0003
79.489,0x028,1.5625,0.0195,1.9055,0.0000,1.9076,0.0003
91.569,0x030,1.8750,0.0195,1.8851,0.0000,1.8873,0.0000
103.798,0x038,2.1875,0.0195,1.8658,0.0000,1.8681,0.0003
116.351,0x040,2.5000,0.0195,1.8467,0.0000,1.8488,0.0003
128.406,0x048,2.8125,0.0195,1.8285,0.0000,1.8308,0.0004
140.487,0x050,3.1250,0.0195,1.8111,0.0000,1.8132,0.0003
152.549,0x058,3.4375,0.0195,1.7945,0.0000,1.7966,0.0004
165.088,0x060,3.7500,0.0195,1.7785,0.0000,1.7809,0.0002
177.330,0x068,4.0625,0.0195,1.7630,0.0000,1.7654,0.0004
189.439,0x070,4.3750,0.0195,1.7480,0.0000,1.7502,0.0003
201.549,0x078,4.6875,0.0195,1.7335,0.0000,1.7358,0.0003
213.762,0x080,5.0000,0.0195,1.7196,0.0000,1.7217,0.0004
226.329,0x088,5.3125,0.0195,1.7062,0.0000,1.7084,0.0005
238.392,0x090,5.6250,0.0195,1.6934,0.0000,1.6955,0.0003
250.453,0x098,5.9375,0.0195,1.6808,0.0000,1.6829,0.0004
262.593,0x0a0,6.2500,0.0195,1.6686,0.0000,1.6709,0.0004
275.091,0x0a8,6.5625,0.0195,1.6569,0.0000,1.6590,0.0004
287.373,0x0b0,6.8750,0.0195,1.6453,0.0000,1.6470,0.0003
299.485,0x0b8,7.1875,0.0195,1.6344,0.0000,1.6360,0.0002
311.562,0x0c0,7.5000,0.0195,1.6239,0.0000,1.6254,0.0000
323.866,0x0c8,7.8125,0.0195,1.6135,0.0000,1.6151,0.0003
336.342,0x0d0,8.1250,0.0195,1.6035,0.0000,1.6052,0.0004
348.453,0x0d8,8.4375,0.0195,1.5937,0.0000,1.5952,0.0004
360.497,0x0e0,8.7500,0.0195,1.5845,0.0000,1.5863,0.0004
372.592,0x0e8,9.0625,0.0195,1.5753,0.0000,1.5771,0.0000
385.108,0x0f0,9.3750,0.0195,1.5663,0.0000,1.5679,0.0004
397.381,0x0f8,9.6875,0.0195,1.5576,0.0000,1.5591,0.0003
1 elapsetime/s val_poti r_restheo/kohm dr_restheo/kohm v_keith/v dv_keith/v v_pit/v dv_pit/v)
2 18.399 0x000 0.0000 0.0195 2.0217 0.0000 2.0239 0.0004
3 30.491 0x008 0.3125 0.0195 1.9960 0.0000 1.9983 0.0003
4 42.618 0x010 0.6250 0.0195 1.9719 0.0000 1.9743 0.0002
5 55.085 0x018 0.9375 0.0195 1.9486 0.0000 1.9509 0.0002
6 67.380 0x020 1.2500 0.0195 1.9267 0.0000 1.9290 0.0003
7 79.489 0x028 1.5625 0.0195 1.9055 0.0000 1.9076 0.0003
8 91.569 0x030 1.8750 0.0195 1.8851 0.0000 1.8873 0.0000
9 103.798 0x038 2.1875 0.0195 1.8658 0.0000 1.8681 0.0003
10 116.351 0x040 2.5000 0.0195 1.8467 0.0000 1.8488 0.0003
11 128.406 0x048 2.8125 0.0195 1.8285 0.0000 1.8308 0.0004
12 140.487 0x050 3.1250 0.0195 1.8111 0.0000 1.8132 0.0003
13 152.549 0x058 3.4375 0.0195 1.7945 0.0000 1.7966 0.0004
14 165.088 0x060 3.7500 0.0195 1.7785 0.0000 1.7809 0.0002
15 177.330 0x068 4.0625 0.0195 1.7630 0.0000 1.7654 0.0004
16 189.439 0x070 4.3750 0.0195 1.7480 0.0000 1.7502 0.0003
17 201.549 0x078 4.6875 0.0195 1.7335 0.0000 1.7358 0.0003
18 213.762 0x080 5.0000 0.0195 1.7196 0.0000 1.7217 0.0004
19 226.329 0x088 5.3125 0.0195 1.7062 0.0000 1.7084 0.0005
20 238.392 0x090 5.6250 0.0195 1.6934 0.0000 1.6955 0.0003
21 250.453 0x098 5.9375 0.0195 1.6808 0.0000 1.6829 0.0004
22 262.593 0x0a0 6.2500 0.0195 1.6686 0.0000 1.6709 0.0004
23 275.091 0x0a8 6.5625 0.0195 1.6569 0.0000 1.6590 0.0004
24 287.373 0x0b0 6.8750 0.0195 1.6453 0.0000 1.6470 0.0003
25 299.485 0x0b8 7.1875 0.0195 1.6344 0.0000 1.6360 0.0002
26 311.562 0x0c0 7.5000 0.0195 1.6239 0.0000 1.6254 0.0000
27 323.866 0x0c8 7.8125 0.0195 1.6135 0.0000 1.6151 0.0003
28 336.342 0x0d0 8.1250 0.0195 1.6035 0.0000 1.6052 0.0004
29 348.453 0x0d8 8.4375 0.0195 1.5937 0.0000 1.5952 0.0004
30 360.497 0x0e0 8.7500 0.0195 1.5845 0.0000 1.5863 0.0004
31 372.592 0x0e8 9.0625 0.0195 1.5753 0.0000 1.5771 0.0000
32 385.108 0x0f0 9.3750 0.0195 1.5663 0.0000 1.5679 0.0004
33 397.381 0x0f8 9.6875 0.0195 1.5576 0.0000 1.5591 0.0003

View File

@ -0,0 +1,18 @@
potival,r_restheo/kohm,dr_res/kohm,v_keith,dv_keith,adcval,dadcval,v_pit,dv_pit
0x000,0.000,.0195,
0x010,0.625,.0195,
0x020,1.250,.0195,
0x030,1.875,.0195,
0x040,2.500,.0195,
0x050,3.125,.0195,
0x060,3.750,.0195,
0x070,4.375,.0195,
0x080,5.000,.0195,
0x090,5.625,.0195,
0x0a0,6.250,.0195,
0x0b0,6.875,.0195,
0x0c0,7.500,.0195,
0x0d0,8.125,.0195,
0x0e0,8.750,.0195,
0x0f0,9.375,.0195,
0x100,10.00,.0195,
1 potival,r_restheo/kohm,dr_res/kohm,v_keith,dv_keith,adcval,dadcval,v_pit,dv_pit
2 0x000,0.000,.0195,
3 0x010,0.625,.0195,
4 0x020,1.250,.0195,
5 0x030,1.875,.0195,
6 0x040,2.500,.0195,
7 0x050,3.125,.0195,
8 0x060,3.750,.0195,
9 0x070,4.375,.0195,
10 0x080,5.000,.0195,
11 0x090,5.625,.0195,
12 0x0a0,6.250,.0195,
13 0x0b0,6.875,.0195,
14 0x0c0,7.500,.0195,
15 0x0d0,8.125,.0195,
16 0x0e0,8.750,.0195,
17 0x0f0,9.375,.0195,
18 0x100,10.00,.0195,

View File

@ -0,0 +1,61 @@
#! /usr/bin/python3
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
lognum = 2
plt.ioff()
plt.style.use('bmh')
plt.figure(figsize=(19.2,10.8))
data = pd.read_csv("./log_poticalib_ana_{:02d}.csv".format(lognum))
print(data)
#plt.errorbar(
# data['time'],
# data['act_curr_ps'],
# yerr=data['act_curr_ps']*.002,
# label="Spannungsquelle Ausgang",
# fmt='.'
#)
#plt.errorbar(
# data['time'],
# data['act_curr_el']-.125,
# label="Elektronische Last Eingang",
# fmt='.'
#)#
data['val_poti'] = data['val_poti'].map(lambda x: int(x, base=16))
data['r_bcu/kohm'] = 2*4.7+1/(1/data['r_restheo/kohm']+1/75)
data['v_bcutheo/v'] = 0.7+0.7*30.1/(data['r_bcu/kohm']+6.49)
plt.errorbar(
data['r_bcu/kohm'],
data['v_keith/v'],
yerr=data['dv_keith/v'],
label="V$_{Keith,IV8A}$",
fmt='.'
)
plt.errorbar(
data['r_bcu/kohm'],
data['v_pit/v'],
yerr=data['dv_pit/v)'],
label="V$_{PIT,IV8A}$",
fmt='.'
)
plt.plot(
data['r_bcu/kohm'],
data['v_bcutheo/v'],
label="V$_{BCU,O}$"
)
plt.xlabel('$R_{BCU,Set}$/k$\Omega$')
plt.ylabel('V$_{1V8A}$/V')
plt.title("PowerIt Calibration: Analog Potentiometer")
plt.legend()
#-plt.savefig("2kw_direct.png")
plt.savefig("adccalib_{:02d}.eps".format(lognum), format='eps', dpi=1000)