A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-amc.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Original Author: Giuseppe Piro <g.piro@poliba.it>
7 * Modified by: Marco Miozzo <mmiozzo@cttc.es>
8 * Nicola Baldo <nbaldo@cttc.es>
9 */
10
11#include "lte-amc.h"
12
13#include "lte-mi-error-model.h"
14
15#include "ns3/enum.h"
16#include <ns3/assert.h>
17#include <ns3/double.h>
18#include <ns3/log.h>
19#include <ns3/math.h>
20#include <ns3/spectrum-value.h>
21
22#include <vector>
23
24namespace ns3
25{
26
28
30
31/**
32 * Table of CQI index and its spectral efficiency. Taken from 3GPP TSG-RAN WG1
33 * [R1-081483 Conveying MCS and TB size via PDCCH]
34 * (http://www.3gpp.org/ftp/tsg_ran/WG1_RL1/TSGR1_52b/Docs/R1-081483.zip)
35 * file `TBS_support.xls` tab "MCS Table" (rounded to 2 decimal digits).
36 * The index of the vector (range 0-15) identifies the CQI value.
37 */
38static const double SpectralEfficiencyForCqi[16] = {
39 0.0, // out of range
40 0.15,
41 0.23,
42 0.38,
43 0.6,
44 0.88,
45 1.18,
46 1.48,
47 1.91,
48 2.41,
49 2.73,
50 3.32,
51 3.9,
52 4.52,
53 5.12,
54 5.55,
55};
56
57#if 0 // currently unused
58/**
59 * Table of MCS index (IMCS) and its TBS index (ITBS). Taken from 3GPP TS
60 * 36.213 v8.8.0 Table 7.1.7.1-1: _Modulation and TBS index table for PDSCH_.
61 * The index of the vector (range 0-31; valid values 0-28) identifies the MCS
62 * index. Note that this is similar to the one in R1-081483, but:
63 * - a few values are different; and
64 * - in R1-081483, a valid MCS index is in the range of 1-30 (not 0-28).
65 */
66static const int ModulationSchemeForMcs[32] = {
67 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
68 4, 4, 4, 4, 4, 4, 4,
69 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
70 2, // reserved
71 4, // reserved
72 6, // reserved
73};
74#endif
75
76/**
77 * Table of MCS index and its spectral efficiency. Taken from 3GPP TSG-RAN WG1
78 * [R1-081483 Conveying MCS and TB size via PDCCH]
79 * (http://www.3gpp.org/ftp/tsg_ran/WG1_RL1/TSGR1_52b/Docs/R1-081483.zip)
80 * file `TBS_support.xls` tab "MCS Table" (rounded to 2 decimal digits).
81 * The index of the vector (range 0-31) corresponds to the MCS index according
82 * to the convention in TS 36.213 (i.e., the MCS index reported in R1-081483
83 * minus one)
84 */
85static const double SpectralEfficiencyForMcs[32] = {
86 0.15, 0.19, 0.23, 0.31, 0.38, 0.49, 0.6, 0.74, 0.88, 1.03, 1.18, 1.33, 1.48, 1.7, 1.91, 2.16,
87 2.41, 2.57, 2.73, 3.03, 3.32, 3.61, 3.9, 4.21, 4.52, 4.82, 5.12, 5.33, 5.55, 0, 0, 0,
88};
89
90/**
91 * Table of MCS index (IMCS) and its TBS index (ITBS). Taken from 3GPP TS
92 * 36.213 v8.8.0 Table 7.1.7.1-1: _Modulation and TBS index table for PDSCH_.
93 * The index of the vector (range 0-28) identifies the MCS index.
94 */
95static const int McsToItbsDl[29] = {
96 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 10, 11, 12, 13,
97 14, 15, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
98};
99
100/**
101 * Table of MCS index (IMCS) and its TBS index (ITBS). Taken from 3GPP TS
102 * 36.213 v8.8.0 Table 8.6.1-1: _Modulation, TBS index and redundancy version table for PUSCH_.
103 * The index of the vector (range 0-28) identifies the MCS index.
104 */
105static const int McsToItbsUl[29] = {
106 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13,
107 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 23, 24, 25, 26,
108};
109
110/**
111 * Table of number of physical resource blocks (NPRB), TBS index (ITBS), and
112 * their associated transport block size. Taken from 3GPP TS 36.213 v8.8.0
113 * Table 7.1.7.2.1-1: _Transport block size table (dimension 27×110)_.
114 * \note For NPRB = 1 and ITBS = 6 the standard returns 328, but it is not
115 * consistent with the other values, therefore we use 88 obtained by
116 * following the sequence of NPRB = 1 values.
117 */
118static const int TransportBlockSizeTable[110][27] = {
119 /* NPRB 001*/ {16, 24, 32, 40, 56, 72, 88, 104, 120, 136, 144, 176, 208, 224,
120 256, 280, 328, 336, 376, 408, 440, 488, 520, 552, 584, 616, 712},
121 /* NPRB 002*/ {32, 56, 72, 104, 120, 144, 176, 224, 256, 296, 328, 376, 440, 488,
122 552, 600, 632, 696, 776, 840, 904, 1000, 1064, 1128, 1192, 1256, 1480},
123 /* NPRB 003*/ {56, 88, 144, 176, 208, 224, 256, 328, 392, 456, 504, 584, 680, 744,
124 840, 904, 968, 1064, 1160, 1288, 1384, 1480, 1608, 1736, 1800, 1864, 2216},
125 /* NPRB 004*/ {88, 144, 176, 208, 256, 328, 392, 472, 536,
126 616, 680, 776, 904, 1000, 1128, 1224, 1288, 1416,
127 1544, 1736, 1864, 1992, 2152, 2280, 2408, 2536, 2984},
128 /* NPRB 005*/ {120, 176, 208, 256, 328, 424, 504, 584, 680,
129 776, 872, 1000, 1128, 1256, 1416, 1544, 1608, 1800,
130 1992, 2152, 2344, 2472, 2664, 2856, 2984, 3112, 3752},
131 /* NPRB 006*/ {152, 208, 256, 328, 408, 504, 600, 712, 808,
132 936, 1032, 1192, 1352, 1544, 1736, 1800, 1928, 2152,
133 2344, 2600, 2792, 2984, 3240, 3496, 3624, 3752, 4392},
134 /* NPRB 007*/ {176, 224, 296, 392, 488, 600, 712, 840, 968,
135 1096, 1224, 1384, 1608, 1800, 1992, 2152, 2280, 2536,
136 2792, 2984, 3240, 3496, 3752, 4008, 4264, 4392, 5160},
137 /* NPRB 008*/ {208, 256, 328, 440, 552, 680, 808, 968, 1096,
138 1256, 1384, 1608, 1800, 2024, 2280, 2472, 2600, 2856,
139 3112, 3496, 3752, 4008, 4264, 4584, 4968, 5160, 5992},
140 /* NPRB 009*/ {224, 328, 376, 504, 632, 776, 936, 1096, 1256,
141 1416, 1544, 1800, 2024, 2280, 2600, 2728, 2984, 3240,
142 3624, 3880, 4136, 4584, 4776, 5160, 5544, 5736, 6712},
143 /* NPRB 010*/ {256, 344, 424, 568, 696, 872, 1032, 1224, 1384,
144 1544, 1736, 2024, 2280, 2536, 2856, 3112, 3240, 3624,
145 4008, 4264, 4584, 4968, 5352, 5736, 5992, 6200, 7480},
146 /* NPRB 011*/ {288, 376, 472, 616, 776, 968, 1128, 1320, 1544,
147 1736, 1928, 2216, 2472, 2856, 3112, 3368, 3624, 4008,
148 4392, 4776, 5160, 5544, 5992, 6200, 6712, 6968, 8248},
149 /* NPRB 012*/ {328, 424, 520, 680, 840, 1032, 1224, 1480, 1672,
150 1864, 2088, 2408, 2728, 3112, 3496, 3624, 3880, 4392,
151 4776, 5160, 5544, 5992, 6456, 6968, 7224, 7480, 8760},
152 /* NPRB 013*/ {344, 456, 568, 744, 904, 1128, 1352, 1608, 1800,
153 2024, 2280, 2600, 2984, 3368, 3752, 4008, 4264, 4776,
154 5160, 5544, 5992, 6456, 6968, 7480, 7992, 8248, 9528},
155 /* NPRB 014*/ {376, 488, 616, 808, 1000, 1224, 1480, 1672, 1928,
156 2216, 2472, 2792, 3240, 3624, 4008, 4264, 4584, 5160,
157 5544, 5992, 6456, 6968, 7480, 7992, 8504, 8760, 10296},
158 /* NPRB 015*/ {392, 520, 648, 872, 1064, 1320, 1544, 1800, 2088,
159 2344, 2664, 2984, 3368, 3880, 4264, 4584, 4968, 5352,
160 5992, 6456, 6968, 7480, 7992, 8504, 9144, 9528, 11064},
161 /* NPRB 016*/ {424, 568, 696, 904, 1128, 1384, 1672, 1928, 2216,
162 2536, 2792, 3240, 3624, 4136, 4584, 4968, 5160, 5736,
163 6200, 6968, 7480, 7992, 8504, 9144, 9912, 10296, 11832},
164 /* NPRB 017*/ {456, 600, 744, 968, 1192, 1480, 1736, 2088, 2344,
165 2664, 2984, 3496, 3880, 4392, 4968, 5160, 5544, 6200,
166 6712, 7224, 7992, 8504, 9144, 9912, 10296, 10680, 12576},
167 /* NPRB 018*/ {488, 632, 776, 1032, 1288, 1544, 1864, 2216, 2536,
168 2856, 3112, 3624, 4136, 4584, 5160, 5544, 5992, 6456,
169 7224, 7736, 8248, 9144, 9528, 10296, 11064, 11448, 13536},
170 /* NPRB 019*/ {504, 680, 840, 1096, 1352, 1672, 1992, 2344, 2664,
171 2984, 3368, 3880, 4392, 4968, 5544, 5736, 6200, 6712,
172 7480, 8248, 8760, 9528, 10296, 11064, 11448, 12216, 14112},
173 /* NPRB 020*/ {536, 712, 872, 1160, 1416, 1736, 2088, 2472, 2792,
174 3112, 3496, 4008, 4584, 5160, 5736, 6200, 6456, 7224,
175 7992, 8504, 9144, 9912, 10680, 11448, 12216, 12576, 14688},
176 /* NPRB 021*/ {568, 744, 936, 1224, 1480, 1864, 2216, 2536, 2984,
177 3368, 3752, 4264, 4776, 5352, 5992, 6456, 6712, 7480,
178 8248, 9144, 9912, 10680, 11448, 12216, 12960, 13536, 15264},
179 /* NPRB 022*/ {600, 776, 968, 1256, 1544, 1928, 2280, 2664, 3112,
180 3496, 3880, 4392, 4968, 5736, 6200, 6712, 7224, 7992,
181 8760, 9528, 10296, 11064, 11832, 12576, 13536, 14112, 16416},
182 /* NPRB 023*/ {616, 808, 1000, 1320, 1608, 2024, 2408, 2792, 3240,
183 3624, 4008, 4584, 5352, 5992, 6456, 6968, 7480, 8248,
184 9144, 9912, 10680, 11448, 12576, 12960, 14112, 14688, 16992},
185 /* NPRB 024*/ {648, 872, 1064, 1384, 1736, 2088, 2472, 2984, 3368,
186 3752, 4264, 4776, 5544, 6200, 6968, 7224, 7736, 8760,
187 9528, 10296, 11064, 12216, 12960, 13536, 14688, 15264, 17568},
188 /* NPRB 025*/ {680, 904, 1096, 1416, 1800, 2216, 2600, 3112, 3496,
189 4008, 4392, 4968, 5736, 6456, 7224, 7736, 7992, 9144,
190 9912, 10680, 11448, 12576, 13536, 14112, 15264, 15840, 18336},
191 /* NPRB 026*/ {712, 936, 1160, 1480, 1864, 2280, 2728, 3240, 3624,
192 4136, 4584, 5352, 5992, 6712, 7480, 7992, 8504, 9528,
193 10296, 11064, 12216, 12960, 14112, 14688, 15840, 16416, 19080},
194 /* NPRB 027*/ {744, 968, 1192, 1544, 1928, 2344, 2792, 3368, 3752,
195 4264, 4776, 5544, 6200, 6968, 7736, 8248, 8760, 9912,
196 10680, 11448, 12576, 13536, 14688, 15264, 16416, 16992, 19848},
197 /* NPRB 028*/ {776, 1000, 1256, 1608, 1992, 2472, 2984, 3368, 3880,
198 4392, 4968, 5736, 6456, 7224, 7992, 8504, 9144, 10296,
199 11064, 12216, 12960, 14112, 15264, 15840, 16992, 17568, 20616},
200 /* NPRB 029*/ {776, 1032, 1288, 1672, 2088, 2536, 2984, 3496, 4008,
201 4584, 5160, 5992, 6712, 7480, 8248, 8760, 9528, 10296,
202 11448, 12576, 13536, 14688, 15840, 16416, 17568, 18336, 21384},
203 /* NPRB 030*/ {808, 1064, 1320, 1736, 2152, 2664, 3112, 3624, 4264,
204 4776, 5352, 5992, 6712, 7736, 8504, 9144, 9912, 10680,
205 11832, 12960, 14112, 15264, 16416, 16992, 18336, 19080, 22152},
206 /* NPRB 031*/ {840, 1128, 1384, 1800, 2216, 2728, 3240, 3752, 4392,
207 4968, 5544, 6200, 6968, 7992, 8760, 9528, 9912, 11064,
208 12216, 13536, 14688, 15840, 16992, 17568, 19080, 19848, 22920},
209 /* NPRB 032*/ {872, 1160, 1416, 1864, 2280, 2792, 3368, 3880, 4584,
210 5160, 5736, 6456, 7224, 8248, 9144, 9912, 10296, 11448,
211 12576, 13536, 14688, 15840, 16992, 18336, 19848, 20616, 23688},
212 /* NPRB 033*/ {904, 1192, 1480, 1928, 2344, 2856, 3496, 4008, 4584,
213 5160, 5736, 6712, 7480, 8504, 9528, 10296, 10680, 11832,
214 12960, 14112, 15264, 16416, 17568, 19080, 19848, 20616, 24496},
215 /* NPRB 034*/ {936, 1224, 1544, 1992, 2408, 2984, 3496, 4136, 4776,
216 5352, 5992, 6968, 7736, 8760, 9912, 10296, 11064, 12216,
217 13536, 14688, 15840, 16992, 18336, 19848, 20616, 21384, 25456},
218 /* NPRB 035*/ {968, 1256, 1544, 2024, 2472, 3112, 3624, 4264, 4968,
219 5544, 6200, 6968, 7992, 9144, 9912, 10680, 11448, 12576,
220 14112, 15264, 16416, 17568, 19080, 19848, 21384, 22152, 25456},
221 /* NPRB 036*/ {1000, 1288, 1608, 2088, 2600, 3112, 3752, 4392, 4968,
222 5736, 6200, 7224, 8248, 9144, 10296, 11064, 11832, 12960,
223 14112, 15264, 16992, 18336, 19080, 20616, 22152, 22920, 26416},
224 /* NPRB 037*/ {1032, 1352, 1672, 2152, 2664, 3240, 3880, 4584, 5160,
225 5736, 6456, 7480, 8504, 9528, 10680, 11448, 12216, 13536,
226 14688, 15840, 16992, 18336, 19848, 21384, 22920, 23688, 27376},
227 /* NPRB 038*/ {1032, 1384, 1672, 2216, 2728, 3368, 4008, 4584, 5352,
228 5992, 6712, 7736, 8760, 9912, 11064, 11832, 12216, 13536,
229 15264, 16416, 17568, 19080, 20616, 22152, 22920, 24496, 28336},
230 /* NPRB 039*/ {1064, 1416, 1736, 2280, 2792, 3496, 4136, 4776, 5544,
231 6200, 6712, 7736, 8760, 9912, 11064, 11832, 12576, 14112,
232 15264, 16992, 18336, 19848, 21384, 22152, 23688, 24496, 29296},
233 /* NPRB 040*/ {1096, 1416, 1800, 2344, 2856, 3496, 4136, 4968, 5544,
234 6200, 6968, 7992, 9144, 10296, 11448, 12216, 12960, 14688,
235 15840, 16992, 18336, 19848, 21384, 22920, 24496, 25456, 29296},
236 /* NPRB 041*/ {1128, 1480, 1800, 2408, 2984, 3624, 4264, 4968, 5736,
237 6456, 7224, 8248, 9528, 10680, 11832, 12576, 13536, 14688,
238 16416, 17568, 19080, 20616, 22152, 23688, 25456, 26416, 30576},
239 /* NPRB 042*/ {1160, 1544, 1864, 2472, 2984, 3752, 4392, 5160, 5992,
240 6712, 7480, 8504, 9528, 10680, 12216, 12960, 13536, 15264,
241 16416, 18336, 19848, 21384, 22920, 24496, 25456, 26416, 30576},
242 /* NPRB 043*/ {1192, 1544, 1928, 2536, 3112, 3752, 4584, 5352, 5992,
243 6712, 7480, 8760, 9912, 11064, 12216, 12960, 14112, 15264,
244 16992, 18336, 19848, 21384, 22920, 24496, 26416, 27376, 31704},
245 /* NPRB 044*/ {1224, 1608, 1992, 2536, 3112, 3880, 4584, 5352, 6200,
246 6968, 7736, 8760, 9912, 11448, 12576, 13536, 14112, 15840,
247 17568, 19080, 20616, 22152, 23688, 25456, 26416, 28336, 32856},
248 /* NPRB 045*/ {1256, 1608, 2024, 2600, 3240, 4008, 4776, 5544, 6200,
249 6968, 7992, 9144, 10296, 11448, 12960, 13536, 14688, 16416,
250 17568, 19080, 20616, 22920, 24496, 25456, 27376, 28336, 32856},
251 /* NPRB 046*/ {1256, 1672, 2088, 2664, 3240, 4008, 4776, 5736, 6456,
252 7224, 7992, 9144, 10680, 11832, 12960, 14112, 14688, 16416,
253 18336, 19848, 21384, 22920, 24496, 26416, 28336, 29296, 34008},
254 /* NPRB 047*/ {1288, 1736, 2088, 2728, 3368, 4136, 4968, 5736, 6456,
255 7480, 8248, 9528, 10680, 12216, 13536, 14688, 15264, 16992,
256 18336, 20616, 22152, 23688, 25456, 27376, 28336, 29296, 35160},
257 /* NPRB 048*/ {1320, 1736, 2152, 2792, 3496, 4264, 4968, 5992, 6712,
258 7480, 8504, 9528, 11064, 12216, 13536, 14688, 15840, 17568,
259 19080, 20616, 22152, 24496, 25456, 27376, 29296, 30576, 35160},
260 /* NPRB 049*/ {1352, 1800, 2216, 2856, 3496, 4392, 5160, 5992, 6968,
261 7736, 8504, 9912, 11064, 12576, 14112, 15264, 15840, 17568,
262 19080, 21384, 22920, 24496, 26416, 28336, 29296, 31704, 36696},
263 /* NPRB 050*/ {1384, 1800, 2216, 2856, 3624, 4392, 5160, 6200, 6968,
264 7992, 8760, 9912, 11448, 12960, 14112, 15264, 16416, 18336,
265 19848, 21384, 22920, 25456, 27376, 28336, 30576, 31704, 36696},
266 /* NPRB 051*/ {1416, 1864, 2280, 2984, 3624, 4584, 5352, 6200, 7224,
267 7992, 9144, 10296, 11832, 12960, 14688, 15840, 16416, 18336,
268 19848, 22152, 23688, 25456, 27376, 29296, 31704, 32856, 37888},
269 /* NPRB 052*/ {1416, 1864, 2344, 2984, 3752, 4584, 5352, 6456, 7224,
270 8248, 9144, 10680, 11832, 13536, 14688, 15840, 16992, 19080,
271 20616, 22152, 24496, 26416, 28336, 29296, 31704, 32856, 37888},
272 /* NPRB 053*/ {1480, 1928, 2344, 3112, 3752, 4776, 5544, 6456, 7480,
273 8248, 9144, 10680, 12216, 13536, 15264, 16416, 16992, 19080,
274 21384, 22920, 24496, 26416, 28336, 30576, 32856, 34008, 39232},
275 /* NPRB 054*/ {1480, 1992, 2408, 3112, 3880, 4776, 5736, 6712, 7480,
276 8504, 9528, 11064, 12216, 14112, 15264, 16416, 17568, 19848,
277 21384, 22920, 25456, 27376, 29296, 30576, 32856, 34008, 40576},
278 /* NPRB 055*/ {1544, 1992, 2472, 3240, 4008, 4776, 5736, 6712, 7736,
279 8760, 9528, 11064, 12576, 14112, 15840, 16992, 17568, 19848,
280 22152, 23688, 25456, 27376, 29296, 31704, 34008, 35160, 40576},
281 /* NPRB 056*/ {1544, 2024, 2536, 3240, 4008, 4968, 5992, 6712, 7736,
282 8760, 9912, 11448, 12576, 14688, 15840, 16992, 18336, 20616,
283 22152, 24496, 26416, 28336, 30576, 31704, 34008, 35160, 40576},
284 /* NPRB 057*/ {1608, 2088, 2536, 3368, 4136, 4968, 5992, 6968, 7992,
285 9144, 9912, 11448, 12960, 14688, 16416, 17568, 18336, 20616,
286 22920, 24496, 26416, 28336, 30576, 32856, 35160, 36696, 42368},
287 /* NPRB 058*/ {1608, 2088, 2600, 3368, 4136, 5160, 5992, 6968, 7992,
288 9144, 10296, 11832, 12960, 14688, 16416, 17568, 19080, 20616,
289 22920, 25456, 27376, 29296, 31704, 32856, 35160, 36696, 42368},
290 /* NPRB 059*/ {1608, 2152, 2664, 3496, 4264, 5160, 6200, 7224, 8248,
291 9144, 10296, 11832, 13536, 15264, 16992, 18336, 19080, 21384,
292 23688, 25456, 27376, 29296, 31704, 34008, 36696, 37888, 43816},
293 /* NPRB 060*/ {1672, 2152, 2664, 3496, 4264, 5352, 6200, 7224, 8504,
294 9528, 10680, 12216, 13536, 15264, 16992, 18336, 19848, 21384,
295 23688, 25456, 28336, 30576, 32856, 34008, 36696, 37888, 43816},
296 /* NPRB 061*/ {1672, 2216, 2728, 3624, 4392, 5352, 6456, 7480, 8504,
297 9528, 10680, 12216, 14112, 15840, 17568, 18336, 19848, 22152,
298 24496, 26416, 28336, 30576, 32856, 35160, 36696, 39232, 45352},
299 /* NPRB 062*/ {1736, 2280, 2792, 3624, 4392, 5544, 6456, 7480, 8760,
300 9912, 11064, 12576, 14112, 15840, 17568, 19080, 19848, 22152,
301 24496, 26416, 29296, 31704, 34008, 35160, 37888, 39232, 45352},
302 /* NPRB 063*/ {1736, 2280, 2856, 3624, 4584, 5544, 6456, 7736, 8760,
303 9912, 11064, 12576, 14112, 16416, 18336, 19080, 20616, 22920,
304 24496, 27376, 29296, 31704, 34008, 36696, 37888, 40576, 46888},
305 /* NPRB 064*/ {1800, 2344, 2856, 3752, 4584, 5736, 6712, 7736, 9144,
306 10296, 11448, 12960, 14688, 16416, 18336, 19848, 20616, 22920,
307 25456, 27376, 29296, 31704, 34008, 36696, 39232, 40576, 46888},
308 /* NPRB 065*/ {1800, 2344, 2856, 3752, 4584, 5736, 6712, 7992, 9144,
309 10296, 11448, 12960, 14688, 16992, 18336, 19848, 21384, 23688,
310 25456, 28336, 30576, 32856, 35160, 37888, 39232, 40576, 48936},
311 /* NPRB 066*/ {1800, 2408, 2984, 3880, 4776, 5736, 6968, 7992, 9144,
312 10296, 11448, 13536, 15264, 16992, 19080, 20616, 21384, 23688,
313 26416, 28336, 30576, 32856, 35160, 37888, 40576, 42368, 48936},
314 /* NPRB 067*/ {1864, 2472, 2984, 3880, 4776, 5992, 6968, 8248, 9528,
315 10680, 11832, 13536, 15264, 16992, 19080, 20616, 22152, 24496,
316 26416, 29296, 31704, 34008, 36696, 37888, 40576, 42368, 48936},
317 /* NPRB 068*/ {1864, 2472, 3112, 4008, 4968, 5992, 6968, 8248, 9528,
318 10680, 11832, 13536, 15264, 17568, 19848, 20616, 22152, 24496,
319 27376, 29296, 31704, 34008, 36696, 39232, 42368, 43816, 51024},
320 /* NPRB 069*/ {1928, 2536, 3112, 4008, 4968, 5992, 7224, 8504, 9528,
321 11064, 12216, 14112, 15840, 17568, 19848, 21384, 22152, 24496,
322 27376, 29296, 31704, 35160, 36696, 39232, 42368, 43816, 51024},
323 /* NPRB 070*/ {1928, 2536, 3112, 4136, 4968, 6200, 7224, 8504, 9912,
324 11064, 12216, 14112, 15840, 18336, 19848, 21384, 22920, 25456,
325 27376, 30576, 32856, 35160, 37888, 40576, 42368, 43816, 52752},
326 /* NPRB 071*/ {1992, 2600, 3240, 4136, 5160, 6200, 7480, 8760, 9912,
327 11064, 12576, 14112, 16416, 18336, 20616, 22152, 22920, 25456,
328 28336, 30576, 32856, 35160, 37888, 40576, 43816, 45352, 52752},
329 /* NPRB 072*/ {1992, 2600, 3240, 4264, 5160, 6200, 7480, 8760, 9912,
330 11448, 12576, 14688, 16416, 18336, 20616, 22152, 23688, 26416,
331 28336, 30576, 34008, 36696, 39232, 40576, 43816, 45352, 52752},
332 /* NPRB 073*/ {2024, 2664, 3240, 4264, 5160, 6456, 7736, 8760, 10296,
333 11448, 12960, 14688, 16416, 19080, 20616, 22152, 23688, 26416,
334 29296, 31704, 34008, 36696, 39232, 42368, 45352, 46888, 55056},
335 /* NPRB 074*/ {2088, 2728, 3368, 4392, 5352, 6456, 7736, 9144, 10296,
336 11832, 12960, 14688, 16992, 19080, 21384, 22920, 24496, 26416,
337 29296, 31704, 34008, 36696, 40576, 42368, 45352, 46888, 55056},
338 /* NPRB 075*/ {2088, 2728, 3368, 4392, 5352, 6712, 7736, 9144, 10680,
339 11832, 12960, 15264, 16992, 19080, 21384, 22920, 24496, 27376,
340 29296, 32856, 35160, 37888, 40576, 43816, 45352, 46888, 55056},
341 /* NPRB 076*/ {2088, 2792, 3368, 4392, 5544, 6712, 7992, 9144, 10680,
342 11832, 13536, 15264, 17568, 19848, 22152, 23688, 24496, 27376,
343 30576, 32856, 35160, 37888, 40576, 43816, 46888, 48936, 55056},
344 /* NPRB 077*/ {2152, 2792, 3496, 4584, 5544, 6712, 7992, 9528, 10680,
345 12216, 13536, 15840, 17568, 19848, 22152, 23688, 25456, 27376,
346 30576, 32856, 35160, 39232, 42368, 43816, 46888, 48936, 57336},
347 /* NPRB 078*/ {2152, 2856, 3496, 4584, 5544, 6968, 8248, 9528, 11064,
348 12216, 13536, 15840, 17568, 19848, 22152, 23688, 25456, 28336,
349 30576, 34008, 36696, 39232, 42368, 45352, 46888, 48936, 57336},
350 /* NPRB 079*/ {2216, 2856, 3496, 4584, 5736, 6968, 8248, 9528, 11064,
351 12576, 14112, 15840, 18336, 20616, 22920, 24496, 25456, 28336,
352 31704, 34008, 36696, 39232, 42368, 45352, 48936, 51024, 57336},
353 /* NPRB 080*/ {2216, 2856, 3624, 4776, 5736, 6968, 8248, 9912, 11064,
354 12576, 14112, 16416, 18336, 20616, 22920, 24496, 26416, 29296,
355 31704, 34008, 36696, 40576, 43816, 45352, 48936, 51024, 59256},
356 /* NPRB 081*/ {2280, 2984, 3624, 4776, 5736, 7224, 8504, 9912, 11448,
357 12960, 14112, 16416, 18336, 20616, 22920, 24496, 26416, 29296,
358 31704, 35160, 37888, 40576, 43816, 46888, 48936, 51024, 59256},
359 /* NPRB 082*/ {2280, 2984, 3624, 4776, 5992, 7224, 8504, 9912, 11448,
360 12960, 14688, 16416, 19080, 21384, 23688, 25456, 26416, 29296,
361 32856, 35160, 37888, 40576, 43816, 46888, 51024, 52752, 59256},
362 /* NPRB 083*/ {2280, 2984, 3752, 4776, 5992, 7224, 8760, 10296, 11448,
363 12960, 14688, 16992, 19080, 21384, 23688, 25456, 27376, 30576,
364 32856, 35160, 39232, 42368, 45352, 46888, 51024, 52752, 61664},
365 /* NPRB 084*/ {2344, 3112, 3752, 4968, 5992, 7480, 8760, 10296, 11832,
366 13536, 14688, 16992, 19080, 21384, 24496, 25456, 27376, 30576,
367 32856, 36696, 39232, 42368, 45352, 48936, 51024, 52752, 61664},
368 /* NPRB 085*/ {2344, 3112, 3880, 4968, 5992, 7480, 8760, 10296, 11832,
369 13536, 14688, 16992, 19080, 22152, 24496, 26416, 27376, 30576,
370 34008, 36696, 39232, 42368, 45352, 48936, 52752, 55056, 61664},
371 /* NPRB 086*/ {2408, 3112, 3880, 4968, 6200, 7480, 9144, 10680, 12216,
372 13536, 15264, 17568, 19848, 22152, 24496, 26416, 28336, 30576,
373 34008, 36696, 40576, 43816, 46888, 48936, 52752, 55056, 63776},
374 /* NPRB 087*/ {2408, 3240, 3880, 5160, 6200, 7736, 9144, 10680, 12216,
375 13536, 15264, 17568, 19848, 22152, 25456, 26416, 28336, 31704,
376 34008, 37888, 40576, 43816, 46888, 51024, 52752, 55056, 63776},
377 /* NPRB 088*/ {2472, 3240, 4008, 5160, 6200, 7736, 9144, 10680, 12216,
378 14112, 15264, 17568, 19848, 22920, 25456, 27376, 28336, 31704,
379 35160, 37888, 40576, 43816, 46888, 51024, 52752, 55056, 63776},
380 /* NPRB 089*/ {2472, 3240, 4008, 5160, 6456, 7736, 9144, 11064, 12576,
381 14112, 15840, 18336, 20616, 22920, 25456, 27376, 29296, 31704,
382 35160, 37888, 42368, 45352, 48936, 51024, 55056, 57336, 66592},
383 /* NPRB 090*/ {2536, 3240, 4008, 5352, 6456, 7992, 9528, 11064, 12576,
384 14112, 15840, 18336, 20616, 22920, 25456, 27376, 29296, 32856,
385 35160, 39232, 42368, 45352, 48936, 51024, 55056, 57336, 66592},
386 /* NPRB 091*/ {2536, 3368, 4136, 5352, 6456, 7992, 9528, 11064, 12576,
387 14112, 15840, 18336, 20616, 23688, 26416, 28336, 29296, 32856,
388 36696, 39232, 42368, 45352, 48936, 52752, 55056, 57336, 66592},
389 /* NPRB 092*/ {2536, 3368, 4136, 5352, 6456, 7992, 9528, 11448, 12960,
390 14688, 16416, 18336, 21384, 23688, 26416, 28336, 30576, 32856,
391 36696, 39232, 42368, 46888, 48936, 52752, 57336, 59256, 68808},
392 /* NPRB 093*/ {2600, 3368, 4136, 5352, 6712, 8248, 9528, 11448, 12960,
393 14688, 16416, 19080, 21384, 23688, 26416, 28336, 30576, 34008,
394 36696, 40576, 43816, 46888, 51024, 52752, 57336, 59256, 68808},
395 /* NPRB 094*/ {2600, 3496, 4264, 5544, 6712, 8248, 9912, 11448, 12960,
396 14688, 16416, 19080, 21384, 24496, 27376, 29296, 30576, 34008,
397 37888, 40576, 43816, 46888, 51024, 55056, 57336, 59256, 68808},
398 /* NPRB 095*/ {2664, 3496, 4264, 5544, 6712, 8248, 9912, 11448, 13536,
399 15264, 16992, 19080, 21384, 24496, 27376, 29296, 30576, 34008,
400 37888, 40576, 43816, 46888, 51024, 55056, 57336, 61664, 71112},
401 /* NPRB 096*/ {2664, 3496, 4264, 5544, 6968, 8504, 9912, 11832, 13536,
402 15264, 16992, 19080, 22152, 24496, 27376, 29296, 31704, 35160,
403 37888, 40576, 45352, 48936, 51024, 55056, 59256, 61664, 71112},
404 /* NPRB 097*/ {2728, 3496, 4392, 5736, 6968, 8504, 10296, 11832, 13536,
405 15264, 16992, 19848, 22152, 25456, 28336, 29296, 31704, 35160,
406 37888, 42368, 45352, 48936, 52752, 55056, 59256, 61664, 71112},
407 /* NPRB 098*/ {2728, 3624, 4392, 5736, 6968, 8760, 10296, 11832, 13536,
408 15264, 16992, 19848, 22152, 25456, 28336, 30576, 31704, 35160,
409 39232, 42368, 45352, 48936, 52752, 57336, 59256, 61664, 73712},
410 /* NPRB 099*/ {2728, 3624, 4392, 5736, 6968, 8760, 10296, 12216, 14112,
411 15840, 17568, 19848, 22920, 25456, 28336, 30576, 31704, 35160,
412 39232, 42368, 46888, 48936, 52752, 57336, 61664, 63776, 73712},
413 /* NPRB 100*/ {2792, 3624, 4584, 5736, 7224, 8760, 10296, 12216, 14112,
414 15840, 17568, 19848, 22920, 25456, 28336, 30576, 32856, 36696,
415 39232, 43816, 46888, 51024, 55056, 57336, 61664, 63776, 75376},
416 /* NPRB 101*/ {2792, 3752, 4584, 5992, 7224, 8760, 10680, 12216, 14112,
417 15840, 17568, 20616, 22920, 26416, 29296, 30576, 32856, 36696,
418 40576, 43816, 46888, 51024, 55056, 57336, 61664, 63776, 75376},
419 /* NPRB 102*/ {2856, 3752, 4584, 5992, 7224, 9144, 10680, 12576, 14112,
420 16416, 18336, 20616, 23688, 26416, 29296, 31704, 32856, 36696,
421 40576, 43816, 46888, 51024, 55056, 59256, 61664, 63776, 75376},
422 /* NPRB 103*/ {2856, 3752, 4584, 5992, 7480, 9144, 10680, 12576, 14688,
423 16416, 18336, 20616, 23688, 26416, 29296, 31704, 34008, 36696,
424 40576, 43816, 48936, 51024, 55056, 59256, 63776, 66592, 75376},
425 /* NPRB 104*/ {2856, 3752, 4584, 5992, 7480, 9144, 10680, 12576, 14688,
426 16416, 18336, 21384, 23688, 26416, 29296, 31704, 34008, 37888,
427 40576, 45352, 48936, 52752, 57336, 59256, 63776, 66592, 75376},
428 /* NPRB 105*/ {2984, 3880, 4776, 6200, 7480, 9144, 11064, 12960, 14688,
429 16416, 18336, 21384, 23688, 27376, 30576, 31704, 34008, 37888,
430 42368, 45352, 48936, 52752, 57336, 59256, 63776, 66592, 75376},
431 /* NPRB 106*/ {2984, 3880, 4776, 6200, 7480, 9528, 11064, 12960, 14688,
432 16992, 18336, 21384, 24496, 27376, 30576, 32856, 34008, 37888,
433 42368, 45352, 48936, 52752, 57336, 61664, 63776, 66592, 75376},
434 /* NPRB 107*/ {2984, 3880, 4776, 6200, 7736, 9528, 11064, 12960, 15264,
435 16992, 19080, 21384, 24496, 27376, 30576, 32856, 35160, 39232,
436 42368, 46888, 48936, 52752, 57336, 61664, 66592, 68808, 75376},
437 /* NPRB 108*/ {2984, 4008, 4776, 6200, 7736, 9528, 11448, 12960, 15264,
438 16992, 19080, 22152, 24496, 27376, 30576, 32856, 35160, 39232,
439 42368, 46888, 51024, 55056, 59256, 61664, 66592, 68808, 75376},
440 /* NPRB 109*/ {2984, 4008, 4968, 6456, 7736, 9528, 11448, 13536, 15264,
441 16992, 19080, 22152, 24496, 28336, 31704, 34008, 35160, 39232,
442 43816, 46888, 51024, 55056, 59256, 61664, 66592, 68808, 75376},
443 /* NPRB 110*/ {3112, 4008, 4968, 6456, 7992, 9528, 11448, 13536, 15264,
444 17568, 19080, 22152, 25456, 28336, 31704, 34008, 35160, 39232,
445 43816, 46888, 51024, 55056, 59256, 63776, 66592, 71112, 75376},
446};
447
449{
450}
451
453{
454}
455
456TypeId
458{
459 static TypeId tid =
460 TypeId("ns3::LteAmc")
461 .SetParent<Object>()
462 .SetGroupName("Lte")
463 .AddConstructor<LteAmc>()
464 .AddAttribute("Ber",
465 "The requested BER in assigning MCS (default is 0.00005).",
466 DoubleValue(0.00005),
469 .AddAttribute(
470 "AmcModel",
471 "AMC model used to assign CQI",
475 return tid;
476}
477
478int
480{
482 NS_ASSERT_MSG(s >= 0.0, "negative spectral efficiency = " << s);
483 int cqi = 0;
484 while ((cqi < 15) && (SpectralEfficiencyForCqi[cqi + 1] < s))
485 {
486 ++cqi;
487 }
488 NS_LOG_LOGIC("cqi = " << cqi);
489 return cqi;
490}
491
492int
494{
495 NS_LOG_FUNCTION(cqi);
496 NS_ASSERT_MSG(cqi >= 0 && cqi <= 15, "CQI must be in [0..15] = " << cqi);
497 double spectralEfficiency = SpectralEfficiencyForCqi[cqi];
498 int mcs = 0;
499 while ((mcs < 28) && (SpectralEfficiencyForMcs[mcs + 1] <= spectralEfficiency))
500 {
501 ++mcs;
502 }
503 NS_LOG_LOGIC("mcs = " << mcs);
504 return mcs;
505}
506
507int
509{
510 NS_LOG_FUNCTION(mcs);
511
512 NS_ASSERT_MSG(mcs < 29, "MCS=" << mcs);
513 NS_ASSERT_MSG(nprb > 0 && nprb < 111, "NPRB=" << nprb);
514
515 int itbs = McsToItbsDl[mcs];
516 return TransportBlockSizeTable[nprb - 1][itbs];
517}
518
519int
521{
522 NS_LOG_FUNCTION(mcs);
523
524 NS_ASSERT_MSG(mcs < 29, "MCS=" << mcs);
525 NS_ASSERT_MSG(nprb > 0 && nprb < 111, "NPRB=" << nprb);
526
527 int itbs = McsToItbsUl[mcs];
528 return TransportBlockSizeTable[nprb - 1][itbs];
529}
530
531double
533{
534 NS_LOG_FUNCTION(cqi);
535 NS_ASSERT_MSG(cqi >= 0 && cqi <= 15, "CQI must be in [0..15] = " << cqi);
536 NS_LOG_LOGIC("Spectral efficiency = " << SpectralEfficiencyForCqi[cqi]);
537 return SpectralEfficiencyForCqi[cqi];
538}
539
540std::vector<int>
541LteAmc::CreateCqiFeedbacks(const SpectrumValue& sinr, uint8_t rbgSize)
542{
543 NS_LOG_FUNCTION(this);
544
545 std::vector<int> cqi;
546
547 if (m_amcModel == PiroEW2010)
548 {
549 for (auto it = sinr.ConstValuesBegin(); it != sinr.ConstValuesEnd(); it++)
550 {
551 double sinr_ = (*it);
552 if (sinr_ == 0.0)
553 {
554 cqi.push_back(-1); // SINR == 0 (linear units) means no signal in this RB
555 }
556 else
557 {
558 /*
559 * Compute the spectral efficiency from the SINR
560 * SINR
561 * spectralEfficiency = log2 (1 + -------------------- )
562 * -ln(5*BER)/1.5
563 * NB: SINR must be expressed in linear units
564 */
565
566 double s = log2(1 + (sinr_ / ((-std::log(5.0 * m_ber)) / 1.5)));
567
568 int cqi_ = GetCqiFromSpectralEfficiency(s);
569
570 NS_LOG_LOGIC(" PRB =" << cqi.size() << ", sinr = " << sinr_
571 << " (=" << 10 * std::log10(sinr_) << " dB)"
572 << ", spectral efficiency =" << s << ", CQI = " << cqi_
573 << ", BER = " << m_ber);
574
575 cqi.push_back(cqi_);
576 }
577 }
578 }
579 else if (m_amcModel == MiErrorModel)
580 {
581 NS_LOG_DEBUG(this << " AMC-VIENNA RBG size " << (uint16_t)rbgSize);
582 NS_ASSERT_MSG(rbgSize > 0, " LteAmc-Vienna: RBG size must be greater than 0");
583 std::vector<int> rbgMap;
584 int rbId = 0;
585 for (auto it = sinr.ConstValuesBegin(); it != sinr.ConstValuesEnd(); it++)
586 {
587 rbgMap.push_back(rbId++);
588 if ((rbId % rbgSize == 0) || ((it + 1) == sinr.ConstValuesEnd()))
589 {
590 uint8_t mcs = 0;
591 TbStats_t tbStats;
592 while (mcs <= 28)
593 {
594 HarqProcessInfoList_t harqInfoList;
596 sinr,
597 rbgMap,
598 (uint16_t)GetDlTbSizeFromMcs(mcs, rbgSize) / 8,
599 mcs,
600 harqInfoList);
601 if (tbStats.tbler > 0.1)
602 {
603 break;
604 }
605 mcs++;
606 }
607 if (mcs > 0)
608 {
609 mcs--;
610 }
611 NS_LOG_DEBUG(this << "\t RBG " << rbId << " MCS " << (uint16_t)mcs << " TBLER "
612 << tbStats.tbler);
613 int rbgCqi = 0;
614 if ((tbStats.tbler > 0.1) && (mcs == 0))
615 {
616 rbgCqi = 0; // any MCS can guarantee the 10 % of BER
617 }
618 else if (mcs == 28)
619 {
620 rbgCqi = 15; // all MCSs can guarantee the 10 % of BER
621 }
622 else
623 {
624 double s = SpectralEfficiencyForMcs[mcs];
625 rbgCqi = 0;
626 while ((rbgCqi < 15) && (SpectralEfficiencyForCqi[rbgCqi + 1] < s))
627 {
628 ++rbgCqi;
629 }
630 }
631 NS_LOG_DEBUG(this << "\t MCS " << (uint16_t)mcs << "-> CQI " << rbgCqi);
632 // fill the cqi vector (per RB basis)
633 for (uint8_t j = 0; j < rbgSize; j++)
634 {
635 cqi.push_back(rbgCqi);
636 }
637 rbgMap.clear();
638 }
639 }
640 }
641
642 return cqi;
643}
644
645} // namespace ns3
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition double.h:31
Hold variables of type enum.
Definition enum.h:52
Implements the Adaptive Modulation And Coding Scheme.
Definition lte-amc.h:31
int GetCqiFromSpectralEfficiency(double s)
Get a proper CQI for the spectral efficiency value.
Definition lte-amc.cc:479
~LteAmc() override
Definition lte-amc.cc:452
int GetDlTbSizeFromMcs(int mcs, int nprb)
Get the Transport Block Size for a selected MCS and number of PRB (table 7.1.7.2.1-1 of 36....
Definition lte-amc.cc:508
@ MiErrorModel
An AMC model based on 10% of BER according to LteMiErrorModel.
Definition lte-amc.h:56
int GetMcsFromCqi(int cqi)
Get the Modulation and Coding Scheme for a CQI value.
Definition lte-amc.cc:493
std::vector< int > CreateCqiFeedbacks(const SpectrumValue &sinr, uint8_t rbgSize=0)
Create a message with CQI feedback.
Definition lte-amc.cc:541
int GetUlTbSizeFromMcs(int mcs, int nprb)
Get the Transport Block Size for a selected MCS and number of PRB (table 8.6.1-1 of 36....
Definition lte-amc.cc:520
double m_ber
The Ber attribute.
Definition lte-amc.h:116
double GetSpectralEfficiencyFromCqi(int cqi)
Get the spectral efficiency value associated to the received CQI.
Definition lte-amc.cc:532
AmcModel m_amcModel
The AmcModel attribute.
Definition lte-amc.h:123
static TypeId GetTypeId()
Get the type ID.
Definition lte-amc.cc:457
static TbStats_t GetTbDecodificationStats(const SpectrumValue &sinr, const std::vector< int > &map, uint16_t size, uint8_t mcs, HarqProcessInfoList_t miHistory)
run the error-model algorithm for the specified TB
A base class which provides memory management and object aggregation.
Definition object.h:78
Set of values corresponding to a given SpectrumModel.
Values::const_iterator ConstValuesBegin() const
Values::const_iterator ConstValuesEnd() const
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition assert.h:75
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:271
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeDoubleChecker()
Definition double.h:82
static const int TransportBlockSizeTable[110][27]
Table of number of physical resource blocks (NPRB), TBS index (ITBS), and their associated transport ...
Definition lte-amc.cc:118
static const int McsToItbsUl[29]
Table of MCS index (IMCS) and its TBS index (ITBS).
Definition lte-amc.cc:105
Ptr< const AttributeChecker > MakeEnumChecker(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
Definition enum.h:179
std::vector< HarqProcessInfoElement_t > HarqProcessInfoList_t
HarqProcessInfoList_t typedef.
static const double SpectralEfficiencyForCqi[16]
Table of CQI index and its spectral efficiency.
Definition lte-amc.cc:38
static const double SpectralEfficiencyForMcs[32]
Table of MCS index and its spectral efficiency.
Definition lte-amc.cc:85
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition double.h:32
static const int McsToItbsDl[29]
Table of MCS index (IMCS) and its TBS index (ITBS).
Definition lte-amc.cc:95
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Definition enum.h:221
TbStats_t structure.
double tbler
Transport block BLER.