"SetVoltage,PsuMeasureVoltage,DmmAverageVoltage,DmmMinimumVoltage,DmmMaximumVoltage,DmmStandardDeviation\n" ) else: 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' % {
delay = 0.01 #delay in seconds (50 ms) #--------------------------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)