要使用SCPI指令查询双向直流电源当前输出电流序列的状态,需结合序列模式(List Mode)的状态查询指令,获取序列的运行进度、当前点位置、循环次数等信息。以下是详细步骤和示例:
plaintextSOURce:LIST:FUNCtion?
ON或OFF,表示序列功能是否激活。plaintextSOURce:LIST:ADVance:COUNter?
2,表示当前处于第2个序列点。plaintextSOURce:LIST:COUNt?
3表示3个点)。plaintextSOURce:LIST:CYCLe:STATe?
ON或OFF,表示是否启用循环模式。plaintextSOURce:LIST:CYCLe:COUNt:REMaining?
INF或特定值)。plaintextMEASure:CURRent?
plaintextOUTPut:STATe?
ON或OFF,确认输出是否开启(序列运行时输出应为ON)。检查序列是否启用
plaintextSOURce:LIST:FUNCtion? ; 返回"ON"表示序列已激活
获取序列总点数
plaintextSOURce:LIST:COUNt? ; 假设返回"3",表示3个序列点
查询当前序列点位置
plaintextSOURce:LIST:ADVance:COUNter? ; 假设返回"2",表示当前在第2点
检查循环状态
plaintextSOURce:LIST:CYCLe:STATe? ; 返回"ON"表示启用循环SOURce:LIST:CYCLe:COUNt:REMaining? ; 返回剩余循环次数(如"1"表示还剩1次)
获取实际输出电流
plaintextMEASure:CURRent? ; 返回当前输出电流值(如"5.000"A)
SOURce:LIST:STATe?:plaintextSOURce:LIST:STATe? ; 返回"RUNNING"或"IDLE"
plaintextSOURce:LIST:CURRent:DATA? (@<n>) ; 查询第<n>点电流值(如@2)
LIST:ADVance:COUNter?查询当前点位置,LIST:LOOP:COUNter?查询循环次数:plaintextLIST:ADVance:COUNter? ; 当前点序号LIST:LOOP:COUNter? ; 已完成循环次数
SOURce:LIST:STEP:ACTual?查询当前步数:plaintextSOURce:LIST:STEP:ACTual? ; 返回当前步数(1-based)
-400 Parameter Error:参数超出范围(如查询未启用的序列状态)。-350 Command Error:指令语法错误(如拼写错误)。-107 No Sequence Active:序列未启用时查询状态。MEASure:CURRent?确认输出是否符合预期。pythonimport pyvisa# 连接电源rm = pyvisa.ResourceManager()power_supply = rm.open_resource("TCPIP0::192.168.1.100::inst0::INSTR") # 替换为实际地址# 查询序列状态is_list_active = power_supply.query("SOURce:LIST:FUNCtion?").strip() == "ON"print(f"序列是否启用: {is_list_active}")if is_list_active: # 查询总点数 total_points = int(power_supply.query("SOURce:LIST:COUNt?").strip()) print(f"序列总点数: {total_points}") # 查询当前点位置 current_point = int(power_supply.query("SOURce:LIST:ADVance:COUNter?").strip()) print(f"当前序列点: {current_point}/{total_points}") # 查询循环状态(Keysight示例) try: is_loop_enabled = power_supply.query("SOURce:LIST:CYCLe:STATe?").strip() == "ON" remaining_loops = power_supply.query("SOURce:LIST:CYCLe:COUNt:REMaining?").strip() print(f"循环启用: {is_loop_enabled}, 剩余循环次数: {remaining_loops}") except: print("循环查询指令不支持或未启用") # 查询实际输出电流 output_current = float(power_supply.query("MEASure:CURRent?").strip()) print(f"当前输出电流: {output_current:.3f}A")else: print("序列未启用,请先配置并启动序列")# 关闭连接power_supply.close()
SYSTem:REMote)且未被其他程序锁定。