Perform Guided TRL Calibration

This VBScript file performs a 2-Port Guided TRL calibration on 2-port PNA analyzers. (See an example of TRL cal on a 4-port PNA.) This program does the following:

Note: This program runs without error on all PNA code revisions 7.21 and higher.

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 PNA. To do this, copy the following code into a text editor file such as Notepad and save it on the PNA hard drive as TRL.vbs. Learn how to setup and run the macro.

Dim App

Dim Parser

Dim Chan

Dim txtDat

Dim step

Dim parserTxt

Dim prompt

Set App = CreateObject("AgilentPNA835x.Application")

' Clear old measurements


' Create a new Measurement

Set Parser = App.SCPIStringParser

Parser.Parse "DISPlay:WINDow1:STATE ON"

Parser.Parse "CALCulate:PARameter:DEFine:EXT 'MyMeas',S12"

Parser.Parse "DISPlay:WINDow1:TRACe1:FEED 'MyMeas'"

' Initialize state

Set Chan = App.ActiveChannel

Chan.StartFrequency = 18.0e9

Chan.StopFrequency = 20.0e9

Chan.IFBandwidth = 1000

' Begin a guided calibrations

Parser.Parse "SENS:CORR:COLL:GUID:CONN:PORT1 'APC 3.5 male'"

Parser.Parse "SENS:CORR:COLL:GUID:CONN:PORT2 'APC 3.5 female'"

Parser.Parse "SENS:CORR:COLL:GUID:CKIT:PORT1 '85052C'"

Parser.Parse "SENS:CORR:COLL:GUID:CKIT:PORT2 '85052C'"

' Select TRL cal method.


txtDat = Parser.Parse("SENS:CORR:COLL:GUID:PATH:CMET? 1,2")

MsgBox("Method " + txtDat)


' Query the number of steps

txtDat = Parser.Parse("SENS:CORR:COLL:GUID:STEP?")

' Display the number of steps

MsgBox("Number of steps is " + txtDat)

' Set the loop counter limit

step = CInt(txtDat)

' Measure the standards

For i = 1 To step

parserTxt = "sens:corr:coll:guid:desc? " + CStr(i)

prompt = Parser.Parse(parserTxt)


parserTxt = "sens:corr:coll:guid:acq STAN" + CStr(i)

Parser.Parse (parserTxt)


' All standards have been measured.  Save the result


MsgBox("The TRL calibration has been completed")