Time Synchronization and PSS/Cell ID-2 Detection

The time synchronization is required in all communication systems (wired or wireless) to communication the information to and fro the base-station (BS) and user equipment (UE). This module provides the the API for time synchronization during initial access phase using primary synchronization sequence which has excellent time correlation properties. It performs the following:

  1. Physical Cell ID-2 Detection \(\text{N}_\text{ID}^\text{(2)}\).

  2. Frequency Offset estimation.

  3. Index of \(\text{1}^\text{st}\) sample of the OFDM symbol in which the PSS was transmitted by the BS.


Both Cell ID-2 and Frequency Offset are unknown:

method       = 'largestPeak'
detectorType = 'peakDetector'

timeSynch    = PSSDetection(method, detectorType)

numSamples   = 1024
timeIndex    = np.random.rand()*1024
rxSamples    = np.fft.ifft(np.exp(-1j*2*np.pi*timeIndex*np.arange(numSamples)/numSamples))
fftSize      = 256
lengthCP     = 12
N_ID2        = None
freqOffset   = None
pssPeakIndices, pssCorrelation, N_ID2, freqOffset = timeSynch(rxSamples, fftSize, lengthCP, N_ID2, freqOffset)
**(rasterOffset, PSS-ID) (0, 0)
**(rasterOffset, PSS-ID) (0, 1)
**(rasterOffset, PSS-ID) (0, 2)
**(rasterOffset, PSS-ID) (1, 0)
**(rasterOffset, PSS-ID) (1, 1)
**(rasterOffset, PSS-ID) (1, 2)
**(rasterOffset, PSS-ID) (2, 0)
**(rasterOffset, PSS-ID) (2, 1)
**(rasterOffset, PSS-ID) (2, 2)
**(rasterOffset, PSS-ID) (3, 0)
**(rasterOffset, PSS-ID) (3, 1)
**(rasterOffset, PSS-ID) (3, 2)
**(rasterOffset, PSS-ID) (4, 0)
**(rasterOffset, PSS-ID) (4, 1)
**(rasterOffset, PSS-ID) (4, 2)
**(rasterOffset, PSS-ID) (5, 0)
**(rasterOffset, PSS-ID) (5, 1)
**(rasterOffset, PSS-ID) (5, 2)
**(rasterOffset, PSS-ID) (6, 0)
**(rasterOffset, PSS-ID) (6, 1)
**(rasterOffset, PSS-ID) (6, 2)
**(rasterOffset, PSS-ID) (7, 0)
**(rasterOffset, PSS-ID) (7, 1)
**(rasterOffset, PSS-ID) (7, 2)
**(rasterOffset, PSS-ID) (8, 0)
**(rasterOffset, PSS-ID) (8, 1)
**(rasterOffset, PSS-ID) (8, 2)
**(rasterOffset, PSS-ID) (9, 0)
**(rasterOffset, PSS-ID) (9, 1)
**(rasterOffset, PSS-ID) (9, 2)
**(rasterOffset, PSS-ID) (10, 0)
**(rasterOffset, PSS-ID) (10, 1)
**(rasterOffset, PSS-ID) (10, 2)
**(rasterOffset, PSS-ID) (11, 0)
**(rasterOffset, PSS-ID) (11, 1)
**(rasterOffset, PSS-ID) (11, 2)
**(rasterOffset, PSS-ID) (12, 0)
**(rasterOffset, PSS-ID) (12, 1)
**(rasterOffset, PSS-ID) (12, 2)
**(rasterOffset, PSS-ID) (13, 0)
**(rasterOffset, PSS-ID) (13, 1)
**(rasterOffset, PSS-ID) (13, 2)
**(rasterOffset, PSS-ID) (14, 0)
**(rasterOffset, PSS-ID) (14, 1)
**(rasterOffset, PSS-ID) (14, 2)
**(rasterOffset, PSS-ID) (15, 0)
**(rasterOffset, PSS-ID) (15, 1)
**(rasterOffset, PSS-ID) (15, 2)
## PSS Detection Plot
#################################################################
fig, ax = plt.subplots()

# single line
ax.plot(pssCorrelation)
ax.vlines(x = pssPeakIndices, ymin = 0*pssCorrelation[pssPeakIndices],
           ymax = pssCorrelation[pssPeakIndices], colors = 'purple', label = "PSS-Rx symbol Correlation")
ax.set_ylim([0,np.max(pssCorrelation)*1.1])
ax.legend()
ax.grid()
ax.set_xlabel("Time samples Indices")
ax.set_ylabel("Normalized Correlation Values")
ax.set_title("PSS and Recevied Correlation Plot")

plt.show()
#________________________________________________________________
Alternative text

Cell ID-2 is known but Frequency Offset is unknown:

method       = 'largestPeak'
detectorType = 'peakDetector'

timeSynch    = PSSDetection(method, detectorType)

numSamples   = 1024
timeIndex    = np.random.rand()*1024
rxSamples    = np.fft.ifft(np.exp(-1j*2*np.pi*timeIndex*np.arange(numSamples)/numSamples))
fftSize      = 256
lengthCP     = 12
N_ID2        = 0
freqOffset   = None
pssPeakIndices, pssCorrelation, N_ID2, freqOffset = timeSynch(rxSamples, fftSize, lengthCP, N_ID2, freqOffset)
**(rasterOffset, PSS-ID) (0, 0)
**(rasterOffset, PSS-ID) (1, 0)
**(rasterOffset, PSS-ID) (2, 0)
**(rasterOffset, PSS-ID) (3, 0)
**(rasterOffset, PSS-ID) (4, 0)
**(rasterOffset, PSS-ID) (5, 0)
**(rasterOffset, PSS-ID) (6, 0)
**(rasterOffset, PSS-ID) (7, 0)
**(rasterOffset, PSS-ID) (8, 0)
**(rasterOffset, PSS-ID) (9, 0)
**(rasterOffset, PSS-ID) (10, 0)
**(rasterOffset, PSS-ID) (11, 0)
**(rasterOffset, PSS-ID) (12, 0)
**(rasterOffset, PSS-ID) (13, 0)
**(rasterOffset, PSS-ID) (14, 0)
**(rasterOffset, PSS-ID) (15, 0)

Cell ID-2 is unknown but Frequency Offset is known:

method       = 'largestPeak'
detectorType = 'peakDetector'

timeSynch    = PSSDetection(method, detectorType)

numSamples   = 1024
timeIndex    = np.random.rand()*1024
rxSamples    = np.fft.ifft(np.exp(-1j*2*np.pi*timeIndex*np.arange(numSamples)/numSamples))
fftSize      = 256
lengthCP     = 12
N_ID2        = None
freqOffset   = 12
pssPeakIndices, pssCorrelation, N_ID2, freqOffset = timeSynch(rxSamples, fftSize, lengthCP, N_ID2, freqOffset)
**(rasterOffset, PSS-ID) (12, 0)
**(rasterOffset, PSS-ID) (12, 1)
**(rasterOffset, PSS-ID) (12, 2)

Both Cell ID-2 and Frequency Offset are known:

method       = 'largestPeak'
detectorType = 'peakDetector'

timeSynch    = PSSDetection(method, detectorType)

numSamples   = 1024
fftSize      = 256
lengthCP     = 12
N_ID2        = 0
freqOffset   = 1
timeIndex    = np.random.rand()*numSamples
rxSamples    = np.fft.ifft(np.exp(-1j*2*np.pi*timeIndex*np.arange(numSamples)/numSamples))

pssPeakIndices, pssCorrelation, N_ID2, freqOffset = timeSynch(rxSamples, fftSize, lengthCP, N_ID2, freqOffset)
**(rasterOffset, PSS-ID) (1, 0)

API Documentation

The details about the input-output interface of the PSSDetection modules is provided below.

class toolkit5G.ReceiverAlgorithms.PSSDetection(method='largestPeak', detectorType='peakDetector')[source]

This module detects the SSS Parameters physical cell ID-1 and physical cell ID-2 using the estimates of ssb Estimates. Current PSS detection is based on largest peak detection. More techniques will be included in future.

Parameters:
  • method (str) – Defines the method used for time synchronization. It can a value from the set \(\{\)“largestPeak” \(\}\). Default value is “largestPeak”.

  • detectorType (int) – Defines the method used for spike detection in time correlation. It can a value from the set \(\{\) “peakDetector”, “threshold” \(\}\). Default value is “peakDetector”.

Input:
  • rxSamples ((numSamples,), np.complex) – Received time domain samples. It must be a 1D NumPy array.

  • fftsize (int) – Defines the fftsize.

  • lengthCP (int) – Defines the length of cyclic prefix attached to PSS OFDM symbol.

  • nID2 (int) – Defines the physical cell ID-2.

  • freqOffset (int) – Defines the frequency offset parameters wrt to subcarrier-0 of the resource grid.

  • height (float) – Defines of the height of the peak/spike. Default value is = 0.025. For more details read height from find_peaks from scipy.signal.

  • prominence (float) – Defines of the prominence of the peak/spike. Default value is = 0.025. For more details read prominence from find_peaks from scipy.signal.

  • width=20 – Defines of the width of the peak/spike. Default value is 20. For more details read width from find_peaks from scipy.signal.

Output:
  • pssPeakIndices (int) – PSS OFDM symbol start Index.

  • pssCorrelation (float) – PSS Correlation Peak Value.

  • nID2 (int) – Estimates Physical Cell ID-2.

  • freqOffset (int) – Estimated Frequencey Offset wrt subcarrier-0 of resource grid.

Raises:
  • Exception – [Error-PSSDetection]: ‘rxSamples’ must be 1-dimensional NumPy array of complex numbers!

  • ValueError – [Error-PSSDetection]: ‘fftsize’ must is integer!

  • ValueError – [Error-PSSDetection]: ‘lengthCP’ must is integer!

  • Exception – [Error-PSSDetection]: PSS Detection ‘method’ can only be ‘largestPeak’!

  • Exception – [Error-PSSDetection]: ‘detectorType’ can only be ‘peakDetector’ or ‘threshold’!

  • ValueError – [Error-PSSDetection]: ‘freqOffset’ must is integer or integer array!

  • ValueError – [Error-PSSDetection]: ‘nID2’ must is integer or integer array!

  • ValueError – [Error-PSSDetection]: ‘height’ must is integer or integer array!

  • ValueError – [Error-PSSDetection]: ‘prominence’ must is integer or integer array!

  • ValueError – [Error-PSSDetection]: ‘width’ must is integer or integer array!