This VBScript program does the following:
Presets the analyzer, deleting the default trace
Create 2 windows
Create 2 Measurements
Feed the measurements to windows / traces
Change frequency ranges for channels
Select both measurements
Turn marker 1 ON for each measurement
The following notes explain the basic structure of the SCPI tree on the analyzer:
SOURce: and most SENSe: commands act on the channel that is specified in the command. Channel 1 is default if not specified.
Most DISPlay: commands act on the window and trace specified in the command. Window1 and Trace1 are default if not specified.
CALCulate: commands act on the selected measurement in the specified channel. Select the measurement for each channel using
CALCulate<channel number>:PARameter:SELect <meas name>. You can select one measurement in each channel.
See Traces, Channels, and Windows on the Analyzer
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 PNA 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" |