Perform an ECal using COM


This example uses the GuidedCalibration interface to perform a 2-port ECal calibration.

Learn more about Reading and Writing Calibration data using COM.

See Other COM Example Programs

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 on the PNA hard drive as ECal.vbs. Learn how to setup and run the macro.

Set pna = CreateObject("AgilentPNA835x.Application")
Set calMgr = pna.GetCalManager
Set guidedCal = calMgr.GuidedCalibration
Set chan = pna.ActiveChannel
chanNum = chan.ChannelNumber
' Initialize guided cal to be performed on the active channel.
' The boolean argument of True indicates to create a new calset

guidedCal.Initialize chanNum, True
' To perform 3-port cal, Uncomment the following
' Then comment the 2-port cal

' Do 2-port cal

TwoPortGuidedCal

' Do 3-port cal
' ThreePortGuidedCal



Sub TwoPortGuidedCal()
'Change the following to match the connectors on your ECal module

guidedCal.ConnectorType(1) = "APC 3.5 female"
guidedCal.ConnectorType(2) = "APC 3.5 female"
For i = 3 To pna.NumberOfPorts
guidedCal.ConnectorType(i) = "Not used"
Next
value = MsgBox("Connectors defined for Ports 1 and 2")

 

' Select the ECal module for each port being calibrated.

' Replace N4691-60004 with your own ECAL model followed by 'ECal'.

' Your ECal module must already be connected

' via USB to the PNA.

guidedCal.CalKitType(1) = "N4691-60004 ECal"

guidedCal.CalKitType(2) = "N4691-60004 ECal"

' Non-factory characterizations are specified as follows:

'guidedCal.CalKitType(1) = "N4691-60004 User 1 ECal"

' When two or more ECal modules with the same model number are connected

' also specify the serial number as follows:

'guidedCal.CalKitType(1) = "N4691-60004 ECal 01234"

' When Disk Memory ECal user characterizations are used,

' specify both the User char and the serial number as follows:

'guidedCal.CalKitType(1) = "N4691-60004 MyDskChar ECal 01234"

' Turn on auto orientation for the ECal (default behavior).

'guidedCal.AutoOrient = 1'

MsgBox("Cal kits defined for Ports 1 and 2")
 

' Initiate the calibration and query the number of steps
numSteps = guidedCal.GenerateSteps
' Measure the standards, compute and apply the cal

MeasureAndComplete(numSteps)
End Sub

Sub ThreePortGuidedCal()
''Change the following to match the connectors on your ECal module

guidedCal.ConnectorType(1) = "APC 3.5 female"
guidedCal.ConnectorType(2) = "APC 3.5 female"
guidedCal.ConnectorType(3) = "APC 3.5 female"

' Select the ECal module for each port being calibrated.
' Replace N4691-60003 with your own ECAL model followed by 'ECal'.
' Your ECal module must already be connected to a PNA USB port.

guidedCal.CalKitType(1) = "N4431-60003 ECal"
guidedCal.CalKitType(2) = "N4431-60003 ECal"
guidedCal.CalKitType(3) = "N4431-60003 ECal"

value = MsgBox("Cal kits defined for Ports 1 to 3")
' Initiate the calibration

numSteps = guidedCal.GenerateSteps
' Measure the standards, compute and apply the cal

MeasureAndComplete(numSteps)
End Sub

Sub MeasureAndComplete(ByVal numSteps)
value = MsgBox("Number of steps is " + CStr(numSteps))
' Measure the standards

For i = 1 To numSteps
step = "Step " + CStr(i) + " of " + CStr(numSteps)
strPrompt = guidedCal.GetStepDescription(i)
value = MsgBox(strPrompt, vbOKOnly, step)
guidedCal.AcquireStep i
Next

' Conclude the calibration

guidedCal.GenerateErrorTerms
MsgBox ("Cal is done!")
End Sub
 


Last Modified:

5-Apr-2011

Edited for ECal options