From 2f0f5a7d721fda20d8e68abe3ac749d39f8f2eb3 Mon Sep 17 00:00:00 2001 From: Nicola Baldo Date: Fri, 14 Dec 2012 10:54:12 +0100 Subject: [PATCH] updated tests for RRC real/ideal: interference antenna mimo harq --- src/lte/test/lte-test-harq.cc | 1 + src/lte/test/lte-test-interference.cc | 35 ++++++++------- src/lte/test/lte-test-mimo.cc | 26 ++++++++--- src/lte/test/lte-test-mimo.h | 5 ++- src/lte/test/test-lte-antenna.cc | 64 +++++++++++++++++++-------- 5 files changed, 89 insertions(+), 42 deletions(-) diff --git a/src/lte/test/lte-test-harq.cc b/src/lte/test/lte-test-harq.cc index 2fd7d9dfb..76e8fd679 100644 --- a/src/lte/test/lte-test-harq.cc +++ b/src/lte/test/lte-test-harq.cc @@ -110,6 +110,7 @@ LenaHarqTestCase::DoRun (void) Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010)); Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false)); Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (true)); + Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true)); // Config::SetDefault ("ns3::RrFfMacScheduler::HarqEnabled", BooleanValue (false)); // LogComponentEnable ("LteEnbRrc", LOG_LEVEL_ALL); // LogComponentEnable ("LteUeRrc", LOG_LEVEL_ALL); diff --git a/src/lte/test/lte-test-interference.cc b/src/lte/test/lte-test-interference.cc index 8d4d0518a..def0f3a9a 100644 --- a/src/lte/test/lte-test-interference.cc +++ b/src/lte/test/lte-test-interference.cc @@ -68,8 +68,6 @@ LteTestUlSchedulingCallback (LteInterferenceTestCase *testcase, std::string path LteInterferenceTestSuite::LteInterferenceTestSuite () : TestSuite ("lte-interference", SYSTEM) { - NS_LOG_INFO ("Creating LteInterferenceTestSuite"); - AddTestCase (new LteInterferenceTestCase ("d1=3000, d2=6000", 3000.000000, 6000.000000, 3.844681, 1.714583, 0.761558, 0.389662, 6, 4)); AddTestCase (new LteInterferenceTestCase ("d1=50, d2=10", 50.000000, 10.000000, 0.040000, 0.040000, 0.010399, 0.010399, 0, 0)); AddTestCase (new LteInterferenceTestCase ("d1=50, d2=20", 50.000000, 20.000000, 0.160000, 0.159998, 0.041154, 0.041153, 0, 0)); @@ -114,12 +112,15 @@ LteInterferenceTestCase::~LteInterferenceTestCase () void LteInterferenceTestCase::DoRun (void) { + NS_LOG_INFO (this << GetName ()); + Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false)); Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false)); Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010)); Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (0.00005)); Ptr lteHelper = CreateObject (); lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel")); + lteHelper->SetAttribute ("UseIdealRrc", BooleanValue (false)); // Create Nodes: eNodeB and UE NodeContainer enbNodes; @@ -203,21 +204,25 @@ LteInterferenceTestCase::DoRun (void) MakeBoundCallback (&LteTestUlSchedulingCallback, this)); // need to allow for RRC connection establishment + SRS - Simulator::Stop (Seconds (0.040)); + Simulator::Stop (Seconds (0.100)); Simulator::Run (); + if (m_dlMcs > 0) + { + double dlSinr1Db = 10.0 * log10 (testDlSinr1->GetSinr ()->operator[] (0)); + NS_TEST_ASSERT_MSG_EQ_TOL (dlSinr1Db, m_dlSinrDb, 0.01, "Wrong SINR in DL! (eNB1 --> UE1)"); - double dlSinr1Db = 10.0 * log10 (testDlSinr1->GetSinr ()->operator[] (0)); - NS_TEST_ASSERT_MSG_EQ_TOL (dlSinr1Db, m_dlSinrDb, 0.01, "Wrong SINR in DL! (eNB1 --> UE1)"); - - double ulSinr1Db = 10.0 * log10 (testUlSinr1->GetSinr ()->operator[] (0)); - NS_TEST_ASSERT_MSG_EQ_TOL (ulSinr1Db, m_ulSinrDb, 0.01, "Wrong SINR in UL! (UE1 --> eNB1)"); - - double dlSinr2Db = 10.0 * log10 (testDlSinr2->GetSinr ()->operator[] (0)); - NS_TEST_ASSERT_MSG_EQ_TOL (dlSinr2Db, m_dlSinrDb, 0.01, "Wrong SINR in DL! (eNB2 --> UE2)"); - - double ulSinr2Db = 10.0 * log10 (testUlSinr2->GetSinr ()->operator[] (0)); - NS_TEST_ASSERT_MSG_EQ_TOL (ulSinr2Db, m_ulSinrDb, 0.01, "Wrong SINR in UL! (UE2 --> eNB2)"); + double dlSinr2Db = 10.0 * log10 (testDlSinr2->GetSinr ()->operator[] (0)); + NS_TEST_ASSERT_MSG_EQ_TOL (dlSinr2Db, m_dlSinrDb, 0.01, "Wrong SINR in DL! (eNB2 --> UE2)"); + } + if (m_ulMcs > 0) + { + double ulSinr1Db = 10.0 * log10 (testUlSinr1->GetSinr ()->operator[] (0)); + NS_TEST_ASSERT_MSG_EQ_TOL (ulSinr1Db, m_ulSinrDb, 0.01, "Wrong SINR in UL! (UE1 --> eNB1)"); + + double ulSinr2Db = 10.0 * log10 (testUlSinr2->GetSinr ()->operator[] (0)); + NS_TEST_ASSERT_MSG_EQ_TOL (ulSinr2Db, m_ulSinrDb, 0.01, "Wrong SINR in UL! (UE2 --> eNB2)"); + } Simulator::Destroy (); @@ -240,7 +245,7 @@ LteInterferenceTestCase::UlScheduling (uint32_t frameNo, uint32_t subframeNo, ui uint8_t mcs, uint16_t sizeTb) { // need to allow for RRC connection establishment + SRS transmission - if (Simulator::Now () > MilliSeconds (35)) + if (Simulator::Now () > MilliSeconds (50)) { NS_TEST_ASSERT_MSG_EQ ((uint32_t)mcs, (uint32_t)m_ulMcs, "Wrong UL MCS"); } diff --git a/src/lte/test/lte-test-mimo.cc b/src/lte/test/lte-test-mimo.cc index 4eb8f4b17..0adac1916 100644 --- a/src/lte/test/lte-test-mimo.cc +++ b/src/lte/test/lte-test-mimo.cc @@ -74,8 +74,10 @@ LenaTestMimoSuite::LenaTestMimoSuite () estThrDl.push_back (119100); // TTI 1 estimated throughput for TxMode 1 estThrDl.push_back (183600); // TTI 2 estimated throughput for TxMode 2 estThrDl.push_back (193400); // TTI 3 estimated throughput for TxMode 3 - AddTestCase (new LenaMimoTestCase(300, estThrDl, "ns3::RrFfMacScheduler")); - AddTestCase (new LenaMimoTestCase(300, estThrDl, "ns3::PfFfMacScheduler")); + AddTestCase (new LenaMimoTestCase(300, estThrDl, "ns3::RrFfMacScheduler", true)); + AddTestCase (new LenaMimoTestCase(300, estThrDl, "ns3::PfFfMacScheduler", true)); + AddTestCase (new LenaMimoTestCase(300, estThrDl, "ns3::RrFfMacScheduler", false)); + AddTestCase (new LenaMimoTestCase(300, estThrDl, "ns3::PfFfMacScheduler", false)); } @@ -83,18 +85,27 @@ LenaTestMimoSuite::LenaTestMimoSuite () static LenaTestMimoSuite lenaTestMimoSuite; std::string -LenaMimoTestCase::BuildNameString (uint16_t dist, std::string schedulerType) +LenaMimoTestCase::BuildNameString (uint16_t dist, std::string schedulerType, bool useIdealRrc) { std::ostringstream oss; oss << " UE distance " << dist << " m" << " Scheduler " << schedulerType; + if (useIdealRrc) + { + oss << ", ideal RRC"; + } + else + { + oss << ", real RRC"; + } return oss.str (); } -LenaMimoTestCase::LenaMimoTestCase (uint16_t dist, std::vector estThrDl, std::string schedulerType) - : TestCase (BuildNameString (dist, schedulerType)), +LenaMimoTestCase::LenaMimoTestCase (uint16_t dist, std::vector estThrDl, std::string schedulerType, bool useIdealRrc) + : TestCase (BuildNameString (dist, schedulerType, useIdealRrc)), m_dist (dist), m_estThrDl (estThrDl), - m_schedulerType (schedulerType) + m_schedulerType (schedulerType), + m_useIdealRrc (useIdealRrc) { } @@ -105,9 +116,10 @@ LenaMimoTestCase::~LenaMimoTestCase () void LenaMimoTestCase::DoRun (void) { + NS_LOG_FUNCTION (this << GetName ()); Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false)); Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010)); - + Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (m_useIdealRrc)); /** * Initialize Simulation Scenario: 1 eNB and m_nUser UEs diff --git a/src/lte/test/lte-test-mimo.h b/src/lte/test/lte-test-mimo.h index 91c43dee1..59400c979 100644 --- a/src/lte/test/lte-test-mimo.h +++ b/src/lte/test/lte-test-mimo.h @@ -34,7 +34,7 @@ namespace ns3 { class LenaMimoTestCase : public TestCase { public: - LenaMimoTestCase (uint16_t dist, std::vector estThrDl, std::string schedulerType); + LenaMimoTestCase (uint16_t dist, std::vector estThrDl, std::string schedulerType, bool useIdealRrc); virtual ~LenaMimoTestCase (); private: @@ -42,12 +42,13 @@ private: void GetRlcBufferSample (Ptr rlcStats, uint64_t imsi, uint8_t rnti); - static std::string BuildNameString (uint16_t dist, std::string schedulerType); + static std::string BuildNameString (uint16_t dist, std::string schedulerType, bool useIdealRrc); uint16_t m_nUser; uint16_t m_nLc; uint16_t m_dist; std::vector m_estThrDl; std::string m_schedulerType; + bool m_useIdealRrc; std::vector m_dlDataRxed; diff --git a/src/lte/test/test-lte-antenna.cc b/src/lte/test/test-lte-antenna.cc index 67605540b..d81ce24b5 100644 --- a/src/lte/test/test-lte-antenna.cc +++ b/src/lte/test/test-lte-antenna.cc @@ -35,6 +35,8 @@ #include "ns3/lte-enb-net-device.h" #include "ns3/ff-mac-scheduler.h" +#include "ns3/lte-global-pathloss-database.h" + #include "lte-test-sinr-chunk-processor.h" NS_LOG_COMPONENT_DEFINE ("LteAntennaTest"); @@ -149,34 +151,60 @@ LteEnbAntennaTestCase::DoRun (void) enbphy->GetUplinkSpectrumPhy ()->AddDataSinrChunkProcessor (testUlSinr); + // keep track of all path loss values in two centralized objects + DownlinkLteGlobalPathlossDatabase dlPathlossDb; + UplinkLteGlobalPathlossDatabase ulPathlossDb; + // we rely on the fact that LteHelper creates the DL channel object first, then the UL channel object, + // hence the former will have index 0 and the latter 1 + Config::Connect ("/ChannelList/0/PathLoss", + MakeCallback (&DownlinkLteGlobalPathlossDatabase::UpdatePathloss, &dlPathlossDb)); + Config::Connect ("/ChannelList/1/PathLoss", + MakeCallback (&UplinkLteGlobalPathlossDatabase::UpdatePathloss, &ulPathlossDb)); + Simulator::Stop (Seconds (0.035)); Simulator::Run (); - const double enbTxPowerDbm = 30; // default eNB TX power over whole bandwdith const double ueTxPowerDbm = 10; // default UE TX power over whole bandwdith const double ktDbm = -174; // reference LTE noise PSD const double noisePowerDbm = ktDbm + 10 * log10 (25 * 180000); // corresponds to kT*bandwidth in linear units const double ueNoiseFigureDb = 9.0; // default UE noise figure const double enbNoiseFigureDb = 5.0; // default eNB noise figure - - double calculatedSinrDbDl = -INFINITY; - if (testDlSinr->GetSinr () != 0) - { - calculatedSinrDbDl = 10.0 * log10 (testDlSinr->GetSinr ()->operator[] (0)); - } - double calculatedSinrDbUl = -INFINITY; - if (testUlSinr->GetSinr () != 0) - { - calculatedSinrDbUl = 10.0 * log10 (testUlSinr->GetSinr ()->operator[] (0)); - } - - // remember that propagation loss is 0dB - double calculatedAntennaGainDbDl = - (enbTxPowerDbm - calculatedSinrDbDl - noisePowerDbm - ueNoiseFigureDb); - double calculatedAntennaGainDbUl = - (ueTxPowerDbm - calculatedSinrDbUl - noisePowerDbm - enbNoiseFigureDb); double tolerance = (m_antennaGainDb != 0) ? abs (m_antennaGainDb)*0.001 : 0.001; - NS_TEST_ASSERT_MSG_EQ_TOL (calculatedAntennaGainDbDl, m_antennaGainDb, tolerance, "Wrong DL antenna gain!"); - NS_TEST_ASSERT_MSG_EQ_TOL (calculatedAntennaGainDbUl, m_antennaGainDb, tolerance, "Wrong UL antenna gain!"); + + // first test with SINR from LteTestSinrChunkProcessor + // this can only be done for not-too-bad SINR otherwise the measurement won't be available + double expectedSinrDl = enbTxPowerDbm + m_antennaGainDb - noisePowerDbm + ueNoiseFigureDb; + if (expectedSinrDl > 0) + { + double calculatedSinrDbDl = -INFINITY; + if (testDlSinr->GetSinr () != 0) + { + calculatedSinrDbDl = 10.0 * log10 (testDlSinr->GetSinr ()->operator[] (0)); + } + // remember that propagation loss is 0dB + double calculatedAntennaGainDbDl = - (enbTxPowerDbm - calculatedSinrDbDl - noisePowerDbm - ueNoiseFigureDb); + NS_TEST_ASSERT_MSG_EQ_TOL (calculatedAntennaGainDbDl, m_antennaGainDb, tolerance, "Wrong DL antenna gain!"); + } + double expectedSinrUl = ueTxPowerDbm + m_antennaGainDb - noisePowerDbm + enbNoiseFigureDb; + if (expectedSinrUl > 0) + { + double calculatedSinrDbUl = -INFINITY; + if (testUlSinr->GetSinr () != 0) + { + calculatedSinrDbUl = 10.0 * log10 (testUlSinr->GetSinr ()->operator[] (0)); + } + double calculatedAntennaGainDbUl = - (ueTxPowerDbm - calculatedSinrDbUl - noisePowerDbm - enbNoiseFigureDb); + NS_TEST_ASSERT_MSG_EQ_TOL (calculatedAntennaGainDbUl, m_antennaGainDb, tolerance, "Wrong UL antenna gain!"); + } + + + // repeat the same tests with the LteGlobalPathlossDatabases + double measuredLossDl = dlPathlossDb.GetPathloss (1, 1); + NS_TEST_ASSERT_MSG_EQ_TOL (measuredLossDl, -m_antennaGainDb, tolerance, "Wrong DL loss!"); + double measuredLossUl = ulPathlossDb.GetPathloss (1, 1); + NS_TEST_ASSERT_MSG_EQ_TOL (measuredLossUl, -m_antennaGainDb, tolerance, "Wrong UL loss!"); + Simulator::Destroy (); }