厂商:Chroma
——————————————————————
购买国产仪器器振兴民族工业
——————————————————————
型号:63600-2
Rev:1
驱动更新时间:2024/8/8
import pyvisa
class ChromaEload:
CmEload='None'
#设置默认地址 将addres 内的内容修改为你自己的机器地址
def __init__(self,CmEload_addres='USB0::XXXXX::INSTR'):
rm = pyvisa.ResourceManager()
#连接示波器
ChromaEload.CmEload = rm.open_resource(CmEload_addres)
# 设置静态电流
def StaticCurrent(self,Current,Status=0):
# 设置为恒流模式
ChromaEload.CmEload.write('MODE CCM')
# 查询模式?
# print(ChromaEload.CmEload.query('MODE?'))
ChromaEload.CmEload.write('CURR:STAT:L1 '+str(Current))
#如果条件为1 或者输入str ON 就打开
if Status==1 or Status=='ON':
ChromaEload.CmEload.write('LOAD ON')
else:
ChromaEload.CmEload.write('LOAD OFF')
# ChromaEload.CmEload.close()
def DynamicCurrent(self, CurrentT1,CurrentT2,Status=0,repeat=10,period='5ms',rise=0.8):
# 设置为动态响应模式
ChromaEload.CmEload.write('MODE CCDM')
# 上升沿下降沿相等
ChromaEload.CmEload.write('CURR:DYN:RISE '+str(rise))
ChromaEload.CmEload.write('CURR:DYN:FALL '+str(rise))
ChromaEload.CmEload.write('CCUR:DYN:T1 '+period)
ChromaEload.CmEload.write('CCUR:DYN:T2 '+period)
ChromaEload.CmEload.write('CURR:DYN:REP '+ str(repeat))
# 设置电流 T1时间段
ChromaEload.CmEload.write('CURR:DYN:L1 ' + str(CurrentT1))
# 设置电流 T2时间段
ChromaEload.CmEload.write('CURR:DYN:L2 ' + str(CurrentT2))
# ChromaEload.CmEload.write('CURR:SWE:FEND 100')
if Status==1 or Status=='ON':
ChromaEload.CmEload.write('LOAD ON')
else:
ChromaEload.CmEload.write('LOAD OFF')
# 设置 最大电流 设置最小电流 关闭状态,占空比50% 频率100Hz 上升沿0.8A/us 持续时间0.2S
def CCSweep(self, Currmax, Currmin,Status=0,Duty=50,Freq=100,time_ON=2,Crise=0.8,Cfall=0.8):
if Status==1 or Status=='ON':
ChromaEload.CmEload.write('MODE CCFSM')
# 扫频停留时间
ChromaEload.CmEload.write('CURR:SWE:DWEL '+ str(time_ON))
# 查询设置
print(ChromaEload.CmEload.query('CURR:SWE:DWEL?'))
# 设置占空比
ChromaEload.CmEload.write('CURR:SWE:DUTY ' + str(Duty))
# 设置频率
# ChromaEload.CmEload.write('CURR:SWE:FEND ' + str(Freq))
ChromaEload.CmEload.write('CURR:SWE:FSTA ' + str(Freq))
ChromaEload.CmEload.write('CURR:SWE:IMAX ' + str(Currmax))
ChromaEload.CmEload.write('CURR:SWE:IMIN ' + str(Currmin))
# 上升沿下降沿都是0.8A
ChromaEload.CmEload.write('CURR:SWE:RISE 0.8'+str(Crise))
ChromaEload.CmEload.write('CURR:SWE:FALL 0.8'+str(Cfall))
ChromaEload.CmEload.write('LOAD ON')
else:
ChromaEload.CmEload.write('LOAD OFF')