python operating spectrum analyzer (Keysight N9030B)

Due to work needs, it is necessary to conduct some automated tests on the product, which includes verifying the frequency or power deviation of the radio frequency, crystal oscillator frequency, etc. during startup or long-term operation. Here you need to use a spectrum analyzer. You can use a script to connect to the spectrum analyzer to collect data in a loop, etc. Let’s get straight to the topic. The instrument is generally controlled by SCPI, so the adapter program Ni-visa needs to be installed on the computer and the pyvisa module needs to be installed in python. Please refer to these two points: https://blog.csdn.net/qq_19294353/ article/details/127927857?spm=1001.2014.3001.5501

1: Operation process

Here is the general process of using the spectrum analyzer in this work:

1) First, the instrument needs to adjust the parameters such as FREQ, SPAN, and AMPTD.

2) After the python script connects to the instrument, adjust TRACE to "maximum hold".

3) Control the transmit power of the product.

4) The python script controls "Peak Search" to find the maximum power mark point.

5) The script obtains the maximum marker point frequency and power value.

2: Instrument description

The main interface after booting is as shown below. There are many ways to connect the instrument. It can be TCP connection through a network cable or communication through USB. Here is a brief introduction to the method of connecting using a network cable.

  1. Use a network cable to connect. First use a network cable to connect the instrument and the test computer. The network port of the instrument is next to the power interface at the back of the device. You need to check the obtained IP address together first. The instrument is a Windows operating system, and the network connection can be found directly in the control panel.

  1. The network on the instrument automatically obtains an IP. Since it is directly connected to my computer, if the obtained IP is 169.254.246.81, it is recommended to use a router to connect to the instrument and assign the router's IP address.

  1. After knowing the IP address of the instrument, the basic operation is to operate on the local computer.

Three: Local script operation

  1. First, verify the connection between the computer and the instrument. Use a browser to directly enter the IP address of the instrument. If the web interface of the instrument opens, it means that the network connection is normal. Do not use ping.

  1. 开始写脚本,首先也是需要验证下脚本连接仪器是否正常,如果不报错返回的也是设备的信号信息就表示连接正常。

  1. 命令控制TRACE的最大保持和清除。

  1. 脚本发送命令进行标记最大的MARKER点,可以看到获取的数据与仪器显示的数据一样,有一点是获取的数据是真是的,仪器上显示的数据有存在四舍五入的情况。

  1. 保存仪器屏幕截图,如下图的命令如果不添加路径则直接保存在电脑的Document\SA\screen目录里面。如果想保存其他地址,在文件名前面加上路径。例如:my_instrument.write('MMEM:STOR:SCR "G:\\1.png"')

四:帮助手册

在仪器里面都有帮助手册可以查询到相关命令,还可以直接拷贝到自己电脑上进行查看和搜索。

写在最后的话,如果有需要合作的可以私信联系下,硬件、软件、WIFI、射频、自动化测试等等等。

Guess you like

Origin blog.csdn.net/qq_19294353/article/details/129428737