
05 | Keysight | N437x Lightwave Component Analyzer Automation – Getting Started with SCPI - Application Note
Table 2: SCPI Commands for ENA/PNA Automation
Operation PNA ENA
Instrument Reset :SYST:PRES :SYST:PRES
Save Instrument State :MMEMory:STORe 'filename.csa' :MMEM:STOR 'filename.sta'
Recall Instrument State :MMEM:LOAD 'filename.csa' :MMEM:LOAD 'filename.sta'
Start Frequency :SENS1:FREQ:STAR <double> :SENS1:FREQ:STAR <double>
Stop Frequency :SENS1:FREQ:STOP <double> :SENS1:FREQ:STOP <double>
IF Bandwidth :SENS1:BWID <double> :SENS1:BAND <double>
Number of Points :SENS1:SWE:POIN <int> :SENS1:SWE:POIN <int>
Autoscale Trace :DISP:WIND:TRAC:Y:AUTO :DISP:WIND:TRAC:Y:AUTO
Query Available Traces DISP:WIND1:CAT? CALC1:PAR:COUNT?
Query Trace Data CALC1:PAR:MNUM <int>
CALC1:DATA? FDATA
SDATA - Complex Measurement Data
FDATA - Formatted Measurement Data
where <int> represents the trace number
:CALC1:TRAC<int>:DATA:FDAT?
SDATA - Complex Measurement Data
FDATA - Formatted Measurement Data
where <int> represents the trace number
Operation Complete *OPC? *OPC?
Save *.CSV File MMEM:STORe:DATA <string>,’CSV Formatted
Data’,’Trace’,’Displayed’, <int>
where <string> represents the file name and <int>
represents the trace number
:CALC1:PAR<int>:SEL
:MMEMory:STORe:FDATa <string>
where <string> represents the file name and <int>
represents the trace number
It is important to make sure that the automation program is synchronized with the
operations being performed by the test equipment. Often this is accomplished using the
operation complete query, ‘*OPC?’, which returns a ‘1’ when an operation has finished.
The instruments in this example will wait until the operation is complete and then return
a ‘1’. In other words, nothing is returned until the operation is complete. It is important
that the interface timeout is set for a value which is longer the operation. For example,
if the interface timeout is set to 1 second but the measurement requires 3 seconds to
complete then a timeout error will result in response to the ‘*OPC?’.
Here is a brief example which summarizes typical operations and SCPI commands
required to setup the VNA. The syntax of the example in this section has been
abbreviated to highlight the commands required for each step. Comments are included
on lines starting with the ‘#’ character. A complete Python example which sends
SCPI commands using the PyVisa libraries is provided in Appendix B. The individual
SCPI commands sent to the instrument using the ‘myVNA.write()’ statements are the
important commands which can be transported to a different language. The example
code below will query one of the VNA traces as a comma separated string which can be
parsed and formatted into an array. The trace is returned as a real and imaginary pair
if ‘SDATA’ is specified or in the currently displayed format (i.e. log magnitude, phase,
group delay, etc.) if ‘FDATA’ is used in the command string. The example program also
highlights the command to save *.csv file to the VNA hard disk drive.