1
+ from bs1200 import BS1200
2
+ import time
3
+
4
+ u = [1 ]
5
+ with BS1200 (u , 'PCAN_USBBUS1' , 1000000 ) as units :
6
+ for unit in range (1 ,len (u )+ 1 ):
7
+ print ("Testing unit " + str (unit ))
8
+ units .set_V_all (unit , 0 ) # set all cells to 0V
9
+ print ("Setting all unit " + str (unit )+ " cells to 0V" )
10
+ print ("Setting current limits on unit " + str (unit )+ " to 500mA src/sink" )
11
+ units .set_I_all (unit , 0.5 , 0.5 )
12
+ print ("Enabling all cells on unit " + str (unit ))
13
+ units .cell_enable_all (unit , True )
14
+ for cell in range (1 ,13 ):
15
+ units .set_cell_I_source (unit , cell , 0.5 )
16
+ units .set_cell_I_sink (unit , cell , 0.5 )
17
+ volts = units .readback_V_all (unit )
18
+ amps = units .readback_I_all (unit )
19
+ print (units .v_fmt_txt .format (* volts ))
20
+ print (units .i_fmt_txt .format (* amps ))
21
+ input ("All units initialized-- enter to continue" )
22
+
23
+ for unit in range (1 ,len (u )+ 1 ):
24
+ for cell in range (1 ,13 ):
25
+ print ("\n Unit " + str (unit )+ " cell " + str (cell ))
26
+ units .set_cell_V (unit , cell , 4.5 )
27
+ units .set_cell_I_source (unit , cell , 0.5 )
28
+ units .set_cell_I_sink (unit , cell , 0.5 , wait = True ) #wait set to True for 10 ms delay
29
+ volts = units .readback_V_all (unit )
30
+ amps = units .readback_I_all (unit )
31
+ print ("Cell voltages:\n " + units .v_fmt_txt .format (* volts ))
32
+ print ("Cell currents:\n " + units .i_fmt_txt .format (* amps ))
33
+ input ("Measure current w/dmm on cell " + str (cell )+ " unit " + str (unit ))
34
+ units .set_cell_V (unit , cell , 0 )
35
+ input ("Press enter to continue to next cell" )
0 commit comments