通过pyvisa创建通讯
rm = pyvisa.ResourceManager()
instr = rm.open_resource('TCPIP0::192.168.3.11:: inst0:INSTR') # 替换为您的 IP 地址
instr.timeout = 10*1000
instr = rm.open_resource('TCPIP0::192.168.3.11:: inst0:INSTR') # 替换为您的 IP 地址
instr.timeout = 10*1000
instr.write('*RST')
由于创建杂散模版,起使会有4个range,需要先删除
instr.write('
SENSe1:LIST:RANGe4:DELete')
instr.write('
SENSe1:LIST:RANGe3:DELete')
instr.write('
SENSe1:LIST:RANGe2:DELete')
instr.write('
SENSe1:LIST:RANGe1:DELete')
创建第一个range:
例如:2.4gWiFi第一段:30M-48.5M ≤-30dbm/100k
instr.write(
"SENSe1:LIST:RANGe1:FREQuency:STARt 30000")
instr.write(
"SENSe1:LIST:RANGe1:FREQuency:STOP 48500")
instr.write(
"SENSe1:LIST:RANGe1:FILTer:TYPE NORM")
instr.write(
"SENSe1:LIST:RANGe1:BANDwidth:RESolution 100000")
instr.write(
"SENSe1:LIST:RANGe1:BANDwidth:VIDeo 300000")
instr.write(
"SENSe1:LIST:RANGe1:SWEep:TIME:AUTO ON")
instr.write(
"SENSe1:LIST:RANGe1:DETector RMS")
instr.write(
"SENSe1:LIST:RANGe1:RLEVel -10")
instr.write(
"SENSe1:LIST:RANGe1:INPut:ATTenuation:AUTO ON")
instr.write(
"SENSe1:LIST:RANGe1:POINts 1001")
instr.write(
"SENSe1:LIST:RANGe1:INPut:GAIN:STATe OFF")
instr.write(
"SENSe1:LIST:RANGe1:BREak OFF")
instr.write(
"SENSe1:LIST:RANGe1:LIMit:STARt -20")
instr.write(
"SENSe1:LIST:RANGe1:LIMit:STOP -20")
instr.write(
"SENSe1:LIST:RANGe1:LIMit:STATe ON")
然后根据段数重复上面指令(SENSe2,SENSe3........)
查询测试数据
instr.write(
":TRACe1:DATA? LIST")
instr.write(
":CALCulate1:PSEarch[:IMMediate]"")
instr.write(
":TRACe1:DATA? SPUR")
instr.write(
":CALCulate:LIMit:FAIL?")