27 #include <ns3/object.h>
28 #include <ns3/spectrum-interference.h>
29 #include <ns3/spectrum-error-model.h>
32 #include <ns3/simulator.h>
33 #include <ns3/packet.h>
35 #include "ns3/radio-bearer-stats-calculator.h"
36 #include <ns3/constant-position-mobility-model.h>
37 #include <ns3/eps-bearer.h>
38 #include <ns3/node-container.h>
39 #include <ns3/mobility-helper.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/string.h"
46 #include "ns3/double.h"
47 #include <ns3/lte-enb-phy.h>
48 #include <ns3/lte-ue-phy.h>
49 #include <ns3/boolean.h>
59 :
TestSuite (
"lte-tdbet-ff-mac-scheduler", SYSTEM)
61 NS_LOG_INFO (
"creating LenaTestTdBetFfMacSchedulerSuite");
157 std::vector<uint16_t> dist;
159 dist.push_back (3000);
160 dist.push_back (6000);
161 dist.push_back (9000);
162 dist.push_back (15000);
163 std::vector<uint32_t> estAchievableRateDl;
164 estAchievableRateDl.push_back (2196000);
165 estAchievableRateDl.push_back (1383000);
166 estAchievableRateDl.push_back (903000);
167 estAchievableRateDl.push_back (597000);
168 estAchievableRateDl.push_back (309000);
169 std::vector<uint32_t> estThrTdBetUl;
170 estThrTdBetUl.push_back (469000);
171 estThrTdBetUl.push_back (249000);
172 estThrTdBetUl.push_back (125000);
173 estThrTdBetUl.push_back (85000);
174 estThrTdBetUl.push_back (41000);
189 std::ostringstream oss;
190 oss << nUser <<
" UEs, distance " << dist <<
" m";
195 :
TestCase (BuildNameString (nUser, dist)),
199 m_thrRefDl (thrRefDl),
200 m_thrRefUl (thrRefUl)
248 lteHelper->
Attach (ueDevs, enbDevs.
Get (0));
258 enbPhy->SetAttribute (
"NoiseFigure",
DoubleValue (5.0));
261 for (
int i = 0; i <
m_nUser; i++)
267 uePhy->SetAttribute (
"TxPower",
DoubleValue (23.0));
268 uePhy->SetAttribute (
"NoiseFigure",
DoubleValue (9.0));
273 double simulationTime = 1.0;
274 double tolerance = 0.1;
286 std::vector <uint64_t> dlDataRxed;
287 for (
int i = 0; i <
m_nUser; i++)
293 dlDataRxed.push_back (rlcStats->
GetDlRxData (imsi, lcId));
294 NS_LOG_INFO (
"\tUser " << i <<
" imsi " << imsi <<
" bytes rxed " << (
double)dlDataRxed.at (i) <<
" thr " << (double)dlDataRxed.at (i) / simulationTime <<
" ref " <<
m_thrRefDl);
302 for (
int i = 0; i <
m_nUser; i++)
311 std::vector <uint64_t> ulDataRxed;
312 for (
int i = 0; i <
m_nUser; i++)
318 ulDataRxed.push_back (rlcStats->
GetUlRxData (imsi, lcId));
319 NS_LOG_INFO (
"\tUser " << i <<
" imsi " << imsi <<
" bytes rxed " << (
double)ulDataRxed.at (i) <<
" thr " << (double)ulDataRxed.at (i) / simulationTime <<
" ref " <<
m_thrRefUl);
327 for (
int i = 0; i <
m_nUser; i++)
343 std::ostringstream oss;
344 oss <<
"distances (m) = [ " ;
345 for (std::vector<uint16_t>::iterator it = dist.begin (); it != dist.end (); ++it)
355 :
TestCase (BuildNameString (dist.size (), dist)),
356 m_nUser (dist.size ()),
358 m_achievableRateDl (estAchievableRateDl),
359 m_estThrTdBetUl (estThrTdBetUl)
402 lteHelper->
Attach (ueDevs, enbDevs.
Get (0));
412 enbPhy->SetAttribute (
"NoiseFigure",
DoubleValue (5.0));
415 for (
int i = 0; i <
m_nUser; i++)
421 uePhy->SetAttribute (
"TxPower",
DoubleValue (23.0));
422 uePhy->SetAttribute (
"NoiseFigure",
DoubleValue (9.0));
427 double simulationTime = 1;
428 double tolerance = 0.1;
436 NS_LOG_INFO (
"DL - Test with " << m_nUser <<
" user(s)");
437 std::vector <uint64_t> dlDataRxed;
438 double totalData = 0;
439 double estTotalThr = 0;
441 for (
int i = 0; i <
m_nUser; i++)
447 dlDataRxed.push_back (rlcStats->
GetDlRxData (imsi, lcId));
448 totalData += (double)dlDataRxed.at (i);
453 estTotalThr = m_nUser * (1 / estTotalThr);
454 estUeThr = estTotalThr /
m_nUser;
460 for (
int i = 0; i <
m_nUser; i++)
462 double thrRatio = (double) 1 / m_nUser;
463 double estThrRatio = (double)dlDataRxed.at (i) / totalData;
464 NS_LOG_INFO (
"\tUser " << i <<
" thrRatio " << thrRatio <<
" estThrRatio " << estThrRatio);
466 NS_TEST_ASSERT_MSG_EQ_TOL ((
double)dlDataRxed.at (i) / simulationTime, estUeThr, estUeThr * tolerance,
" Unfair Throughput!");
474 std::vector <uint64_t> ulDataRxed;
475 for (
int i = 0; i <
m_nUser; i++)
481 ulDataRxed.push_back (rlcStats->
GetUlRxData (imsi, lcId));
482 NS_LOG_INFO (
"\tUser " << i <<
" dist " <<
m_dist.at (i) <<
" bytes rxed " << (double)ulDataRxed.at (i) <<
" thr " << (double)ulDataRxed.at (i) / simulationTime <<
" ref " << (double)
m_estThrTdBetUl.at (i));