Perform a Guided 1-Port Cal using SCPI

This example performs simultaneous measurement of multiple cal standards and channels, then feeds all data to SCPI commands to compute and activate 1-port calibrations for the channels.

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 VNA. To do this, copy the following code into a text editor file, such as Notepad, and save it on the VNA hard drive as *.vbs.

Learn how to setup and run the macro.

See Guided Cal SCPI commands

See Other SCPI Example Programs

Dim app

Dim scpi

' Create / Get the PNA application.

Set app = CreateObject("AgilentPNA835x.Application")

' Get the ScpiStringParser COM object

Set scpi = app.ScpiStringParser

' Ensure data format is ASCII for this example

scpi.Parse "form:data asc,0"

Dim response

' Begging with a FPRESET to start out with no measurements

response = scpi.Parse("syst:fpreset;*opc?")

' For both channels of this example, creating an S11 measurement and an "a1,1" measurement

scpi.Parse "calc1:par:ext 'CH1_S11_1','S11'"

scpi.Parse "calc1:par:ext 'CH1_a1_1','a1_1'"

scpi.Parse "calc2:par:ext 'CH2_S11_1','S11'"

scpi.Parse "calc2:par:ext 'CH2_a1_1','a1_1'"

' Feeding all four of the newly created measurements to traces in Window 1

scpi.Parse "disp:wind1:stat on"

scpi.Parse "disp:wind1:trac1:feed 'CH1_S11_1'"

scpi.Parse "disp:wind1:trac2:feed 'CH1_a1_1'"

scpi.Parse "disp:wind1:trac3:feed 'CH2_S11_1'"

scpi.Parse "disp:wind1:trac4:feed 'CH2_a1_1'"

' Setting up for 1-port cal acquisitions on both channels 1 and 2,

' using APC 3.5 female DUT connector and 85033D/E cal kit for this example.

scpi.Parse "sens1:corr:coll:guid:conn:port1 'APC 3.5 female'"

scpi.Parse "sens2:corr:coll:guid:conn:port1 'APC 3.5 female'"

scpi.Parse "sens1:corr:coll:guid:ckit:port1 '85033D/E'"

scpi.Parse "sens2:corr:coll:guid:ckit:port1 '85033D/E'"

scpi.Parse "sens1:corr:coll:guid:init"

scpi.Parse "sens2:corr:coll:guid:init"

' This commented-out command shows how you can query for a given connection step of a cal,

' which measurement parameters the calibration needs to measure for that step of the cal.

' But for this example we know for each step the 1-port cals want to measure S11 and

' "a1,1" a.k.a "a1_1".

'response = scpi.Execute("sens:corr:coll:guid:data:cat? STAN1")

'MsgBox response

' Set up for channel coupling and measurement parameter coupling

scpi.Parse "syst:chan:coup:stat on"

scpi.Parse "syst:chan:coup:par on"

' Prompt for the standards to be connected, trigger all the channel-coupled measurements,

' and feed the measured data into the cal connection steps.

MsgBox "Connect all the Opens"

MeasureStandards 1

MsgBox "Connect all the Shorts"

MeasureStandards 2

MsgBox "Connect all the Loads"

MeasureStandards 3

' Conclude and activate the calibrations for both channels

response = scpi.Parse("sens1:corr:coll:guid:save;*opc?")

response = scpi.Parse("sens2:corr:coll:guid:save;*opc?")

' Finished!

MsgBox "Done"

'Subroutine that acquires the measurements and feeds the data into the cal steps

Sub MeasureStandards(stepNum)

    response = scpi.Parse("sens1:swe:mode sing;*opc?")

    response = scpi.Parse("calc1:par:mnum:sel 1;*opc?")

    response = scpi.Parse("calc1:data? rdata")

    scpi.Parse "sens1:corr:coll:guid:data STAN" & CStr(stepNum) & ",'S11',0," & response

    response = scpi.Parse("calc1:par:mnum:sel 2;*opc?")

    response = scpi.Parse("calc1:data? rdata")

    scpi.Parse "sens1:corr:coll:guid:data STAN" & CStr(stepNum) & ",'a1_1',0," & response

    response = scpi.Parse("calc2:par:mnum:sel 3;*opc?")

    response = scpi.Parse("calc2:data? rdata")

    scpi.Parse "sens2:corr:coll:guid:data STAN" & CStr(stepNum) & ",'S11',0," & response

    response = scpi.Parse("calc2:par:mnum:sel 4;*opc?")

    response = scpi.Parse("calc2:data? rdata")

    scpi.Parse "sens2:corr:coll:guid:data STAN" & CStr(stepNum) & ",'a1_1',0," & response

End Sub