This example program does the following:
Setup transient for Wide Narrow
Setup for video trigger
Make a trigger
Get the measurement result
Learn more about transient measurement
See Other SCPI Example Programs
' Transient Measurement ' Dim app Dim scpi Dim NoP Dim dataWBStimulus dim dataNB1Stimulus dim dataWBFreq dim dataNB1Freq Dim strTemp Dim objFSO Dim objFile ' Create / Get the SSA application. Set app = CreateObject("AgilentPNA835x.Application") Set scpi = app.ScpiStringparser ' scpi.parse "SYSTem:FPReset" ' Set the manual trigger scpi.parse "TRIG:SOUR MAN"
' Define Parameters scpi.parse "DISP:WIND1 ON" scpi.parse "DISP:WIND2 ON" ' scpi.parse "CALC:MEAS1:DEF 'WB_Freq:Transient'" scpi.parse "DISP:MEAS1:FEED 1" scpi.parse "CALC1:MEAS1:FORM FREQ"
scpi.parse "CALC:MEAS2:DEF 'NB1_Freq:Transient'" scpi.parse "DISP:MEAS2:FEED 2" scpi.parse "CALC1:MEAS2:FORM FREQ"
' Setup the parameter in Sweep Tab of Transient Setup
scpi.parse "SENS:TR:STYPE WN" scpi.parse "SENS:TR:WIDE:FREQ:RANG R32" scpi.parse "SENS:TR:WIDE:TIME:SPAN 1E-3"
scpi.parse "SENS:TR:NARR1:FREQ:CENT 1E9" scpi.parse "SENS:TR:NARR1:FREQ:RANG R320" scpi.parse "SENS:TR:NARR1:TIME:SPAN 3E-5"
' Setup the parameter of Video Trigger scpi.parse "TRIG:CHAN:TR:VID:ENAB ON" scpi.parse "TRIG:CHAN:TR:VID:SOUR WB" scpi.parse "TRIG:CHAN:TR:VID:WIDE:FREQ:TARG 1E9" scpi.parse "TRIG:CHAN:TR:VID:WIDE:SLOP POS" scpi.parse "TRIG:CHAN:TR:VID:WIDE:FREQ:HYST 1E6"
' Check for Ready for Trigger Do While strTemp = 0 strTemp = scpi.parse("TRIG:STAT:READ? MAN") Loop
' Trigger scpi.parse "INIT:IMM" strTemp = scpi.parse("*OPC?")
' Auto Scale for all windows scpi.parse "DISP:WIND1:TRAC1:Y:AUTO" scpi.parse "DISP:WIND2:TRAC1:Y:AUTO"
' Get the number of points NoP = scpi.parse(":SENS1:SWE:POIN?")
' Get the time data of Wide Band StrTemp = scpi.parse(":CALC1:MEAS1:DATA:X?") strTemp = Replace(strTemp, vbLf, "") dataWBStimulus = Split(StrTemp, ",")
' Get the time data of Narrow Band StrTemp = scpi.parse(":CALC1:MEAS2:DATA:X?") strTemp = Replace(strTemp, vbLf, "") dataNB1Stimulus = Split(StrTemp, ",")
' Get the measurement data of Wide Band strTemp = scpi.parse(":CALC1:MEAS1:DATA:FDAT?") strTemp = Replace(strTemp, vbLf, "") dataWBFreq= Split(StrTemp, ",")
' Get the measurement data of Narow Band strTemp = scpi.parse(":CALC1:MEAS2:DATA:FDAT?") strTemp = Replace(strTemp, vbLf, "") dataNB1Freq = Split(StrTemp, ",")
' Saving the result into a file Set objFSO = WScript.CreateObject("Scripting.FileSystemObject") If Err.Number = 0 Then Set objFile = objFSO.OpenTextFile("Result.csv", 2, True) If Err.Number = 0 Then ' Output Phase Noise result into the file. objFile.Writeline("Number of Data:"&NoP) objFile.Writeline("WB Time, WB Frequency, NB Time, NB1 Frequency") For i = 0 To NoP-1 objFile.Writeline(dataWBStimulus(i)&", "&dataWBFreq(i)&", "&dataNB1Stimulus(i)&", "&dataNB1Freq(i)) Next
objFile.Close Else WScript.Echo "File Open Error: " & Err.Description End If Else WScript.Echo "Error: " & Err.Description End If Set objFile = Nothing Set objFSO = Nothing |