Channel Generator
This module provides classes and functions that generate or compute cluster level complex valued channel coefficients including OFDM.
The class ChannelGenerator
allows the user to generate the channel.
A call to a method :method:`ofdm` generates OFDM channel after instantiating this class and creating an object.
- class toolkit5G.ChannelModels.ChannelGenerator(fc, terrain, txLocations, rxLocations, txVelocityVector, rxVelocityVector)[source]
CoefficientGenerator(fc, terrain, txLocations, rxLocations, txVelocityVector, rxVelocityVector)
A class to generate cluster level channel coefficients for all the links specified in the simulation.
- Parameters:
fc (int or float or NumPy.ndarray of int or float) – Carrier Frequency in GHz. Must be positive.
terrain (str or NumPy.ndarray of str.) – Propagation scenario/terrain. When passed as a numpy array it takes a shape of (3,). i.e., array of 3 terrain each correspond to BS-UE, UE-UE and BS-BS links respectively.
txLocations (NumPy.ndarray) – Specifies the locations of transmitter (tx). Typically Base Stations (BSs) in the downlink (DL). Must be a three dimensional numpy array of shape (numSnapShots,numBS,3), where numSnapShots correspond to number of SnapShots, numBS correspond to number of BSs respectively.
rxLocations (NumPy.ndarray) – Specifies the locations of receiver (rx). Typically User Equipments (UEs) in the downlink (DL). Must be a three dimensional numpy array of shape (numSnapShots,numUE,3), where numUE correspond to number of UEs respectively.
txVelocityVector (NumPy.ndarray) – Specifies the velocity of each tx node in simulation. It takes a shape of (numSnapShots, numBS, 3). Ref: Equation 7.5-25 of TR 38.901.
rxVelocityVector (NumPy.ndarray) – Specifies the velocity of each rx node in simulation. It takes a shape of (numSnapShots, numUE, 3). Ref: Equation 7.5-25 of TR 38.901.
- property fc
Carrier or Center Frequency at which each link is being operated in the simulation. Must be always a positive int or float
- ChannelGenerator.ofdm(subCarrierSpacing=15000, fftSize=128, carrierFrequency=None, normalizeChannel=False)[source]
Method to generate OFDM channel coefficients. For a given fft size and sub carrier spacing, this function returns ofdm channel coefficients in frequency domain.
- Parameters:
subCarrierSpacing (int or float) – Specifies the sub-carrier spacing being used in OFDM channel. Default value is 15*10**3 or 15 KHz.
fftSize (int) – Size of FFT/IFFT used to compute OFDM channel. Must be a positive int. Default value is 128.
carrierFrequency (np.ndarray of int or float) – Carrier Frequency in Hz. Must be an numpy array of int or float and defaults to None. When carrierFrequency is passed, it includes carrier phase while computing OFDM channel frequency response. Otherwise it ignores the passband carrier frequency phase.
normalizeChannel (bool) – A boolean flag to specify whether to normalize the power of each OFDM channel. It forces the average power of OFDM channel block (of size Nfft) accross subcarriers to 1 for link level simulations. Defaults to False.
- Returns:
A 7 dimensional tensor representing OFDM channel coefficients. Where numCarrierFreq correspond to number of carrier frequencies in simulation, numSnapShots correspond to number of SnapShots or the different time instants at which the channel coefficients are being computed, numBSs correspond to number of Base Stations (BSs), numUEs correspond to number of User Equipments (UEs), Nfft correspond to fftSize, numRxAnt correspond to number of Rx antenna elements, numTxAnt correspond to number of Tx antenna elements respectively.
- Return type:
[numCarrierFreq, numSnapShots, numBSs, numUEs, Nfft, numRxAnt, numTxAnt], np.complex64
Example:
# terrain or scenario for BS-UE links "UMa"
>>> terrain = np.array(["UMa","UMi","InH-OO"])
# links simulated at two carrier frequencies in Hz
>>> carrierFreq = np.array([3*10**9, 5*10**9])
>>> numCarriers = carrierFreq.shape[0]
# vector of Antenna Array objects at UE or Rx side at each carrier frequency and with an OMNI directional antenna element.
>>> ueAntennaArray = np.empty(numCarriers, dtype=object)
>>> for i in range(carrierFreq.size):
>>> ueAntennaArray[i] = AntennaArrays(antennaType = "OMNI",
... centerFrequency = carrierFreq[i],
... arrayStructure = np.array([1,1,1,1,1]),
... antennaSpacing = np.array([0.5,0.5,0.5,0.5]))
>>> ueAntennaArray[i]()
# vector of Antenna Array objects at BS or Tx side at each carrier frequency and with a 3GPP_38.901 parabolic antenna element.
>>> bsAntennaArray = np.empty(numCarriers, dtype=object)
>>> for i in range(carrierFreq.size):
>>> bsAntennaArray[i] = AntennaArrays(antennaType = "3GPP_38.901",
... centerFrequency = carrierFreq[i],
... arrayStructure = np.array([1,1,1,1,1]),
... antennaSpacing = np.array([0.5,0.5,0.5,0.5]))
>>> bsAntennaArray[i]()
# simulating BS Layout and UE drops by passing ueRoute, where ueRoute is an object of NodeMobility class.
# Here we assume that all the BSs are static and all the UEs are mobile.
# NodeMobility parameters
>>> nBSs = 19 # number of BSs
>>> nUEs = 100 # number of UEs
>>> nSnapShots = 2 # number of Snap-Shots
>>> timeInst = np.linspace(start = 0, stop = 10, num=nSnapShots, dtype=np.float32) # time values at each snapshot.
>>> UEroute = NodeMobility("randomWalk", nUEs, timeInst) # object of class NodeMobility
>>> UEroute()
# simulation layout object
>>> simLayoutObj = SimulationLayout(numOfBS = nBSs,
... numOfUE = nUEs,
... heightOfBS = 25,
... heightOfUE = 10,
... ISD = 500,
... layoutType = "Hexagonal",
... numOfSectorsPerSite = 3,
... minUEBSDistance = 35,
ueRoute = UEroute)
>>> simLayoutObj(terrain, carrierFreq, ueAntennaArray, bsAntennaArray)
# displaying the topology of simulation layout
>>> simLayoutObj.display2DTopology()
# velocity vector
>>> velocityVect = simLayoutObj.UEvelocityVector #(numSnapShots,numUE,3)
# Fetching channel parameters using simLayoutObj
# Returns an object of the class ParameterGenerator
>>> paramGenObj = simLayoutObj.getParameterGenerator()
# Channel Generation
>>> channel = paramGenObj.getChannel(applyPathLoss = True)
# OFDM Channel Generation
>>> Nfft = 1024
>>> Hf = channel.ofdm(30*10**3, Nfft, simLayoutObj.carrierFrequency)