ECE Undergraduate Laboratory
ECE 469 - RF/Microwave and Optics Lab

ECE 469 - RF/Microwave and Optics Lab

Lab 7: Automation

Introduction

VNAs can be readily automated and there are numerous options for users to do so. To help illustrate the different automation methods and interfaces available, consider the components in an automated VNA measurement system. There is hardware: the VNA itself and a computer. There is software, as well: the VNA control software loaded onto the computer. While non-automated use of these components consists of each of these components in this basic configuration, automation options alter this configuration. For instance, an instrument can be locally or remotely automated. In local automation, an automating program executes on the same computer that is connected to the VNA and has the VNA control software. This is the same basic configuration. On the other hand, in remote automation, another computer, connected to the first by a network, runs the automation program. Automation of Copper Mountain Technologies’ VNAs can be achieved by using either of two interfaces:


COM/DCOM

COM automation is well suited for local automation, where the automation software and the VNA control software both execute on the same Windows PC. This PC must be located within a USB cable’s reach of the VNA being automated, generally meaning within a 5-meter radius, though there are technologies available for extending USB over distances of many meters (i.e. conversion to fiber optic or use of a wired or wireless USB sharing hub).

DCOM automation is suited for remote automation. The procedure is quite involved, requiring various user account authorization settings and a firewall opening which might not be practical in some network environments. If a network between Windows PCs can be configured as a Workgroup – typically found in home network scenarios – DCOM may be a practical approach.

The COM/DCOM interface is a Microsoft product and can only be used in a Windows or virtual Windows environment. COM/DCOM automation is supported by LabVIEW, MATLAB, Python (with the PyWin32 package), VB.NET, VBA, C++, C#, VEE, Octave, and more. Because it is a software-to-software interface, data transfer times are negligible. Additionally, depending on the programming environment, the COM properties structure might be directly explored and command syntax auto-completed – a convenient addition to help avoid typos. In summary, The COM interface works well for local automation in a Windows or virtual Windows environment and can even have unique benefits. However, it is difficult to set up DCOM for remote automation.


TCP Interface

In automation under the TCP interface, the connection between the automation program and the VNA control software is established through TCP/IP sockets and the network stack of the computer. Through these, the automation program can send (industry-standard) Standard Commands for Programmable Instruments (SCPI) commands to the VNA control software, either locally on the same computer or remotely across a network.

SCPI is a standard protocol for communicating with instruments using ASCII-based commands to control the device and ASCII encoding to send and receive data. It is a relatively easy to use protocol because of its straightforward encoding.

Local automation can be accomplished via the special IP address 127.0.0.1 (also known as ‘localhost’) together with port number 5025. This makes it simple to connect to a VNA over LAN, because no special network configuration is typically required beyond possibly port forwarding for remote connections across the internet.

TCP has its own drawbacks. To query the device, you must first send a command and then read the response. SCPI uses ASCII to transfer data, so all data will be read as strings and must be later converted. Generally, programming environments will not be aware of valid and invalid SCPI command syntaxes, so errors due to typos are more likely to occur. Finally, using the TCP socket will introduce delays due to the latencies and bandwidth limitations of the network stack.


General Best Practices

Before starting this lab, there are few practices one should keep in mind. They are as follows:

  1. It is always a good practice to warm up the VNA before using it to get accurate measurements.
  2. Second important thing is to check if the cables are in a good condition. A quick way to do this is to connect the cable end to Short, Open and Load and see the corresponding S11 graph in Log Magnitude.
  3. Both the open and short connections must yield a flat line very close to 0dB. The load connection must give you a very low return loss (around -40dB).
  4. Always make sure to use a torque wrench while making the connections.
  5. Also make sure that the VNA is in an ESD (Electrostatic Discharge) safe environment and the operator is wearing an ESD wrist wrap.
  6. With these prechecks performed, you can now go ahead and make the measurements.

General Full 2-Port Calibration Procedure for CMT804U and CMT304U VNA

Link to this complete calibration procedure video is as follows - https://coppermountaintech.wistia.com/medias/90gsd3yb3x

  1. Before you begin the actual calibration procedure, it is always a good practice to have the stimulus settings ready and then start the calibration.
  2. To begin the stimulus settings, click on the stimulus option on the sidebar and set the start frequency to 1MHz and stop frequency to 8GHz.
  3. Next, set the number of points to 401. And leave the IF bandwidth unchanged (i.e. 10KHz).
  4. The calibration kit definition is where the instrument is told the actual, known characteristics of the calibration standards. Each calibration kit has its own known characteristics. You will be using N911/912 Cal kit.
  5. For a full two port calibration, follow the steps below:
    • On the main menu in the sidebar go to Calibration -> Calibrate -> Full 2-port Cal
    • To perform the calibration, connect the “Open” standard to the end of the cable on Port 1.
    • Click the “Open” button on the screen. It should say “calibration in progress…” followed shortly by a checkmark on the left part of the button, as shown in Figure 6.
    • Repeat (a) and (b) with the Short and Load standards with the cable attached to Port 1.
    • Similarly, repeat (a), (b) and (c) for Port 2.
    • Now connect the “Thru” standard between the two ports through the cable. When it is attached, click the “Port1-2 Thru” button and then click on the Subclass 2 UnThru option.
    • When there is a check mark next to each of the seven standard names click “Apply.”

  6. The program will process the measurements, computing differences between the measured characteristics and the known correct characteristics provided in the calibration kit definition earlier. These differences are due to non-idealities of the VNA itself and losses in the cables and adaptors used. The error correction will automatically be enabled.
  7. Correction option under calibration should now be ON as shown in the Figure 9. If it says OFF, click once and it should now be activated. This will apply the calibration settings to the

Pre-Lab

  1. What is automation?
  2. What are the common methods used in automation?
  3. Which method do you think is easier to execute than the other? Justify.
  4. Try the different SCPI commands from the SCPI programming manual available on https://coppermountaintech.com/automation/ under the programming manuals section.

Objective

To learn the basics of VNA Test Automation. Pre-requisite

  1. Install python
  2. Install Visa and Matplotlib

(For other codes, https://coppermountaintech.com/automation/ )


Materials

  1. Copper Mountain Technologies VNA (804U)
  2. University Kit Hardware (2 N-SMA cables, Band Pass Filter, Wi-Fi Antenna, Torque Wrenches (N and SMA), 2 SMA-SMA adapters, Calibration Kit SMA 2.1)

Lab Procedure

  1. In this lab, we will automate using TCP interface using SCPI commands.
  2. Turn the VNA on and open the S2VNA software.
  3. Make sure that the Socket Server is ON. To do so click on System > Misc Setup > Network remote Control Settings > Socket Server ON in the sidebar menu.
  4. Make a full 2-port calibration and then connect the bandpass filter between the ports.
  5. With the BPF connected between the two ports of the VNA, launch the python.
  6. Now copy and paste the script given at the end of this document onto the python screen.
  7. Once you’ve done so, you can go ahead and run the program.
  8. You should now be able to see the S11 and S21 plot of the band-pass or a low-pass filter.

Script (this is a Pyton code; For other codes, such as MathLab, consult with, https://coppermountaintech.com/automation/ )
	#Import VISA library and Matplotlib to plot data
	import visa
	import matplotlib.pyplot as plt
	#Connect to a Socket on the local machine at 5025
	#Use the IP address of a remote machine to connect to it instead rm = visa.ResourceManager() try:
	#Enable socket server in the VNA software System > Misc Setup > Network Remote Control Settings > Socket Port - 5025 > Socket Server - ON
	CMT = rm.open_resource('TCPIP0::localhost::5025::SOCKET')
	except:
	print("Failure to connect to VNA!")
	print("Check network settings")
	#The VNA ends each line with this. Reads will time out without this CMT.read_termination='\n'
	#Set a long timeout period for slow sweeps CMT.timeout = 200000 #Change stimulus to BUS based triggers CMT.write('TRIG:SOUR BUS\n') CMT.query("*OPC?\n")
	#Trigger a measurement CMT.write('TRIG:SEQ:SING\n') #Wait for sweep completion CMT.query("*OPC?\n")
	#Read data Freq = (CMT.query("SENS1:FREQ:DATA?\n")) #Get frequency data as a string
	S11 = (CMT.query("CALC1:TRAC1:DATA:FDAT?\n")) #Get displayed formatted data as a string S21 = (CMT.query("CALC1:TRAC2:DATA:FDAT?\n")) #Get displayed formatted data as a string
	#split the long strings into a string list #also take every other value from magnitudes since second value is 0
	#If complex data were needed we would use polar format and the second #value would be the imaginary part
	Freq = Freq.split(",") S11 = S11.split(",") S11 = S11[::2]
	S21 = S21.split(",") S21 = S21[::2]
	#Change the string values into numbers for plotting
	S11 = [float(s) for s in S11]
	S21 = [float(s) for s in S21]
	Freq = [float(f)/1e6 for f in Freq]
	#Plot results
	plt.title('BandPass Filter S11 and S21 Plot')
	plt.plot(Freq,S11)
	plt.plot(Freq,S21)

Result:

Your plot of S11 and S21 for a bandpass filter may look like the one given below. If you use low-pass filter instead, compare your results with the ones obtained for Low Pass (LP) filter lab.


Figure  7.1
Figure 7.1 BandPass Filter S11 and S21 Plot

Lab Report

  1. Submit the screenshot of the plot you obtained.
  2. What were the changes that you could observe on the S2VNA software when you executed various lines of the program in the command window?
  3. Include a screenshot of other SCPI commands that you tried executing from the programming manual with its corresponding result.