Creating a Macro: ACPR Measurement Example

This example follows the process described in Creating a Macro to create a macro that measures the adjacent channel power ratio (ACPR Adjacent Channel Power Ratio - A measurement of the amount of interference, or power, in the adjacent frequency channel. ACPR is usually defined as the ratio of the average power in the adjacent frequency channel (or offset) to the average power in the transmitted frequency channel. ACPR is a critical measurement for CDMA transmitters and their components. It describes the amount of distortion generated due to nonlinearities in RF components. The ACPR measurement is not part of the cdmaOne standard.) of an I/Q modulated signal.

This macro was developed using the recorded QPSK Quadrature phase shift keying.dat signal located in %PROGRAMFILES%\Keysight\89600 Software <ReleaseVersion>\89600 VSA Software\Help\Signals\QPSK directory.

  1. Determine the measurement procedure

    For example, a procedure for measuring ACPR is shown below. This set of steps will be used in Step 2.

    1. Recall the QPSK.htm demo

      Click File > Recall > Recall Demo and then browse to the QPSK directory.

    2. Enable averaging (set Average Type to RMS (Video))

    3. Restart the measurement. The measurement will pause after the number of sweeps specified by the Count parameter (10 is the default).
    4. Measure channel power.

      1. Click Markers > Calculation
      2. Select the Ch1 Spectrum trace (Trace B)
      3. Select the Band Power check box.
      4. Set Center = 5 MHz Megahertz: A unit of frequency equal to one million hertz or cycles per second., Span = 50 kHz kiloHertz: A radio frequency measurement (one kilohertz = one thousand cycles per second).
      5. Note the marker power reading.
    5. Measure adjacent channel power

      Perform the same steps as above except set Center = 5.05 MHz.

    6. Take the difference between the two channel power readings to compute the adjacent channel power ratio.

  2. Record your keystrokes while performing the measurement

    1. Click Utilities > Macros from the main menu.

    2. Select the language you prefer and then click Record.

      Changes to the measurement setup are recorded until you return to this dialog box and click End Record.

    3. Perform the ACPR measurement steps shown in Step 1.

    4. Click Utilities > Macros from the main menu to return to the Macros dialog box. Click End Record.

    5. Specify the name for the macro as "MeasureACPR" and click OK.

    Instead of recording a macro, you can configure the VSA to echo the corresponding command to the Output window each time you interact with the user interface. To do this, select the Show Code check box in the Output window.

  3. Review the generated code

    1. Click Edit. Take a moment to associate the lines of code with the measurement steps that you performed.

      Instead of using the built-in code editor, you can use Microsoft Visual Studio (click the dropdown part of the Edit button), which has code highlighting, code completion, and other features. A free version of Visual Studio can be downloaded from Microsoft's Visual Studio Community.

    2. Delete unnecessary lines of code, such as the auto-generated comment and line that recalls the QPSK demo. The code for the macro should appear as in the following screenshot:

    3. Run the macro

      From the Macros dialog box, select the new macro, and then click (Build and) Run).

      After you run this macro, the Spectrum trace will look like this.

      Notice that the macro just executes the two band power measurements in rapid succession. This does not leave time for the user to read the results. The next step reads the two marker measurements into the macro.

  4. Complete the macro by adding additional commands to calculate and show the ACPR result

    1. Capture channel power

      After setting up the band power marker on the channel, assign the Marker's band power calculation to a local variable:

      double channelPower = app.Display.Traces.SelectedItem.Markers.SelectedItem.BandPowerResult

    2. Capture adjacent channel power:

      After moving the marker to the adjacent channel, assign the Marker's band power calculation to a local variable:

      double adjChannelPower = app.Display.Traces.SelectedItem.Markers.SelectedItem.BandPowerResult

    3. Show the difference between the channel power and adjacent channel power

      Show a message box by adding the following line at the end of the macro:

      System.Windows.MessageBox.Show("ACPR = " + (channelPower - adjChannelPower));

      This calculation assumes that the trace format is set to LogMag so that the band power will be calculated in dBm deciBels referenced to a milliWatt: dB relative to 1 milliwatt dissipated in the nominal input impedance of the analyzer.

    The modified macro code should look like this (changes marked by red rectangle).

  5. Run the completed macro

    When run, the macro will automatically measure, compute, and display ACPR as shown below.

See Also

About Macros

Importing and Exporting Macros