#--------------------------GENERAL FUNCTIONS----------------------------------------- def iteration(start, end, step): #define a for loop function while start <= end: yield start start += step #--------------------------------MAIN------------------------------------------------ time.sleep(1) psu.setCurrent(3,0.5) #psu.setOVP(3,5.1) #psu.toggleOVP('OFF') psu.setOCP(3,0.222) psu.toggleOCP('ON') psu.setVoltage(3,3.3) psu.toggleOutput(3,'ON') time.sleep(1) for i in iteration(3.3,5,0.1): psu.setVoltage(3,i) time.sleep(1) power = round(psu.measPower(3)*1000,2) volt = round(psu.measVolt(3),1) current = round(psu.measCurrent(3),2) print("Power: " + str(power) + " mW" + " Voltage: " + str(volt) + " V" + " Current: " + str(current) + " A")
#--------------------------GENERAL FUNCTIONS----------------------------------------- def iteration(start, end, step): #define a for loop function while start <= end: yield start start += step #--------------------------------MAIN------------------------------------------------ time.sleep(1) #Initialize PSU (set CH1: 12V / 0.2A OCP and CH2: 12V / 0.2A OCP) psu.setVoltage(1, 12) psu.setOCP(1, 0.2) psu.toggleOCP('ON') psu.setVoltage(2, 12) psu.setOCP(2, 0.2) psu.toggleOCP('ON') psu.toggleOutput(1, 'ON') psu.toggleOutput(2, 'ON') time.sleep(1) #Initialize Function Generator wf.sine(1, 0.004, 1) wf.toggleOutput(1, 'ON') time.sleep(1) #Begin test iteration for i in iteration(freqStep, maxFreq, freqStep):
file2.write("SetVoltage,PsuMeasureVoltage,DmmMeasureVoltage\n") initialTemp = psu.sysTemp() #Initialize DMM (set to measure voltage auto ranging) dmm.confV() #Initialize PSU (set test channel off, 0V, OVP OFF, currentLimit, overCurrentLimit, OCP ON) psu.selOutput(pChan) psu.toggleOutput(pChan, 'OFF') psu.setVoltage(pChan, 0) psu.toggleOVP('OFF') # make sure OVP off psu.setCurrent( pChan, currentLimit ) # should be set to something reasonable incase something goes wrong psu.setOCP( pChan, overCurrentLimit ) # should be set to something reasonable incase something goes wrong psu.toggleOCP('ON') # make sure OCP off psu.toggleOutput(pChan, 'ON') for v in iteration(voltMin, voltMax, voltStep): psu.setVoltage(pChan, v) time.sleep(measDelay) psuReading = psu.measVolt(pChan) if (dmmMeasureMode == 'single'): dmmReading = dmm.measV('DC') #dmmReading = round(dmmReading, dmm.calcDigits(dmmReading)) line = '%(setVolt)s,%(psuReading)s,%(dmmReading)s' % { 'setVolt': v, 'psuReading': psuReading, 'dmmReading': dmmReading
sheet['B1'] = 'Gain' #label B1 'Gain' #--------------------------GENERAL FUNCTIONS----------------------------------------- def iteration(start, end, step): #define a for loop function while start <= end: yield start start += step #--------------------------------MAIN------------------------------------------------ time.sleep(1) #Initialize PSU (set CH1: 12V / 0.2A OCP and CH2: 12V / 0.2A OCP) psu.setVoltage(1,12) psu.setOCP(1,0.2) psu.toggleOCP('ON') psu.setVoltage(2,12) psu.setOCP(2,0.2) psu.toggleOCP('ON') psu.toggleOutput(1,'ON') psu.toggleOutput(2,'ON') time.sleep(1) #Initialize Function Generator wf.sine(1,0.004,1) wf.toggleOutput(1,'ON') time.sleep(1) #Begin test iteration for i in iteration(freqStep,maxFreq,freqStep):