diff --git a/src/lte/model/rr-ff-mac-scheduler.cc b/src/lte/model/rr-ff-mac-scheduler.cc index 4fc81b89e..402ea7ef1 100644 --- a/src/lte/model/rr-ff-mac-scheduler.cc +++ b/src/lte/model/rr-ff-mac-scheduler.cc @@ -694,7 +694,7 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched } uldci.m_tbSize = (LteAmc::GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8); // MCS 0 -> UL-AMC TBD - NS_LOG_DEBUG (this << " UE " << (*it).first << " startPRB " << (uint32_t)uldci.m_rbStart << " nPRB " << (uint32_t)uldci.m_rbLen << " CQI " << cqi << " MCS " << (uint32_t)uldci.m_mcs << " TBsize " << uldci.m_tbSize); +// NS_LOG_DEBUG (this << " UE " << (*it).first << " startPRB " << (uint32_t)uldci.m_rbStart << " nPRB " << (uint32_t)uldci.m_rbLen << " CQI " << cqi << " MCS " << (uint32_t)uldci.m_mcs << " TBsize " << uldci.m_tbSize); uldci.m_ndi = 1; uldci.m_cceIndex = 0; uldci.m_aggrLevel = 1; diff --git a/src/lte/test/lte-test-pf-ff-mac-scheduler.cc b/src/lte/test/lte-test-pf-ff-mac-scheduler.cc index 04af7afcf..3adf0eee6 100644 --- a/src/lte/test/lte-test-pf-ff-mac-scheduler.cc +++ b/src/lte/test/lte-test-pf-ff-mac-scheduler.cc @@ -35,10 +35,13 @@ #include #include #include +#include #include #include #include "ns3/string.h" #include "ns3/double.h" +#include +#include NS_LOG_COMPONENT_DEFINE ("LenaTestPfFfMacCheduler"); @@ -59,65 +62,95 @@ LenaTestPfFfMacSchedulerSuite::LenaTestPfFfMacSchedulerSuite () //Test Case 1: AMC works in PF - // DISTANCE 0 -> MCS 28 -> Itbs 26 (from table 7.1.7.2.1-1 of 36.213) + // DOWNLINK - DISTANCE 0 -> MCS 28 -> Itbs 26 (from table 7.1.7.2.1-1 of 36.213) // 1 user -> 24 PRB at Itbs 26 -> 2196 -> 2196000 bytes/sec // 3 users -> 2196000 among 3 users -> 732000 bytes/sec // 6 users -> 2196000 among 6 users -> 366000 bytes/sec // 12 users -> 2196000 among 12 users -> 183000 bytes/sec // 15 users -> 2196000 among 15 users -> 146400 bytes/sec - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (1,0,0,2196000)); - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (3,0,0,732000)); - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (6,0,0,366000)); - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (12,0,0,183000)); - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (15,0,0,146400)); + // UPLINK- DISTANCE 0 -> MCS 28 -> Itbs 26 (from table 7.1.7.2.1-1 of 36.213) + // 1 user -> 25 PRB at Itbs 26 -> 2292 -> 2292000 bytes/sec + // 3 users -> 8 PRB at Itbs 26 -> 749 -> 749000 bytes/sec + // 6 users -> 4 PRB at Itbs 26 -> 373 -> 373000 bytes/sec + // 12 users -> 2 PRB at Itbs 26 -> 185 -> 185000 bytes/sec + // 15 users -> 1 PRB at Itbs 26 -> 89 -> 89000 bytes/sec + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (1,0,0,2196000,2292000)); + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (3,0,0,732000,749000)); + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (6,0,0,366000,373000)); + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (12,0,0,183000,185000)); + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (15,0,0,146400,89000)); - // DISTANCE 3000 -> MCS 24 -> Itbs 30 (from table 7.1.7.2.1-1 of 36.213) + // DOWNLINK - DISTANCE 3000 -> MCS 24 -> Itbs 30 (from table 7.1.7.2.1-1 of 36.213) // 1 user -> 24 PRB at Itbs 20 -> 1383 -> 1383000 bytes/sec // 3 users -> 1383000 among 3 users -> 461000 bytes/sec // 6 users -> 1383000 among 6 users -> 230500 bytes/sec // 12 users -> 1383000 among 12 users -> 115250 bytes/sec // 15 users -> 1383000 among 15 users -> 92200 bytes/sec - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (1,0,3000,1383000)); - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (3,0,3000,461000)); - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (6,0,3000,230500)); - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (12,0,3000,115250)); - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (15,0,3000,92200)); + // UPLINK - DISTANCE 3000 -> MCS 20 -> Itbs 18 (from table 7.1.7.2.1-1 of 36.213) + // 1 user -> 25 PRB at Itbs 18 -> 1239 -> 1239000 bytes/sec + // 3 users -> 8 PRB at Itbs 18 -> 389 -> 389000 bytes/sec + // 6 users -> 4 PRB at Itbs 18 -> 193 -> 193000 bytes/sec + // 12 users -> 2 PRB at Itbs 18 -> 97 -> 97000 bytes/sec + // 15 users -> 1 PRB at Itbs 18 -> 47 -> 47000 bytes/sec + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (1,0,3000,1383000,1239000)); + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (3,0,3000,461000,389000)); + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (6,0,3000,230500,193000)); + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (12,0,3000,115250,97000)); + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (15,0,3000,92200,47000)); - // DISTANCE 6000 -> MCS 16 -> Itbs 15 (from table 7.1.7.2.1-1 of 36.213) + // DOWNLINK - DISTANCE 6000 -> MCS 16 -> Itbs 15 (from table 7.1.7.2.1-1 of 36.213) // 1 user -> 24 PRB at Itbs 15 -> 903 -> 903000 bytes/sec // 3 users -> 903000 among 3 users -> 301000 bytes/sec // 6 users -> 903000 among 6 users -> 150500 bytes/sec // 12 users -> 903000 among 12 users -> 75250 bytes/sec // 15 users -> 903000 among 15 users -> 60200 bytes/sec - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (1,0,6000,903000)); - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (3,0,6000,301000)); - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (6,0,6000,150500)); - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (12,0,6000,75250)); - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (15,0,6000,60200)); + // UPLINK - DISTANCE 6000 -> MCS 12 -> Itbs 11 (from table 7.1.7.2.1-1 of 36.213) + // 1 user -> 25 PRB at Itbs 11 -> 621 -> 621000 bytes/sec + // 3 users -> 8 PRB at Itbs 11 -> 201 -> 201000 bytes/sec + // 6 users -> 4 PRB at Itbs 11 -> 97 -> 97000 bytes/sec + // 12 users -> 2 PRB at Itbs 11 -> 47 -> 47000 bytes/sec + // 15 users -> 1 PRB at Itbs 11 -> 22 -> 22000 bytes/sec + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (1,0,6000,903000,621000)); + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (3,0,6000,301000,201000)); + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (6,0,6000,150500,97000)); + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (12,0,6000,75250,47000)); + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (15,0,6000,60200,22000)); - // DISTANCE 9000 -> MCS 12 -> Itbs 11 (from table 7.1.7.2.1-1 of 36.213) + // DOWNLINK - DISTANCE 9000 -> MCS 12 -> Itbs 11 (from table 7.1.7.2.1-1 of 36.213) // 1 user -> 24 PRB at Itbs 11 -> 597 -> 597000 bytes/sec // 3 users -> 597000 among 3 users -> 199000 bytes/sec // 6 users -> 597000 among 6 users -> 99500 bytes/sec // 12 users -> 597000 among 12 users -> 49750 bytes/sec // 15 users -> 597000 among 15 users -> 39800 bytes/sec - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (1,0,9000,597000)); - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (3,0,9000,199000)); - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (6,0,9000,99500)); - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (12,0,9000,49750)); - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (15,0,9000,39800)); + // UPLINK - DISTANCE 9000 -> MCS 8 -> Itbs 8 (from table 7.1.7.2.1-1 of 36.213) + // 1 user -> 24 PRB at Itbs 8 -> 437 -> 437000 bytes/sec + // 3 users -> 8 PRB at Itbs 8 -> 137 -> 137000 bytes/sec + // 6 users -> 4 PRB at Itbs 8 -> 67 -> 67000 bytes/sec + // 12 users -> 2 PRB at Itbs 8 -> 32 -> 32000 bytes/sec + // 15 users -> 1 PRB at Itbs 8 -> 15 -> 15000 bytes/sec + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (1,0,9000,597000,437000)); + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (3,0,9000,199000,137000)); + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (6,0,9000,99500,67000)); + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (12,0,9000,49750,32000)); + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (15,0,9000,39800,15000)); - // DISTANCE 15000 -> MCS 6 -> Itbs 6 (from table 7.1.7.2.1-1 of 36.213) + // DONWLINK - DISTANCE 15000 -> MCS 6 -> Itbs 6 (from table 7.1.7.2.1-1 of 36.213) // 1 user -> 24 PRB at Itbs 6 -> 309 -> 309000 bytes/sec // 3 users -> 309000 among 3 users -> 103000 bytes/sec // 6 users -> 309000 among 6 users -> 51500 bytes/sec // 12 users -> 309000 among 12 users -> 25750 bytes/sec // 15 users -> 309000 among 15 users -> 20600 bytes/sec - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (1,0,15000,309000)); - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (3,0,15000,103000)); - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (6,0,15000,51500)); - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (12,0,15000,25750)); - AddTestCase (new LenaPfFfMacSchedulerTestCase1 (15,0,15000,20600)); + // UPLINK - DISTANCE 15000 -> MCS 6 -> Itbs 6 (from table 7.1.7.2.1-1 of 36.213) + // 1 user -> 25 PRB at Itbs 6 -> 233 -> 233000 bytes/sec + // 3 users -> 8 PRB at Itbs 6 -> 69 -> 69000 bytes/sec + // 6 users -> 4 PRB at Itbs 6 -> 32 -> 32000 bytes/sec + // 12 users -> 2 PRB at Itbs 6 -> 15 -> 15000 bytes/sec + // 15 users -> 1 PRB at Itbs 6 -> 7 -> 7000 bytes/sec + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (1,0,15000,309000,233000)); + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (3,0,15000,103000,69000)); + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (6,0,15000,51500,32000)); + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (12,0,15000,25750,15000)); + AddTestCase (new LenaPfFfMacSchedulerTestCase1 (15,0,15000,20600,7000)); // Test Case 2: fairness check @@ -127,14 +160,19 @@ LenaTestPfFfMacSchedulerSuite::LenaTestPfFfMacSchedulerSuite () dist.push_back (6000); // User 2 distance dist.push_back (9000); // User 3 distance dist.push_back (15000); // User 4 distance - std::vector estThrPf; - estThrPf.push_back (89000); // User 0 estimated TTI throughput from PF - estThrPf.push_back (55000); // User 1 estimated TTI throughput from PF - estThrPf.push_back (35000); // User 2 estimated TTI throughput from PF - estThrPf.push_back (22000); // User 3 estimated TTI throughput from PF - estThrPf.push_back (11000); // User 4 estimated TTI throughput from PF - - AddTestCase (new LenaPfFfMacSchedulerTestCase2 (5,dist,estThrPf)); + std::vector estThrPfDl; + estThrPfDl.push_back (89000); // User 0 estimated TTI throughput from PF + estThrPfDl.push_back (55000); // User 1 estimated TTI throughput from PF + estThrPfDl.push_back (35000); // User 2 estimated TTI throughput from PF + estThrPfDl.push_back (22000); // User 3 estimated TTI throughput from PF + estThrPfDl.push_back (11000); // User 4 estimated TTI throughput from PF + std::vector estThrPfUl; + estThrPfUl.push_back (469000); // User 0 estimated TTI throughput from PF + estThrPfUl.push_back (249000); // User 1 estimated TTI throughput from PF + estThrPfUl.push_back (125000); // User 2 estimated TTI throughput from PF + estThrPfUl.push_back (85000); // User 3 estimated TTI throughput from PF + estThrPfUl.push_back (32000); // User 4 estimated TTI throughput from PF + AddTestCase (new LenaPfFfMacSchedulerTestCase2 (5,dist,estThrPfDl,estThrPfUl)); } @@ -144,12 +182,13 @@ static LenaTestPfFfMacSchedulerSuite lenaTestPfFfMacSchedulerSuite; // --------------- T E S T - C A S E # 1 ------------------------------ -LenaPfFfMacSchedulerTestCase1::LenaPfFfMacSchedulerTestCase1 (uint16_t nUser, uint16_t nLc, uint16_t dist, double thrRef) +LenaPfFfMacSchedulerTestCase1::LenaPfFfMacSchedulerTestCase1 (uint16_t nUser, uint16_t nLc, uint16_t dist, double thrRefDl, double thrRefUl) : TestCase ("Proportional Fair (PF) Mac Scheduler Test Case"), m_nUser (nUser), m_nLc (nLc), m_dist (dist), - m_thrRef (thrRef) + m_thrRefDl (thrRefDl), + m_thrRefUl (thrRefUl) { } @@ -226,11 +265,20 @@ LenaPfFfMacSchedulerTestCase1::DoRun (void) EpsBearer bearer (q); lena->ActivateEpsBearer (ueDevs, bearer); - // position nodes + Ptr lteEnbDev = enbDevs.Get (0)->GetObject (); + Ptr enbPhy = lteEnbDev->GetPhy (); + enbPhy->SetAttribute ("TxPower", DoubleValue (30.0)); + enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0)); + + // Set UEs' position and power for (int i = 0; i < m_nUser; i++) { Ptr mm = ueNodes.Get (i)->GetObject (); mm->SetPosition (Vector (m_dist, 0.0, 0.0)); + Ptr lteUeDev = ueDevs.Get (i)->GetObject (); + Ptr uePhy = lteUeDev->GetPhy (); + uePhy->SetAttribute ("TxPower", DoubleValue (23.0)); + uePhy->SetAttribute ("NoiseFigure", DoubleValue (9.0)); } lena->EnableDlRlcTraces(); @@ -245,9 +293,9 @@ LenaPfFfMacSchedulerTestCase1::DoRun (void) Simulator::Run (); /** - * Check that the assignation is done in a "proportional fair" manner + * Check that the downlink assignation is done in a "proportional fair" manner */ - NS_LOG_INFO("Test with " << m_nUser << " user(s) at distance " << m_dist); + NS_LOG_INFO("DL - Test with " << m_nUser << " user(s) at distance " << m_dist); std::vector dlDataRxed; for (int i = 0; i < m_nUser; i++) { @@ -256,7 +304,7 @@ LenaPfFfMacSchedulerTestCase1::DoRun (void) // get the lcId uint8_t lcId = ueDevs.Get (i)-> GetObject ()->GetRrc ()->GetLcIdVector ().at(0); dlDataRxed.push_back (rlcStats->GetDlRxData (imsi, lcId)); - NS_LOG_INFO ("\tUser " << i << " imsi " << imsi << " bytes rxed " << (double)dlDataRxed.at (i) << " thr " << (double)dlDataRxed.at (i) / simulationTime << " ref " << m_thrRef); + NS_LOG_INFO ("\tUser " << i << " imsi " << imsi << " bytes rxed " << (double)dlDataRxed.at (i) << " thr " << (double)dlDataRxed.at (i) / simulationTime << " ref " << m_thrRefUl); } /** * Check that the assignation is done in a "proportional fair" manner among users @@ -266,9 +314,33 @@ LenaPfFfMacSchedulerTestCase1::DoRun (void) */ for (int i = 0; i < m_nUser; i++) { - NS_TEST_ASSERT_MSG_EQ_TOL ((double)dlDataRxed.at (i) / simulationTime, m_thrRef, m_thrRef * tolerance, " Unfair Throughput!"); + NS_TEST_ASSERT_MSG_EQ_TOL ((double)dlDataRxed.at (i) / simulationTime, m_thrRefDl, m_thrRefDl * tolerance, " Unfair Throughput!"); } + /** + * Check that the uplink assignation is done in a "proportional fair" manner + */ + NS_LOG_INFO("UL - Test with " << m_nUser << " user(s) at distance " << m_dist); + std::vector ulDataRxed; + for (int i = 0; i < m_nUser; i++) + { + // get the imsi + uint64_t imsi = ueDevs.Get (i)-> GetObject ()->GetImsi (); + // get the lcId + uint8_t lcId = ueDevs.Get (i)-> GetObject ()->GetRrc ()->GetLcIdVector ().at(0); + ulDataRxed.push_back (rlcStats->GetUlRxData (imsi, lcId)); + NS_LOG_INFO ("\tUser " << i << " imsi " << imsi << " bytes rxed " << (double)ulDataRxed.at (i) << " thr " << (double)ulDataRxed.at (i) / simulationTime << " ref " << m_thrRefUl); + } + /** + * Check that the assignation is done in a "proportional fair" manner among users + * with equal SINRs: the bandwidht should be distributed according to the + * ratio of the estimated throughput per TTI of each user; therefore equally + * partitioning the whole bandwidth achievable from a single users in a TTI + */ + for (int i = 0; i < m_nUser; i++) + { + NS_TEST_ASSERT_MSG_EQ_TOL ((double)ulDataRxed.at (i) / simulationTime, m_thrRefUl, m_thrRefUl * tolerance, " Unfair Throughput!"); + } Simulator::Destroy (); } @@ -278,13 +350,12 @@ LenaPfFfMacSchedulerTestCase1::DoRun (void) // --------------- T E S T - C A S E # 2 ------------------------------ -LenaPfFfMacSchedulerTestCase2::LenaPfFfMacSchedulerTestCase2 (uint16_t nUser, std::vector dist, std::vector estThrPf) +LenaPfFfMacSchedulerTestCase2::LenaPfFfMacSchedulerTestCase2 (uint16_t nUser, std::vector dist, std::vector estThrPfDl, std::vector estThrPfUl) : TestCase ("Proportional Fair (PF) Mac Scheduler Test Case"), m_nUser (nUser), m_dist (dist), - m_estThrPf (estThrPf) - - + m_estThrPfDl (estThrPfDl), + m_estThrPfUl (estThrPfDl) { } @@ -360,12 +431,21 @@ LenaPfFfMacSchedulerTestCase2::DoRun (void) EpsBearer bearer (q); lena->ActivateEpsBearer (ueDevs, bearer); - // position nodes + Ptr lteEnbDev = enbDevs.Get (0)->GetObject (); + Ptr enbPhy = lteEnbDev->GetPhy (); + enbPhy->SetAttribute ("TxPower", DoubleValue (30.0)); + enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0)); + + // Set UEs' position and power for (int i = 0; i < m_nUser; i++) - { - Ptr mm = ueNodes.Get (i)->GetObject (); - mm->SetPosition (Vector (m_dist.at (i), 0.0, 0.0)); - } + { + Ptr mm = ueNodes.Get (i)->GetObject (); + mm->SetPosition (Vector (m_dist.at (i), 0.0, 0.0)); + Ptr lteUeDev = ueDevs.Get (i)->GetObject (); + Ptr uePhy = lteUeDev->GetPhy (); + uePhy->SetAttribute ("TxPower", DoubleValue (23.0)); + uePhy->SetAttribute ("NoiseFigure", DoubleValue (9.0)); + } lena->EnableDlRlcTraces(); @@ -378,21 +458,21 @@ LenaPfFfMacSchedulerTestCase2::DoRun (void) Simulator::Run (); - NS_LOG_INFO("Test with " << m_nUser << " user(s)"); + NS_LOG_INFO("DL - Test with " << m_nUser << " user(s)"); std::vector dlDataRxed; double totalData = 0; double totalEstThrPf = 0; for (int i = 0; i < m_nUser; i++) - { - // get the imsi - uint64_t imsi = ueDevs.Get (i)-> GetObject ()->GetImsi (); - // get the lcId - uint8_t lcId = ueDevs.Get (i)-> GetObject ()->GetRrc ()->GetLcIdVector ().at(0); - dlDataRxed.push_back (rlcStats->GetDlRxData (imsi, lcId)); - totalData += (double)dlDataRxed.at (i); - NS_LOG_INFO ("\tUser " << i << " dist " << m_dist.at (i) << " imsi " << imsi << " bytes rxed " << (double)dlDataRxed.at (i) << " thr " << (double)dlDataRxed.at (i) / simulationTime << " ref " << m_nUser); - totalEstThrPf += m_estThrPf.at (i); - } + { + // get the imsi + uint64_t imsi = ueDevs.Get (i)-> GetObject ()->GetImsi (); + // get the lcId + uint8_t lcId = ueDevs.Get (i)-> GetObject ()->GetRrc ()->GetLcIdVector ().at(0); + dlDataRxed.push_back (rlcStats->GetDlRxData (imsi, lcId)); + totalData += (double)dlDataRxed.at (i); + NS_LOG_INFO ("\tUser " << i << " dist " << m_dist.at (i) << " imsi " << imsi << " bytes rxed " << (double)dlDataRxed.at (i) << " thr " << (double)dlDataRxed.at (i) / simulationTime << " ref " << m_nUser); + totalEstThrPf += m_estThrPfDl.at (i); + } /** * Check that the assignation is done in a "proportional fair" manner among users @@ -400,12 +480,29 @@ LenaPfFfMacSchedulerTestCase2::DoRun (void) * ratio of the estimated throughput per TTI of each user. */ for (int i = 0; i < m_nUser; i++) - { - double thrRatio = (double)dlDataRxed.at (i) / totalData; - double estThrRatio = (double)m_estThrPf.at (i) / totalEstThrPf; - NS_LOG_INFO ("User " << i << " thrRatio " << thrRatio << " estThrRatio " << estThrRatio); - NS_TEST_ASSERT_MSG_EQ_TOL (estThrRatio, thrRatio, tolerance, " Unfair Throughput!"); - } + { + double thrRatio = (double)dlDataRxed.at (i) / totalData; + double estThrRatio = (double)m_estThrPfDl.at (i) / totalEstThrPf; + NS_LOG_INFO ("User " << i << " thrRatio " << thrRatio << " estThrRatio " << estThrRatio); + NS_TEST_ASSERT_MSG_EQ_TOL (estThrRatio, thrRatio, tolerance, " Unfair Throughput!"); + } + + /** + * Check that the assignation in uplink is done in a round robin manner. + */ + + NS_LOG_INFO("UL - Test with " << m_nUser); + std::vector ulDataRxed; + for (int i = 0; i < m_nUser; i++) + { + // get the imsi + uint64_t imsi = ueDevs.Get (i)-> GetObject ()->GetImsi (); + // get the lcId + uint8_t lcId = ueDevs.Get (i)-> GetObject ()->GetRrc ()->GetLcIdVector().at(0); + ulDataRxed.push_back (rlcStats->GetUlRxData (imsi, lcId)); + 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_estThrPfUl.at (i)); + NS_TEST_ASSERT_MSG_EQ_TOL ((double)ulDataRxed.at (i) / simulationTime, (double)m_estThrPfUl.at (i), (double)m_estThrPfUl.at (i) * tolerance, " Unfair Throughput!"); + } Simulator::Destroy (); diff --git a/src/lte/test/lte-test-pf-ff-mac-scheduler.h b/src/lte/test/lte-test-pf-ff-mac-scheduler.h index 7ca394bec..c3f311951 100644 --- a/src/lte/test/lte-test-pf-ff-mac-scheduler.h +++ b/src/lte/test/lte-test-pf-ff-mac-scheduler.h @@ -40,7 +40,7 @@ using namespace ns3; class LenaPfFfMacSchedulerTestCase1 : public TestCase { public: - LenaPfFfMacSchedulerTestCase1 (uint16_t nUser, uint16_t nLc, uint16_t dist, double thrRef); + LenaPfFfMacSchedulerTestCase1 (uint16_t nUser, uint16_t nLc, uint16_t dist, double thrRefDl, double thrRefUl); virtual ~LenaPfFfMacSchedulerTestCase1 (); private: @@ -48,21 +48,23 @@ class LenaPfFfMacSchedulerTestCase1 : public TestCase uint16_t m_nUser; uint16_t m_nLc; uint16_t m_dist; - double m_thrRef; + double m_thrRefDl; + double m_thrRefUl; }; class LenaPfFfMacSchedulerTestCase2 : public TestCase { public: - LenaPfFfMacSchedulerTestCase2 (uint16_t nUser, std::vector dist, std::vector estThrPf); + LenaPfFfMacSchedulerTestCase2 (uint16_t nUser, std::vector dist, std::vector estThrPfDl, std::vector estThrPfUl); virtual ~LenaPfFfMacSchedulerTestCase2 (); private: virtual void DoRun (void); uint16_t m_nUser; std::vector m_dist; - std::vector m_estThrPf; + std::vector m_estThrPfDl; + std::vector m_estThrPfUl; }; diff --git a/src/lte/test/lte-test-rr-ff-mac-scheduler.cc b/src/lte/test/lte-test-rr-ff-mac-scheduler.cc index 46733d0c0..27f9200ea 100644 --- a/src/lte/test/lte-test-rr-ff-mac-scheduler.cc +++ b/src/lte/test/lte-test-rr-ff-mac-scheduler.cc @@ -55,7 +55,6 @@ LenaTestRrFfMacSchedulerSuite::LenaTestRrFfMacSchedulerSuite () SetVerbose (true); NS_LOG_INFO ("creating LenaRrFfMacSchedulerTestCase"); - //AddTestCase (new LenaRrFfMacSchedulerTestCase (1,0,15000,0,0)); // DOWNLINK- DISTANCE 0 -> MCS 28 -> Itbs 26 (from table 7.1.7.2.1-1 of 36.213) // 1 user -> 24 PRB at Itbs 26 -> 2196 -> 2196000 bytes/sec