diff --git a/src/lte/model/rr-ff-mac-scheduler.cc b/src/lte/model/rr-ff-mac-scheduler.cc index 402ea7ef1..4fc81b89e 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-rr-ff-mac-scheduler.cc b/src/lte/test/lte-test-rr-ff-mac-scheduler.cc index f3dea42ba..46733d0c0 100644 --- a/src/lte/test/lte-test-rr-ff-mac-scheduler.cc +++ b/src/lte/test/lte-test-rr-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 ("LenaTestRrFfMacCheduler"); @@ -52,86 +55,124 @@ LenaTestRrFfMacSchedulerSuite::LenaTestRrFfMacSchedulerSuite () SetVerbose (true); NS_LOG_INFO ("creating LenaRrFfMacSchedulerTestCase"); - // DISTANCE 0 -> MCS 28 -> Itbs 26 (from table 7.1.7.2.1-1 of 36.213) + //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 // 3 users -> 8 PRB at Itbs 26 -> 749 -> 749000 bytes/sec // 6 users -> 4 PRB at Itbs 26 -> 373 -> 373000 bytes/sec // 9 user -> 2 PRB at Itbs 26 -> 185 -> 185000 bytes/sec // 12 users -> 2 PRB at Itbs 26 -> 185 -> 185000 bytes/sec // 15 users -> 2 PRB at Itbs 26 * 0.8 -> 148 -> 148000 bytes/sec - AddTestCase (new LenaRrFfMacSchedulerTestCase (26,0,0,2196000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (3,0,0,749000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (6,0,0,373000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (9,0,0,185000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (12,0,0,185000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (15,0,0,148000)); + // 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 + // 9 user -> 2 PRB at Itbs 26 -> 185 -> 185000 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 LenaRrFfMacSchedulerTestCase (1,0,0,2196000,2292000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (3,0,0,749000,749000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (6,0,0,373000,373000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (9,0,0,185000,185000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (12,0,0,185000,185000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (15,0,0,148000,89000)); - // DISTANCE 3000 -> MCS 22 -> Itbs 20 (from table 7.1.7.2.1-1 of 36.213) + // DOWNLINK - DISTANCE 3000 -> MCS 22 -> Itbs 20 (from table 7.1.7.2.1-1 of 36.213) // 1 user -> 24 PRB at Itbs 20 -> 1383 -> 1383000 bytes/sec // 3 users -> 8 PRB at Itbs 20 -> 469 -> 469000 bytes/sec // 6 users -> 4 PRB at Itbs 20 -> 233 -> 233000 bytes/sec // 9 user -> 2 PRB at Itbs 20 -> 113 -> 113000 bytes/sec // 12 users -> 2 PRB at Itbs 20 -> 113 -> 113000 bytes/sec // 15 users -> 2 PRB at Itbs 20 * 0.8 -> 90.4 -> 90400 bytes/sec - AddTestCase (new LenaRrFfMacSchedulerTestCase (1,0,3000,1383000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (3,0,3000,469000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (6,0,3000,233000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (9,0,3000,113000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (12,0,3000,113000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (15,0,3000,90400)); + // 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 + // 9 user -> 2 PRB at Itbs 18 -> 97 -> 97000 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 LenaRrFfMacSchedulerTestCase (1,0,3000,1383000,1239000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (3,0,3000,469000,389000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (6,0,3000,233000,193000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (9,0,3000,113000,97000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (12,0,3000,113000,97000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (15,0,3000,90400,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 -> 8 PRB at Itbs 15 -> 309 -> 309000 bytes/sec // 6 users -> 4 PRB at Itbs 15 -> 153 -> 153000 bytes/sec // 9 user -> 2 PRB at Itbs 15 -> 75 -> 75000 bytes/sec // 12 users -> 2 PRB at Itbs 15 -> 75 -> 75000 bytes/sec // 15 users -> 2 PRB at Itbs 15 * 0.8 -> 60 -> 60000 bytes/sec - AddTestCase (new LenaRrFfMacSchedulerTestCase (1,0,6000,903000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (3,0,6000,309000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (6,0,6000,153000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (9,0,6000,75000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (12,0,6000,75000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (15,0,6000,60000)); + // 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 + // 9 user -> 2 PRB at Itbs 11 -> 47 -> 47000 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 LenaRrFfMacSchedulerTestCase (1,0,6000,903000,621000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (3,0,6000,309000,201000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (6,0,6000,153000,97000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (9,0,6000,75000,47000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (12,0,6000,75000,47000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (15,0,6000,60000,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 -> 8 PRB at Itbs 11 -> 201 -> 201000 bytes/sec // 6 users -> 4 PRB at Itbs 11 -> 97 -> 97000 bytes/sec // 9 user -> 2 PRB at Itbs 11 -> 47 -> 47000 bytes/sec // 12 users -> 2 PRB at Itbs 11 -> 47 -> 47000 bytes/sec - // 15 users -> 2 PRB at Itbs 11 * 0.8 -> 37.6 -> 37600 bytes/sec - AddTestCase (new LenaRrFfMacSchedulerTestCase (1,0,9000,597000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (3,0,9000,201000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (6,0,9000,97000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (9,0,9000,47000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (12,0,9000,47000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (15,0,9000,37600)); + // 15 users -> 2 PRB at Itbs 11 * 0.8 -> 37.6 -> 37600 bytes/sec + // 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 + // 9 user -> 2 PRB at Itbs 8 -> 32 -> 32000 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 LenaRrFfMacSchedulerTestCase (1,0,9000,597000,437000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (3,0,9000,201000,137000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (6,0,9000,97000,67000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (9,0,9000,47000,32000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (12,0,9000,47000,32000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (15,0,9000,37600,15000)); - // DISTANCE 15000 -> MCS 6 -> Itbs 6 (from table 7.1.7.2.1-1 of 36.213) + // DOWNLINK - 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 -> 8 PRB at Itbs 6 -> 101 -> 101000 bytes/sec // 6 users -> 4 PRB at Itbs 6 -> 49 -> 49000 bytes/sec // 9 user -> 2 PRB at Itbs 6 -> 22 -> 22000 bytes/sec // 12 users -> 2 PRB at Itbs 6 -> 22 -> 22000 bytes/sec // 15 users -> 2 PRB at Itbs 6 * 0.8 -> 17.6 -> 17600 bytes/sec - AddTestCase (new LenaRrFfMacSchedulerTestCase (1,0,15000,309000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (3,0,15000,101000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (6,0,15000,49000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (9,0,15000,22000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (12,0,15000,22000)); - AddTestCase (new LenaRrFfMacSchedulerTestCase (15,0,15000,17600)); + // 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 + // 9 user -> 2 PRB at Itbs 6 -> 15 -> 15000 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 LenaRrFfMacSchedulerTestCase (1,0,15000,309000,233000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (3,0,15000,101000,69000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (6,0,15000,49000,32000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (9,0,15000,22000,15000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (12,0,15000,22000,15000)); + AddTestCase (new LenaRrFfMacSchedulerTestCase (15,0,15000,17600,7000)); } static LenaTestRrFfMacSchedulerSuite lenaTestRrFfMacSchedulerSuite; -LenaRrFfMacSchedulerTestCase::LenaRrFfMacSchedulerTestCase (uint16_t nUser, uint16_t nLc, uint16_t dist, double thrRef) +LenaRrFfMacSchedulerTestCase::LenaRrFfMacSchedulerTestCase (uint16_t nUser, uint16_t nLc, uint16_t dist, double thrRefDl, double thrRefUl) : TestCase ("Round Robin (RR) Mac Scheduler Test Case"), m_nUser (nUser), m_nLc (nLc), m_dist (dist), - m_thrRef (thrRef) + m_thrRefDl (thrRefDl), + m_thrRefUl (thrRefUl) { } @@ -209,11 +250,20 @@ LenaRrFfMacSchedulerTestCase::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->EnableRlcTraces (); @@ -222,7 +272,7 @@ LenaRrFfMacSchedulerTestCase::DoRun (void) Simulator::Stop (Seconds (simulationTime)); Ptr rlcStats = lena->GetRlcStats (); - rlcStats->SetAttribute("EpochDuration", TimeValue(Seconds(simulationTime))); + rlcStats->SetAttribute ("EpochDuration", TimeValue(Seconds(simulationTime))); Simulator::Run (); @@ -239,22 +289,22 @@ LenaRrFfMacSchedulerTestCase::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_TEST_ASSERT_MSG_EQ_TOL ((double)dlDataRxed.at (i) / simulationTime, m_thrRef, m_thrRef * tolerance, " Unfair Throughput!"); + NS_LOG_INFO ("\tUser " << i << " imsi " << imsi << " bytes rxed " << (double)dlDataRxed.at (i) << " thr " << (double)dlDataRxed.at (i) / simulationTime << " ref " << m_thrRefDl); + NS_TEST_ASSERT_MSG_EQ_TOL ((double)dlDataRxed.at (i) / simulationTime, m_thrRefDl, m_thrRefDl * tolerance, " Unfair Throughput!"); } -// 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 txed " << (double)ulDataRxed.at (i) << " thr " << (double)ulDataRxed.at (i) / simulationTime << " ref " << m_thrRef); -// // NS_TEST_ASSERT_MSG_EQ_TOL ((double)ulDataRxed.at (i) / simulationTime, m_thrRef, m_thrRef * tolerance, " Unfair Throughput!"); -// } + 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 txed " << (double)ulDataRxed.at (i) << " thr " << (double)ulDataRxed.at (i) / simulationTime << " ref " << m_thrRefUl); + NS_TEST_ASSERT_MSG_EQ_TOL ((double)ulDataRxed.at (i) / simulationTime, m_thrRefUl, m_thrRefUl * tolerance, " Unfair Throughput!"); + } Simulator::Destroy (); } diff --git a/src/lte/test/lte-test-rr-ff-mac-scheduler.h b/src/lte/test/lte-test-rr-ff-mac-scheduler.h index ddbc4769d..f839ab759 100644 --- a/src/lte/test/lte-test-rr-ff-mac-scheduler.h +++ b/src/lte/test/lte-test-rr-ff-mac-scheduler.h @@ -40,7 +40,7 @@ using namespace ns3; class LenaRrFfMacSchedulerTestCase : public TestCase { public: - LenaRrFfMacSchedulerTestCase (uint16_t nUser, uint16_t nLc, uint16_t dist, double thrRef); + LenaRrFfMacSchedulerTestCase (uint16_t nUser, uint16_t nLc, uint16_t dist, double thrRefDl, double thrRefUl); virtual ~LenaRrFfMacSchedulerTestCase (); private: @@ -48,7 +48,8 @@ class LenaRrFfMacSchedulerTestCase : public TestCase uint16_t m_nUser; uint16_t m_nLc; uint16_t m_dist; - double m_thrRef; + double m_thrRefDl; + double m_thrRefUl; };