Wireless Channel Dataset Generation for Training the AI based Models

Wireless channel dataset generation and preprocessing involve the creation and preparation of datasets containing information about the wireless communication channel. Here’s an overview of the process:

  1. Dataset Generation:

    • Simulation (We are using this): One common approach is to use channel modeling and simulation software to generate synthetic datasets. This involves modeling various channel characteristics such as path loss, shadowing, multipath propagation, and fading effects.

    • Measurement: Real-world measurements can be collected using specialized hardware and equipment deployed in different environments. These measurements capture the characteristics of the wireless channel under various conditions and scenarios.

  2. Data Collection:

    • In simulation-based approaches, data is generated by simulating the propagation of electromagnetic waves through the environment and computing channel parameters such as signal strength, delay spread, and Doppler shift.

    • In measurement-based approaches, data is collected by measuring the received signal strength and other relevant parameters at multiple locations in the environment over time.

  3. Data Preprocessing:

    • Cleaning: The collected data may contain errors, outliers, or missing values that need to be identified and corrected. Cleaning involves removing or correcting these inconsistencies to ensure the quality of the dataset.

    • Normalization: Data normalization involves scaling the values of features to a standard range to ensure uniformity and comparability across different features.

    • Feature Extraction: Relevant features such as signal strength, delay spread, angle of arrival, and Doppler shift are extracted from the raw data. Feature extraction may involve signal processing techniques such as Fourier transforms, wavelet analysis, or machine learning algorithms.

    • Dimensionality Reduction: In some cases, datasets may contain a large number of features, leading to computational complexity and overfitting. Dimensionality reduction techniques such as Principal Component Analysis (PCA) or feature selection methods are applied to reduce the number of features while preserving the most relevant information.

Wireless channel dataset generation and preprocessing are crucial steps in the development of machine learning models, algorithms, and systems for wireless communication. A well-prepared dataset ensures the accuracy, reliability, and generalizability of the models and systems built upon it.

Import Python Libraries

Import Basic Python LIbraries

[1]:
# %matplotlib widgets
import matplotlib.pyplot as plt
import matplotlib as mpl

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

import numpy as np

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

Import 5G Toolkit Libraries

[2]:
from csiNet import CSINet

import sys
sys.path.append("../../")

from toolkit5G.PhysicalChannels.PDSCH import ComputeTransportBlockSize
from toolkit5G.PhysicalChannels       import PDSCHLowerPhy, PDSCHUpperPhy, PDSCHDecoderLowerPhy, PDSCHDecoderUpperPhy
from toolkit5G.ChannelModels          import AntennaArrays, SimulationLayout, ParameterGenerator, ChannelGenerator
from toolkit5G.Configurations         import PDSCHLowerPhyConfiguration, PDSCHUpperPhyConfiguration
from toolkit5G.ChannelProcessing      import AddNoise, ApplyChannel
from toolkit5G.SymbolMapping          import Mapper, Demapper

Simulation Parameters

[3]:
# Carrier Frequency
carrierFrequency = 3.6*10**9
delaySpread   = 100*(10**-9)
numBatches    = 10000       # Number of batches considered for simulation
scs           = 30*10**3  # Subcarrier Spacing for simulation
numBSs        = 1 # Number of BSs considered for simulation
# Number of UEs considered for simulation
numUEs        = numBatches # For now we are assuming that the numbatches are captured via numUEs
numRB         = 85 # Number of Resource mapping considered for simulation | # 1 RB = 12 subcarrier
slotNumber    = int(np.random.randint(0,2**(scs/15000)*10)) # Index of the slot considered for simulation
terrain       = "CDL-A" # Terrain
txAntStruture = np.array([1,1,32,1,1]) # Tx Antenna Structure
rxAntStruture = np.array([1,1,1,1,1]) # Tx Antenna Structure
Nfft          = 1024 # FFTSize

print("************ Simulation Parameters *************")
print()
print("     numBatches: "+str(numBatches))
print("          numRB: "+str(numRB))
print("       fft Size: "+str(Nfft))
print("         numBSs: "+str(numBSs))
print("         numUEs: "+str(numUEs))
print("            scs: "+str(scs))
print("     slotNumber: "+str(slotNumber))
print("        terrain: "+str(terrain))
print("Tx Ant Struture: "+str(txAntStruture))
print("Rx Ant Struture: "+str(rxAntStruture))
print()
print("********************************************")
************ Simulation Parameters *************

     numBatches: 10000
          numRB: 85
       fft Size: 1024
         numBSs: 1
         numUEs: 10000
            scs: 30000
     slotNumber: 9
        terrain: CDL-A
Tx Ant Struture: [ 1  1 32  1  1]
Rx Ant Struture: [1 1 1 1 1]

********************************************

Set Channel Parameters and Generate Common Parameters

[4]:
# Antenna Array at UE side
# assuming antenna element type to be "OMNI"
# with 2 panel and 2 single polarized antenna element per panel.
ueAntArray = AntennaArrays(antennaType = "OMNI",  centerFrequency = carrierFrequency,
                           arrayStructure  = rxAntStruture)
ueAntArray()

# # Radiation Pattern of Rx antenna element
# ueAntArray.displayAntennaRadiationPattern()


# Antenna Array at BS side
# assuming antenna element type to be "3GPP_38.901", a parabolic antenna
# with 4 panel and 4 single polarized antenna element per panel.
bsAntArray = AntennaArrays(antennaType = "3GPP_38.901", centerFrequency = carrierFrequency,
                           arrayStructure  = txAntStruture)
bsAntArray()

# # Radiation Pattern of Tx antenna element
# bsAntArray[0].displayAntennaRadiationPattern()

# Layout Parameters
isd                  = 200         # inter site distance
minDist              = 10          # min distance between each UE and BS
ueHt                 = 1.5         # UE height
bsHt                 = 25          # BS height
bslayoutType         = "Hexagonal" # BS layout type
ueDropType           = "Hexagonal" # UE drop type
htDist               = "equal"     # UE height distribution
ueDist               = "equal"     # UE Distribution per site
nSectorsPerSite      = 1           # number of sectors per site
maxNumFloors         = 1           # Max number of floors in an indoor object
minNumFloors         = 1           # Min number of floors in an indoor object
heightOfRoom         = 3           # height of room or ceiling in meters
indoorUEfract        = 0.5         # Fraction of UEs located indoor
lengthOfIndoorObject = 3           # length of indoor object typically having rectangular geometry
widthOfIndoorObject  = 3           # width of indoor object
# forceLOS             = True       # boolen flag if true forces every link to be in LOS state
forceLOS             = False       # boolen flag if true forces every link to be in LOS state

Nt        = bsAntArray.numAntennas # Number of BS Antennas
Nr        = ueAntArray.numAntennas

Generate the Wireless Channels Databases and Preprocess it before storage.

  1. Generate OFDM Wireless Channels.

  2. Preprocess the OFDM Channel

  3. Store the preprocessed wireless channels

Important: Make sure you have Databases directory/folder where datasets will be stored.

[ ]:
MonteCarloIterations = 10

numTaps       = 32
codewordSize  = 512

for mci in range(4,MonteCarloIterations):
    # simulation layout object
    simLayoutObj = SimulationLayout(numOfBS = numBSs,
                                    numOfUE = numUEs,
                                    heightOfBS = bsHt,
                                    heightOfUE = ueHt,
                                    ISD = isd,
                                    layoutType = bslayoutType,
                                    ueDropMethod = ueDropType,
                                    UEdistibution = ueDist,
                                    UEheightDistribution = htDist,
                                    numOfSectorsPerSite = nSectorsPerSite,
                                    ueRoute = None)

    simLayoutObj(terrain = terrain,
                 carrierFreq = carrierFrequency,
                 ueAntennaArray = ueAntArray,
                 bsAntennaArray = bsAntArray,
                 indoorUEfraction = indoorUEfract,
                 lengthOfIndoorObject = lengthOfIndoorObject,
                 widthOfIndoorObject = widthOfIndoorObject,
                 forceLOS = forceLOS)

    # displaying the topology of simulation layout
#     fig, ax = simLayoutObj.display2DTopology()

    paramGen = simLayoutObj.getParameterGenerator(delaySpread = delaySpread)

    # paramGen.displayClusters((0,0,0), rayIndex = 0)
    channel  = paramGen.getChannel()

    # Generate OFDM Channel
    Hf       = channel.ofdm(scs, Nfft, normalizeChannel = True)[0,0,0,...,0,:].transpose(0,2,1)

    # Preprocess the Frequency Domain channel
    csinet   = CSINet()
    model    = csinet(Nt, numTaps, codewordSize)
    Hprep    = csinet.preprocess(Hf)

    np.savez("Databases/PreprocessedChannel-dB-"+str(mci)+".npz",
             Hprep = Hprep, Nfft  = Nfft, Nt = Nt, codewordSize  = codewordSize, numTaps = numTaps,
             carrierFrequency = carrierFrequency, terrain = terrain, delaySpread = delaySpread,
             isd = isd, txAntStruture = txAntStruture, rxAntStruture = rxAntStruture)

    print("             Number of BSs: "+str(numBSs))
    print("          Shape of Channel: "+str(Hf.shape))
    print("*****************************************************")
    print()
             Number of BSs: 1
          Shape of Channel: (10000, 32, 1024)
*****************************************************

             Number of BSs: 1
          Shape of Channel: (10000, 32, 1024)
*****************************************************

             Number of BSs: 1
          Shape of Channel: (10000, 32, 1024)
*****************************************************

             Number of BSs: 1
          Shape of Channel: (10000, 32, 1024)
*****************************************************

Aggregate all the Datasets into a single Dataset

[ ]:
filename = "Databases/PreprocessedChannel-dB-"+str(0)+".npz"
db = np.load(filename)
Hp = db["Hprep"]
for mci in range(1,10):
    filename = "Databases/PreprocessedChannel-dB-"+str(mci)+".npz"
    db = np.load(filename)
    Hp = np.concatenate([Hp, db["Hprep"]], axis=0)

np.savez("Databases/PreprocessedChannel-dB.npz", Hp = Hp, Nfft  = 1024, Nt = 32)

Display Sparsity of Wireless Channels

[ ]:
numChannels = 10
numBatches  = Hp.shape[0]
idx         = np.random.choice(np.arange(numBatches), size=numChannels, replace = False)

fig, ax = plt.subplots(2,10, figsize = (17.5, 5))

print(idx)
for n in range(numChannels):
    ax[0,n].imshow(np.abs(Hp[idx[n],0])**2 + np.abs(Hp[idx[n],1])**2, cmap = "Greys", aspect = "auto")
#     ax[1,n].imshow(np.abs( Hrec[idx[n],0])**2 + np.abs( Hrec[idx[n],1])**2, cmap = "Greys", aspect = "auto")

plt.show()