5G-LENA nr-v3.3-120-gdac69c56
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
ns3::NrAmc Class Reference

Adaptive Modulation and Coding class for the NR module. More...

#include "nr-amc.h"

+ Inheritance diagram for ns3::NrAmc:
+ Collaboration diagram for ns3::NrAmc:

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.
 

Detailed Description

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.

Configuration

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.

Todo:
Pass NrAmc parameters through RRC, and don't pass pointers to AMC between GNB and UE

Config Paths

ns3::NrAmc is accessible through the following paths with Config::Set and Config::Connect:

Attributes

  • NumRefScPerRb: Number of Subcarriers carrying Reference Signals per RB
    • Set with class: ns3::UintegerValue
    • Underlying type: uint8_t 0:12
    • Initial value: 1
    • Flags: construct write read
  • AmcModel: AMC model used to assign CQI
    • Set with class: ns3::EnumValue<N3ns35NrAmc8AmcModelE>
    • Underlying type: ErrorModel|ShannonModel
    • Initial value: ErrorModel
    • Flags: construct write read
  • ErrorModelType: Type of the Error Model to use when AmcModel is set to ErrorModel. This parameter has to match the ErrorModelType in nr-spectrum-model,because they need to refer to same MCS tables and indexes
    • Set with class: ns3::TypeIdValue
    • Underlying type: TypeId
    • Initial value: ns3::NrLteMiErrorModel
    • Flags: construct write read

No TraceSources are defined for this type.
Size of this type is 128 bytes (on a 64-bit architecture).

Definition at line 36 of file nr-amc.h.

Member Enumeration Documentation

◆ AmcModel

Valid types of the model used to create a cqi feedback.

See also
CreateCqiFeedbackWbTdma
Enumerator
ShannonModel 

Shannon based model (very conservative)

ErrorModel 

Error Model version (can use different error models, see NrErrorModel)

Definition at line 78 of file nr-amc.h.

Constructor & Destructor Documentation

◆ NrAmc()

ns3::NrAmc::NrAmc ( )

NrAmc constructor.

Definition at line 25 of file nr-amc.cc.

◆ ~NrAmc()

ns3::NrAmc::~NrAmc ( )
override

~NrAmc deconstructor

Definition at line 30 of file nr-amc.cc.

Member Function Documentation

◆ CalculateTbSize()

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.

Parameters
mcsthe MCS of the transmission
rankthe MIMO rank
nprbThe number of physical resource blocks used in the transmission
Returns
the TBS in bytes

Definition at line 116 of file nr-amc.cc.

References GetMaxMcs(), GetPayloadSize(), and ns3::LenaErrorModel::GetTypeId().

Referenced by CreateCqiFeedbackWbTdma().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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.

Parameters
sinrthe sinr values
mcsWbThe calculated MCS
Returns
The calculated CQI

Definition at line 163 of file nr-amc.cc.

References CalculateTbSize(), ErrorModel, GetCqiFromSpectralEfficiency(), GetMaxMcs(), GetMcsFromSpectralEfficiency(), GetSpectralEfficiencyForSinr(), and ShannonModel.

+ Here is the call graph for this function:

◆ CreateSinrMatForSb()

NrSinrMatrix ns3::NrAmc::CreateSinrMatForSb ( const NrSinrMatrix avgSinrSb,
const NrSinrMatrix sinrMat 
) const

Create wide-band matrix based on average sinr of particular sub-band.

Parameters
avgSinrSbthe average sinr of sub-band
sinrMatthe MIMO SINR matrix (rank * nRbs)
Returns
the MIMO SINR matrix with the sub-band sinr value for whole matrix (rank * nRbs)

Definition at line 403 of file nr-amc.cc.

◆ ExtractSbFromMat()

NrSinrMatrix ns3::NrAmc::ExtractSbFromMat ( const uint8_t  sbIndex,
const size_t  subbandSize,
const NrSinrMatrix sinrMat 
) const

Extract sub-band sinr value from the sinrMatrix.

Parameters
sbIndexthe index of sub-band to calc the value
subbandSizethe size of each sub-band, used to create sub-band CQI values
sinrMatthe MIMO SINR matrix (rank * nRbs)

Definition at line 386 of file nr-amc.cc.

Referenced by GetSbMcs().

+ Here is the caller graph for this function:

◆ GetAmcModel()

NrAmc::AmcModel ns3::NrAmc::GetAmcModel ( ) const

Get the AMC model type.

Returns
the AMC model type

Definition at line 310 of file nr-amc.cc.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ GetCqiFromSpectralEfficiency()

uint8_t ns3::NrAmc::GetCqiFromSpectralEfficiency ( double  s) const

Get CQI from a SpectralEfficiency value.

Parameters
sspectral efficiency
Returns
the CQI (depends on the Error Model)

Definition at line 267 of file nr-amc.cc.

Referenced by CreateCqiFeedbackWbTdma().

+ Here is the caller graph for this function:

◆ GetErrorModelType()

TypeId ns3::NrAmc::GetErrorModelType ( ) const

Get the error model type.

Returns
the error model type

Definition at line 330 of file nr-amc.cc.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ GetMaxMcs()

uint32_t ns3::NrAmc::GetMaxMcs ( ) const

Get the maximum MCS (depends on the underlying error model)

Returns
the maximum MCS

Definition at line 296 of file nr-amc.cc.

Referenced by CalculateTbSize(), CreateCqiFeedbackWbTdma(), GetMcsFromCqi(), and GetMcsFromSpectralEfficiency().

+ Here is the caller graph for this function:

◆ GetMaxMcsParams()

NrAmc::McsParams ns3::NrAmc::GetMaxMcsParams ( const NrSinrMatrix sinrMat,
size_t  subbandSize 
) const

Find maximum MCS supported for this channel and obtain related parameters.

Parameters
sinrMatthe MIMO SINR matrix (rank * nRbs)
subbandSizethe size of each subband, used to create subband CQI values
Returns
a struct with the optimal MCS and corresponding CQI and TB size

Definition at line 352 of file nr-amc.cc.

References GetMcs(), and GetSbMcs().

+ Here is the call graph for this function:

◆ GetMcs()

uint8_t ns3::NrAmc::GetMcs ( const NrSinrMatrix sinrMat) const

Find MCS supported for this channel.

Parameters
sinrMatthe MIMO SINR matrix (rank * nRbs)
Returns
the MCS

Definition at line 418 of file nr-amc.cc.

References ErrorModel, and ShannonModel.

Referenced by GetMaxMcsParams(), and GetSbMcs().

+ Here is the caller graph for this function:

◆ GetMcsFromCqi()

uint8_t ns3::NrAmc::GetMcsFromCqi ( uint8_t  cqi) const

Get the MCS value from a CQI value.

Parameters
cqithe CQI
Returns
the MCS that corresponds to that CQI (it depends on the error model)

Definition at line 79 of file nr-amc.cc.

References GetMaxMcs().

+ Here is the call graph for this function:

◆ GetMcsFromSpectralEfficiency()

uint8_t ns3::NrAmc::GetMcsFromSpectralEfficiency ( double  s) const

Get MCS from a SpectralEfficiency value.

Parameters
sspectral efficiency
Returns
the MCS (depends on the Error Model)

Definition at line 281 of file nr-amc.cc.

References GetMaxMcs().

Referenced by CreateCqiFeedbackWbTdma(), and ns3::NrMacSchedulerUeInfo::GetDlMcs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetNumRefScPerRb()

uint8_t ns3::NrAmc::GetNumRefScPerRb ( ) const
Returns
The number of reference subcarriers per resource block

Definition at line 102 of file nr-amc.cc.

Referenced by GetPayloadSize(), and GetTypeId().

+ Here is the caller graph for this function:

◆ GetPayloadSize()

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.

Parameters
mcsMCS of the transmission
rankthe MIMO rank
nprbNumber of Physical Resource Blocks (not RBG)
Returns
the payload size in bytes

Definition at line 152 of file nr-amc.cc.

References GetNumRefScPerRb(), and ns3::NrSpectrumValueHelper::SUBCARRIERS_PER_RB.

Referenced by CalculateTbSize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSbMcs()

std::vector< uint8_t > ns3::NrAmc::GetSbMcs ( const size_t  subbandSize,
const NrSinrMatrix sinrMat 
) const

Find Sb MCS supported for this channel.

Parameters
subbandSizethe size of each subband, used to create subband CQI values
sinrMatthe MIMO SINR matrix (rank * nRbs)
Returns
the vector of MCS for subband

Definition at line 370 of file nr-amc.cc.

References ExtractSbFromMat(), and GetMcs().

Referenced by GetMaxMcsParams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSinrFromSpectralEfficiency()

double ns3::NrAmc::GetSinrFromSpectralEfficiency ( double  spectralEff) const

Compute SINR for a given spectral efficiency according to Shannon's capacity.

Parameters
spectralEffSpectral efficiency (bits/Hz)
Returns
the linear sinr

Definition at line 547 of file nr-amc.cc.

◆ GetSpectralEfficiencyForCqi()

double ns3::NrAmc::GetSpectralEfficiencyForCqi ( uint8_t  cqi) const
inline

Compute spectral efficient for a given CQI according to the error model.

Parameters
cqiCQI
Returns
the spectral efficiency

Definition at line 232 of file nr-amc.h.

◆ GetSpectralEfficiencyForSinr()

double ns3::NrAmc::GetSpectralEfficiencyForSinr ( double  sinr) const

Compute spectral efficient for a given SINR according to Shannon's capacity.

Parameters
sinrLinear SINR
Returns
the spectral efficiency

Definition at line 533 of file nr-amc.cc.

Referenced by CreateCqiFeedbackWbTdma().

+ Here is the caller graph for this function:

◆ GetTypeId()

TypeId ns3::NrAmc::GetTypeId ( )
static

GetTypeId.

Returns
the TypeId of the Object

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetAmcModel()

void ns3::NrAmc::SetAmcModel ( NrAmc::AmcModel  m)

Set the AMC model type.

Parameters
mthe AMC model

Definition at line 303 of file nr-amc.cc.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ SetDlMode()

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.

◆ SetErrorModelType()

void ns3::NrAmc::SetErrorModelType ( const TypeId &  type)

Set Error model type.

Parameters
typethe Error model type

Definition at line 317 of file nr-amc.cc.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ SetNumRefScPerRb()

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.

Parameters
nrefthe number of reference subcarriers

Definition at line 109 of file nr-amc.cc.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ SetUlMode()

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.

Member Data Documentation

◆ NR_AMC_NUM_SYMBOLS_DEFAULT

constexpr size_t ns3::NrAmc::NR_AMC_NUM_SYMBOLS_DEFAULT = 12
staticconstexpr

Num OFDM syms for TB size.

Definition at line 184 of file nr-amc.h.


The documentation for this class was generated from the following files: