Go to www.awrcorp.com
Back to search page Click to download printable version of this guide.

Align Signal (Gain, Phase and Delay Compensate): ALIGN

Symbol

Summary

ALIGN analyzes two signals, a reference signal and a distorted version of the reference signal, for timing alignment and gain and phase distortion. The signals are then delayed as necessary to time-align the signals on output. The distorted signal is gain and phase compensated to minimize the effects of any gain and phase distortion.

Parameters

Name Data Type Description Unit Type Default
ID   Element ID Text A1
N I Number of samples for evaluation Scalar  
REEVAL I Number of samples after initial evaluation to repeat gain/phase evaluation Scalar 0
CORRDLY I Additional delay before correlation Scalar  
DLYCOMP E Delay compensation N/A Align to Sample Boundaries
INTRPSPN I Number of samples to use in delay compensation interpolation Scalar 0
GAINCOMP E Gain compensation N/A Power
PHSCOMP E Phase compensation N/A Enabled
NPOSTPHS I Number of samples phase difference for post alignment phase correction Scalar 0
SMPLPTS I Optional 1 based indices of samples to use for gain/phase compensation Vector  

* indicates a secondary parameter

Parameter Details

N. The number of samples over which to compare the distorted and the reference signal. This value also determines the maximum amount by which the distorted signal may be shifted, which is +/- N/2. The correlation for timing correction is performed using 2 N samples.

If left empty, the number of samples is set to the smallest multiple of the signal's oversampling ratio (samples per symbol) that is greater than or equal to 256.

This may also be set to 0, in which case alignment is performed using static signal properties rather than sample correlation. This is useful when one signal needs to be delayed in order to align it with another signal that has been delayed, but the first signal is independent from the second signal. An example would be a descrambling bit sequence that is XOR'd with a transmitted signal. The transmitted signal is not a distorted version of the descrambling bits so correlation cannot be used to align the signal. Refer to the Implementation Details section for more information.

REEVAL. The number of samples after which the gain and/or phase is to be recomputed. This is only used if N is not set to 0. Set to -1 to perform only a single evaluation, set to 0 to reevaluate the gain and/or phase every N samples. If this is left empty, it is set to -1 if GAINCOMP is "Training Sequence", otherwise it is set to 0.

CORRDLY. Additional delay beyond the signal delay points at which to compare the signals. This is typically used to allow additional time for the signals to stabilize. If left empty, N is used.

DLYCOMP. Enables (set to "Basic") or disables (set to "No") delay compensation. When delay compensation is disabled, the input and the reference signal are delayed as necessary to have the same signal delay property values. Set to "Align to Sample Boundaries" to enable compensation only when samples per symbol is > 1.

INTRPSPN. The number of samples to use in the interpolation for fractional sample delay compensation.

NOTE: Fractional sample delay compensation is only used if N is set to 0. It is not supported for correlation based alignment.

GAINCOMP. Determines the type of gain compensation to perform:

  • None: No gain compensation is performed.

  • Power: The distorted signal is scaled so the average power levels of the distorted signal and the reference signal are the same within the evaluation blocks.

  • Voltage: The distorted signal is scaled so the average voltage levels of the distorted signal and the reference signal are the same within the evaluation blocks.

  • Training Sequence: Scaling values are computed for each individual sample in the evaluation block, for a total of N scaling values. Each block of N samples of the distorted signal is then scaled by the corresponding value. Note that N must be set to a value greater than 0 in order to use "Training Sequence".

PHSCOMP. Determines the type of phase compensation to perform. There are two types of phase compensation: rotation and reversal. Rotation compensation detects phase shifts in the signal. Compensation is performed by subtracting the detected phase shift.

Reversal compensation detects a phase reversal, which typically occurs when the signal represents the lower sideband output of a mixer. When phase reversal is detected, the signal is conjugated to remove the reversal.

NPOSTPHS. Optional number of samples for the running average phase correction to be applied to the aligned signal. A value of 0 disables the post-alignment phase correction. If left empty the number of samples in the running average will be set to the number of samples used to compare the reference and distorted signals. The post-alignment phase correction only applies to complex signals.

SMPLPTS. Optional vector of indices indicating which samples within the N samples are to be used for gain and phase compensation. The indices are 1 based. This is only when GAINCOMP is set to either "Power" or "Voltage".

SMPLPTS is useful when working with OFDM sub-carriers and only the pilots are to be used for the gain/phase compensation. For example, if there are 52 subcarriers with the 5th, 19th, 33rd and 47th subcarriers pilots, the ALIGN block can be configured to compensate for the average gain and phase distortion at those four subcarriers by setting N to 52 and SMPLPTS to {5, 19, 33, 47}.

Data Input

Node No. Type Purpose
1 Real, Complex Reference Signal
2 Real, Complex Distorted Signal

Data Output

Node No. Type Purpose
3 Real, Complex Delay Adjusted Reference Signal
4 Real, Complex Compensated Distorted Signal
5 Real Signal lag(>0) or lead(<0), in seconds, relative to the reference signal
6 Complex Gain and Phase Adjustment

Output Node Details

Node No. 5. The number of seconds the distorted signal lagged (>0) or led (<0) the reference signal is output each time a sample is generated at the compensated signal output node.

Node No. 6. The scaling applied to the distorted signal for gain and phase compensation is output each time a sample is generated at the compensated signal output node.

Error Conditions

Error Correction
Could not estimate delay correction from correlation, not performing correction.This is a warning generated when the timing correlation results in a peak that is outside the range +/- N, or would result in the distorted signal achieving a negative signal delay. When this occurs, the distorted signal is not shifted relative to output signal delay. Try increasing N to increase the number of samples in the correlation.Try increasing CORRDLY to allow additional time for the signal to settle.

Implementation Details

ALIGN performs three functions: timing alignment, gain compensation, and phase compensation.

Timing Alignment

When a signal is passed through a filter or any other block that introduces a delay, the static signal delay property associated with the signal is increased by the estimated delay introduced by the block. Downstream blocks and measurements use this static signal delay property to automatically compensate for introduced signal delays.

The static signal delay property is only an estimate of the signal delay that has been introduced. In many cases it is a sufficient estimate. However, when working with analog filters such as the circuit-based filters such as BPFB, or Microwave Office circuits using LIN_S, the estimate may be off by several samples due to the frequency-dependent group delay introduced by the block, particularly in the transition regions. This occurs because the static signal delay property is estimated based on static information and not on actual signal samples. If the characteristics of the sampled signal differ significantly from the assumptions made when estimating the static signal delay property, then the actual signal delay in the sampled signal is significantly different from the static signal delay property.

ALIGN is capable of analyzing the distorted signal and compensating, to a certain degree, for this signal delay estimation error. This correction is enabled by setting the DLYCOMP parameter to "Enabled".

The delay compensation is performed by correlating the distorted and reference signal samples to estimate the required delay correction. The block of samples used for the correlation depends on the N and CORRDLY parameters and the static signal delay properties of the reference and distorted signals.

The correlation is performed using 2 N samples from each signal, offset from the start of the signal by the static signal delay property less N/2 samples, and an additional CORRDLY samples. CORRDLY is useful for allowing additional settling time from the start of the signal.

To reduce the chance of a poor correlation producing an incorrect error correction, if the correlation indicates a correction greater than N/2 in either direction, the correction is not performed and a warning is generated. To allow for the distorted signal's static signal delay being too large, the start of the correlation block is positioned N/2 samples before the signal delay position. The following illustrates the situation when the maximum delay correction is required.

The static signal delays of both output signals are set to the maximum delay required to accommodate the error correction and the static signal delay of the reference signal. For the distorted signal, the maximum delay is the static signal delay plus N / 2 samples. The static signal delays of both output signals is then the maximum of either the distorted signal's static signal delay plus N, or the reference signal's static signal delay. Samples with value 0 are inserted prior to the first sample to shift the signals to the output static signal delay.

When the DLYCOMP parameter is set to "None", the error correction is not performed. However, delay may still be introduced to align the signal delays of the reference and distorted signals:

N can also be set to 0, in which case the signals are delay compensated based solely on the static signal delay. No correlation is performed. In this case, the signal with the smaller delay is delayed to align it with the other signal.

When N is set to 0, static signal delays that contain a fraction of a sample can be compensated to a certain extent using interpolation. This mode can be enabled by setting INTRPSPN to a value greater than 0. INTRPSPN determines the number of samples to use for the interpolation. The interpolation is performed similar to that performed by DLYCMP.

Gain and Phase Rotation Compensation

The distorted signal can be gain and phase compensated to match the reference signal. Gain compensation is determined by the GAINCOMP parameter and phase compensation is determined by the PHSCOMP parameter.

The gain and phase compensation are applied to the distorted signal by multiplying each input sample by a constant complex scale value of the form:

Scale = A·exp(j·θ)

This is the value output on node 6. When GAINCOMP is set to "None" A equals 1. When PHSCOMP is set to "None" θ equals 0.

The constants A and θ are computed from N samples offset by CORRDLY from the corrected signal delay point.

If GAINCOMP is set to "Power", A is computed from:

where d is the distorted signal's samples, r is the reference signal's samples, SigDlyD is the distorted signal's corrected signal delay offset, and SigDlyR is the reference signal's static signal delay.

If GAINCOMP is set to "Voltage", A is computed from:

θ is computed from:

If GAINCOMP is set to "Training Sequence", N individual scale values are computed. This requires N be set to a value > 0. The A values are computed from:

θ values are computed from:

If N is set to 0, the gain and phase compensation are determined from the static signal power and phase rotation properties. In this case the gain compensation A is the square root of the reference signal's signal power property divided by the distorted signal's signal power property. If either signal does not have a signal power property no gain compensation is performed.

The phase compensation θ is the reference signal's phase rotation minus the distorted signal's phase rotation wrapped to ±π. If either signal does not have a phase rotation property its phase rotation property is treated as 0.

Phase Reversal Compensation

The distorted signal may have undergone a phase reversal, such as passing through the lower sideband of a mixer, or being complex conjugated. If phase reversal compensation is enabled, the distorted signal will be examined for a phase reversal.

If correlation based delay compensation is enabled, the correlation is performed on both the original distorted signal and the complex conjugate of the distorted signal. If the complex conjugate correlation is significantly stronger, the signal is treated as phase reversed.

If correlation based gain compensation is enabled but delay compensation is disabled, then correction factors are computed for both the original distorted signal and the complex conjugate of the distorted signal. If the absolute value of the phase correction for the complex conjugated signal is significantly smaller than that of the absolute value of the phase correction for the original signal, the signal is treated as phase reversed.

If phase reversal detection is not being performed, the distorted signal may still be phase reversed. This occurs if the phase reversed static signal property of the distorted and reference signals differ. This property is normally set when a block applies a complex conjugate operation to the signal, such as a mixer set to DIFF (lower sideband) operation, or the Complex Conjugate primitive block CONJ.

Post-alignment Phase Adjustment

If the distorted signal has undergone a time varying phase distortion, it may be helpful to apply the post-alignment phase adjustment. This adjustment is performed by comparing the phases of each reference and corrected signals signal after the alignment. A running average of the phase difference is kept, and this average phase difference is subtracted from the phase of the corrected signal. The number of samples used in the running average is determined by the NPOSTPHS parameter. Setting NPOSTPHS to 0 disables the post-alignment phase adjustment. Setting NPOSTPHS empty uses the number of samples used to perform the alignment, which is N or the value automatically computed for N.

Note that the post-alignment phase adjustment only applies to complex signals.

Recommendations for Use

ALIGN is typically used when performing EVM measurements on received symbols. Whether the ALIGN block is placed before or after a receiver depends upon the individual situation.

The ALIGN block is often placed before the receiver, where it acts as a tuner of sorts. The Visual System SimulatorTM (VSS) receivers offer built-in gain and phase compensation. However, this compensation is based on the propagated static signal power, phase rotation, and signal delay properties of the signal entering the receiver, and these properties are approximations of the transforms the signal went through on its way to the receiver. With an ALIGN block before the receiver these properties are updated based on the correlation between the signals entering the ALIGN block.

One scenario where the ALIGN block is placed after the receiver is when working with OFDM signals. This is particularly useful when the modulated signal has passed through filters. In this case, N should be set to the number of carriers per OFDM symbol, and DLYCMP should be set to "Training Sequence".

Since an OFDM modulated signal is frequency based, the distortion incurred when the modulated signal passes through a linear filter will be constant for the individual carriers, but will typically differ from carrier to carrier. By using the training sequence mode, corrections are computed for and applied to each OFDM carrier.

ALIGN can also be used to align two signals with differing signal delays. ALIGN will insert samples as necessary so the earlier signal is delayed to line up with the later signal. This is useful when post-processing the signal using blocks.

Please send email to awr.support@ni.com if you would like to provide feedback on this article. Please make sure to include the article link in the email.

Legal and Trademark Notice