def getCaldValues(voltage): v, i = CEE.getInput('a', .1, 1, CEE.setOutput('a', 'v', voltage)['startSample']+100) idx = findNearest(calV, v) indexes.append(idx) i = i - calI[idx] return [v, i]
from connectClient import CEE CEE = CEE() samples = [] while True: if CEE.getInput()[0] < 4.2: sample = CEE.getInput('a', 2, 1, CEE.setOutput('a', 'i', 200)['startSample']) # constant current else: sample = CEE.getInput('a', 2, 1, CEE.setOutput('a', 'v', 4.2)['startSample']) # constant voltage if sample[1] < 10: break # if in CV mode, current drops below 10mA, exit samples.append(sample) print samples[-1]
#!/usr/bin/python # -*- coding: utf-8 -*- from pylab import * from connectClient import CEE CEE = CEE() ion() setAndGet = lambda x: CEE.getInput('a', .1, 1, CEE.setOutput('a', 'i', x)['startSample']+100) voltages = [] currents = [] for mA in arange(5, 130): [v, i] = setAndGet(mA) voltages.append(v) currents.append(i) voltage = array(voltages) current = array(currents) resistance = voltages/(current/1000) power = voltages*(current/1000) temperature = [((r/resistance[0])-1)/.004403+20 for r in resistance] subplot(221) plot(resistance, temperature, '.') xlabel(u"resistance (Ω)") ylabel(u"temperature (ºC)") subplot(223)
from connectClient import CEE CEE = CEE() while True: if CEE.getInput('a', .1, 1, CEE.setOutput('a', 'i', 0)['startSample'])[0][0] < 3.7: break # if open-cell voltage is less than 3.7 then exit else: print CEE.getInput('a', 2, 1, CEE.setOutput('a', 'i', -100)['startSample']) # otherwise, draw a 100mA load