add measurement and script for directly connected full load test
This commit is contained in:
parent
4262f10c3e
commit
ca6de5e20d
|
|
@ -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)
|
||||||
|
|
@ -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,16 +1,44 @@
|
||||||
#! /usr/bin/python3
|
#! /usr/bin/python3
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
plt.style.use('bmh')
|
plt.style.use('bmh')
|
||||||
|
|
||||||
data = pd.read_csv("log.csv")
|
data = pd.read_csv("./log_2kw_direct.csv")
|
||||||
|
|
||||||
print(data)
|
print(data)
|
||||||
|
|
||||||
plt.errorbar(data['time'],data['act_curr_ps'], yerr=data['act_curr_ps']*.002, fmt='.')
|
#plt.errorbar(
|
||||||
plt.errorbar(data['time'],data['act_curr_el'], yerr=.125, fmt='.')
|
# data['time'],
|
||||||
plt.bar(data['time'], data['act_curr_el']-data['act_curr_ps'], 2, aa=True)
|
# data['act_curr_ps'],
|
||||||
plt.ylabel('I/A')
|
# yerr=data['act_curr_ps']*.002,
|
||||||
plt.xlabel('t/s')
|
# 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.show()
|
plt.show()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue