![]() |
5G-LENA nr-v3.3-120-gdac69c56
The 5G/NR module for the ns-3 simulator
|
Adaptive Modulation and Coding class for the NR module. More...
#include "nr-amc.h"
Classes | |
struct | McsParams |
Parameters related to MCS selection. More... | |
Public Types | |
enum | AmcModel { ShannonModel , ErrorModel } |
Valid types of the model used to create a cqi feedback. More... | |
Public Member Functions | |
NrAmc () | |
NrAmc constructor. | |
~NrAmc () override | |
~NrAmc deconstructor | |
uint32_t | CalculateTbSize (uint8_t mcs, uint8_t rank, uint32_t nprb) const |
Calculate the TransportBlock size (in bytes) giving the MCS and the number of RB assigned. | |
uint8_t | CreateCqiFeedbackWbTdma (const SpectrumValue &sinr, uint8_t &mcsWb) const |
Create a CQI/MCS wideband feedback from a SINR values. | |
NrSinrMatrix | CreateSinrMatForSb (const NrSinrMatrix &avgSinrSb, const NrSinrMatrix &sinrMat) const |
Create wide-band matrix based on average sinr of particular sub-band. | |
NrSinrMatrix | ExtractSbFromMat (const uint8_t sbIndex, const size_t subbandSize, const NrSinrMatrix &sinrMat) const |
Extract sub-band sinr value from the sinrMatrix. | |
AmcModel | GetAmcModel () const |
Get the AMC model type. | |
uint8_t | GetCqiFromSpectralEfficiency (double s) const |
Get CQI from a SpectralEfficiency value. | |
TypeId | GetErrorModelType () const |
Get the error model type. | |
uint32_t | GetMaxMcs () const |
Get the maximum MCS (depends on the underlying error model) | |
McsParams | GetMaxMcsParams (const NrSinrMatrix &sinrMat, size_t subbandSize) const |
Find maximum MCS supported for this channel and obtain related parameters. | |
uint8_t | GetMcs (const NrSinrMatrix &sinrMat) const |
Find MCS supported for this channel. | |
uint8_t | GetMcsFromCqi (uint8_t cqi) const |
Get the MCS value from a CQI value. | |
uint8_t | GetMcsFromSpectralEfficiency (double s) const |
Get MCS from a SpectralEfficiency value. | |
uint8_t | GetNumRefScPerRb () const |
uint32_t | GetPayloadSize (uint8_t mcs, uint8_t rank, uint32_t nprb) const |
Calculate the Payload Size (in bytes) from MCS and the number of RB. | |
std::vector< uint8_t > | GetSbMcs (const size_t subbandSize, const NrSinrMatrix &sinrMat) const |
Find Sb MCS supported for this channel. | |
double | GetSinrFromSpectralEfficiency (double spectralEff) const |
Compute SINR for a given spectral efficiency according to Shannon's capacity. | |
double | GetSpectralEfficiencyForCqi (uint8_t cqi) const |
Compute spectral efficient for a given CQI according to the error model. | |
double | GetSpectralEfficiencyForSinr (double sinr) const |
Compute spectral efficient for a given SINR according to Shannon's capacity. | |
void | SetAmcModel (AmcModel m) |
Set the AMC model type. | |
void | SetDlMode () |
Set the object to be in "DL" mode. | |
void | SetErrorModelType (const TypeId &type) |
Set Error model type. | |
void | SetNumRefScPerRb (uint8_t nref) |
Set the the number of subcarriers carrying reference signals per resource block. | |
void | SetUlMode () |
Set the object to be in "UL" mode. | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
GetTypeId. | |
Static Public Attributes | |
static constexpr size_t | NR_AMC_NUM_SYMBOLS_DEFAULT = 12 |
Num OFDM syms for TB size. | |
Adaptive Modulation and Coding class for the NR module.
The class has two option to calculate the CQI feedback (which is the MCS to use in the future transmissions): the "ShannonModel" or the "ErrorModel" model, which uses the output of an error model to find the optimal MCS.
Please note that it is necessary, even when using the ShannonModel, to correctly configure the ErrorModel type, which must be the same as the one set in the NrSpectrumPhy class.
The attributes of this class can be configured through the helper methods NrHelper::SetGnbDlAmcAttribute() and NrHelper::SetGnbUlAmcAttribute() for what regards the GNB side (DL or UL). It is important to note that the UE gets a pointer to the GNB AMC to which is connected to.
ns3::NrAmc is accessible through the following paths with Config::Set and Config::Connect:
/NodeList/[i]/DeviceList/[i]/$ns3::NrGnbNetDevice/BandwidthPartMap/[i]/MacScheduler/$ns3::NrMacSchedulerNs3/DlAmc
/NodeList/[i]/DeviceList/[i]/$ns3::NrGnbNetDevice/BandwidthPartMap/[i]/MacScheduler/$ns3::NrMacSchedulerNs3/UlAmc
/NodeList/[i]/DeviceList/[i]/$ns3::NrNetDevice/$ns3::NrGnbNetDevice/BandwidthPartMap/[i]/MacScheduler/$ns3::NrMacSchedulerNs3/DlAmc
/NodeList/[i]/DeviceList/[i]/$ns3::NrNetDevice/$ns3::NrGnbNetDevice/BandwidthPartMap/[i]/MacScheduler/$ns3::NrMacSchedulerNs3/UlAmc
No TraceSources are defined for this type.
Size of this type is 128 bytes (on a 64-bit architecture).
enum ns3::NrAmc::AmcModel |
Valid types of the model used to create a cqi feedback.
Enumerator | |
---|---|
ShannonModel | Shannon based model (very conservative) |
ErrorModel | Error Model version (can use different error models, see NrErrorModel) |
uint32_t ns3::NrAmc::CalculateTbSize | ( | uint8_t | mcs, |
uint8_t | rank, | ||
uint32_t | nprb | ||
) | const |
Calculate the TransportBlock size (in bytes) giving the MCS and the number of RB assigned.
It depends on the error model and the "mode" configured with SetMode(). Please note that this function expects in input the RB, not the RBG of the transmission.
mcs | the MCS of the transmission |
rank | the MIMO rank |
nprb | The number of physical resource blocks used in the transmission |
Definition at line 116 of file nr-amc.cc.
References GetMaxMcs(), GetPayloadSize(), and ns3::LenaErrorModel::GetTypeId().
Referenced by CreateCqiFeedbackWbTdma().
uint8_t ns3::NrAmc::CreateCqiFeedbackWbTdma | ( | const SpectrumValue & | sinr, |
uint8_t & | mcsWb | ||
) | const |
Create a CQI/MCS wideband feedback from a SINR values.
For CQI creation, a CSI reference resource equal to all RBs in which the gNB/UE has transmitted power, and from which the SINR can be measured, during 1 OFDM symbol, is assumed.
sinr | the sinr values |
mcsWb | The calculated MCS |
Definition at line 163 of file nr-amc.cc.
References CalculateTbSize(), ErrorModel, GetCqiFromSpectralEfficiency(), GetMaxMcs(), GetMcsFromSpectralEfficiency(), GetSpectralEfficiencyForSinr(), and ShannonModel.
NrSinrMatrix ns3::NrAmc::CreateSinrMatForSb | ( | const NrSinrMatrix & | avgSinrSb, |
const NrSinrMatrix & | sinrMat | ||
) | const |
NrSinrMatrix ns3::NrAmc::ExtractSbFromMat | ( | const uint8_t | sbIndex, |
const size_t | subbandSize, | ||
const NrSinrMatrix & | sinrMat | ||
) | const |
Extract sub-band sinr value from the sinrMatrix.
sbIndex | the index of sub-band to calc the value |
subbandSize | the size of each sub-band, used to create sub-band CQI values |
sinrMat | the MIMO SINR matrix (rank * nRbs) |
Definition at line 386 of file nr-amc.cc.
Referenced by GetSbMcs().
NrAmc::AmcModel ns3::NrAmc::GetAmcModel | ( | ) | const |
Get the AMC model type.
Definition at line 310 of file nr-amc.cc.
Referenced by GetTypeId().
uint8_t ns3::NrAmc::GetCqiFromSpectralEfficiency | ( | double | s | ) | const |
Get CQI from a SpectralEfficiency value.
s | spectral efficiency |
Definition at line 267 of file nr-amc.cc.
Referenced by CreateCqiFeedbackWbTdma().
TypeId ns3::NrAmc::GetErrorModelType | ( | ) | const |
Get the error model type.
Definition at line 330 of file nr-amc.cc.
Referenced by GetTypeId().
uint32_t ns3::NrAmc::GetMaxMcs | ( | ) | const |
Get the maximum MCS (depends on the underlying error model)
Definition at line 296 of file nr-amc.cc.
Referenced by CalculateTbSize(), CreateCqiFeedbackWbTdma(), GetMcsFromCqi(), and GetMcsFromSpectralEfficiency().
NrAmc::McsParams ns3::NrAmc::GetMaxMcsParams | ( | const NrSinrMatrix & | sinrMat, |
size_t | subbandSize | ||
) | const |
Find maximum MCS supported for this channel and obtain related parameters.
sinrMat | the MIMO SINR matrix (rank * nRbs) |
subbandSize | the size of each subband, used to create subband CQI values |
Definition at line 352 of file nr-amc.cc.
References GetMcs(), and GetSbMcs().
uint8_t ns3::NrAmc::GetMcs | ( | const NrSinrMatrix & | sinrMat | ) | const |
Find MCS supported for this channel.
sinrMat | the MIMO SINR matrix (rank * nRbs) |
Definition at line 418 of file nr-amc.cc.
References ErrorModel, and ShannonModel.
Referenced by GetMaxMcsParams(), and GetSbMcs().
uint8_t ns3::NrAmc::GetMcsFromCqi | ( | uint8_t | cqi | ) | const |
Get the MCS value from a CQI value.
cqi | the CQI |
Definition at line 79 of file nr-amc.cc.
References GetMaxMcs().
uint8_t ns3::NrAmc::GetMcsFromSpectralEfficiency | ( | double | s | ) | const |
Get MCS from a SpectralEfficiency value.
s | spectral efficiency |
Definition at line 281 of file nr-amc.cc.
References GetMaxMcs().
Referenced by CreateCqiFeedbackWbTdma(), and ns3::NrMacSchedulerUeInfo::GetDlMcs().
uint8_t ns3::NrAmc::GetNumRefScPerRb | ( | ) | const |
Definition at line 102 of file nr-amc.cc.
Referenced by GetPayloadSize(), and GetTypeId().
uint32_t ns3::NrAmc::GetPayloadSize | ( | uint8_t | mcs, |
uint8_t | rank, | ||
uint32_t | nprb | ||
) | const |
Calculate the Payload Size (in bytes) from MCS and the number of RB.
mcs | MCS of the transmission |
rank | the MIMO rank |
nprb | Number of Physical Resource Blocks (not RBG) |
Definition at line 152 of file nr-amc.cc.
References GetNumRefScPerRb(), and ns3::NrSpectrumValueHelper::SUBCARRIERS_PER_RB.
Referenced by CalculateTbSize().
std::vector< uint8_t > ns3::NrAmc::GetSbMcs | ( | const size_t | subbandSize, |
const NrSinrMatrix & | sinrMat | ||
) | const |
Find Sb MCS supported for this channel.
subbandSize | the size of each subband, used to create subband CQI values |
sinrMat | the MIMO SINR matrix (rank * nRbs) |
Definition at line 370 of file nr-amc.cc.
References ExtractSbFromMat(), and GetMcs().
Referenced by GetMaxMcsParams().
double ns3::NrAmc::GetSinrFromSpectralEfficiency | ( | double | spectralEff | ) | const |
|
inline |
double ns3::NrAmc::GetSpectralEfficiencyForSinr | ( | double | sinr | ) | const |
Compute spectral efficient for a given SINR according to Shannon's capacity.
sinr | Linear SINR |
Definition at line 533 of file nr-amc.cc.
Referenced by CreateCqiFeedbackWbTdma().
|
static |
GetTypeId.
Definition at line 49 of file nr-amc.cc.
References ErrorModel, GetAmcModel(), GetErrorModelType(), GetNumRefScPerRb(), ns3::NrLteMiErrorModel::GetTypeId(), SetAmcModel(), SetErrorModelType(), SetNumRefScPerRb(), and ShannonModel.
Referenced by ns3::NrHelper::NrHelper().
void ns3::NrAmc::SetAmcModel | ( | NrAmc::AmcModel | m | ) |
Set the AMC model type.
m | the AMC model |
Definition at line 303 of file nr-amc.cc.
Referenced by GetTypeId().
void ns3::NrAmc::SetDlMode | ( | ) |
Set the object to be in "DL" mode.
In this mode, all the requests made to the underlying error model will be done keeping in consideration that the requests refers to DL transmissions.
Definition at line 35 of file nr-amc.cc.
References ns3::NrErrorModel::DL.
void ns3::NrAmc::SetErrorModelType | ( | const TypeId & | type | ) |
Set Error model type.
type | the Error model type |
Definition at line 317 of file nr-amc.cc.
Referenced by GetTypeId().
void ns3::NrAmc::SetNumRefScPerRb | ( | uint8_t | nref | ) |
Set the the number of subcarriers carrying reference signals per resource block.
By default it is fixed at 1. For LTE, it should be 4.
nref | the number of reference subcarriers |
Definition at line 109 of file nr-amc.cc.
Referenced by GetTypeId().
void ns3::NrAmc::SetUlMode | ( | ) |
Set the object to be in "UL" mode.
In this mode, all the requests made to the underlying error model will be done keeping in consideration that the requests refers to UL transmissions.
Definition at line 42 of file nr-amc.cc.
References ns3::NrErrorModel::UL.
|
staticconstexpr |