Perform a CalAllChannels Calibration

M9370A / M9371A / M9372A / M9374A / M9375A

Perform a Cal All Channels Calibration


This example sets up an SMC channel and a standard channel. It then performs a 'Cal All Channels' calibration which calibrates both channels.

Note: The example does NOT modify any Cal All path settings.

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 *.vbs.

Learn how to setup and run the macro.

See CalAll SCPI commands

Learn about Cal All

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

scpi.Parse "SYST:FPReset"

'

'********************* Setup Channel 1, Window 1 ***************

' Create and turn on window 1

scpi.Parse "DISPlay:WINDow1:STATE ON"

'Define a measurement name in chan 1 with S21 parameter

scpi.Parse "CALC1:PARameter:DEFine:EXT 'MyMeas',S21"

'FEED the measurement to window 1, and give the new TRACe a number (1).

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

'Modify stimulus settings

'Set IF Bandwidth to 700 Hz

scpi.Parse "SENSe1:BANDwidth 700"

'Set Center and Span Freq's to 1 GHz

scpi.Parse "SENSe1:FREQuency:CENTer 1ghz"

scpi.Parse "SENSe1:FREQuency:SPAN 1ghz"

'Set number of points to 11

scpi.Parse "SENSe1:SWEep:POINts 11"

'

'********************* Setup Channel 2, Window 2 ***************

' Create and turn on window 2

scpi.Parse "DISPlay:WINDow2:STATE ON"

' Create an SMC meas in channel 2

scpi.Parse "CALC2:CUST:DEF 'My SC21', 'Scalar Mixer/Converter', 'SC21'"

'Setup the new measurement in the active window

scpi.Parse "DISP:WIND2:TRAC:FEED 'My SC21'"

' Setup Mixer Stimulus ***************

' Points and IFBW are channel settings

scpi.Parse "SENS2:SWEep:POINts 11"

scpi.Parse "SENS2:BANDwidth 1e3"

' The rest are mixer settings

scpi.Parse "SENS2:MIX:INPut:FREQ:MODE SWEPt"

scpi.Parse "SENS2:MIX:INPut:FREQ:STAR 3.6e9"

scpi.Parse "SENS2:MIX:INPut:FREQ:STOP 3.9e9"

scpi.Parse "SENS2:MIX:LO:FREQ:MODE FIXED"

scpi.Parse "SENS2:MIX:LO:FREQ:FIX 1.0e9"

scpi.Parse "SENS2:MIX:LO:POW 10"

scpi.Parse "SENS2:MIX:OUTP:FREQ:SID LOW"

scpi.Parse "SENS2:MIX:CALC Output"

scpi.Parse "SENS2:MIX:LO:NAME 'Port 3'"

scpi.Parse "SENS2:MIX:APPLY"

'

'********************* Setup Cal All Channel ***************

'Reset Cal All settings

scpi.Parse "SYST:CAL:ALL:RESet"

' Select channels to cal

' By default, all active channels are selected.

' VMC channels are NOT supported by Cal All.

scpi.Parse "SYST:CAL:ALL:SEL 1,2"

'Set IFBW

scpi.Parse "SYST:CAL:ALL:IFBW 1e3"

'Set power level

scpi.Parse "SYST:CAL:ALL:PORT2:SOUR:POWer 0"

'Set CalSet prefix. The meas class and channel number

'are appended to the User Cal set for each channel.

'If you don’t set this, only Cal Registers will be generated.

scpi.Parse "SYST:CAL:ALL:CSET:PREFix 'MyCalAll'"

' Read unique Cal settings for Cal All channels

uniqSettings = scpi.Parse ("SYST:CAL:ALL:MCL:PROP:NAME:CAT?")

msgbox (uniqSettings)

' We want "Enable Phase Correction"

' Now find valid settings

uniqVal = scpi.Parse ("SYST:CAL:ALL:MCL:PROP:VAL:CAT? 'Enable Phase Correction'")

'returns 'false,true' make it true.

scpi.Parse "SYST:CAL:ALL:MCL:PROP:VAL 'Enable Phase Correction','true'"

'

'********************* 'Perform Guided Cal on <ch> ***************

'Read the Cal All channel number

ch = scpi.Parse ("SYST:CAL:ALL:GUIDed:CHAN?")

'Convert ch to integer

ch=CInt(ch)

' Specify the DUT connectors

scpi.Parse ("sens" &ch& ":corr:coll:guid:conn:port1 ""APC 3.5 female"" ")

scpi.Parse ("sens" &ch& ":corr:coll:guid:conn:port2 ""APC 3.5 male"" ")

scpi.Parse ("sens" &ch& ":corr:coll:guid:conn:port3 ""Not used"" ")

scpi.Parse ("sens" &ch& ":corr:coll:guid:conn:port4 ""Not used"" ")

' Select the Cal Kit for each port being calibrated.

scpi.Parse ("sens" &ch& ":corr:coll:guid:ckit:port1 ""85052D"" ")

scpi.Parse ("sens" &ch& ":corr:coll:guid:ckit:port2 ""85052D"" ")

' Initiate the calibration and query the number of steps

scpi.Parse ("sens" &ch& ":corr:coll:guid:init")

numSteps = scpi.Parse("sens" &ch& ":corr:coll:guid:steps?")

MsgBox "Number of steps is " + CStr(numSteps)

' Measure the standards

For i = 1 to numSteps

step = "Step " + CStr(i) + " of " + CStr(numSteps)

strPrompt = scpi.Parse("sens" &ch& ":corr:coll:guid:desc? " + CStr(i))

MsgBox strPrompt, vbOKOnly, step

scpi.Parse ("sens" &ch& ":corr:coll:guid:acq STAN" + CStr(i)) + ";*OPC?"

' If you have set up a slow sweep speed (for example, if

' you’re using a narrow IF bandwidth), and while this calibration is

' being acquired you wish to have your program perform other operations

' (like checking for the click event of a Cancel button) and you’re

' NOT using the COM ScpiStringParser, you can use the optional

' ASYNchronous argument with the ACQuire command as shown below

' instead of sending that command in the way shown above. The SCPI

' parser then will return immediately while the cal acquisition

' proceeds (i.e., the parser will NOT block-and-wait for the

' cal to finish, so you can send additional commands in the meantime).

' So you can do “*ESR?” or “*STB?” queries to monitor the status register

' bytes to see when the OPC bit gets set, which indicates the cal has

' finished.  That type of OPC detection works for all of the PNA’s SCPI

' parsers except the COM ScpiStringParser.

' An alternative to querying the status register is to setup an SRQ handler

' if your IO Libraries supports that.

' When an SRQ event occurs, a call back will occur automatically

'  “SENSe:CORRection:COLLect:ACQuire ECAL1,CHAR0,ASYNchronous;*OPC”

Next

' Conclude the calibration

scpi.Parse ("sens" &ch& ":corr:coll:guid:save")

' Read the cal set names that were generated

calsets = scpi.Parse ("system:cal:all:cset:catalog?")

MsgBox calsets

 


Last modified:

7-Sep-2012

New topic