-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetALDOBias.py
More file actions
executable file
·86 lines (67 loc) · 2.72 KB
/
setALDOBias.py
File metadata and controls
executable file
·86 lines (67 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env python
import sys
import time
from optparse import OptionParser
from Lab5015_utils import Keithley2231A
parser = OptionParser()
parser.add_option("--power", dest="power", default="0")
parser.add_option("--target", dest="target", default="46")
parser.add_option("--combine-ps", dest="combinePS", default="0", help="combine two different power supplies")
(options, args) = parser.parse_args()
if options.combinePS == '1':
mapping = {}
mapping['keithley2231A-0'] = ['CH1']
mapping['keithley2231A-1'] = ['CH1']
it = 0
for usb in mapping.keys():
channels = mapping[usb]
for ch in channels:
mykey = Keithley2231A('ASRL/dev/'+usb+'::INSTR', ch)
currV = mykey.meas_V()
print("current voltage is %.2f V") % currV
if options.power == "1" and currV < 0.1:
print("ramping up...")
for volt in range(0,int((int(options.target)+it)/2)+1,1):
mykey.set_V(volt)
mykey.set_state(1)
time.sleep(0.5)
elif options.power == "0" and currV > 0.1:
print("ramping down...")
for volt in range(int(currV),-1,-1):
mykey.set_V(volt)
mykey.set_state(1)
time.sleep(0.5)
else:
print("doing nothing")
time.sleep(2)
I = mykey.meas_I()
V = mykey.meas_V()
print("voltage: %.2f V current: %.3f A") %(V,I)
it += 1
if options.combinePS == '0':
mapping = {}
mapping['keithley2231A-0'] = ['CH1']
for usb in mapping.keys():
channels = mapping[usb]
for ch in channels:
mykey = Keithley2231A('ASRL/dev/'+usb+'::INSTR', ch)
currV = mykey.meas_V()
print("current voltage is %.2f V") % currV
if options.power == "1" and currV < 0.1:
print("ramping up...")
for volt in range(0,int(options.target)+1,1):
mykey.set_V(volt)
mykey.set_state(1)
time.sleep(0.5)
elif options.power == "0" and currV > 0.1:
print("ramping down...")
for volt in range(int(currV),-1,-1):
mykey.set_V(volt)
mykey.set_state(1)
time.sleep(0.5)
else:
print("doing nothing")
time.sleep(2)
I = mykey.meas_I()
V = mykey.meas_V()
print("voltage: %.2f V current: %.3f A") %(V,I)