Channel and Noise Model (Detailed Documentation)¶
This page provides the complete documentation of the implemented channel and noise models.
Channel Model¶
- class ChannelModel(Nt: int, Nr: int, K: int)[source]¶
The Channel Model Abstract Base Class (ABC).
A channel model is responsible for generating the channel matrix according to a specific channel model and applying the channel effects to the transmitted signals.
- __init__(Nt: int, Nr: int, K: int)[source]¶
Instantiate the channel model.
- Parameters:
Nt (int) – The number of transmit antennas at the base station.
Nr (int) – The number of receive antennas per user terminal.
K (int) – The number of user terminals.
- abstractmethod generate() ndarray[tuple[Any, ...], dtype[complexfloating]][source]¶
Generate the channel matrix.
- Returns:
H – The generated channel matrix.
- Return type:
ComplexArray, shape (K*Nr, Nt)
- class NeutralChannelModel(Nt: int, Nr: int, K: int)[source]¶
Bases:
ChannelModelNeutral Channel Model.
This channel model acts as a ‘neutral element’ for the channel.In particular, it generates an identity channel matrix, which means that the symbols are transmitted to the receive antennas for which they are intended, and without any interference.
- class IIDRayleighFadingChannelModel(Nt: int, Nr: int, K: int)[source]¶
Bases:
ChannelModelIndependent and Identically Distributed (IID) Rayleigh Fading Channel Model.
This channel model generates a channel matrix with independent and identically distributed (IID) circularly-symmetric zero-mean unit-variance complex Gaussian entries.The Rayleigh fading aspect is captured by the fact that the channel coefficients change independently after M transmissions.
- class RiceanFadingChannelModel(Nt: int, Nr: int, K: int, K_rice: float, fD: float, num_channel_realizations: int = 2000, NLoS_method: str = 'Cholesky-decomposition method')[source]¶
Bases:
ChannelModelThe Ricean fading channel model.
The LoS component is modeled as a deterministic component independent of time and across users. The NLoS component follows Jake’s model.
\[H_k(t) = e^{j \theta_k} \left(\sqrt{\frac{K}{K+1}} + \sqrt{\frac{1}{K+1}} \mathbf{H}_{\text{NLoS},k}(t)\right)\]The parameters are:
\(K \in [0, +\infty)\): The Rice factor. It quantifies the strength of the deterministic LoS component relative to the scattered multipath.
\(\theta_k\): The arbitrary channel phase, uniformly distributed over $[-pi, pi]$ and independent across users $k$.
\(\mathbf{H}_{\text{NLoS},k}(t)\): The NLoS components. Each entry is an i.i.d. zero-mean unit-variance complex Gaussian process correlated in time. The PSD is:
\[S(f) = \frac{1}{\pi f_D \sqrt{1 - \left( \frac{f}{f_D} \right)^2}}, \quad |f| < f_D\]- __init__(Nt: int, Nr: int, K: int, K_rice: float, fD: float, num_channel_realizations: int = 2000, NLoS_method: str = 'Cholesky-decomposition method')[source]¶
Instantiate the channel model.
- Parameters:
Nt (int) – The number of transmit antennas at the base station.
Nr (int) – The number of receive antennas per user terminal.
K (int) – The number of user terminals.
K_rice (float) – The Rice factor. It quantifies the strength of the deterministic LoS component relative to the scattered multipath.
fD (float) – The maximum Doppler frequency (in Hertz).
NLoS_method (str) – The method to use for generating the NLoS component. Choose between: ‘Cholesky-decomposition method’, ‘spectral method’, ‘FIR filter method’.
- generate() ndarray[tuple[Any, ...], dtype[complexfloating]][source]¶
Generate the channel matrix.
- Returns:
H – The generated channel matrix.
- Return type:
ComplexArray, shape (K*Nr, Nt)
- _retrieve_NLoS(k: int, method: str) ndarray[tuple[Any, ...], dtype[complexfloating]][source]¶
Retrieve the current NLoS component for user k.
If this is the first time instant, generate the NLoS component for all time instants and all users using the specified method and store it in the state for later use. Then, retrieve the current NLoS component for user k.
- Parameters:
k (int) – The user terminal ID for which to retrieve the current NLoS component.
method (str) – The method to use for generating the NLoS component. Choose between: ‘Cholesky-decomposition method’, ‘spectral method’, ‘FIR filter method’.
- Returns:
H_NLoS_k – The current NLoS component for user k.
- Return type:
- _generate_NLoS(method: str) ndarray[tuple[Any, ...], dtype[complexfloating]][source]¶
Generate the NLoS component for all users and all time instants, using the specified method.
- Parameters:
method (str) – The method to use for generating the NLoS component. Choose between: ‘Cholesky-decomposition method’, ‘spectral method’, ‘FIR filter method’.
- Returns:
H_NLoS – The generated NLoS component of the channel, for all time instants.
- Return type:
ComplexArray, shape (K * Nr, Nt, num_channel_realizations)
- _generate_NLoS_cholesky() ndarray[tuple[Any, ...], dtype[complexfloating]][source]¶
Generate the NLoS component for user k using the Cholesky decomposition method for generating a Gaussian process with a specified auto-correlation function.
The Cholesky decomposition method for generating a zero-mean unit-variance complex Gaussian process \(\mathbf{h}\) of length \(N\) with a specified autocorrelation function \(R_h(\tau)\):
Step 1: Build the \(N \times N\) covariance matrix \(\mathbf{C}\) with entries \(C_{i,j} = R_h((i-j)T_s)\).
Step 2: Compute the Cholesky decomposition of the covariance matrix \(\mathbf{C} = \mathbf{L}\mathbf{L}^H\), where \(\mathbf{L}\) is a lower triangular matrix.
Step 3: Generate a column vector \(\mathbf{w}\) of \(N\) i.i.d. white complex Gaussian random variables with zero mean and unit variance.
Step 4: Find the desired Gaussian process as \(\mathbf{h} = \mathbf{L}\mathbf{w}\).
- _generate_NLoS_spectral() ndarray[tuple[Any, ...], dtype[complexfloating]][source]¶
Generate the NLoS component for all users using the spectral method for generating a Gaussian process with a specified power spectral density (PSD) function.
- _generate_NLoS_FIR_filter() ndarray[tuple[Any, ...], dtype[complexfloating]][source]¶
Generate the NLoS component for all users using the FIR filter method for generating a Gaussian process with a specified power spectral density (PSD) function.
- plot_autocorrelation(max_lag: int = 200, num_samples: int = 1, component: str = 'NLoS') None[source]¶
Plot the autocorrelation function of the generated channel gain process and compare it to the analytical expression.
The simulated autocorrelation is computed as the empirical autocorrelation, averaged over num_samples independent realizations of the NLoS process:
\[\hat{R}_h(k) = \frac{1}{M} \sum_{m=1}^{M} \cdot \frac{1}{N-k} \sum_{n=0}^{N-k-1} h_m[n+k] h_m^*[n], \quad k = 0, 1, \ldots, N-1\]The analytical autocorrelation equals the zero-order Bessel function of the first kind:
\[R_h(\tau) = J_0(2\pi f_D \tau)\]- Parameters:
max_lag (int) – The maximum lag (in samples) to compute the autocorrelation for.
num_samples (int) – The number of independent realizations of the NLoS process to average over. Default is 1. Should be smaller than or equal to K * Nr * Nt, because the average cannot be taken accross different simulations.
component (str) – The component of the channel to plot the autocorrelation for. Choose between: ‘LoS’, ‘NLoS’ and ‘LoS + NLoS’.
- Returns:
fig (matplotlib.figure.Figure) – The figure object containing the plot.
ax (matplotlib.axes.Axes) – The axes object containing the plot.
Notes
This function is intended to be used for validating the generated NLoS process! It will reset the channel model to ensure we start at time instant zero and that all pre-generated NLoS components are deleted. Then, it will generate num_samples sequences of the NLoS process using the specified method, and compute the averaged empirical autocorrelation for both positive and negative lags. Finally, it will compute the analytical autocorrelation and plot both the empirical and analytical autocorrelation functions.
- plot_NLoS_PSD(num_samples: int = 1) None[source]¶
Plot the power spectral density (PSD) of the generated NLoS process and compare it to the analytical expression.
The simulated PSD is calculated by averaging the periodograms of num_samples independent realizations (Bartlett’s method):
\[\hat{S}_h(f) = \frac{1}{M} \sum_{m=1}^{M} \frac{T_s}{N} \left| H_m(f) \right|^2\]where M is the number of realizations (num_samples).
The analytical PSD is given by Jake’s Doppler Spectrum:
\[S_h(f) = \frac{1}{\pi f_D \sqrt{1 - \left( \frac{f}{f_D} \right)^2}}, \quad |f| < f_D\]- Parameters:
num_samples (int) – The number of periodogram realizations to average over. Default is 1. Should be smaller than or equal to K * Nr * Nt, because the average cannot be taken across different simulations.
- Returns:
fig (matplotlib.figure.Figure) – The figure object containing the plot.
ax (matplotlib.axes.Axes) – The axes object containing the plot.
Notes
This function is intended to be used for validating the generated NLoS process! It will reset the channel model to ensure we start at time instant zero and that all pre-generated NLoS components are deleted. Then, it will generate num_samples sequences of the NLoS process using the specified method, compute the periodogram for each, and average them (Bartlett’s method). Finally, it will compute the analytical PSD and plot both the empirical and analytical PSDs.
Noise Model¶
- class NoiseModel(Nr: int, K: int)[source]¶
Noise Model Abstract Base Class (ABC).
A noise model is responsible for generating the noise vectors according to a specific noise model and applying the noise effects to the received signals.
- __init__(Nr: int, K: int)[source]¶
Instantiate the noise model.
- Parameters:
Nr (int) – The number of receive antennas per user terminal.
K (int) – The number of user terminals.
- abstractmethod generate(snr: float, x: ndarray[tuple[Any, ...], dtype[complexfloating]]) ndarray[tuple[Any, ...], dtype[complexfloating]][source]¶
Generate the noise vectors.
- class NeutralNoiseModel(Nr: int, K: int)[source]¶
Bases:
NoiseModelNeutral Noise Model.
This noise model acts as a ‘neutral element’ for noise.It does not add any noise to the received signals but simply lets the noiseless received signals pass through.
- class CSAWGNNoiseModel(Nr: int, K: int)[source]¶
Bases:
NoiseModelCircularly-Symmetric Additive White Gaussian Noise (CSAWGN) Model.
This noise model generates complex proper, circularly-symmetric additive white Gaussian noise (AWGN) vectors based on the specified signal-to-noise ratio (SNR).