VEGAS balance problem

NEW Tiger Team Week

Overview

The current requantization balancing algorithm does not always succeed. An example is the configuration eso558_vegas in ~TGBT14A_912 - a configuration used by the MegaMaser project. This configures for Mode 6, and the requantization balancing consistently fails. The problem seems to be that the intiial value of lbw_gain is too small, and it is increased by too small increments, failing to reach the right level before the maximum number of iterations is exceeded. I believe there is a different approach, which should need at most one or two iterations, and hopefully will be consistently successful.

Background

You can skip over this section if you wish, but I found it helpful to understand how the system works.

Converting ADC counts to power.

Power is proportional to the square of the RMS voltage (i.e. to the variance of the voltage). We can convert VEGAS ADC counts to a power level in dBFS (dB with respect to full-scale deflection) as follows.

Consider a sine-wave that toggles all of the ADC inputs - i.e. 255 counts peak-to-peak. For a sinusoid, Vrms = 0.707 * Vp (a useful summary is here).

So, variance of a 255-count peak-peak sine wave in dB = 10log10(127*127*0.5) = 39.1dB

If we assume a sine-wave which toggles all the bits equals 0dBm, then

Input Power (dBm) = 10log10(Variance in counts) - 39.1 dB

Non-linearity of ADC counts to power relationship

The above equation assumes that the input voltage is well sampled by the ADCs, i.e. quantization and saturation are not problems. To get a feel for this, I performed simulations generating random Gaussian noise of a given (floating point) variance, sampling this by an 8-bit sampler, calculating the observed variance, and plotting one against the other. that it is shown here:
  • Measured versus input variance for simulated data:
    powerVvar.png

It is apparent that for input variance from about 10 to 10**3.5 (input rms values from around 3 to 50 counts), the relationship is completely linear. Below rms values around 3, quantization effects severely modify the relationship. Above rms values of about 50 counts, some of the individuals ADC values are clipped at +/1 127 counts, reducing the observed variance below the input variance.

The offset of -0.367 in log space (a factor of about 0.4 in linear terms). is related to the fact that the input random Gaussian noise is independently generated for the real and the imaginary values, and the output is the variance of the magnitude of these.

Operation of the "round2" CASPER block (Modes 4 - 9)

The decimated polyphase filter banks are converted to 8-bit values by the CASPER "round2" block. This operates as follows:

  • The input value is a 64 bit word which contains the real and the imaginary parts in each of 31 bits.
  • These are scaled as 1 sign bit, and 31 fraction bit (and so take values ranging from -1 to +1.
  • For each part of the complex value, the value is multiplied by the gain (a 32 bit integer), and then placed in a 64-bit word, with the binary point at bit 31.
  • the FPGA takes 8 bits for each part, from bit 49 through 56.
  • These are again combined into a 16 bit complex value.

In order for the above process to be successful, the gain must be at least 2**17, to get the MSB of the input value into the LSB of the output value. To convert the maximum input value (bit 31 in the input word set) to the maximum output value (bit 56 in the output word set), requires a gain of 2**25. If the input value is smaller than the maximum value, gains all the way up to 2**32 may be required.

Note: modes 10-29 use a different CASPER block. I believe the principle is the same, but the gain values required seem quite different.

Operation of the current algorithm.

I do not have full details of the current algorithm. It appears to set an initial value, and then iterates this by factors of around 5%. It sometimes fails to converge.

Proposed new algorithm

Note: A change in gain by a factor of 2 (3dB) corresponds to a change in the output power by a factor of 4 (6dB). This is because the real and imaginary parts are both multiplied by two, and then the variance is the sum of (real)**2 + (imag)**2 - it seems like on average, the real and imaginary values must be approximately equal.

Modes 4-9

  • let INP be the input power (measpwr sampler for the appropriate polarization), and SNAP the measured output power (filtersnap,polx,measpwr for the appropriate polarization).
  • Set the initial value of lbw_gain to 1,000,000,000 (approx 2**30)
  • let RATIO be the linear ratio of INP and SNAP (i.e. ijn log space, (INP - SNAP) in linear space, 10** [(INP - SNAP)/20.0] (additional factor of 2 since lbw_gain is applied to both real and imag values)
  • set the new value of lbw_gain to be the old value of lbw_gain x RATIO
  • repeat the above algorithm until SNAP is within 2dB of INP
  • iterate for a maximum of five times. If the algorithm fails to achieve the target value, proceed as described below

Modes 10 - 29

  • As above, but:
    • SNAP is now the appropriate value from the appropriate snapblock
    • set the starting value of lbw_gain for each subband be 4000 (approx 2**12)

If the algorithm fails to converge

  • If the absolute difference between INP and SNAP is more than 9dB (3 bits) display an error message in the Astrid message window:
    • "Error: requantization balancing failed" (with details about Bank, subband as appropriate)
  • If the absolute difference between INP and SNAP is more than 3dB (1 bit) display a warning message in the Astrid message window:
    • "Warning: requantization balancing failed" (with details about Bank, subband as appropriate)
  • display to the Astrid message window the values of INP and SNAP

-- RichardPrestage - 2014-12-16

Topic attachments
I Attachment Action SizeSorted descending Date Who Comment
powerVvar.pngpng powerVvar.png manage 48 K 2014-12-22 - 12:19 RichardPrestage Measured versus input variance for simulated data
This topic: CICADA > WebHome > GreenBankSpectrometer > VegasToDoList > VegasBalanceProblem
Topic revision: 2015-05-21, RichardPrestage
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding NRAO Public Wiki? Send feedback