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): wf.sine(1, 0.004, i) #increment sine wave frequency #set the proper time and magnitude scaling for oscope osc.setVoltDiv(1, outputSig) osc.setVoltDiv(2, inputSig)
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") psu.toggleOutput(3,'OFF') print("\n*** Script Completed! ***")
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): wf.sine(1,0.004,i) #increment sine wave frequency #set the proper time and magnitude scaling for oscope osc.setVoltDiv(1,outputSig) osc.setVoltDiv(2,inputSig)
sheet['A1'] = 'Voltage' #label A1 'Voltage' sheet['B1'] = 'Current' #label B1 'Current' #--------------------------GENERAL FUNCTIONS----------------------------------------- def iteration(start, end, step): #define a for loop function while start <= end: yield start start += step #--------------------------------MAIN------------------------------------------------ time.sleep(1) #delay psu.toggleOutput(3, 'ON') # turn PSU channel 3 output ON i = 0 # initialize voltage coutner variable while (i <= 1): # while voltage is less than euqal to 5V psu.setVoltage(3, i) # set PSU output voltage time.sleep(0.5) # delay voltReading = dmm.measV('DC') # measure voltage (DMM) voltArray.append(voltReading) time.sleep(0.5) # delay currReading = dmm.measI('DC') # measure current (DMM) currArray.append(currReading) time.sleep(0.5) # delay
# write data header line if (dmmMeasureMode == 'average'): file2.write( "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)
sheet['A1'] = 'Voltage' #label A1 'Voltage' sheet['B1'] = 'Current' #label B1 'Current' #--------------------------GENERAL FUNCTIONS----------------------------------------- def iteration(start, end, step): #define a for loop function while start <= end: yield start start += step #--------------------------------MAIN------------------------------------------------ time.sleep(1) #delay psu.toggleOutput(3,'ON') # turn PSU channel 3 output ON i = 0; # initialize voltage coutner variable while(i <= 1): # while voltage is less than euqal to 5V psu.setVoltage(3, i) # set PSU output voltage time.sleep(0.5) # delay voltReading = dmm.measV('DC') # measure voltage (DMM) voltArray.append(voltReading) time.sleep(0.5) # delay currReading = dmm.measI('DC') # measure current (DMM) currArray.append(currReading) time.sleep(0.5) # delay i = i+0.1 # increment counter for voltage