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-fdbet-ff-mac-scheduler", SYSTEM)
61 NS_LOG_INFO (
"creating LenaTestFdBetFfMacSchedulerSuite");
142 std::vector<uint16_t> dist;
144 dist.push_back (3000);
145 dist.push_back (6000);
146 dist.push_back (9000);
147 std::vector<uint32_t> estAchievableRateDl;
148 estAchievableRateDl.push_back (2196000);
149 estAchievableRateDl.push_back (1383000);
150 estAchievableRateDl.push_back (903000);
151 estAchievableRateDl.push_back (597000);
152 std::vector<uint32_t> estThrFdBetUl;
153 estThrFdBetUl.push_back (549000);
154 estThrFdBetUl.push_back (293000);
155 estThrFdBetUl.push_back (149000);
156 estThrFdBetUl.push_back (101000);
171 std::ostringstream oss;
172 oss << nUser <<
" UEs, distance " << dist <<
" m";
177 :
TestCase (BuildNameString (nUser, dist)),
181 m_thrRefDl (thrRefDl),
182 m_thrRefUl (thrRefUl)
230 lteHelper->
Attach (ueDevs, enbDevs.
Get (0));
240 enbPhy->SetAttribute (
"NoiseFigure",
DoubleValue (5.0));
243 for (
int i = 0; i <
m_nUser; i++)
249 uePhy->SetAttribute (
"TxPower",
DoubleValue (23.0));
250 uePhy->SetAttribute (
"NoiseFigure",
DoubleValue (9.0));
255 double simulationTime = 1.0;
256 double tolerance = 0.1;
268 std::vector <uint64_t> dlDataRxed;
269 for (
int i = 0; i <
m_nUser; i++)
275 dlDataRxed.push_back (rlcStats->
GetDlRxData (imsi, lcId));
276 NS_LOG_INFO (
"\tUser " << i <<
" imsi " << imsi <<
" bytes rxed " << (
double)dlDataRxed.at (i) <<
" thr " << (double)dlDataRxed.at (i) / simulationTime <<
" ref " <<
m_thrRefDl);
284 for (
int i = 0; i <
m_nUser; i++)
293 std::vector <uint64_t> ulDataRxed;
294 for (
int i = 0; i <
m_nUser; i++)
300 ulDataRxed.push_back (rlcStats->
GetUlRxData (imsi, lcId));
301 NS_LOG_INFO (
"\tUser " << i <<
" imsi " << imsi <<
" bytes rxed " << (
double)ulDataRxed.at (i) <<
" thr " << (double)ulDataRxed.at (i) / simulationTime <<
" ref " <<
m_thrRefUl);
309 for (
int i = 0; i <
m_nUser; i++)
325 std::ostringstream oss;
326 oss <<
"distances (m) = [ " ;
327 for (std::vector<uint16_t>::iterator it = dist.begin (); it != dist.end (); ++it)
337 :
TestCase (BuildNameString (dist.size (), dist)),
338 m_nUser (dist.size ()),
340 m_achievableRateDl (estAchievableRateDl),
341 m_estThrFdBetUl (estThrFdBetUl)
384 lteHelper->
Attach (ueDevs, enbDevs.
Get (0));
394 enbPhy->SetAttribute (
"NoiseFigure",
DoubleValue (5.0));
397 for (
int i = 0; i <
m_nUser; i++)
403 uePhy->SetAttribute (
"TxPower",
DoubleValue (23.0));
404 uePhy->SetAttribute (
"NoiseFigure",
DoubleValue (9.0));
409 double simulationTime = 1;
410 double tolerance = 0.1;
418 NS_LOG_INFO (
"DL - Test with " << m_nUser <<
" user(s)");
419 std::vector <uint64_t> dlDataRxed;
420 double totalData = 0;
421 double estTotalThr = 0;
423 for (
int i = 0; i <
m_nUser; i++)
429 dlDataRxed.push_back (rlcStats->
GetDlRxData (imsi, lcId));
430 totalData += (double)dlDataRxed.at (i);
435 estTotalThr = m_nUser * (1 / estTotalThr);
436 estUeThr = estTotalThr /
m_nUser;
441 for (
int i = 0; i <
m_nUser; i++)
443 double thrRatio = (double) 1 / m_nUser;
444 double estThrRatio = (double)dlDataRxed.at (i) / totalData;
445 NS_LOG_INFO (
"\tUser " << i <<
" thrRatio " << thrRatio <<
" estThrRatio " << estThrRatio);
447 NS_TEST_ASSERT_MSG_EQ_TOL ((
double)dlDataRxed.at (i) / simulationTime, estUeThr, estUeThr * tolerance,
" Unfair Throughput!");
456 std::vector <uint64_t> ulDataRxed;
457 for (
int i = 0; i <
m_nUser; i++)
463 ulDataRxed.push_back (rlcStats->
GetUlRxData (imsi, lcId));
464 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_estThrFdBetUl.at (i));