# Presentation: 815515

## BPM test signalSpectrum analysis

- BPM project

## Gustavo’s test signal

- No RF buckets = 1113.
- RF frequency = 53.104 MHz.
- 1 lap period = 20.958 μs.
- Starting from Jim Steimel’s A and B sampled at 2GHz a closed-orbit load of 36 bunches in 3 batches of 12 bunches separated by abort gaps is generated. i.e. 41917 samples.
- This signal is resampled at a freq. close to 7/5 of 53.104MHz.
- The difference between my sampling freq and 7/5 of 53.104MHz was 0.39%.
- This error shifts the spectrum centered at 53.104MHz by 207.7KHz.
- The “recicler” filter BW is ~10KHz, so it was very sensitive to this error.

## Spectrum analysis

- T1=6.99μs => f1=143KHz
- T2=396ns => f2=2.52MHz
- T3=18.9ns => f3=53.1MHz
-   The 53MHz signal is not periodic f3 represents its 1st harmonic.
- Sampling frequency
- fs = 74.3MHz

## Spectrum analysis

**T****2**** = 2.52MHz**

- The spectrum of the input (sampled) signal is centered at 53MHz. After down-conversion a portion is sent to baseband.
- Most of the spectrum density concentrates around 2.52MHz lines.

## Spectrum analysis

**T****2**** = 2.52MHz**

**142KHz line**

## Spectrum analysis

- Spectrum of the test signal in the low KHz range

- Spectrum at the output of the CIC filter

## Specifications to implement the “batch envelope filter” in the Ecotek Stratix FPGA

- BPM project

## Signal to noise

- The matched filter is a linear filter widely used to recover deterministic signals embedded in white Gaussian noise (WGN) because it optimizes the S/N ratio.
- y(n) = x(n) * s(n), where s(n) is the deterministic signal and x(n) is the noisy signal. i.e. x(n) = s(n) + w(n).     (w(n) is WGN).
- S/N = ε/σ2, where ε is the energy of the signal and σ2 is the noise variance.
- S/N increases with the number of “signal samples”.
- The matched filter meets the Cramer-Rao lower bound.
- We can do better than the matched filter by choosing only “signal samples”. In a batch we have enough “signal samples” that can be detected applying a simple threshold cut.

## Filtered signals

- |A|-|B|/|A|+|B| is fairly constant for |A|+|B|>Threshold.
- The example shows about 25 useful points per batch.
- The samples are averaged to provide a single I and Q pair per batch.
- Batch numbers are averaged again to improve estimate and lower the data bandwidth.

**α**** = threshold **

**Use I and Q’s in this window only **

## Task Description

- Implement the “batch envelope filter” in the Stratix FPGA that handles the I and Q data stream into the Ecotek’s FIFO.
- Write the Filter algorithm in VHDL code and simulate it on the PC using I and Q signals coming from Matlab simulations.
- Port the Filter VHDL to the Ecotek FPGA.
- Test and qualify the Filter using Jim Steimel’s setup.

## Signal processing options

- The amount of signal processing done by the filter has alternatives:
- Select I and Q based on corresponding |A|+|B|>threshold but output “raw” I and Q to VME.
- Select I and Q as above but output averaged I and Q’s to VME.
- Select I and Q as above, compute |A|-|B|/|A|+|B| for each sample above threshold.
- Select I and Q as above, compute |A|-|B|/|A|+|B| for each sample above threshold, sum up N number of points to eliminate betatron oscillations (N~32).
- How to determine the threshold?
- The threshold can be fixed to a number above the noise level and below 1⁄2 the minimum |A|+|B| signal level expected.
- It can be calculated from the signal level and set accordingly.

## Filter Algorithm (Option i. and ii.)

**(.)****2**

**I****A**

**(.)****2**

**Q****A**

**(.)****2**

**I****B**

**(.)****2**

**Q****B**

**+**

**+**

**+**

**>****α**

- |A|+|B|

**Select I’s and Q’s such that**
**corresponding**
** ****|A|-|B|>****α**

**I****A*******

**Q****A*******

**I****B*******

**Q****B*******

- High bandwidth: Each I,Q data stream is ~2 M samples/s

**Average N samples**

**I****A********

**Q****A********

**I****B********

**Q****B********

## Filter Algorithm (Option iii.)

**(.)****2**

**I****A**

**(.)****2**

**Q****A**

**(.)****2**

**I****B**

**(.)****2**

**Q****B**

**+**

**+**

**-**

**+**

**>****α**

- |A|+|B|

- |A|-|B|

**Select **
**(|A|-|B|)’s **
**such that**
** ****|A|-|B|>****α**

**Σ****(****In****2****/****In****1****)**

**In****1**

**In****2**

- Σ(|A|-|B|/|A|+|B|)

- Moderate bandwidth: 145 K samples/s

- One point per signal bunch.

- (Averages samples within bunch only)

## Filter Algorithm (Option iv.)

**I****A**

**Q****A**

**I****B**

**Q****B**

**1****st**** Filter as in Option ii.**

- |A|-|B| / |A|+|B|

**Average N samples to eliminate betatron oscillation**

- |A|-|B| / |A|+|B|

- Low bandwidth: 4.5 K samples/s

## Position estimation

- Let

- the likelihood estimation function of **I** is:

- Similarly for Q.

- However, the position estimation is nonlinear with respect to I and Q.

- If the noise is WGN ~ N(0,σ2),

- It is better to run sums over I and Q before calculating P.

- The filters color the noise. Not WGN any more.

## How to set the threshold

- The threshold can be fixed to a number above the noise level and below 1⁄2 the minimum |A|+|B| signal level expected.
- It can be calculated from the signal level and set accordingly.