Channels, Windows, and Measurements using SCPI


This VBScript program does the following:

The following notes explain the basic structure of the SCPI tree on the analyzer:

See Traces, Channels, and Windows on the Analyzer

How to run this program:

The SCPI commands in this example are sent over a COM interface using the SCPIStringParser object. You do NOT need a GPIB connection to run this example.

This VBScript (*.vbs) program can be run as a macro in the analyzer. To do this, copy the following code into a text editor file such as Notepad and save it on the analyzer hard drive as NewMeas.vbs. Learn how to setup and run the macro.

See Other SCPI Example Programs

Dim app

Dim scpi

' Create / Get the VNA application.

Set app = CreateObject("AgilentPNA835x.Application")

Set scpi = app.ScpiStringParser

'Preset the analyzer

'This command also deletes the default trace

scpi.execute "SYSTem:FPReset"

'Create Measurements

scpi.execute "CALCulate1:PARameter:DEFine:EXT 'Meas1','S11'"

scpi.execute "CALCulate2:PARameter:DEFine:EXT 'Meas2','S21'"

' Turn on windows - creates if new

scpi.execute "DISPlay:WINDow1:STATE ON"

scpi.execute "DISPlay:WINDow2:STATE ON"

'Associate ("FEED") the measurement name('Meas1') to WINDow(1), and give the new TRACe a number(1).

scpi.execute "DISPlay:WINDow1:TRACe1:FEED 'Meas1'"

scpi.execute "DISPlay:WINDow2:TRACe2:FEED 'Meas2'"

'Change each channel's frequency range

scpi.execute "SENSe1:FREQuency:SPAN 1e9"

scpi.execute "SENSe2:FREQuency:SPAN 2e9"

'Select both measurements

scpi.execute "CALCulate1:PARameter:SELect 'Meas1'"

scpi.execute "CALCulate2:PARameter:SELect 'Meas2'"

'Turn marker 1 ON for each measurement

scpi.execute "CALCulate1:MARKer:STATe ON"

scpi.execute "CALCulate2:MARKer:STATE ON"

 

GPIB.Write "SYSTem:PReset"

'Create two windows
GPIB.Write ":DISPlay:SPLit 2"

'Create one trace on each window
GPIB.Write ":CALCulate1:PARameter:COUNt 1"
GPIB.Write ":CALCulate2:PARameter:COUNt 1"

'Define the parameter for each trace
GPIB.Write ":CALCulate1:MEASure1:PARameter 'S21'"
GPIB.Write ":CALCulate2:MEASure2:PARameter 'S12'"

'Change each channel's frequency range
GPIB.Write "SENSe1:FREQuency:SPAN 1e9"
GPIB.Write "SENSe2:FREQuency:SPAN 2e9"

'Turn marker 1 ON for each measurement
GPIB.Write "CALCulate1:MEASure1:MARKer:STATe ON"
GPIB.Write "CALCulate2:MEASure2:MARKer:STATe ON"