#def main():
#load step
l1 = np.arange(0, 0.01, 0.0005)
l2 = np.arange(0.01, 0.02, 0.005)
load_current = np.hstack((l1,l2))
N_current = len(load_current)
N = N_current
# eload
E_load = rm.open_resource('GPIB1::5::INSTR',
write_termination='\n',read_termination = '\n') # need the termination else will
get timeout error
eload = agilent_6060b.agilent_6060b(E_load, mode='CURR', rang=1, debug=False)
#power meter
power_meter = rm.open_resource('GPIB1::1::INSTR',
write_termination='\n',read_termination = '\n') # need the termination else will
get timeout error
pmeter = yokogawa_wt310.yokogawa_wt310(power_meter,debug =False, mode = 'DC')
#dmm setup
#DMM_I = rm.open_resource('USB0::0x0957::0x0607::MY47011505::INSTR',
write_termination='\n',read_termination = '\n')
DMM_V = rm.open_resource('GPIB1::10::INSTR',
write_termination='\n',read_termination = '\n')
#dmm_I = agilent_34410a.agilent_34410a(DMM_I, mode = 'CURR', ACDC ='DC')
dmm_V = agilent_34410a.agilent_34410a(DMM_V, mode = 'VOLT', ACDC ='DC')
#DC Supply
DC = rm.open_resource('USB0::0x1AB1::0x0E11::DP8C194205851::INSTR',
write_termination='\n',read_termination = '\n')
DCSupply = rigol832.rigol832(DC,debug =1,RST=1)
#DCSupply.setVoltage('CH1',3.3,1)
#DCSupply.activate('CH1')
#vMid supply
DCVMID = rm.open_resource('USB0::0x1AB1::0x0E11::DP8C194306032::INSTR',
write_termination='\n',read_termination = '\n')
DC_MID = rigol832.rigol832(DCVMID,debug =1,RST=1)
# ==========================================================================
# Excel creating
# ==========================================================================
workbook =
xlsxwriter.Workbook('/Users/peihanng/Documents/automation/Result/B3_0p7_18D2_180n.x
lsx')
worksheet = workbook.add_worksheet()
# Start from the first cell. Rows and columns are zero indexed.
row = 0
col = 0
# ==========================================================================
# Sweep
# ==========================================================================
eload.activate()
for iter in range(N):
print ('cycle %d' %iter)
value = load_current[iter]
eload.setValue(value)
time.sleep(time_wait)
IMid = DC_MID.readCurrent('CH1')
VMid = DC_MID.readVoltage('CH1')
time.sleep(0.25)
I_VDD = DC_MID.readCurrent('CH2')
V_VDD = DC_MID.readVoltage('CH2')
#Iin = dmm_I.readData(0.25)
#Vin = dmm_V.readData(0.25)
Pin = Iin[0]*Vin[0]
P_VDD = I_VDD[0]*V_VDD[0]
P_VMID = IMid[0]*VMid[0]
#P_VDD = 0
#P_VMID = 0
Pin_total = Pin + P_VDD +P_VMID
#print type(Vout)
Efficiency = Pout/Pin_total * 100
#print Iin
#print type(Iin)
row +=1
col = 0
workbook.close()
eload.deactivate()
time.sleep(1)
#DCSupply.deactivate('CH1')
E_load.close()
DC.close()
power_meter.close()
DMM_V.close()
print 'done'
#DMM_I.close()