
This guide contains the absolute minimum amount of information you need to start automating Copper Mountain Technologies VNAs.

CMT VNAs are USB based and they do not have built-in computers. The VNAs depend on the VNA software (RVNA, TRVNA, S2VNA or S4VNA) to work. You can consider the VNA software as the driver for the VNAs. When you write code to automate VNAs, you are actually communicating with the VNA software, which then communicates with the physical VNA through USB connection. Now this means even if you are automating the VNA with your code, the VNA software still must be running when you run your code and you should not close the VNA software during automation. The VNA software user interface can be hidden though. This can be confusing because some other VNA manufacturers have built-in PCs in the VNAs and in that case when you automate the VNA, you don't need an extra VNA software running in the background.

The two folders here contain examples to automate CMT VNAs using either COM or SCPI. These are two different methods to automate VNAs. Here is what these mean:

SCPI stands for "Standard Commands for Programmable Instruments", pronounced "skippy". It is an industry standard for text commands that you can send to instruments to control them. When we say "automate a VNA with SCPI", we mean we establish a connection between our code and the VNA software and then send SCPI commands to the VNA software to automate the VNA. In the SCPI folder, all the examples use this method to automate the VNA. An example of a SCPI command looks like this: "SENS:FREQ:STAR 1000000". This command tells the VNA to set the STARt FREQuency of measurement to 1MHz. As you can see, if you see a command, you can sort of tell what it does. However if you don't know the command for a specific action that you want the VNA to do, you won't be able to come up with it easily. This is when you go to our programming manual to find the SCPI commands you need. By default, the VNA software is installed under C:\VNA\ and the programming manual is located under C:\VNA\RVNA or TRVNA or S2VNA or S4VNA\Doc\. It is also recommended to check the examples in other languages than the language you are using, because you can easily adapt an example to your language. Automating VNAs with SCPI commands is recommended because:

1) It is less confusing to use SCPI commands than to figure out how to use COM object functions. The syntax to use COM object functions may not be obvious in some languages but SCPI commands will always be the same for any programming language.
2) SCPI gives you a more stable data transfer speed. This result is based on experiments.
3) You can only automate one VNA on the same computer with COM. If you use SCPI commands, you can run multiple instances of the VNA software and automate multiple VNAs connected to the same PC by assigning different socket server numbers to each instance.

To send SCPI commands to a VNA, you need to establish a connection to the VNA software from your code. The connection can be either TCP/IP socket connection or TCP\IP Hislip connection. The connection can be established in two ways: use standard TCP client library offered by each programming language or use VISA. More information on VISA can be found in the "more info following the quick guide" document. Before you try to establish a TCP connection from your code to the VNA software. You must make sure the VNA software is running and the correct socket number is used and the socket server is turned on. The IP address 127.0.0.1 is what you need to use when automating VNAs connected to the same PC that's running the code. This is because the address 127.0.0.1 is a special IP address which represents the local PC. You will see this address used in all the examples and you typically should not change this IP address. It can be confusing because you would think every machine has a different IP address.

To turn on socket server in RVNA, go to "system" -> "network setup" -> "socket server on".
To turn on socket server in S2VNA/S4VNA/TRVNA, go to "system" -> "misc setup" -> "network remote control settings" -> "socket server on"   

Complete process for VNA automation using SCPI commands:
1) In the VNA software, turn on TCP/IP socket server, remember the socket number you selected. Keep the VNA software running.
2) In your code, establish a connection to the VNA software through TCP/IP socket.
3) In your code, set up the VNA stimulus (frequency, IFBW, number of points) using SCPI commands.
4) In your code, set up formats for traces and software UI display using SCPI commands.
5) In your code, trigger VNA and capture measurement data using SCPI commands. For continuous measurement, set up a loop.

COM stands for Microsoft "Component Object Model". This should not be confused with serial communication port COM. They are absolutely not related. When we say "automate a VNA with COM", we mean we use the functions contained inside the COM object of the VNA software to tell the VNA to do different actions. An example of a COM object function looks like this: app.SCPI.SENSe(Ch).FREQuency.STARt = 1000000. Notice this achieves the same action of setting the start frequency to 1MHz as the previous SCPI example. However, this time we are not sending a command in text form to the VNA. Instead, we are calling a function contained in the COM object of the VNA software. Yes the function name has SCPI in there. It can be confusing but the reason we named the COM object functions like this is to stay consistent with the corresponding SCPI commands. The manual for COM functions is located under the same folder as the SCPI programming manual. If you only see one programming manual in the \Doc\ folder, the SCPI and COM manuals are combined into one.

To use COM object to automate a VNA, you simply need to make sure the checkbox that says "register COM server" is checked at the last step of the VNA software installer. It will pop a message saying "COM server registered successfully" after you install the software.

There are many more interesting things you can do with CMT VNA automation. For more advanced automation information, please go to www.coppermountaintech.com -> resources -> tech library and search for "Automation Guide for CMT VNAs".



