5G-LENA nr-v3.3-159-ga6832aa7
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
nr-eesm-error-model.h
1// Copyright (c) 2018 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
2//
3// SPDX-License-Identifier: GPL-2.0-only
4
5#ifndef NR_EESM_ERROR_MODEL_H
6#define NR_EESM_ERROR_MODEL_H
7
8#include "nr-error-model.h"
9
10#include <map>
11
12namespace ns3
13{
14
15class NrL2smEesmTestCase;
16
25{
30
36 : NrErrorModelOutput(tbler)
37 {
38 }
39
40 double m_sinrExp{0.0};
41 double m_sinrEff{0.0};
42 SpectrumValue m_sinr;
43 std::vector<int> m_map;
44 uint32_t m_infoBits{0};
45 uint32_t m_codeBits{0};
46};
47
78{
79 public:
80 friend NrL2smEesmTestCase;
85 static TypeId GetTypeId();
86
94 ~NrEesmErrorModel() override;
95
109 Ptr<NrErrorModelOutput> GetTbDecodificationStats(
110 const SpectrumValue& sinr,
111 const std::vector<int>& map,
112 uint32_t size,
113 uint8_t mcs,
114 const NrErrorModelHistory& sinrHistory) override;
115
120 double GetSpectralEfficiencyForCqi(uint8_t cqi) override;
125 double GetSpectralEfficiencyForMcs(uint8_t mcs) const override;
137 uint32_t GetPayloadSize(uint32_t usefulSc,
138 uint8_t mcs,
139 uint8_t rank,
140 uint32_t rbNum,
141 Mode mode) const override;
148 uint32_t GetMaxCbSize(uint32_t tbSize, uint8_t mcs) const override;
152 uint8_t GetMaxMcs() const override;
153
154 typedef std::vector<double> DoubleVector;
155 typedef std::tuple<DoubleVector, DoubleVector> DoubleTuple;
156 typedef std::vector<std::vector<std::map<uint32_t, DoubleTuple>>> SimulatedBlerFromSINR;
157
158 protected:
164 std::string PrintMap(const std::vector<int>& map) const;
165
185 double SinrEff(const SpectrumValue& sinr,
186 const std::vector<int>& map,
187 uint8_t mcs,
188 double a,
189 double b) const;
190
200 double SinrExp(const SpectrumValue& sinr, const std::vector<int>& map, uint8_t mcs) const;
201
218 virtual double ComputeSINR(const SpectrumValue& sinr,
219 const std::vector<int>& map,
220 uint8_t mcs,
221 uint32_t sizeBit,
222 const NrErrorModel::NrErrorModelHistory& sinrHistory) const = 0;
223
233 virtual double GetMcsEq(uint8_t mcsTx) const = 0;
234
238 virtual const std::vector<double>* GetBetaTable() const = 0;
242 virtual const std::vector<double>* GetMcsEcrTable() const = 0;
246 virtual const SimulatedBlerFromSINR* GetSimulatedBlerFromSINR() const = 0;
250 virtual const std::vector<uint8_t>* GetMcsMTable() const = 0;
254 virtual const std::vector<double>* GetSpectralEfficiencyForMcs() const = 0;
258 virtual const std::vector<double>* GetSpectralEfficiencyForCqi() const = 0;
259
260 private:
261 static std::vector<std::string> m_bgTypeName;
262
272 double MappingSinrBler(double sinrEff, uint8_t mcs, uint32_t cbSize);
273
287 Ptr<NrErrorModelOutput> GetTbBitDecodificationStats(const SpectrumValue& sinr,
288 const std::vector<int>& map,
289 uint32_t size,
290 uint8_t mcs,
291 const NrErrorModelHistory& sinrHistory);
292
296 enum GraphType
297 {
298 FIRST = 0,
299 SECOND = 1
300 };
301
310 GraphType GetBaseGraphType(uint32_t tbSize, uint8_t mcs) const;
311
322 std::pair<uint32_t, uint32_t> CodeBlockSegmentation(uint32_t B, GraphType bg_type) const;
323
331 const std::vector<double>& GetSinrDbVectorFromSimulatedValues(GraphType graphType,
332 uint8_t mcs,
333 uint32_t cbSizeIndex) const;
341 const std::vector<double>& GetBLERVectorFromSimulatedValues(GraphType graphType,
342 uint8_t mcs,
343 uint32_t cbSizeIndex) const;
344};
345
346} // namespace ns3
347
348#endif /* NR_EESM_ERROR_MODEL_H */
Ptr< NrErrorModelOutput > GetTbDecodificationStats(const SpectrumValue &sinr, const std::vector< int > &map, uint32_t size, uint8_t mcs, const NrErrorModelHistory &sinrHistory) override
Get an output for the decodification error probability of a given transport block,...
virtual double GetMcsEq(uint8_t mcsTx) const =0
Get the "Equivalent MCS" after retransmission combining.
uint32_t GetMaxCbSize(uint32_t tbSize, uint8_t mcs) const override
Get the maximum code block size in Bytes, as per NR. It depends on the LDPC base graph type.
double SinrEff(const SpectrumValue &sinr, const std::vector< int > &map, uint8_t mcs, double a, double b) const
compute the effective SINR for the specified MCS and SINR, according to the EESM method.
uint32_t GetPayloadSize(uint32_t usefulSc, uint8_t mcs, uint8_t rank, uint32_t rbNum, Mode mode) const override
Get the payload size in Bytes, following the MCSs in NR. It follows TS 38.214 Section 5....
virtual const std::vector< double > * GetBetaTable() const =0
static TypeId GetTypeId()
GetTypeId.
virtual const std::vector< double > * GetSpectralEfficiencyForMcs() const =0
virtual const std::vector< uint8_t > * GetMcsMTable() const =0
double SinrExp(const SpectrumValue &sinr, const std::vector< int > &map, uint8_t mcs) const
compute the sum of exponential SINRs for the specified MCS and SINR, according to the EESM method,...
uint8_t GetMaxMcs() const override
Get the maximum MCS. It depends on NR tables being used.
virtual const std::vector< double > * GetMcsEcrTable() const =0
~NrEesmErrorModel() override
~NrEesmErrorModel
std::string PrintMap(const std::vector< int > &map) const
function to print the RB map
virtual double ComputeSINR(const SpectrumValue &sinr, const std::vector< int > &map, uint8_t mcs, uint32_t sizeBit, const NrErrorModel::NrErrorModelHistory &sinrHistory) const =0
Compute the effective SINR after retransmission combining.
virtual const SimulatedBlerFromSINR * GetSimulatedBlerFromSINR() const =0
virtual const std::vector< double > * GetSpectralEfficiencyForCqi() const =0
NrEesmErrorModel()
NrEesmErrorModel constructor.
Interface for calculating the error probability for a transport block.
std::vector< Ptr< NrErrorModelOutput > > NrErrorModelHistory
Vector of previous output.
Mode
Indicate the mode (UL or DL)
The NrEesmErrorModelOutput struct.
double m_sinrExp
Sum of exponential SINR (needed for HARQ-IR)
SpectrumValue m_sinr
perceived SINRs in the whole bandwidth
double m_sinrEff
The effective SINR (needed just for the test)
NrEesmErrorModelOutput()=delete
NrEesmErrorModelOutput constructor (deleted)
NrEesmErrorModelOutput(double tbler)
NrEesmErrorModelOutput constructor to use.
uint32_t m_infoBits
number of info bits
std::vector< int > m_map
map of the active RBs
uint32_t m_codeBits
number of code bits
Store the output of an NRErrorModel.