21 #include "ns3/simulator.h"
25 #include "ns3/spectrum-test.h"
27 #include "ns3/lte-phy-tag.h"
28 #include "ns3/lte-sinr-chunk-processor.h"
31 #include <ns3/hybrid-buildings-propagation-loss-model.h>
32 #include <ns3/node-container.h>
33 #include <ns3/mobility-helper.h>
34 #include <ns3/lte-helper.h>
35 #include <ns3/single-model-spectrum-channel.h>
36 #include "ns3/string.h"
37 #include "ns3/double.h"
38 #include <ns3/building.h>
40 #include <ns3/net-device-container.h>
41 #include <ns3/lte-ue-net-device.h>
42 #include <ns3/lte-enb-net-device.h>
43 #include <ns3/lte-ue-rrc.h>
44 #include <ns3/lte-helper.h>
45 #include <ns3/lte-enb-phy.h>
46 #include <ns3/lte-ue-phy.h>
69 uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
70 uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
72 testcase->
DlScheduling (frameNo, subframeNo, rnti, mcsTb1, sizeTb1, mcsTb2, sizeTb2);
78 :
TestSuite (
"lte-pathloss-model", SYSTEM)
90 struct SnrEfficiencyMcs
101 SnrEfficiencyMcs snrEfficiencyMcs[] = {
102 { -5.00000, 0.08024, -1},
103 { -4.00000, 0.10030, -1},
104 { -3.00000, 0.12518, -1},
105 { -2.00000, 0.15589, 0},
106 { -1.00000, 0.19365, 0},
107 { 0.00000, 0.23983, 2},
108 { 1.00000, 0.29593, 2},
109 { 2.00000, 0.36360, 2},
110 { 3.00000, 0.44451, 4},
111 { 4.00000, 0.54031, 4},
112 { 5.00000, 0.65251, 6},
113 { 6.00000, 0.78240, 6},
114 { 7.00000, 0.93086, 8},
115 { 8.00000, 1.09835, 8},
116 { 9.00000, 1.28485, 10},
117 { 10.00000, 1.48981, 12},
118 { 11.00000, 1.71229, 12},
119 { 12.00000, 1.95096, 14},
120 { 13.00000, 2.20429, 14},
121 { 14.00000, 2.47062, 16},
122 { 15.00000, 2.74826, 18},
123 { 16.00000, 3.03560, 18},
124 { 17.00000, 3.33115, 20},
125 { 18.00000, 3.63355, 20},
126 { 19.00000, 3.94163, 22},
127 { 20.00000, 4.25439, 22},
128 { 21.00000, 4.57095, 24},
129 { 22.00000, 4.89060, 24},
130 { 23.00000, 5.21276, 26},
131 { 24.00000, 5.53693, 26},
132 { 25.00000, 5.86271, 28},
133 { 26.00000, 6.18980, 28},
134 { 27.00000, 6.51792, 28},
135 { 28.00000, 6.84687, 28},
136 { 29.00000, 7.17649, 28},
137 { 30.00000, 7.50663, 28},
141 double txPowerDbm = 30;
142 double txPowerLin = std::pow (10, (txPowerDbm - 30)/10);
144 double noisePowerDbm = ktDbm + 10 * std::log10 (25 * 180000);
145 double receiverNoiseFigureDb = 9.0;
146 double noiseLin = std::pow (10, (noisePowerDbm-30+receiverNoiseFigureDb)/10);
150 double loss[] = {81.062444, 134.078605, 144.259958};
151 double dist[] = {100.0, 500.0, 1500};
153 int numOfTests =
sizeof (loss) /
sizeof (
double);
154 for (
int i = 0 ; i < numOfTests; i++ )
157 double sinrLin = (txPowerLin/(pow(10, loss[i]/10))) / noiseLin;
159 double sinrDb = 10 * std::log10 (sinrLin);
160 NS_LOG_INFO (
" Ptx " << txPowerDbm <<
" Pn " << noisePowerDbm <<
" Fn " << receiverNoiseFigureDb <<
" Pl " << loss[i] <<
" dist " << dist[i]);
163 int numSnrEfficiencyMcsEntries =
sizeof (snrEfficiencyMcs) /
sizeof (SnrEfficiencyMcs);
164 for (
int j = 0; j < numSnrEfficiencyMcsEntries && snrEfficiencyMcs[j].snrDb < sinrDb; ++j)
166 mcs = snrEfficiencyMcs[j].mcsIndex;
169 std::ostringstream name;
170 name <<
" snr= " << sinrDb <<
" dB, "
171 <<
" mcs= " << snrEfficiencyMcs[i].mcsIndex;
190 m_mcsIndex (mcsIndex)
192 std::ostringstream sstream1, sstream2;
193 sstream1 <<
" snr=" << snrDb
194 <<
" mcs=" << mcsIndex <<
" distance=" << dist;
196 NS_LOG_INFO (
"Creating LtePathlossModelSystemTestCase: " + sstream1.str ());
252 enbPhy->SetAttribute (
"NoiseFigure",
DoubleValue (5.0));
256 uePhy->SetAttribute (
"TxPower",
DoubleValue (23.0));
257 uePhy->SetAttribute (
"NoiseFigure",
DoubleValue (9.0));
261 lteHelper->
Attach (ueDevs, enbDevs.
Get (0));
273 uePhy->GetDownlinkSpectrumPhy ()->AddCtrlSinrChunkProcessor (testSinr);
281 double calculatedSinrDb = 10.0 * std::log10 (testSinr->GetSinr ()->operator[] (0));
290 uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
292 static bool firstTime =
true;