5#include "nr-error-model.h"
12NS_LOG_COMPONENT_DEFINE(
"NrErrorModel");
13NS_OBJECT_ENSURE_REGISTERED(NrErrorModel);
18 NS_LOG_FUNCTION(
this);
28 static TypeId tid = TypeId(
"ns3::NrErrorModel").SetParent<Object>();
32Ptr<NrErrorModelOutput>
34 const std::vector<int>& map,
40 NS_ASSERT_MSG(!sinrChunks.empty(),
"At least one SINR value is required");
44 NS_ASSERT(avgSinrMat.GetNumRows() == rank);
51 auto vectorizedSinr = avgSinrMat.GetVectorizedSpecVal();
62 NS_ASSERT(!sinrChunks.empty());
63 if (sinrChunks.size() == 1)
65 return sinrChunks[0].mimoSinr;
67 auto nRbs = sinrChunks[0].mimoSinr.GetNumCols();
68 auto rank = sinrChunks[0].mimoSinr.GetNumRows();
69 auto totDur =
double{0.0};
70 auto avgSinrMat = DoubleMatrixArray{rank, nRbs};
71 for (
const auto& chunk : sinrChunks)
73 const auto& sinrMat = chunk.mimoSinr;
74 NS_ASSERT(sinrMat.GetNumRows() == avgSinrMat.GetNumRows());
75 NS_ASSERT(sinrMat.GetNumCols() == avgSinrMat.GetNumCols());
76 avgSinrMat += sinrMat * chunk.dur.GetDouble();
77 totDur += chunk.dur.GetDouble();
85 auto vectorizedMap = std::vector<int>{};
88 for (
size_t layer = 0; layer < rank; layer++)
90 vectorizedMap.emplace_back(iRb * rank + layer);
virtual Ptr< NrErrorModelOutput > GetTbDecodificationStatsMimo(const std::vector< MimoSinrChunk > &mimoChunks, const std::vector< int > &map, uint32_t size, uint8_t mcs, uint8_t rank, const NrErrorModelHistory &history)
Get an output for the decoding error probability of a given transport block. This method is not purel...
std::vector< Ptr< NrErrorModelOutput > > NrErrorModelHistory
Vector of previous output.
std::vector< int > CreateVectorizedRbMap(std::vector< int > map, uint8_t rank)
Create an equivalent RB index map for vectorized SINR values Matches layer-to-codeword mapping in TR ...
NrErrorModel()
NrErrorModel default constructor.
static TypeId GetTypeId()
GetTypeId.
virtual Ptr< NrErrorModelOutput > GetTbDecodificationStats(const SpectrumValue &sinr, const std::vector< int > &map, uint32_t size, uint8_t mcs, const NrErrorModelHistory &history)=0
Get an output for the decodification error probability of a given transport block.
virtual NrSinrMatrix ComputeAvgSinrMimo(const std::vector< MimoSinrChunk > &sinrChunks)
Compute an average SINR matrix.
~NrErrorModel() override
deconstructor
NrSinrMatrix stores the MIMO SINR matrix, with dimension rank x nRbs.