コード例 #1
0
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
コード例 #2
0
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")
	
psu.toggleOutput(3,'OFF')
コード例 #3
0
ファイル: opAmpFreq.py プロジェクト: freq0ut/Python-PyVisa
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
コード例 #4
0
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

psu.toggleOutput(3, 'OFF')  # turn PSU channel 3 output OFF

voltLength = len(
    voltArray
コード例 #5
0
# 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)
    if (dmmMeasureMode == 'single'):
コード例 #6
0
ファイル: dmmDemo.py プロジェクト: freq0ut/Python-PyVisa
#--------------------------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

psu.toggleOutput(3,'OFF')				# turn PSU channel 3 output OFF

voltLength = len(voltArray)				#find length of voltage vector for transfer to excel spreadsheet
currLength = len(currArray)				#find length of magnitude vector for transfer to excel spreadsheet
コード例 #7
0
ファイル: psuDemo.py プロジェクト: freq0ut/Python-PyVisa
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")
	
psu.toggleOutput(3,'OFF')