def start(): if not can_start(): error("Enter diode name") return scpi("DISP:DIALog:CLOSe") uStep = U_step uBreakdown = None try: scpi("*SAV 10") scpi("MEM:STAT:FREEze ON") ch1Model = scpi("SYSTem:CHANnel:MODel? ch1") ch2Model = scpi("SYSTem:CHANnel:MODel? ch2") if ch1Model.startswith("DCP405") and ch2Model.startswith("DCP405"): scpi("INST:COUP:TRAC SER") else: scpi("INST:COUP:TRAC NONE") scpi("INST ch1") uMax = float(scpi("VOLT? MAX")) scpi("OUTP 0") scpi("SENS:CURR:RANG MIN") scpi("VOLT 0") scpi("CURR " + str(I_SET)) scpi('SENS:DLOG:TRAC:COMMent "Diode name = ' + diode_name + '; U step = ' + str(U_step) + '"') scpi("SENS:DLOG:TRAC:X:UNIT VOLT") scpi("SENS:DLOG:TRAC:X:STEP " + str(U_step)) scpi("SENS:DLOG:TRAC:X:RANG:MAX " + str(uMax)) scpi('SENS:DLOG:TRAC:X:LABel "Uset"') scpi("SENS:DLOG:TRAC:Y1:UNIT AMPER") scpi("SENS:DLOG:TRAC:Y1:RANG:MAX " + str(I_SET)) scpi('SENS:DLOG:TRAC:Y1:LABel "Imon"') scpi('INIT:DLOG:TRACE "/Recordings/' + diode_name + '.dlog"') scpi("OUTP 1") scpi("DISP:WINDOW:DLOG") ch = 1 t = ticks_ms() i = 0 while True: uSet = i * U_step if uSet > uMax: break setU(ch, uSet) #scpi("VOLT " + str(uSet)) t = ticks_add(t, TIME_STEP_MS) sleep_ms(ticks_diff(t, ticks_ms())) iMon = getI(ch) #iMon = scpi("MEAS:CURR?") dlogTraceData(iMon) #scpi("DLOG:TRACE:DATA " + scpi("MEAS:CURR?")) mode = getOutputMode(ch) #mode = scpi("OUTP:MODE?") #print(uSet, iMon, mode) #if mode == "CC": # break if iMon >= I_SET: uBreakdown = uSet break i = i + 1 finally: scpi("ABOR:DLOG") scpi("*RCL 10") scpi("MEM:STAT:FREEze OFF") if uBreakdown != None: scpi('DISP:INPUT? "Breakdown voltage is ' + str(round(uBreakdown, 2)) + 'V", MENU, BUTTON, "Close"') else: scpi( 'DISP:INPUT? "Breakdown voltage not found", MENU, BUTTON, "Close"')
if uSet > uMax: break setU(ch, uSet) #scpi("VOLT " + str(uSet)) t = ticks_add(t, TIME_STEP_MS) sleep_ms(ticks_diff(t, ticks_ms())) iMon = getI(ch) #iMon = scpi("MEAS:CURR?") dlogTraceData(iMon) #scpi("DLOG:TRACE:DATA " + scpi("MEAS:CURR?")) mode = getOutputMode(ch) #mode = scpi("OUTP:MODE?") print(uSet, iMon, mode) #if mode == "CC": # break if iMon >= I_SET: uBreakdown = uSet break i = i + 1 finally: scpi("ABOR:DLOG") scpi("*RCL 10") scpi("MEM:STAT:FREEze OFF")