在设置双向直流电源的空载测试参数时,可通过SCPI指令配置输出电压/电流、保护阈值、触发模式及查询运行状态,以下为具体操作方法:
SOURce:VOLTage <value>(如 SOUR:VOLT 24.0 设置24V输出)。SOURce:CURRent:POSitive <value>(如 SOUR:CURR:POS 0.5 限制正向电流为0.5A)。SOURce:CURRent:NEGative <value>(如 SOUR:CURR:NEG -0.5 限制反向电流为-0.5A)。SOURce:VOLTage:PROTection <value>(如 SOUR:VOLT:PROT 30.0 设置过压保护为30V)。SOURce:CURRent:POSitive:PROTection <value>(如 SOUR:CURR:POS:PROT 1.0 限制正向过流为1A)。SOURce:CURRent:NEGative:PROTection <value>(如 SOUR:CURR:NEG:PROT -1.0 限制反向过流为-1A)。TRIGger:SOURce IMMediate(立即启动输出)。TRIGger:SOURce EXTernal。TRIGger:SLOPe POSitive(上升沿触发)或 TRIGger:SLOPe NEGative(下降沿触发)。TRIGger:INITiate(内部触发)或等待外部TTL信号触发。OUTPut:STATe ON(确保电源开始输出)。MEASure:VOLTage?(如返回 24.00 表示当前输出24V)。MEASure:CURRent?(空载时接近0A)。OUTPut:PROTection:STATe?(返回 1 表示保护触发,0 表示正常)。pythonimport pyvisarm = pyvisa.ResourceManager()power_supply = rm.open_resource('TCPIP0::192.168.1.100::inst0::INSTR') # 根据实际接口修改# 切换至远程模式power_supply.write("SYSTem:REMote")# 设置输出电压为24Vpower_supply.write("SOURce:VOLTage 24.0")# 设置正向电流限值为0.5A,反向电流限值为-0.5Apower_supply.write("SOURce:CURRent:POSitive 0.5")power_supply.write("SOURce:CURRent:NEGative -0.5")# 设置过压保护为30Vpower_supply.write("SOURce:VOLTage:PROTection 30.0")# 设置触发模式为内部触发power_supply.write("TRIGger:SOURce IMMediate")# 启动输出power_supply.write("OUTPut:STATe ON")# 查询实际输出电压和电流voltage = power_supply.query("MEASure:VOLTage?")current = power_supply.query("MEASure:CURRent?")print(f"实际输出电压: {voltage.strip()} V, 实际输出电流: {current.strip()} A")# 关闭输出(测试完成后)power_supply.write("OUTPut:STATe OFF")power_supply.close()
OUTPut:STATe? 查询状态,排除故障后手动重启输出。