要使用SCPI指令查询双向直流电源的输出电流峰值,核心指令为 SOURce:CURRent:PROTection:LEVel? 或 CURR:PROT?,具体需根据设备型号调整。以下是详细步骤与注意事项:
plaintextSOURce:CURRent:PROTection:LEVel?
或简写为:plaintextCURR:PROT?
plaintextOUTPut:PROTect:STATe?
plaintextSOUR:CURR:PROT:LEV?
plaintextSOURce:CURRent:PROTection:HIGH?
CURR:PROT:LIM?,需参考手册确认。进入远程模式
发送指令确保电源处于可编程控制状态:
plaintextSYSTem:REMote
发送查询指令
通过串口、GPIB、LAN等接口发送电流峰值查询指令,例如:
plaintextCURR:PROT?
读取响应
电源会返回当前设置的电流峰值(单位通常为安培,A),例如:
10.000
表示电流峰值为10A。
pythonimport pyvisa# 连接电源rm = pyvisa.ResourceManager()power_supply = rm.open_resource("TCPIP0::192.168.1.100::inst0::INSTR") # 替换为实际地址# 进入远程模式power_supply.write("SYSTem:REMote")# 查询电流峰值current_limit = power_supply.query("CURR:PROT?")print(f"当前电流峰值: {current_limit.strip()} A")# 关闭连接power_supply.close()
SOURce:CURRent:PROTection:LEVel?)或短格式(如 CURR:PROT?)。plaintextSOURce:CURRent:PROTection:STATe ON
plaintextSOURce2:CURRent:PROTection:LEVel? # 查询通道2的电流峰值
plaintextSYSTem:ERRor?
常见错误包括:plaintextCURR:PROT 15
plaintextCURR:PROT 10