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)
sheet['A1'] = 'Frequency' #label A1 'Frequency' 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
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
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
#!/usr/bin/env python import pyvisa as visa import time import datetime import os import DP832 as psu import SDM3055 as dmm from decimal import * #--------------------------GLOBAL VARIABLES------------------------------------------ dmmModel = dmm.getModel() psuModel = psu.getModel() cmdDelay = Decimal('0.01') #delay in seconds (10 ms) measDelay = Decimal( '1' ) #delay in seconds to wait before starting dmm measurement, less than 1 seems to make DP832 read previous set value pChan = 1 # channel to test voltMin = Decimal('0.000') voltMax = Decimal('32.000') voltStep = Decimal('0.001') currentLimit = Decimal( '0.020' ) # set to something high enough that we don't current limit, but low enough incase something goes wrong overCurrentLimit = Decimal( '0.020' ) # set to same as currentLimit for now, for if we've reached currentLimit something has gone wrong dmmMeasureMode = "average" # take a single measurement, or multiple measurements and take average dmmMeasureCount = 10 # if multiple measurements, take this many measurements for each voltage setting load = 'open' # load measuring across, open for no load hooked directly to meter #--------------------------GENERAL FUNCTIONS-----------------------------------------
from DP832 import * try: PSU = DP832() print(PSU.status()) except: print("Connection Failed, Script Ended") PSU.toggle_output(1, 0) PSU.set_voltage(1, 13.333) print(PSU.measure_current(1))
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