GW-H5GSDR Logo
Edition-24a.2

Contents:

  • Course Overview
    • Course deliverables:
  • Pre-requisites
  • Getting Started with the Course
  • Course Contents
    • 1. Introduction to ADALM-Pluto SDR and its application programming interface
    • 2. Analysis of Wireless Channel Spectrum using Software Defined Radios
    • 3. Coarse Downlink Time Synchronization in 5G-Wireless Networks
    • 4. Implementation of OFDM in 5G networks
    • 5. Carrier Frequency Offset Estimation and Correction using PSS in 5G Networks
    • 6. Channel Estimation and Equalization for SSB/PBCH using PBCH-DMRS
    • 7. Implementation of PBCH Chain in 5G Networks
    • 8. PDCCH Implementation and Blind Decoding in 5G Networks
    • 9. Data Communication using PDSCH in 5G Networks
    • 10. MIMO-OFDM Systems in 5G Networks
    • 11. Important System Parameters and their effect on the 5G Networks Performance
  • Codes
    • Introduction to Software Defined Radios (SDRs) and Its Application Programming Interface
      • Import Python libraries
      • System Parameters
      • Set-up the SDR
      • Transmitting the data
      • Receiving the data
    • 2. Analysis of Wireless Channel Spectrum using ADALM-Pluto SDR
      • Wireless Spectrum Analysis based on Fast Fourier Transform techniques
        • 2. Import libraries
        • 2. System Parameters
        • 2. Setup SDRs
        • 2. Transmitter Side
          • 2. Generate Samples for transmission
          • 2. Transmit the samples
        • 2. Receiver Side
          • 2. Signal Acquisition: Receive the samples
        • 2. Spectrum Computation
          • 2. Compute the power spectral density
          • 2. Display the power spectral density
        • 2. Quasi realtime Spectrum Analysis
      • Transmitter-side: Wireless Spectrum Analysis based on Fast Fourier Transform techniques
        • 2.1 Import libraries
        • 2.1 System Parameters
        • 2.1 Setup SDRs
        • 2.1 Transmitter Side
          • 2.1 Generate Samples for transmission
          • 2.1 Transmit the samples
      • Receiver-side:Fast Fourier Transform based Spectrum Analysis
        • 2.2 Import libraries
        • 2.2 System Parameters
        • 2.2 Setup SDRs
        • 2.2 Receiver Side
          • 2.2 Signal Acquisition: Receive the samples
        • 2.2 Spectrum Computation
          • 2.2 Compute the power spectral density
          • 2.2 Display the power spectral density
        • 2.2 Quasi Real-time Spectrum Analysis
    • 3. Coarse Downlink Time/OFDM frame Synchronization in 5G-Wireless Networks
      • Downlink Time/Frame Synchronization using PSS in 5G Networks
        • 3. Import Libraries
          • 3. Import Some Basic Python Libraries
          • 3. Import 5G Libraries
        • 3. Emulation Parameters
        • 3. Generate SSB Parameters
        • Generate PSS
        • Generate SSS
        • Generate PBCH-DMRS
        • Generate PBCH Payload
        • Generate SSB
        • Load SSB into SSB resource Grid
        • 3. Construct Transmission Grid and Generate Time Domain Samples
        • OFDM Modulation
        • 3. SDR-Setup Configurations
        • 3. Transmission: SDR RF Transmitter
        • 3. Reception: SDR RF Receiver
        • 3. Time Synchronization: Based on PSS Correlation
        • 3. Frame Synchronization: Visualization
        • 3. Saving Running frames
      • BS Side Implementation-Downlink Time/Frame Synchronization using PSS in 5G Networks
        • 3.1 Import Libraries
          • 3.1 Import Some Basic Python Libraries
          • 3.1 Import 5G Libraries
        • 3.1 Emulation Parameters
        • 3.1 Generate SSB Parameters
        • 3.1 Construct Transmission Grid and Generate Time Domain Samples
        • 3.1 SDR-Setup Configurations
        • 3.1 Transmission: SDR RF Transmitter
      • UE Side Implementation-Downlink Time/Frame Synchronization using PSS in 5G Networks
        • 3.2 Import Libraries
          • 3.2 Import Some Basic Python Libraries
          • 3.2 Import 5G Libraries
        • 3.2 Emulation Parameters
        • 3.2 SDR-Setup Configurations
        • 3.2 Reception: SDR RF Receiver
        • 3.2 Time Frequency Configurations
        • 3.2 Time Synchronization: Based on PSS Correlation
        • 3.2 Frame Synchronization: Visualization
        • 3.2 Saving Running frames
    • 4. OFDM in 5G Networks
      • OFDM in 5G Networks
        • 4. Import Libraries
          • 4. Import Python and SDR Libraries
          • 4. Import 5G Toolkit Libraries
        • 4. Emulation Parameters
        • 4. Transmitter Implementation
        • 4. Generate the SSB Grid for synchronization
        • 4. PSS, SSS, PBCH, DMRS Generation
        • 4. SSB Generation
        • 4. Generate transmission Grid
        • 4. OFDM Modulation: Transmitted SSB
        • 4. SDR-Setup Configurations
        • 4. Transmission
        • 4. Reception
        • 4. Receive Samples from SDR
        • 4. Time Synchronization: Detection of PSS
        • 4. OFDM Demodulation: Receiver
        • 4. Quasi-realtime reception of OFDM Grid
      • Transmitter side implementation: OFDM in 5G Networks
        • 4.1 Import Libraries
          • 4.1 Import Python and SDR Libraries
          • 4.1 Import 5G Toolkit Libraries
        • 4.1 Emulation Parameters
        • 4.1 Transmitter Implementation
        • 4.1 Generate the SSB Grid for synchronization
        • 4.1 PSS, SSS, PBCH, DMRS Generation
        • 4.1 SSB Generation
        • 4.1 Generate transmission Grid
        • 4.1 OFDM Modulation: Transmitted SSB
        • 4.1 SDR-Setup Configurations
        • 4.1 Transmission
      • Receiver side implementation: OFDM in 5G Networks
        • 4.2 Import Libraries
          • 4.2 Import Python and SDR Libraries
          • 4.2 Import 5G Toolkit Libraries
        • 4.2 Emulation Parameters
        • 4.2 SDR-Setup Configurations
        • 4.2 Reception
        • 4.2 Receive Samples from SDR
        • 4.2 Time Synchronization: Detection of PSS
        • 4.2 OFDM Demodulation: Receiver
        • 4.2 Quasi-realtime reception of OFDM Grid
    • 5. Carrier frequency offset (CFO) Estimation and Correction in 5G networks
      • 5. Carrier frequency offset estimation and correction in 5G networks
        • 5. Import Libraries
          • 5. Import Python and SDR Libraries
        • 5. Toolkit Libraries
        • 5. Simulation Parameters
        • 5. PBCH Payload Generation: MIB + ATI
        • 5. PSS, SSS, PBCH, DMRS Generation
        • 5. Constellation Diagram: Base Station
        • 5. SSB Generation
        • 5. OFDM Implementation: Transmission of SSB
        • 5. SDR Setup
        • 5. Transmission of samples
        • 5. Receiver
          • 5. Receive Samples from SDR
        • 5. Time Synchronization: Coarse Tuning
        • 5. CFO Estimation
        • 5. OFDM Demodulation
        • 5. Extract SSB Grid
        • 5. PBCH Processing
        • 5. Constellation Diagram: User Equipment
        • 5. Error vector magnitude (EVM)
        • 5. Quasi-realtime: CFO Estimation and Reconstruction
      • 5.1 Base-station side: Carrier frequency offset (CFO) estimation and correction in 5G networks
        • 5.1 Import Libraries
          • 5.1 Import Python and SDR Libraries
        • 5.1 Toolkit Libraries
        • 5.1 Simulation Parameters
        • 5.1 PBCH Payload Generation: MIB + ATI
        • 5.1 PSS, SSS, PBCH, DMRS Generation
        • 5.1 Constellation Diagram: Base Station
        • 5.1 SSB Generation
        • 5.1 OFDM Implementation: Transmission of SSB
        • 5.1 SDR Setup
        • 5.1 Transmission of samples
      • 5. UE_Side: Carrier frequency offset (CFO) estimation and correction in 5G networks
        • 5.2 Import Libraries
          • 5.2 Import Python and SDR Libraries
        • 5.2 Toolkit Libraries
        • 5.2 Simulation Parameters
        • 5.2 TimeFrequency Parameters
        • 5.2 SDR Setup
        • 5.2 Receiver
          • 5.2 Receive Samples from SDR
        • 5.2 Time Synchronization: Coarse Tuning
        • 5.2 CFO Estimation
        • 5.2 OFDM Demodulation
        • 5.2 Extract SSB Grid
        • 5.2 PBCH Processing
        • 5.2 Constellation Diagram: User Equipment
        • 5.2 Error vector magnitude (EVM)
        • 5.2 Quasi-realtime: CFO Estimation and Reconstruction
    • 6. Channel Estimation and Equalization for SSB-PBCH using PBCH-DMRS
      • 6. Channel Estimation and Equalization for SSB-PBCH in 5G Networks
        • 6. Import Libraries
          • 6. Import Python and SDR Libraries
          • 6. Import 5G Toolkit Libraries
        • 6. Emulation Parameters
        • 6. PBCH Payload Generation: MIB + ATI
        • 6. PSS, SSS, PBCH, DMRS Generation
        • 6. Constellation Diagram: Base Station
        • 6. SSB Generation
        • 6. OFDM Implementation– Transmission of SSB.
        • 6. SDR Setup
        • 6. Transmission
        • 6. Receive Samples from SDR
        • 6. Time Synchronization: Coarse Tuning
        • 6. CFO Estimation
        • 6. OFDM Demodulation
        • 6. Extract SSB Grid
        • 6. SSS and DMRS Parameter Detection
        • 6. Channel Estimation and PBCH Symbol Equalization
        • 6. PBCH Decoding
        • 6. Constellation Diagram: UE
        • 6. Checking whether CRC is correct
        • 6. Quasi-realtime: CFO Estimation and Reconstruction
      • 6. BS-Side: Channel Estimation and Equalization for SSB-PBCH in 5G Networks
        • 6.1 Import Libraries
          • 6.1 Import Python and SDR Libraries
          • 6.1 Import 5G Toolkit Libraries
        • 6.1 Emulation Parameters
        • 6.1 PBCH Payload Generation: MIB + ATI
        • 6.1 PSS, SSS, PBCH, DMRS Generation
        • 6.1 Constellation Diagram: Base Station
        • 6.1 SSB Generation
        • 6.1 OFDM Implementation– Transmission of SSB.
        • 6.1 SDR Setup
        • 6.1 Transmission
      • 6. UE-Side: Channel Estimation and Equalization for SSB-PBCH in 5G Networks
        • 6.2 Import Libraries
          • 6.2 Import Python and SDR Libraries
          • 6.2 Import 5G Toolkit Libraries
        • 6.2 Emulation Parameters
        • 6.2 Time-frequency Parameter
        • 6.2 SDR Setup
        • 6.2 Receive Samples from SDR
        • 6.2 Time Synchronization: Coarse Tuning
        • 6.2 CFO Estimation
        • 6.2 OFDM Demodulation
        • 6.2 Extract SSB Grid
        • 6.2 SSS and DMRS Parameter Detection
        • 6.2 Channel Estimation and PBCH Symbol Equalization
        • 6.2 PBCH Decoding
        • 6.2 Constellation Diagram: UE
        • 6.2 Checking whether CRC is correct
        • 6.2 Quasi-realtime: CFO Estimation and Reconstruction
    • 7. PBCH and MIB in 5G Networks
      • 7. Physical Broadcast Channel in 5G Networks
        • 7. Import Libraries
          • 7. Import Python and SDR Libraries
          • 7. Import 5G Toolkit Libraries
          • 7. Import PBCH Components
        • 7. Emulation Configurations
        • 7. PBCH Payload Generation: MIB + ATI
        • 7. PSS, SSS, PBCH, DMRS Generation
        • 7. PBCH: Transmitter
        • 7. Constellation Diagram: Base Station
        • 7. SSB Generation
        • 7. OFDM Implementation
        • 7. SDR Setup
        • 7. Transmission
        • 7. Receive Samples from SDR
        • 7. Time Synchronization: Coarse Tuning
        • 7. CFO Estimation
        • 7. OFDM Demodulation
        • 7. Extract SSB Grid
        • 7. PBCH Processing
        • 7. Channel Estimation and PBCH Symbol Equalization
        • 7. PBCH Decoding
        • 7. PBCH Receiver: Components
        • 7. Constellation Diagram: UE
        • 7. Checking whether CRC is correct
        • 7. MIB and ATI Parameters at User Equioment
      • 7. Base-station side: Physical Broadcast Channel in 5G Networks
        • 7.1 Import Libraries
          • 7.1 Import Python and SDR Libraries
          • 7.1 Import 5G Toolkit Libraries
          • 7.1 Import PBCH Components
        • 7.1 Emulation Configurations
        • 7.1 PBCH Payload Generation: MIB + ATI
        • 7.1 PSS, SSS, PBCH, DMRS Generation
        • 7.1 PBCH: Transmitter
        • 7.1 Constellation Diagram: Base Station
        • 7.1 SSB Generation
        • 7.1 OFDM Implementation
        • 7.1 SDR Setup
        • 7.1 Transmission
        • MIB Information: Transmitted
      • 7. User equipment side: Physical Broadcast Channel in 5G Networks
        • 7.2 Import Libraries
          • 7.2 Import Python and SDR Libraries
          • 7.2 Import 5G Toolkit Libraries
          • 7.2 Import PBCH Components
        • 7.2 Emulation Configurations
        • 7.2 Time Frequency Parameters
        • 7.2 SDR Setup
        • 7.2 Receive Samples from SDR
        • 7.2 Time Synchronization: Coarse Tuning
        • 7.2 CFO Estimation
        • 7.2 OFDM Demodulation
        • 7.2 Extract SSB Grid
        • 7.2 PBCH Processing
        • 7.2 Channel Estimation and PBCH Symbol Equalization
        • 7.2 PBCH Decoding
        • 7.2 PBCH Receiver: Components
        • 7.2 Constellation Diagram: UE
        • 7.2 Checking whether CRC is correct
        • 7.2 MIB and ATI Parameters at User Equioment
    • 8. Blind Decoding of Physical Downlink Control Channel in 5G Networks
      • 8. Blind Decoding Of Physical Downlink Control Channel on Plutto-SDR
        • 8. Import Libraries
          • 8. Import Python and SDR Libraries
          • 8. Import 5G Toolkit Libraries
        • 8. Emulation Configurations
        • 8. Transmitter Implementation
        • 8. Generate the SSB Grid for synchronization
        • 8. CORESET and Search Space Set Parameters
        • 8. Display Grids
          • 8. PDCCH Grid
          • 8. SSB Grid
          • 8. SSB, PDCCH Merged Grid
        • 8. Constellation Diagram
        • 8. OFDM Modulation: Tx
        • 8. SDR-Setup Configurations
        • 8. Transmission: SDR RF Transmitter
        • 8. Receiver Implementation
        • 8. Reception: SDR RF Receiver
        • 8. Time Synchronization: Based on PSS Correlation
        • 8. OFDM Demodulation and SSB Extraction
        • 8. SSB Grid: Transmitter and Receiver
        • 8. Spectrum: Transmitted Grid and Received Grid
        • 8. Parameter Estimation for SSB and PBCH
        • 8. Channel Estimation and PBCH Symbol Equalization
        • 8. PBCH Decoding and Constellation
        • 8. Performance Verification
        • 8. Channel Estimation and Equalization of PDCCH
        • 8. Blind Decoding of PDCCH candidates
          • 8. Received Constellation
        • 8. Quasi real time animation
      • 8.1 Base station side: Blind Decoding Of Physical Downlink Control Channel on Plutto-SDR
        • 8.1 Import Libraries
          • 8.1 Import Python and SDR Libraries
          • 8.1 Import 5G Toolkit Libraries
        • 8.1 Emulation Configurations
        • 8.1 Transmitter Implementation
        • 8.1 Generate the SSB Grid for synchronization
          • 8.1 CORESET and Search Space Set Parameters
          • 8.1 Display Grids
        • 8.1 Constellation Diagram
        • 8.1 OFDM Modulation: Tx
        • 8.1 SDR-Setup Configurations
        • 8.1 Transmission: SDR RF Transmitter
      • 8.2 User-Equipment side: Blind Decoding Of Physical Downlink Control Channel on Plutto-SDR
        • 8.2 Import Libraries
          • 8.2 Import Python and SDR Libraries
          • 8.2 Import 5G Toolkit Libraries
        • 8.2 Emulation Configurations
        • 8.2 SDR-Setup Configurations
        • 8.2 Receiver Implementation
        • 8.2 Reception: SDR RF Receiver
        • 8.2 Time-Frequency Parameters
        • 8.2 Time Synchronization: Based on PSS Correlation
        • 8.2 CFO Estimation
        • 8.2 OFDM Demodulation and SSB Extraction
        • 8.2 Spectrum: Received Grid
        • 8.2 Parameter Estimation for SSB and PBCH
        • 8.2 Channel Estimation and PBCH Symbol Equalization
        • 8.2 PBCH Decoding and Constellation
        • 8.2 CORESET and Search Space Parameters
        • 8.2 Channel Estimation and Equalization of PDCCH
        • Blind Decoding
          • Blind Decoding of PDCCH candidates
          • 8.2 Received Constellation
        • 8.2 Quasi-real-time simulation
    • 9. Data Communication in 5G Networks using Physical Downlink Shared Channel
      • 9. Downlink Data Communication in 5G Networks
        • 9. Import Python Libraries
        • 9. 5G Toolkit Libraries
        • 9. Emulation Parameters
        • 9. PDSCH Transmitter Implementation
        • 9. Generate the PDSCH related parameters: Use PDSCH Configurations
        • 9. Generate the PDSCH Resource Grid
        • 9. SSB Transmitter Implementation
        • 9. Generate the SSB Resource Grid
        • 9. SDR-Setup Configurations
        • 9. Transmission: SDR RF Transmitter
        • 9. Receiver Implementation: SSB
        • 9. Reception: SDR RF Receiver
        • 9. Time Synchronization: Based on PSS Correlation
        • 9. PBCH Receiver
        • 9. SSB Grid: Transmitter and Receiver
        • 9. Spectrum: Transmitted Grid and Received Grid
        • 9. PBCH Decoding and Constellation
        • 9. Performance Verification
        • 9. PDSCH Receiver Implementation
          • 9. Extract PDSCH Resource Grid
          • 9. PDSCH Receiver
          • 9. Constellation Diagram
        • 9. Key Performance Indicators
        • Quasi-realtime simulation
      • 9. Base-station side: Downlink Data Communication in 5G Networks
        • 9.1. Import Python Libraries
        • 9.1. 5G Toolkit Libraries
        • 9.1. Emulation Parameters
        • 9.1. PDSCH Transmitter Implementation
        • 9.1. Generate the PDSCH related parameters: Use PDSCH Configurations
        • 9.1. Generate the PDSCH Resource Grid
        • 9.1. SSB Transmitter Implementation
        • 9.1. Generate the SSB Resource Grid
        • 9.1. SDR-Setup Configurations
        • 9.1. Transmission: SDR RF Transmitter
      • 9. UE Side: Downlink Data Communication in 5G Networks
        • 9.2. Import Python Libraries
        • 9.2. 5G Toolkit Libraries
        • 9.2. Emulation Parameters
        • Time-Frequency Parameters
        • 9.2. Generate the PDSCH related parameters: Use PDSCH Configurations
        • 9.2. SDR-Setup Configurations
        • 9.2. Receiver Implementation: SSB
        • 9.2. Reception: SDR RF Receiver
        • 9.2. Time Synchronization: Based on PSS Correlation
        • 9.2. PBCH Receiver
        • 9.2. SSB Grid: Transmitter and Receiver
        • 9.2. Spectrum: Transmitted Grid and Received Grid
        • 9.2. PBCH Decoding and Constellation
        • 9.2. PDSCH Receiver Implementation
          • 9.2. Extract PDSCH Resource Grid
          • 9.2. PDSCH Receiver
          • 9.2. Constellation Diagram
        • 9.2. Key Performance Indicators
        • 9.2. Quasi-realtime simulation
    • 10. MIMO-OFDM in 5G Networks
      • 10. MIMO-OFDM in Spatial Multiplexing Mode in 5G Networks
        • 10. Import Python Libraries
        • 10. 5G Toolkit Libraries
        • 10. Emulation Parameters
        • 10. PDSCH Transmitter Implementation
        • 10. Generate the PDSCH related parameters: Use PDSCH Configurations
        • 10. Generate the PDSCH Resource Grid
        • 10. SSB Transmitter Implementation
        • 10. Generate the SSB Resource Grid
        • 10. Precoding and Beamforming Architecture
        • 10. SDR-Setup Configurations
        • 10. Transmission: SDR RF Transmitter
          • 10. Precoding and Beamforming the OFDM signal
        • 10. Receiver Implementation: SSB
        • 10. Reception: SDR RF Receiver
        • 10. Time Synchronization: Based on PSS Correlation
        • 10. PBCH Receiver
        • 10. SSB Grid: Transmitter and Receiver
        • 10. Spectrum: Transmitted Grid and Received Grid
        • 10. PBCH Decoding and Constellation
        • 10. Performance Verification
        • 10. PDSCH Receiver Implementation
          • 10. Extract PDSCH Resource Grid
          • 10. PDSCH Receiver
          • 10. Constellation Diagram
        • 10. Key Performance Indicators
        • 10. Quasi-realtime simulation: MIMO in Spatial Multiplexing Mode
      • 10 MIMO-OFDM in Spatial Diversity Mode in 5G Networks
        • 10.1 Import Python Libraries
        • 10.1. 5G Toolkit Libraries
        • 10.1. Emulation Parameters
        • 10.1. PDSCH Transmitter Implementation
        • 10.1. Generate the PDSCH related parameters: Use PDSCH Configurations
        • 10.1. Generate the PDSCH Resource Grid
        • 10.1. SSB Transmitter Implementation
        • 10.1. Generate the SSB Resource Grid
        • 10.1 Precoding and Beamforming Architecture
        • 10.1. SDR-Setup Configurations
        • 10.1. Transmission: SDR RF Transmitter
          • 10.1 Precoding and Beamforming the OFDM signal
        • 10.1. Receiver Implementation: SSB
        • 10.1. Reception: SDR RF Receiver
        • 10.1. Time Synchronization: Based on PSS Correlation
        • 10.1. PBCH Receiver
        • 10.1. SSB Grid: Transmitter and Receiver
        • 10.1. Spectrum: Transmitted Grid and Received Grid
        • 10.1. PBCH Decoding and Constellation
        • 10.1. Performance Verification
        • 10.1. PDSCH Receiver Implementation
          • 10.1. Extract PDSCH Resource Grid
          • 10.1. PDSCH Receiver
          • 10.1. Constellation Diagram
        • 10.1. Key Performance Indicators
        • 10.1. Quasi-realtime simulation: MIMO in Spatial Diversity Mode
    • 11. Effect of System Parameters on the Performance of 5G Networks
      • 11.1 Effect of Bandwidth on 5G Networks Performance
        • 11.1. Import Python Libraries
        • 11.1. 5G Toolkit Libraries
        • 11.1. Emulation Parameters
          • 11.1. Initialization
        • 11.1. Time Frequency Parameters
        • 11.1. PDSCH Transmitter Implementation
        • 11.1. Generate the PDSCH related parameters: Use PDSCH Configurations
        • 11.1. Generate the PDSCH Resource Grid
        • 11.1. SSB Transmitter Implementation
        • 11.1. Generate the SSB Resource Grid
        • 11.1.Precoding and Beamforming Architecture
        • 11.1. SDR-Setup Configurations
        • 11.1. Transmission: SDR RF Transmitter
          • 11.1. Precoding and Beamforming the OFDM signal
        • 11.1. Receiver Implementation: SSB
        • 11.1. Reception: SDR RF Receiver
        • 11.1. Time Synchronization: Based on PSS Correlation
        • 11.1. PBCH Receiver
        • 11.1. SSB Grid: Transmitter and Receiver
        • 11.1. Spectrum: Transmitted Grid and Received Grid
        • 11.1. PBCH Decoding and Constellation
        • 11.1. Performance Verification
        • 11.1. PDSCH Receiver Implementation
          • 11.1. Extract PDSCH Resource Grid
          • 11.1. PDSCH Receiver
          • 11.1. Constellation Diagram
        • 11.1. Key Performance Indicators
        • 11.1. Bandwidth vs Network Throughput
      • 11.3 Effect of Modulation Order and Coding Rate (MCS) on 5G Networks Performance
        • 11.3. Import Python Libraries
        • 11.3. 5G Toolkit Libraries
        • 11.3. Emulation Parameters
          • 11.3. Initialization
        • 11.3. Time Frequency Parameters
        • 11.3. PDSCH Transmitter Implementation
        • 11.3. Generate the PDSCH related parameters: Use PDSCH Configurations
        • 11.3. Generate the PDSCH Resource Grid
        • 11.3. SSB Transmitter Implementation
        • 11.3. Generate the SSB Resource Grid
        • 11.3. SDR-Setup Configurations
        • 11.3. Receiver Implementation: SSB
        • 11.3. Reception: SDR RF Receiver
        • 11.3. Time Synchronization: Based on PSS Correlation
        • 11.3. PBCH Receiver
        • 11.3. SSB Grid: Transmitter and Receiver
        • 11.3. Spectrum: Transmitted Grid and Received Grid
        • 11.3. PBCH Decoding and Constellation
        • 11.3. Performance Verification
        • 11.3. PDSCH Receiver Implementation
          • 11.3. Extract PDSCH Resource Grid
          • 11.3. PDSCH Receiver
          • 11.3. Constellation Diagram
        • 11.3. Key Performance Indicators
        • 11.3. MCS Index (\(Q_m, r\)) vs Network Throughput
  • Upcoming versions of this Course
    • Edition-24a.3+ of GW-H5GSDR
    • Edition-24b of GW-H5GSDR
    • Edition-25a of GW-H5GSDR
    • 6G Features
  • Contributors to this course
  • Support Us
    • Cite this course
  • Downloads
  • Report your concerns
  • Back to 5G-Toolkit
GW-H5GSDR
  • Codes
  • 8. Blind Decoding of Physical Downlink Control Channel in 5G Networks
  • 8. Blind Decoding Of Physical Downlink Control Channel on Plutto-SDR

YouTube logo Watch on YouTube View on GitHub Download notebook

8. Blind Decoding Of Physical Downlink Control Channel on Plutto-SDR

The tutorial demonstrates the downlink synchronization using synchronization signal block (SSB) and PDCCH blind decoding in 5G networks. The SSB consists of 4 elements:

  • Primary Synchronization Signal (PSS)

  • Secondary Synchronization Signal (SSS)

  • Physical Broadacast Channel (PBCH) Payload: 432 symbols

  • Demodulation Reference Signal (DMRS) for PBCH

The PDCCH consists of 2 elements: - Define the PDCCH coreset and search space set parameters. - Aggregation level - frequency domain resources - duration - monitoring symbols with in a slot - search space set type - CCE to REG mapping - REG bundle size - Interleaver size - shift index

  • Decode the PDCCH candidates blindly based on the chosen parameters.

The tutorial performs following procedures:

  • Import Libraries

    • Import Python Libraries

    • Import 5G Toolkit Libraries

  • Emulation Configurations

  • Construct SSB

    • Generate PSS

    • Generate PSS

    • Generate PBCH

    • Generate DMRS-PBCH

    • Generate SSB

  • CORESET and Search Space Set

  • Display SSB and PDCCH Grid

    • PDCCH Grid

    • SSB Grid

    • Transmission Grid

  • Constellation Diagram

  • OFDM Modulation

    • Insert SSB to Tx Resource Grid

    • OFDM Modulation

  • SDR Configuration

  • Transmit using SDR RF Transmitter

  • Receive using SDR RF Receiver

    • Receiver Implementation

  • Time Synchronization

  • OFDM Receiver and SSB Grid Extraction

    • Tx-Rx SSB Grid Comparison

    • Tx-Rx Spectrum Comparison

  • Parameter Estimation

  • PBCH Estimates

    • Channel Estimation

    • Equalization

  • PBCH Decoding

    • MIB Decoding

    • ATI Decoding

  • BER Computation

  • PDCCH Estimation

  • PDCCH Blind Decoding

  • COnstellation of Received PDCCH symbols

  • Quasi-real-time-animation

8. Import Libraries

8. Import Python and SDR Libraries

[1]:
# %matplotlib widget

# from IPython.display import display, HTML
# display(HTML("<style>.container { width:90% !important; }</style>"))

import os
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'

import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.animation as animation

import numpy as np
import adi

8. Import 5G Toolkit Libraries

[2]:
import sys
sys.path.append(".")

from toolkit5G.SequenceGeneration import PSS, SSS, DMRS
from toolkit5G.PhysicalChannels   import PBCH, PBCHDecoder, PDCCH, PDCCHDecoder, PDCCHCandidateBlindDecoding
from toolkit5G.ResourceMapping    import SSB_Grid, ResourceMapperSSB, ResourceMappingPDCCH, CORESET, SearchSpaceSet
from toolkit5G.OFDM               import OFDMModulator, OFDMDemodulator
from toolkit5G.MIMOProcessing     import AnalogBeamforming, ReceiveCombining
from toolkit5G.ReceiverAlgorithms import PSSDetection, SSSDetection, ChannelEstimationAndEqualization, DMRSParameterDetection
from toolkit5G.ReceiverAlgorithms import ChannelEstimationAndEqualizationPBCH, ChannelEstimationAndEqualizationPDCCH
from toolkit5G.Configurations     import TimeFrequency5GParameters, GenerateValidSSBParameters

8. Emulation Configurations

[3]:
###################
# System Parameters
###################

center_frequency    = 2*1e9  # center or carrier frequency in Hz
numerology          = 0
slotNumber          = 0

# OFDM Parameters
Bandwidth           = 30*10**6
fftSize             = 2048
subcarrier_spacing  = 15000
numOFDMSymbols      = 14
sample_rate         = fftSize*subcarrier_spacing

# Pulse Shaping
numSamplesPerSymbol = 1


# number of samples returned per call to rx()
buffer_size         = int(fftSize*1.2*numSamplesPerSymbol*numOFDMSymbols)

8. Transmitter Implementation

8. Generate the SSB Grid for synchronization

[4]:
## This class fetches valid set of 5G parameters for the system configurations
nSymbolFrame= int(140*subcarrier_spacing/15000)
## This class fetches valid set of 5G parameters for the system configurations
tfParams    = TimeFrequency5GParameters(Bandwidth, subcarrier_spacing)
tfParams(nSymbolFrame, typeCP = "normal")
nRB         = tfParams.numRBs      # SSB Grid size (Number of RBs considered for SSB transition)
Neff        = tfParams.Neff        # Number of resource blocks for Resource Grid ( exclude gaurd band | offsets : BWP)
Nfft        = 512                  # FFT-size for OFDM
lengthCP    = tfParams.lengthCP    # CP length
#___________________________________________________________________

#### Generate MIB Information
lamda                           = 3e8/center_frequency;
nSCSOffset                      = 1
ssbParameters                   = GenerateValidSSBParameters(center_frequency, nSCSOffset, "caseA")

systemFrameNumber               = ssbParameters.systemFrameNumber
subCarrierSpacingCommon         = subcarrier_spacing
ssbSubCarrierOffset             = ssbParameters.ssbSubCarrierOffset
DMRSTypeAPosition               = ssbParameters.DMRSTypeAPosition
controlResourceSet0             = ssbParameters.controlResourceSet0
searchSpace0                    = ssbParameters.searchSpace0

isPairedBand                    = ssbParameters.isPairedBand
nSCSOffset                      = ssbParameters.nSCSOffset
choiceBit                       = ssbParameters.choiceBit
ssbType                         = ssbParameters.ssbType
nssbCandidatesInHrf             = ssbParameters.nssbCandidatesInHrf
ssbIndex                        = ssbParameters.ssbIndex
hrfBit                          = ssbParameters.hrfBit
cellBarred                      = ssbParameters.cellBarred
intraFrequencyReselection       = ssbParameters.intraFrequencyReselection
withSharedSpectrumChannelAccess = ssbParameters.withSharedSpectrumChannelAccess

Nsc_ssb                         = 240
Nsymb_ssb                       = 4
#_______________________________________


N_ID2        = np.random.randint(3)

# Generate PSS sequence
pssObject    = PSS(N_ID2);
pssSequence  = pssObject()

N_ID1        = np.random.randint(336)
N_ID         = 3*N_ID1 + N_ID2

# Generate SSS sequence
sssObject    = SSS(N_ID1, N_ID2);
sssSequence  = sssObject()

# Generate DMRS sequence
dmrsLen      = 144;
dmrsObject   = DMRS("PBCH", N_ID, ssbIndex, nssbCandidatesInHrf, hrfBit)
# dmrsSeq = dmrs.getSequence("tensorflow")
dmrsSequence = dmrsObject(dmrsLen)


# Generate PBCH symbols
pbchObject   = PBCH(center_frequency, choiceBit, subCarrierSpacingCommon, DMRSTypeAPosition,
                   controlResourceSet0, searchSpace0, cellBarred, intraFrequencyReselection,
                   systemFrameNumber, ssbSubCarrierOffset, hrfBit, ssbIndex, N_ID,
                   nssbCandidatesInHrf)

pbchSymbols  = pbchObject()

## Generate SSB Object
ssbObject    = SSB_Grid(N_ID, True)
ssb          = ssbObject(pssSequence, sssSequence, dmrsSequence, pbchSymbols)

## Loading SSB to Resource Grid
#####################################
# ssbPositionInBurst = np.ones(nssbCandidatesInHrf, dtype=int)
ssbPositionInBurst    = np.zeros(nssbCandidatesInHrf, dtype=int)
ssbPositionInBurst[0] = 1

ssbRGobject    = ResourceMapperSSB(ssbType=ssbType, carrierFrequency = center_frequency,
                                   isPairedBand = isPairedBand,
                                   withSharedSpectrumChannelAccess = withSharedSpectrumChannelAccess)

ssbGrid = ssbRGobject(ssb[0], ssbPositionInBurst, offsetInSubcarriers = ssbSubCarrierOffset[0],
                      offsetInRBs = 0, numRBs = nRB)[0:14]
fig, ax = ssbObject.displayGrid(option=1)

../../../../_images/api_Content_Codes_Tutorial-8%5BPDCCH%5D_8.Blind_Decoding_Of_Physical_Downlink_Control_Channel_on_Plutto-SDR_8_0.png
[5]:
ssbGrid.shape
[5]:
(14, 1920)

8. CORESET and Search Space Set Parameters

[6]:
AggLevel = 2

monitoringSymbolsWithinSlot = np.array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], dtype = int)
startSymIndex               = np.nonzero(monitoringSymbolsWithinSlot)[0][0]

coresetID       = 1
cce_reg_Mapping = "interleaved" # CCE to REG mapping type
L               = 6             # REG-bundle size
R               = 2             # Interleaver size
nshift          = 0             # cyclic-shift index after interleaving

duration        = 1             # duration of CORESET
frequencyDomainResources = np.array([1,1,1,1,1,1,1,1,0,
                                     0,0,0,0,0,0,0,0,0,
                                     0,0,0,0,0,0,0,0,0,
                                     0,0,0,0,0,0,0,0,0,
                                     0,0,0,0,0,0,0,0,0], dtype = int)

RNTI         = int(1 + np.random.randint(65518, dtype = int)) # radio network temporary indentifier

coresetObj = CORESET(duration,frequencyDomainResources)
coresetPRBIndices = coresetObj(cce_REG_MappingType = cce_reg_Mapping,
                               reg_BundleSize=L, interleaverSize = R, shiftIndex = nshift)
ssType                   = "USS"
AggLevel                 = 2                                 # Aggregation level
coresetSize              = coresetObj.numCCESInCoreset       # CORESET size in number of CCEs
numCandidatesPerAL       = np.array([2,4,0,0,0], dtype=int)  # number of pdcch candidates per Aggregation Level.
ssObj = SearchSpaceSet(numerology = numerology, searchSpaceType = ssType,
                       numCandidates = numCandidatesPerAL, coresetDuration = duration)

##############
# CCE indices
##############

M      = numCandidatesPerAL[int(np.log2(AggLevel))]
ueCand = ssObj(AggLevel,RNTI,coresetSize,slotNumber,coresetID)
ueCCEs = ueCand[np.random.randint(M)]



print("#####################################################################")
print("Duration of CORESET:", duration)
print()
print("Frequency Domain Resources:", frequencyDomainResources)
print()
print("CORESET size in CCEs:", coresetObj.numCCESInCoreset)
print()
print("Monitoring Symbols With in a Slot:", monitoringSymbolsWithinSlot)
print()
print("CORESET Start symbol index:", startSymIndex)
print()
print("#####################################################################")
print("Candidates Corresponding to UE with a chosen Aggregation Level of " + str(AggLevel) + ":\n", ueCand)
print()
print("CCEs chosen for UE:\n", ueCCEs)
#####################################################################
Duration of CORESET: 1

Frequency Domain Resources: [1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0]

CORESET size in CCEs: 8

Monitoring Symbols With in a Slot: [1 0 0 0 0 0 0 0 0 0 0 0 0 0]

CORESET Start symbol index: 0

#####################################################################
Candidates Corresponding to UE with a chosen Aggregation Level of 2:
 [[0 1]
 [2 3]
 [4 5]
 [6 7]]

CCEs chosen for UE:
 [0 1]
C:\Users\asnat\Downloads\May4\May4\toolkit5G\ResourceMapping\searchspaceset.py:506: RuntimeWarning: overflow encountered in long_scalars
  Y[p][nsf_mu] = (A[p]*Y[p][nsf_mu - 1])%D
[7]:
nBatches     = 1                   # number of batches
numPDCCHSym  = int(54*AggLevel)    # number of REs occupied by PDCCH data (QPSK symbols)
numPDCCHdmrs = int(18*AggLevel)    # number of REs occupied by PDCCH DMRS symbols
E            = numPDCCHSym*2       # number of target Bits
K            = 20                  # payload size in bits
dciBits      = np.random.randint(0, 2, [nBatches, K])

##############################################
# PDCCH chain and generation of  QPSK symbols
##############################################
pdcchObj = PDCCH(K, E, RNTI, N_ID)
symb     = pdcchObj(dciBits)

###################
# Resource Mappping
###################
rmPDCCH      = ResourceMappingPDCCH(numerology, frequencyDomainResources, duration, monitoringSymbolsWithinSlot)
pdcchGrid    = rmPDCCH(symb, cce_reg_Mapping, L, R, nshift, slotNumber, N_ID, ueCCEs)

[8]:
pdcchGrid.shape
[8]:
(1, 14, 3240)

8. Display Grids

8. PDCCH Grid

[9]:
fig, ax = plt.subplots()
colors  = ['palegreen', 'white', 'lightcoral', 'gold', 'midnightblue', 'purple']



# Grid  = pdcchGrid[0][...,0:ssbGrid.shape[-1]]
Grid  = pdcchGrid[0]
plt.imshow(np.abs(Grid).T, interpolation='none', aspect = "auto", cmap="hot", origin='lower')


ax.tick_params(axis='both',which='minor', grid_linewidth=  2, width=0)
ax.tick_params(axis='both',which='major', grid_linewidth=0.5, grid_linestyle = '--')
ax.grid(which='both')
ax.set_xlabel("Subcarrier-Index (k)")
ax.set_ylabel("OFDM Symbol Index (n)")

plt.show()
../../../../_images/api_Content_Codes_Tutorial-8%5BPDCCH%5D_8.Blind_Decoding_Of_Physical_Downlink_Control_Channel_on_Plutto-SDR_16_0.png

8. SSB Grid

[10]:
fig, ax = plt.subplots()
colors  = ['palegreen', 'white', 'lightcoral', 'gold', 'midnightblue', 'purple']
bounds  = [0,1,2,3,4,5,6]

plt.imshow(np.abs(ssbGrid.T), interpolation='none', aspect = "auto", cmap="hot", origin='lower')


ax.tick_params(axis='both',which='minor', grid_linewidth=  2, width=0)
ax.tick_params(axis='both',which='major', grid_linewidth=0.5, grid_linestyle = '--')
ax.grid(which='both')
ax.set_ylabel("Subcarrier-Index (k)")
ax.set_xlabel("OFDM Symbol Index (n)")

plt.show()
../../../../_images/api_Content_Codes_Tutorial-8%5BPDCCH%5D_8.Blind_Decoding_Of_Physical_Downlink_Control_Channel_on_Plutto-SDR_18_0.png

8. SSB, PDCCH Merged Grid

[11]:
resourceGrid = ssbGrid
resourceGrid = resourceGrid + np.sqrt(1/127)*pdcchGrid[0,:,0:Neff]  # make sure that the merged grids of SSB and PDCCH do not overlap.

[12]:
resourceGrid.shape
[12]:
(14, 1920)
[13]:
fig, ax = plt.subplots()
colors  = ['white', 'palegreen', 'lightcoral', 'gold', 'midnightblue', 'purple']
bounds  = [0,1,2,3,4,5,6]

plt.imshow(np.abs(resourceGrid.T), interpolation='none', aspect = "auto", cmap="hot", origin='lower')


ax.tick_params(axis='both',which='minor', grid_linewidth=  2, width=0)
ax.tick_params(axis='both',which='major', grid_linewidth=0.5, grid_linestyle = '--')
ax.grid(which='both')
ax.set_ylabel("Subcarrier-Index (k)")
ax.set_xlabel("OFDM Symbol Index (n)")

plt.show()
../../../../_images/api_Content_Codes_Tutorial-8%5BPDCCH%5D_8.Blind_Decoding_Of_Physical_Downlink_Control_Channel_on_Plutto-SDR_22_0.png

8. Constellation Diagram

[14]:
fig, ax = plt.subplots()
ax.scatter(np.real(pbchSymbols),  np.imag(pbchSymbols), s=48)
ax.axhline(y=0, ls=":", c="k")
ax.axvline(x=0, ls=":", c="k")
ax.set_xlim([-1,1])
ax.set_ylim([-1,1])
ax.set_xlabel("Real {x}")
ax.set_ylabel("Imag {x}")
ax.set_title("Constellation Diagram: QPSK")
ax.grid()
plt.show()
../../../../_images/api_Content_Codes_Tutorial-8%5BPDCCH%5D_8.Blind_Decoding_Of_Physical_Downlink_Control_Channel_on_Plutto-SDR_24_0.png

8. OFDM Modulation: Tx

[15]:
## Loading SSB to Resource Grid
numofGuardCarriers = (int((fftSize - Neff)/2), int((fftSize - Neff)/2))
offsetToPointA     = 0
firstSCIndex       = int(numofGuardCarriers[0] + offsetToPointA)
numOFDMSymbols     = ssbGrid.shape[0]

X = np.zeros((numOFDMSymbols, fftSize), dtype= np.complex64)
X2 = np.zeros((numOFDMSymbols, fftSize), dtype= np.complex64)
X[:, firstSCIndex:firstSCIndex+ssbGrid.shape[-1]] = resourceGrid
X = np.concatenate([X, X2], axis = 0)

#__________________________________________________

## OFDM Modulation at Transmitter
#####################################
modulator = OFDMModulator(lengthCP[1])
x_time    = modulator(X).flatten()
#______________________________________________________

# Plot Resource Grid
#################################################################
fig, ax = plt.subplots()
plt.imshow(np.abs(X), cmap = 'hot', interpolation='nearest', aspect = "auto")
ax = plt.gca();
ax.grid(color='c', linestyle='-', linewidth=1)
ax.set_xlabel("Subcarrier-Index (k)")
ax.set_ylabel("OFDM Symbol Index (n)")
ax.set_title("Heat map of Transmit Grid")
# Gridlines based on minor ticks
plt.show()
../../../../_images/api_Content_Codes_Tutorial-8%5BPDCCH%5D_8.Blind_Decoding_Of_Physical_Downlink_Control_Channel_on_Plutto-SDR_26_0.png

8. SDR-Setup Configurations

[16]:
# Basic SDR Setup
sdr = adi.Pluto("ip:192.168.3.1")
sdr.sample_rate = int(sample_rate)

# Config Tx
sdr.tx_rf_bandwidth = int(sample_rate) # filter cutoff, just set it to the same as sample rate
sdr.tx_lo           = int(center_frequency)
sdr.tx_hardwaregain_chan0 = -30 # Increase to increase tx power, valid range is -90 to 0 dB

# Config Rx
sdr.gain_control_mode_chan0 = 'slow_attack'
# sdr.rx_hardwaregain_chan0   = 40.0      # dB
# The receive gain on the Pluto has a range from 0 to 74.5 dB.

# sdr.gain_control_mode_chan0 = 'slow_attack'
# # AGC modes:
#     # 1. "manual"
#     # 2. "slow_attack"
#     # 3. "fast_attack"

sdr.rx_lo           = int(center_frequency)
sdr.rx_rf_bandwidth = int(60*10**6) # filter width, just set it to the same as sample rate for now
sdr.rx_buffer_size  = int(4*buffer_size)

8. Transmission: SDR RF Transmitter

[17]:
sdr.tx_destroy_buffer()
# Start the transmitter
sdr.tx_cyclic_buffer = True # Enable cyclic buffers
# sdr.tx_cyclic_buffer = False # Enable cyclic buffers
sdr.tx(1.3*2**17*(x_time.repeat(1))) # start transmitting

8. Receiver Implementation

8. Reception: SDR RF Receiver

[18]:

# Clear buffer just to be safe for i in range (0, 10): raw_data = sdr.rx() # Receive samples rx_samples = sdr.rx() # # Stop transmitting # sdr.tx_destroy_buffer()

8. Time Synchronization: Based on PSS Correlation

[19]:
## PSS Detection: Based on time domain PSS Correlation
# pssPeakIndices, pssCorrelation, rN_ID2 = pssDetection(r, Nfft, lengthCP = lengthCP[1],
#                                                       N_ID2 = None, freqOffset = ssboffset,
#                                                       height = 0.75, prominence = 0.65, width=10)
## PSS Detection: Based on time domain PSS Correlation
# pssDetection   = PSSDetection("correlation", "threshold")

pssDetection   = PSSDetection("largestPeak")
ssboffset      = int((fftSize-Neff)/2+ssbRGobject.startingSubcarrierIndices)
pssPeakIndices, pssCorrelation, rN_ID2, freqOffset = pssDetection(rx_samples, fftSize, lengthCP = lengthCP[1],
                                                                  nID2=None, freqOffset = ssboffset)

if(pssPeakIndices > rx_samples.size - 28*(fftSize + lengthCP[1])):
    pssPeakIndices = pssPeakIndices - 28*(fftSize + lengthCP[1])

## PSS Detection Plot
#################################################################
fig, ax  = plt.subplots(figsize=(12, 5))

# single line
ax.plot(pssCorrelation)
ax.vlines(x = pssPeakIndices, ymin = 0*pssCorrelation[pssPeakIndices],
           ymax = pssCorrelation[pssPeakIndices], colors = 'purple')
ax.set_ylim([0,np.max(pssCorrelation)*1.1])
ax.set_xlabel("Time Samples Index")
ax.set_ylabel("Amplitude of Time Domain Correlation")
ax.set_title("Amplitude (of Time Domain Correlation) vs Time-samples")
plt.show()
#________________________________________________________________
**(rasterOffset, PSS-ID) (74, 0)
**(rasterOffset, PSS-ID) (74, 1)
**(rasterOffset, PSS-ID) (74, 2)
../../../../_images/api_Content_Codes_Tutorial-8%5BPDCCH%5D_8.Blind_Decoding_Of_Physical_Downlink_Control_Channel_on_Plutto-SDR_34_1.png

8. OFDM Demodulation and SSB Extraction

[20]:
## OFDM Demodulator Object
ofdmDemodulator = OFDMDemodulator(fftSize, lengthCP[1])
pssStartIndex   = pssPeakIndices
# pssStartIndex   = pssPeakIndices[0][0]
rxGrid          = ofdmDemodulator((rx_samples.reshape(1,-1))[...,pssStartIndex:(pssStartIndex+4*(fftSize+lengthCP[1]))])

ssbSCSoffset   = int((fftSize-Neff)/2+ssbRGobject.startingSubcarrierIndices)
ssbEstimate    = rxGrid[:,:,ssbSCSoffset:(ssbSCSoffset+240)]

# Plot SSB
fig, ax = plt.subplots()
plt.imshow(np.abs(ssbEstimate[0]), cmap = 'hot', interpolation='nearest', aspect = "auto")
ax = plt.gca();
ax.grid(color='c', linestyle='-', linewidth=1)
ax.set_xlabel("Subcarrier-Index (k)")
ax.set_ylabel("Normalized Magnitude")
ax.set_title("Heat-map of Received and SSB Grid")
plt.show()

../../../../_images/api_Content_Codes_Tutorial-8%5BPDCCH%5D_8.Blind_Decoding_Of_Physical_Downlink_Control_Channel_on_Plutto-SDR_36_0.png

8. SSB Grid: Transmitter and Receiver

[21]:
# Plot SSB
fig, ax = plt.subplots(1,2, figsize=(12, 4))
ax[0].imshow(np.abs(ssbEstimate[0]), cmap = 'hot', interpolation='nearest', aspect = "auto")
ax[0].grid(color='c', linestyle='-', linewidth=1)
ax[0].set_xlabel("Subcarrier-Index (k)")
ax[0].set_ylabel("Normalized Magnitude")

ax[1].imshow(np.abs(ssb[0]), cmap = 'hot', interpolation='nearest', aspect = "auto")
ax[1].grid(color='c', linestyle='-', linewidth=1)
ax[1].set_xlabel("Subcarrier-Index (k)")
ax[1].set_ylabel("Normalized Magnitude")
plt.title("Heat-map of Received and Transmitted SSB Grid")

plt.show()
../../../../_images/api_Content_Codes_Tutorial-8%5BPDCCH%5D_8.Blind_Decoding_Of_Physical_Downlink_Control_Channel_on_Plutto-SDR_38_0.png

8. Spectrum: Transmitted Grid and Received Grid

[22]:
# Plot SSB
fig, ax = plt.subplots(figsize=(12.5, 4))
ax.plot(np.abs(rxGrid[0][0])/np.abs(rxGrid[0][0]).max())
ax.plot(np.abs(X[2])/np.abs(X[2]).max())
ax.grid(color='c', linestyle='-', linewidth=1)
ax.set_xlabel("Subcarrier-Index (k)")
ax.set_ylabel("Normalized Magnitude")
ax.set_title("Magnitude Spreactrum of Transmitted and Received $1^{st}$ SSB OFDM Symbol")
plt.show()
../../../../_images/api_Content_Codes_Tutorial-8%5BPDCCH%5D_8.Blind_Decoding_Of_Physical_Downlink_Control_Channel_on_Plutto-SDR_40_0.png

8. Parameter Estimation for SSB and PBCH

[23]:
## N_ID_1 Estimation: SSS based
sssDetection   = SSSDetection(method="channelAssisted", nID2=rN_ID2)
rN_ID1         = sssDetection(ssbEstimate[0])
rN_ID          = 3*rN_ID1 + rN_ID2

## Generate SSB object to get DMRS and PBCH Indices
rxSSBobject    = SSB_Grid(rN_ID)
rxDMRSIndices  = rxSSBobject.dmrsIndices

## Generate DMRS sequence
dmrsDetection  = DMRSParameterDetection(int(rN_ID), nssbCandidatesInHrf)
rssbIndex, rHrfBit = dmrsDetection(ssbEstimate[0])
rxDMRSobject   = DMRS("PBCH", int(rN_ID), int(rssbIndex), nssbCandidatesInHrf, rHrfBit)
rxDMRSseq      = rxDMRSobject(dmrsLen)

8. Channel Estimation and PBCH Symbol Equalization

[24]:
# ## Estimating the channel at DMRS (t-f) location, interpolting for data (t-f) location and equalizing the symbols
# ## Object for Channel Estimation
# chanEst        = ChannelEstimationAndEqualization(estimatorType = "ZF", interpolatorType = "NN")
# rxPBCHIndices  = rxSSBobject.pbchIndices
# pbchEstimate   = chanEst(ssbEstimate, rxDMRSseq, rxDMRSIndices, rxPBCHIndices, 10)

chanEst        = ChannelEstimationAndEqualizationPBCH(estimatorType = "ZF", interpolatorType = "Linear", isUEmobile=True)
pbchEstimate   = chanEst(ssbEstimate, rxDMRSseq, rN_ID)

8. PBCH Decoding and Constellation

[25]:
## PBCH Chain for Decoding information
polarDecoder   = "SCL"
symbolDemapper = "maxlog"
# extractMIBinfo = False
extractMIBinfo = True
# carrierFreq, cellID, nssbCandidatesInHrf, ssbIndex, polarDecType, symbolDemapperType
pbchDecoder    = PBCHDecoder(center_frequency, int(rN_ID), nssbCandidatesInHrf, rssbIndex, polarDecoder, symbolDemapper)
rxMIB, check   = pbchDecoder(pbchEstimate, 10, extractMIBinfo)


fig, ax = plt.subplots()
ax.set_aspect(True)
ax.scatter(np.real(pbchEstimate), np.imag(pbchEstimate), s = 12, label = "Equalized Symbols")
ax.scatter(np.real(pbchSymbols), np.imag(pbchSymbols), s = 12, label = "Transmitted Symbols")
ax.grid()
ax.axhline(y=0, ls=":", c="k", lw = 2)
ax.axvline(x=0, ls=":", c="k", lw = 2)
ax.set_xlim([-1.5,1.5])
ax.set_ylim([-1.5,1.5])
ax.set_xlabel("Real {x}")
ax.set_ylabel("Imag {x}")
ax.set_title("Constellation Diagram: QPSK")
ax.legend(loc = "best")
plt.show()
C:\Users\asnat\Downloads\May4\May4\toolkit5G\ChannelCoder\PolarCoder\polarDecoder.py:494: UserWarning: Required ressource allocation is large for the selected blocklength. Consider option `cpu_only=True`.
  warnings.warn("Required ressource allocation is large " \
../../../../_images/api_Content_Codes_Tutorial-8%5BPDCCH%5D_8.Blind_Decoding_Of_Physical_Downlink_Control_Channel_on_Plutto-SDR_46_1.png
[26]:
check
[26]:
array([[ True]])
[27]:
pbchDecoder.mibRx.displayParameters(0)
Carrier Frequency:      2000000000.0
ChoiceBit:              1
nSsbCandidatesInHrf:    4
subCarrierSpacingCommon:15000
DMRSTypeAPosition:      typeA
controlResourceSet0:    10
searchSpace0:           7
cellBarred:             barred
intraFreqReselection:   allowed
systemFrameNumber:      528
ssbSubCarrierOffset:    10
HRFBit:                 0
iSSBindex:              0
[28]:
pbchObject.mib.displayParameters(0)
Carrier Frequency:      2000000000.0
ChoiceBit:              1
nSsbCandidatesInHrf:    4
subCarrierSpacingCommon:15000
DMRSTypeAPosition:      typeA
controlResourceSet0:    10
searchSpace0:           7
cellBarred:             barred
intraFreqReselection:   allowed
systemFrameNumber:      528
ssbSubCarrierOffset:    10
HRFBit:                 0
iSSBindex:              0

8. Performance Verification

[29]:
if (rN_ID == N_ID):
    print("[Success]: Cell-IDs correctly detected!")
else:
    if (rN_ID1 != N_ID1 and rN_ID2 != N_ID2):
        print("[Failed]: Receiver couldn't detect the Cell-ID1 and cell-ID2 correctly!")
    elif(rN_ID1 != N_ID1):
        print("[Failed]: Receiver couldn't detect the Cell-ID1 correctly!")
    else:
        print("[Failed]: Receiver couldn't detect the cell-ID2 correctly!")

if (rssbIndex == ssbIndex[0]):
    print("[Success]: DMRS parameters correctly detected!")
else:
    print("[Failed]: Receiver couldn't detect the ssbIndex correctly!")

## Computing BER: Coded and Uncoded
numUEs = 1
nBatch = 1
uncodedBER     = np.zeros((numUEs, nBatch))
codedBER       = np.zeros((numUEs, nBatch))

bitEst         = pbchDecoder.llr.copy()
bitEst[pbchDecoder.llr  > 0]   = 1
bitEst[pbchDecoder.llr  < 0]   = 0
uncodedBER = np.mean(np.abs(bitEst - pbchObject.scr2bits[0]))
codedBER   = np.mean(np.abs(pbchDecoder.pbchDeInterleavedBits - pbchObject.mibSequence[0]))

print(" (uncoded-BER, codedBER): "+str((uncodedBER, codedBER)))
[Success]: Cell-IDs correctly detected!
[Success]: DMRS parameters correctly detected!
 (uncoded-BER, codedBER): (0.0, 0.0)
[30]:

ofdmDemodulator = OFDMDemodulator(fftSize, lengthCP[1]) startSampleIndex = pssPeakIndices - 2*(fftSize + lengthCP[1]) # pssStartIndex = pssPeakIndices[0][0] rxResGrid = ofdmDemodulator((rx_samples.reshape(1,-1))[...,startSampleIndex:(startSampleIndex+14*(fftSize+lengthCP[1]))]) rxGrid = rxResGrid[0,:,firstSCIndex:firstSCIndex+Neff]
[31]:
rxResGrid.shape
[31]:
(1, 14, 2048)
[32]:
# Plot Resource Grid
#################################################################
fig, ax = plt.subplots()
plt.imshow(np.abs(rxGrid), cmap = 'hot', interpolation='nearest', aspect = "auto")
ax = plt.gca();
ax.grid(color='c', linestyle='-', linewidth=1)
ax.set_xlabel("Subcarrier-Index (k)")
ax.set_ylabel("OFDM Symbol Index (n)")
ax.set_title("Heat map of Transmit Grid")
# Gridlines based on minor ticks
plt.show()
../../../../_images/api_Content_Codes_Tutorial-8%5BPDCCH%5D_8.Blind_Decoding_Of_Physical_Downlink_Control_Channel_on_Plutto-SDR_54_0.png

8. Channel Estimation and Equalization of PDCCH

[33]:
rxPDCCHGrid = np.zeros((14,270*12), dtype = np.complex64)
rxPDCCHGrid[:,0:Neff] = rxGrid
[34]:
##### Channel Estimation and Equalization #####
snr           = 10
channelEst    = ChannelEstimationAndEqualizationPDCCH(duration, frequencyDomainResources, monitoringSymbolsWithinSlot)
equalized_Sym = channelEst(rxPDCCHGrid[np.newaxis], cce_reg_Mapping, L, R, nshift,slotNumber, N_ID)
equalizedGrid = rxPDCCHGrid[np.newaxis]/channelEst.Hest

8. Blind Decoding of PDCCH candidates

[35]:
#########################
# Intiate Blind Decoding
#########################
bdObj  = PDCCHCandidateBlindDecoding(coresetPRBIndices, duration, startSymIndex, ssType, AggLevel ,ueCand)
bdObj(equalizedGrid, K, E, snr, RNTI,N_ID, decoderType="SC", demappingMethod="app")
print("##########################################################################")
print()
Warning: 5G Polar codes use an integrated CRC that cannot be materialized with SC decoding and, thus, causes a degraded performance. Please consider SCL decoding instead.
------------------------------------------------------------------------------------------
Checking the CRC:
 [[ True]]
Blind Decoding Successful for the CCE Indices [0 1]..!
##########################################################################

8. Received Constellation

[36]:
pdcchSymbols    = np.array([1+1j,1-1j,-1-1j,-1+1j])/np.sqrt(2)
## PBCH Chain for Decoding information

fig, ax = plt.subplots()
ax.set_aspect(True)
ax.scatter(np.real(bdObj.equalizedDataSym), np.imag(bdObj.equalizedDataSym), s = 12, label = "Equalized Symbols")
ax.scatter(np.real(pdcchSymbols), np.imag(pdcchSymbols), s = 12, label = "Transmitted Symbols")
ax.grid()
ax.axhline(y=0, ls=":", c="k", lw = 2)
ax.axvline(x=0, ls=":", c="k", lw = 2)
ax.set_xlim([-1.5,1.5])
ax.set_ylim([-1.5,1.5])
ax.set_xlabel("Real {x}")
ax.set_ylabel("Imag {x}")
ax.set_title("Constellation Diagram: QPSK")
ax.legend(loc = "best")
plt.show()
../../../../_images/api_Content_Codes_Tutorial-8%5BPDCCH%5D_8.Blind_Decoding_Of_Physical_Downlink_Control_Channel_on_Plutto-SDR_61_0.png

8. Quasi real time animation

[37]:
# function that draws each frame of the animation
qpskSymbols    = np.array([1+1j,1-1j,-1-1j,-1+1j])/np.sqrt(2)

def animate(i):
    # Receive samples
    rx_samples = sdr.rx()

    pssPeakIndices, pssCorrelation, rN_ID2, freqOffset = pssDetection(rx_samples, fftSize, lengthCP = lengthCP[1],
                                                                  nID2=None, freqOffset = ssboffset)

    if(pssPeakIndices < 3*(fftSize + lengthCP[1])):
        pssPeakIndices = pssPeakIndices + 14*(fftSize + lengthCP[1])
    elif(pssPeakIndices > rx_samples.size - 13*(fftSize + lengthCP[1])):
        pssPeakIndices = pssPeakIndices - 14*(fftSize + lengthCP[1])

    # # CFO estimation
    # obj    = CarrierFrequencyOffsetEstimation(fftSize,lengthCP[1])
    # cfoEst = obj(rx_samples[pssPeakIndices: pssPeakIndices + numSamples],numCFOIteration = 2)  # Computed CFO

    ## OFDM Demodulator Object
    ofdmDemodulator  = OFDMDemodulator(fftSize, lengthCP[1])
    startSampleIndex = pssPeakIndices - 2*(fftSize + lengthCP[1])
    # pssStartIndex   = pssPeakIndices[0][0]
    rxResGrid        = ofdmDemodulator((rx_samples.reshape(1,-1))[...,startSampleIndex:(startSampleIndex+14*(fftSize+lengthCP[1]))])
    rxGrid           = rxResGrid[0,:,firstSCIndex:firstSCIndex+Neff]

    rxPDCCHGrid = np.zeros((14,270*12), dtype = np.complex64)
    rxPDCCHGrid[:,0:Neff] = rxGrid

    ##### Channel Estimation and Equalization #####
    snr           = 10
    channelEst    = ChannelEstimationAndEqualizationPDCCH(duration, frequencyDomainResources, monitoringSymbolsWithinSlot)
    equalized_Sym = channelEst(rxPDCCHGrid[np.newaxis], cce_reg_Mapping, L, R, nshift,slotNumber, N_ID)
    equalizedGrid = rxPDCCHGrid[np.newaxis]/channelEst.Hest


    ## Blind Decoding
    bdObj  = PDCCHCandidateBlindDecoding(coresetPRBIndices, duration, startSymIndex,
                                          ssType, AggLevel ,ueCand, False)
    rdciBits = bdObj(equalizedGrid, K, E, snr, RNTI,N_ID, decoderType="SC", demappingMethod="app")

    ax.clear()
    ax.set_xlim([-1.5, 1.5])
    ax.set_ylim([-1.5, 1.5])
    ax.scatter(np.real(bdObj.equalizedDataSym), np.imag(bdObj.equalizedDataSym), s = 12, label = "Equalized Symbols")
    ax.scatter(np.real(qpskSymbols), np.imag(qpskSymbols), s = 12, label = "Transmitted Symbols")
    ax.grid()
    ax.axhline(y=0, ls=":", c="k")
    ax.axvline(x=0, ls=":", c="k")
    ax.set_xlabel("Real {x}")
    ax.set_ylabel("Imag {x}")
    ax.set_title("Constellation Diagram: QPSK")

# Plot SSB
fig, ax = plt.subplots()
ax.set_aspect(True)

scale = 100
#####################
# run the animation
#####################
# frames= 20 means 20 times the animation function is called.
# interval=500 means 500 milliseconds between each frame.
# repeat=False means that after all the frames are drawn, the animation will not repeat.
# Note: plt.show() line is always called after the FuncAnimation line.


anim = animation.FuncAnimation(fig, animate, frames=1000, interval=1, repeat=False, blit=True)
# saving to mp4 using ffmpeg writer
plt.show()

anim.save("PDCCH_Constellation.gif", fps = 10)

# writervideo = animation.FFMpegWriter(fps=60)
# anim.save('Overall.mp4', writer=writervideo)
PDCCH_Constellation
[ ]:

Previous Next

© Copyright 2024-2026, Gigayasa Wireless Private Limited.

Built with Sphinx using a theme provided by Read the Docs.