diff --git a/doc/models/Makefile b/doc/models/Makefile index a25dc919e..19319ded0 100644 --- a/doc/models/Makefile +++ b/doc/models/Makefile @@ -117,8 +117,7 @@ SOURCEFIGS = \ $(SRC)/lte/doc/source/figures/ue-meas-piecewise-a1.dia \ $(SRC)/lte/doc/source/figures/ue-meas-piecewise-a1-hys.dia \ $(SRC)/lte/doc/source/figures/lte-cell-selection.dia \ - $(SRC)/lte/doc/source/figures/lte-cell-selection-open-access.dia \ - $(SRC)/lte/doc/source/figures/lte-cell-selection-closed-access.dia \ + $(SRC)/lte/doc/source/figures/lte-cell-selection-scenario.dia \ $(SRC)/lte/doc/source/figures/lte-handover-target-scenario.dia \ $(SRC)/lte/doc/source/figures/lena-dual-stripe.eps \ $(SRC)/lte/doc/source/figures/lte-mcs-index.eps \ @@ -259,8 +258,7 @@ IMAGES_EPS = \ $(FIGURES)/ue-meas-piecewise-a1.eps \ $(FIGURES)/ue-meas-piecewise-a1-hys.eps \ $(FIGURES)/lte-cell-selection.eps \ - $(FIGURES)/lte-cell-selection-open-access.eps \ - $(FIGURES)/lte-cell-selection-closed-access.eps \ + $(FIGURES)/lte-cell-selection-scenario.eps \ $(FIGURES)/lte-handover-target-scenario.eps \ $(FIGURES)/lena-dual-stripe.eps \ $(FIGURES)/lte-mcs-index.eps \ diff --git a/src/lte/doc/Makefile b/src/lte/doc/Makefile index 894819d9a..7ddc3aae6 100644 --- a/src/lte/doc/Makefile +++ b/src/lte/doc/Makefile @@ -38,8 +38,7 @@ IMAGES_DIA = \ $(FIGURES)/ue-meas-piecewise-a1.dia \ $(FIGURES)/ue-meas-piecewise-a1-hys.dia \ $(FIGURES)/lte-cell-selection.dia \ - $(FIGURES)/lte-cell-selection-open-access.dia \ - $(FIGURES)/lte-cell-selection-closed-access.dia \ + $(FIGURES)/lte-cell-selection-scenario.dia \ $(FIGURES)/lte-handover-target-scenario.dia diff --git a/src/lte/doc/source/figures/lte-cell-selection-closed-access.dia b/src/lte/doc/source/figures/lte-cell-selection-closed-access.dia deleted file mode 100644 index 52b593607..000000000 Binary files a/src/lte/doc/source/figures/lte-cell-selection-closed-access.dia and /dev/null differ diff --git a/src/lte/doc/source/figures/lte-cell-selection-open-access.dia b/src/lte/doc/source/figures/lte-cell-selection-open-access.dia deleted file mode 100644 index c3f851cdf..000000000 Binary files a/src/lte/doc/source/figures/lte-cell-selection-open-access.dia and /dev/null differ diff --git a/src/lte/doc/source/figures/lte-cell-selection-scenario.dia b/src/lte/doc/source/figures/lte-cell-selection-scenario.dia new file mode 100644 index 000000000..4e9429a15 Binary files /dev/null and b/src/lte/doc/source/figures/lte-cell-selection-scenario.dia differ diff --git a/src/lte/doc/source/lte-references.rst b/src/lte/doc/source/lte-references.rst index d9e5d58dc..a8b6761d1 100644 --- a/src/lte/doc/source/lte-references.rst +++ b/src/lte/doc/source/lte-references.rst @@ -42,8 +42,6 @@ References .. [TR36814] 3GPP TR 36.814 "E-UTRA Further advancements for E-UTRA physical layer aspects" -.. [TS36922] 3GPP TS 36.922 "E-UTRA TDD Home eNode B (HeNB) Radio Frequency (RF) requirements analysis" - .. [R1-081483] 3GPP R1-081483 `"Conveying MCS and TB size via PDCCH" `_ diff --git a/src/lte/doc/source/lte-testing.rst b/src/lte/doc/source/lte-testing.rst index 385a93311..2a45d7241 100644 --- a/src/lte/doc/source/lte-testing.rst +++ b/src/lte/doc/source/lte-testing.rst @@ -1019,67 +1019,30 @@ Initial cell selection ---------------------- The test suite `lte-cell-selection` is responsible for verifying the -:ref:`sec-initial-cell-selection` procedure. Included in the suite are 3 short -test cases using ideal RRC protocol and the same test cases but using real RRC -protocol. +:ref:`sec-initial-cell-selection` procedure. The test is a simulation of a small +etwork of 4 non-CSG cells and 2 non-CSG cells. Several static UEs are then +placed at predefined locations and with initial cell selection procedure +enabled. Thus the UEs enters the simulation without being attached to any cell. -Each test case is a simulation of a small network of 4 cells. Each eNodeB is -equipped with directional antenna (parabolic model) and is arranged so that some -of their coverage are overlapping with other eNodeB. They are configured using -the same Tx Power. Several static UEs are then placed at predefined locations -and with initial cell selection procedure enabled. Thus the UEs enters the -simulation without being attached to any cell. +At predefined check point times during the simulation, the test verifies that +every UE is attached to the right cell. Moreover, the test also ensures that the +UE is properly connected, i.e., its final state is `CONNECTED_NORMALLY`. Figure +:ref:`fig-lte-cell-selection-scenario` depicts the network layout and the +expected result. -At the end of the simulation, the test verifies that every UE is attached to the -right cell. Moreover, the test also ensures that the UE is properly connected -(i.e. its final state is `CONNECTED_NORMALLY`). +.. _fig-lte-cell-selection-scenario: -The first test case is a scenario with open access cells, i.e. without Closed -Subscriber Group (CSG). The result shows that the UEs are attaching to the -expected cells, as shown in Figure :ref:`fig-lte-cell-selection-open-access` -below. Note that the grey area below each eNodeB only indicates the rough -directivity of the antenna, while the actual cell coverage is much wider and -larger. - -.. _fig-lte-cell-selection-open-access: - -.. figure:: figures/lte-cell-selection-open-access.* +.. figure:: figures/lte-cell-selection-scenario.* :scale: 80 % :align: center - Sample result of cell selection in open access scenario - -The second and third cases incorporate CSG into the simulation. 2 out of 4 cells -become a single CSG and implement closed access, while the other 2 cells stay -open. In a similar way, half of the UEs are configured as members of the CSG, -while the rest are not. The resulting simulation is depicted in Figure -:ref:`fig-lte-cell-selection-closed-access` below. - -.. _fig-lte-cell-selection-closed-access: - -.. figure:: figures/lte-cell-selection-closed-access.* - :scale: 80 % - :align: center - - Sample result of cell selection in closed access scenario + Sample result of cell selection test It shows that CSG members may attach to either CSG or non-CSG cells, and simply choose the stronger one. On the other hand, non-members can only attach to non-CSG cells, even when they are actually receiving stronger signal from a CSG cell. -The CSG scenario reveals an interference issue experienced by the UE highlighted -in the figure above. The UE is positioned within the coverage of a CSG cell but -it is not a member of the CSG. The CSG cell becomes a source of major -interference to the UE and causing difficulties (i.e. low SINR) to the UE in its -attempt to attach (i.e. receiving MIB and SIB1) to the closest non-CSG cell. - -A real life CSG deployment typically implements interference coordination to -remedy such issue. Section 5.1 of [TS36922]_ describes frequency, time, and -spatial partitioning as possible approaches to interference coordination. -However, none of these approaches are implemented in this test suite. - - GTP-U protocol -------------- diff --git a/src/lte/test/lte-test-cell-selection.cc b/src/lte/test/lte-test-cell-selection.cc index 246da7910..7d0472f71 100644 --- a/src/lte/test/lte-test-cell-selection.cc +++ b/src/lte/test/lte-test-cell-selection.cc @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -55,92 +56,50 @@ namespace ns3 { LteCellSelectionTestSuite::LteCellSelectionTestSuite () : TestSuite ("lte-cell-selection", SYSTEM) { - // LogComponentEnable ("LteCellSelectionTest", LOG_PREFIX_ALL); - // LogComponentEnable ("LteCellSelectionTest", LOG_FUNCTION); - // LogComponentEnable ("LteSpectrumPhy", LOG_PREFIX_ALL); - // LogComponentEnable ("LteSpectrumPhy", LOG_DEBUG); + //LogComponentEnable ("LteCellSelectionTest", LOG_PREFIX_ALL); + //LogComponentEnable ("LteCellSelectionTest", LOG_FUNCTION); + //LogComponentEnable ("LteCellSelectionTest", LOG_INFO); + //LogComponentEnable ("LteSpectrumPhy", LOG_PREFIX_ALL); + //LogComponentEnable ("LteSpectrumPhy", LOG_DEBUG); - std::vector x; + std::ostringstream oss; + std::vector w; - /* - * <-- <-- - * ue1---CELL3 ue2---CELL4 ue3 - * / / - * / / - * / --> --> / - * ue4 CELL1---ue5 CELL2---ue6 - */ - x.clear (); // position x y z, csg expectedCellId - x.push_back (LteCellSelectionTestCase::UeSetup_t (Vector (-80, 20, 0), 0, 3)); - x.push_back (LteCellSelectionTestCase::UeSetup_t (Vector ( 80, 20, 0), 0, 4)); - x.push_back (LteCellSelectionTestCase::UeSetup_t (Vector (240, 20, 0), 0, 2)); - x.push_back (LteCellSelectionTestCase::UeSetup_t (Vector (-80, 10, 0), 0, 3)); - x.push_back (LteCellSelectionTestCase::UeSetup_t (Vector ( 80, 10, 0), 0, 1)); - x.push_back (LteCellSelectionTestCase::UeSetup_t (Vector (240, 10, 0), 0, 2)); - AddTestCase (new LteCellSelectionTestCase ("[EPC, ideal RRC] Open access", - true, true, false, x, - MilliSeconds (261)), - TestCase::QUICK); - AddTestCase (new LteCellSelectionTestCase ("[EPC, real RRC] Open access", - true, false, false, x, - MilliSeconds (279)), + w.clear (); + // x y csgMember + // checkPoint cell1, cell2 + w.push_back (LteCellSelectionTestCase::UeSetup_t (0.0, 1.55, false, + MilliSeconds (266), 1, 0)); + w.push_back (LteCellSelectionTestCase::UeSetup_t (0.0, 1.45, false, + MilliSeconds (266), 1, 0)); + w.push_back (LteCellSelectionTestCase::UeSetup_t (0.5, 2.0, false, + MilliSeconds (266), 1, 4)); + w.push_back (LteCellSelectionTestCase::UeSetup_t (0.5, 1.45, false, + MilliSeconds (341), 1, 4)); + w.push_back (LteCellSelectionTestCase::UeSetup_t (0.5, 0.55, true, + MilliSeconds (266), 2, 5)); + w.push_back (LteCellSelectionTestCase::UeSetup_t (0.5, 0.0, true, + MilliSeconds (266), 3, 6)); + w.push_back (LteCellSelectionTestCase::UeSetup_t (1.0, 0.55, true, + MilliSeconds (266), 5, 0)); + w.push_back (LteCellSelectionTestCase::UeSetup_t (1.0, 0.45, true, + MilliSeconds (266), 6, 0)); + + AddTestCase (new LteCellSelectionTestCase ("EPC, ideal RRC, RngNum=1", + true, true, + 60.0, 20.0, w, 1), + // isd txpow rngrun TestCase::QUICK); - /* - * <-- <-- - * ue1---CELL3 ue2---CELL4 ue3 - * (1) (1) (1) / (0) /(1) - * / / - * --> / --> / - * ue4 CELL1 ue5 CELL2---ue6 - * (0) (1) (0) (0) (0) - * - * DL error rate of ue4 when attached to CELL3 = 0 - * when attached to CELL4 = 0.734758 - */ - x.clear (); // position x y z, csg expectedCellId - x.push_back (LteCellSelectionTestCase::UeSetup_t (Vector (-80, 20, 0), 1, 3)); - x.push_back (LteCellSelectionTestCase::UeSetup_t (Vector ( 80, 20, 0), 1, 4)); - x.push_back (LteCellSelectionTestCase::UeSetup_t (Vector (240, 20, 0), 1, 2)); - x.push_back (LteCellSelectionTestCase::UeSetup_t (Vector (-80, 10, 0), 0, 0)); - x.push_back (LteCellSelectionTestCase::UeSetup_t (Vector ( 80, 10, 0), 0, 4)); - x.push_back (LteCellSelectionTestCase::UeSetup_t (Vector (240, 10, 0), 0, 2)); - AddTestCase (new LteCellSelectionTestCase ("[EPC, ideal RRC] Some CSG 1", - true, true, true, x, - MilliSeconds (261)), - TestCase::EXTENSIVE); - AddTestCase (new LteCellSelectionTestCase ("[EPC, real RRC] Some CSG 1", - true, false, true, x, - MilliSeconds (279)), - TestCase::EXTENSIVE); - - /* - * <-- <-- - * ue1 CELL3 ue2---CELL4 ue3 - * (0) / (1) (0) (0) /(0) - * / / - * / --> --> / - * ue4 CELL1---ue5 CELL2---ue6 - * (1) (1) (1) (0) (1) - * - * DL error rate of ue1 when attached to CELL3 = 0 - * when attached to CELL4 = 0.777789 - */ - x.clear (); // position x y z, csg expectedCellId - x.push_back (LteCellSelectionTestCase::UeSetup_t (Vector (-80, 20, 0), 0, 0)); - x.push_back (LteCellSelectionTestCase::UeSetup_t (Vector ( 80, 20, 0), 0, 4)); - x.push_back (LteCellSelectionTestCase::UeSetup_t (Vector (240, 20, 0), 0, 2)); - x.push_back (LteCellSelectionTestCase::UeSetup_t (Vector (-80, 10, 0), 1, 3)); - x.push_back (LteCellSelectionTestCase::UeSetup_t (Vector ( 80, 10, 0), 1, 1)); - x.push_back (LteCellSelectionTestCase::UeSetup_t (Vector (240, 10, 0), 1, 2)); - AddTestCase (new LteCellSelectionTestCase ("[EPC, ideal RRC] Some CSG 2", - true, true, true, x, - MilliSeconds (261)), - TestCase::EXTENSIVE); - AddTestCase (new LteCellSelectionTestCase ("[EPC, real RRC] Some CSG 2", - true, false, true, x, - MilliSeconds (279)), - TestCase::EXTENSIVE); + for (int64_t i = 2; i <= 4; i++) + { + oss.str (""); + oss << "EPC, ideal RRC, RngNum=" << i; + AddTestCase (new LteCellSelectionTestCase (oss.str (), true, true, + 60.0, 20.0, w, 1), + // isd txpow rngrun + TestCase::TAKES_FOREVER); + } } // end of LteCellSelectionTestSuite::LteCellSelectionTestSuite () @@ -150,29 +109,33 @@ static LteCellSelectionTestSuite g_lteCellSelectionTestSuite; /* - * Test Case + * 6-cell Test Case */ -LteCellSelectionTestCase::UeSetup_t::UeSetup_t (Vector position, - uint32_t csgIdentity, - uint16_t expectedCellId) - : position (position), - csgIdentity (csgIdentity), - expectedCellId (expectedCellId) +LteCellSelectionTestCase::UeSetup_t::UeSetup_t ( + double relPosX, double relPosY, bool isCsgMember, Time checkPoint, + uint16_t expectedCellId1, uint16_t expectedCellId2) + : position (Vector (relPosX, relPosY, 0.0)), + isCsgMember (isCsgMember), + checkPoint (checkPoint), + expectedCellId1 (expectedCellId1), + expectedCellId2 (expectedCellId2) { } LteCellSelectionTestCase::LteCellSelectionTestCase ( - std::string name, bool isEpcMode, bool isIdealRrc, bool hasCsgDiversity, - std::vector ueSetupList, Time duration) + std::string name, bool isEpcMode, bool isIdealRrc, + double interSiteDistance, double enbTxPower, + std::vector ueSetupList, int64_t rngRun) : TestCase (name), m_isEpcMode (isEpcMode), m_isIdealRrc (isIdealRrc), - m_hasCsgDiversity (hasCsgDiversity), + m_interSiteDistance (interSiteDistance), + m_enbTxPower (enbTxPower), m_ueSetupList (ueSetupList), - m_duration (duration) + m_rngRun (rngRun) { NS_LOG_FUNCTION (this << GetName ()); m_lastState.resize (m_ueSetupList.size (), LteUeRrc::NUM_STATES); @@ -190,6 +153,8 @@ LteCellSelectionTestCase::DoRun () { NS_LOG_FUNCTION (this << GetName ()); + Config::SetGlobal ("RngRun", IntegerValue (m_rngRun)); + Ptr lteHelper = CreateObject (); lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel")); @@ -206,34 +171,35 @@ LteCellSelectionTestCase::DoRun () /* * The topology is the following: * - * + <--x <--x - Parabolic antenna model is used - * | Cell3 Cell4 - eNodeB 1 at ( 0, 10, 0), facing east - * 10 m | - eNodeB 2 at (160, 10, 0), facing east - * | - eNodeB 3 at ( 0, 20, 0), facing west - * + x--> x--> - eNodeB 4 at (160, 20, 0), facing west - * Cell1 Cell2 - UEs are placed according to input - * - UEs do not move during simulation - * +------ 160 m ------+ + * TODO */ // Create Nodes NodeContainer enbNodes; - enbNodes.Create (4); + enbNodes.Create (6); NodeContainer ueNodes; uint16_t nUe = m_ueSetupList.size (); ueNodes.Create (nUe); // Assign nodes to position Ptr positionAlloc = CreateObject (); - positionAlloc->Add (Vector ( 0.0, 10.0, 0.0)); - positionAlloc->Add (Vector (160.0, 10.0, 0.0)); - positionAlloc->Add (Vector ( 0.0, 20.0, 0.0)); - positionAlloc->Add (Vector (160.0, 20.0, 0.0)); - + // eNodeB + positionAlloc->Add (Vector ( 0.0, 2 * m_interSiteDistance, 0.0)); + positionAlloc->Add (Vector ( 0.0, m_interSiteDistance, 0.0)); + positionAlloc->Add (Vector ( 0.0, 0.0, 0.0)); + positionAlloc->Add (Vector (m_interSiteDistance, 2 * m_interSiteDistance, 0.0)); + positionAlloc->Add (Vector (m_interSiteDistance, m_interSiteDistance, 0.0)); + positionAlloc->Add (Vector (m_interSiteDistance, 0.0, 0.0)); + // UE std::vector::const_iterator itSetup; - for (itSetup = m_ueSetupList.begin (); itSetup != m_ueSetupList.end (); itSetup++) + for (itSetup = m_ueSetupList.begin (); + itSetup != m_ueSetupList.end (); itSetup++) { - positionAlloc->Add (itSetup->position); + Vector uePos (m_interSiteDistance * itSetup->position.x, + m_interSiteDistance * itSetup->position.y, + m_interSiteDistance * itSetup->position.z); + NS_LOG_INFO ("UE position " << uePos); + positionAlloc->Add (uePos); } MobilityHelper mobility; @@ -243,34 +209,50 @@ LteCellSelectionTestCase::DoRun () mobility.Install (ueNodes); // Create Devices and install them in the Nodes (eNB and UE) - lteHelper->SetEnbAntennaModelType ("ns3::ParabolicAntennaModel"); - lteHelper->SetEnbAntennaModelAttribute ("Beamwidth", DoubleValue (70)); - lteHelper->SetEnbAntennaModelAttribute ("MaxAttenuation", DoubleValue (20.0)); + int64_t stream = 1; NetDeviceContainer enbDevs; - lteHelper->SetEnbAntennaModelAttribute ("Orientation", DoubleValue (0)); - enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (0))); - enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (1))); - lteHelper->SetEnbAntennaModelAttribute ("Orientation", DoubleValue (180)); - enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (2))); - enbDevs.Add (lteHelper->InstallEnbDevice (enbNodes.Get (3))); + enbDevs = lteHelper->InstallEnbDevice (enbNodes); + stream += lteHelper->AssignStreams (enbDevs, stream); + + lteHelper->SetEnbCsgId (enbDevs.Get (1), 1, true); // cell ID 2 + lteHelper->SetEnbCsgId (enbDevs.Get (4), 1, true); // cell ID 5 NetDeviceContainer ueDevs; ueDevs = lteHelper->InstallUeDevice (ueNodes); + stream += lteHelper->AssignStreams (ueDevs, stream); - // Set the CSG ID - if (m_hasCsgDiversity) - { - lteHelper->SetEnbCsgId (enbDevs.Get (0), 1, true); - lteHelper->SetEnbCsgId (enbDevs.Get (2), 1, true); - } - + Time lastCheckPoint = MilliSeconds (0); NS_ASSERT (m_ueSetupList.size () == ueDevs.GetN ()); NetDeviceContainer::Iterator itDev; for (itSetup = m_ueSetupList.begin (), itDev = ueDevs.Begin (); itSetup != m_ueSetupList.end () || itDev != ueDevs.End (); itSetup++, itDev++) { - lteHelper->SetUeCsgId (*itDev, itSetup->csgIdentity); + if (itSetup->isCsgMember) + { + lteHelper->SetUeCsgId (*itDev, 1); + } + + Ptr ueDev = (*itDev)->GetObject (); + NS_ASSERT (ueDev != 0); + Simulator::Schedule (itSetup->checkPoint, + &LteCellSelectionTestCase::CheckPoint, + this, ueDev, + itSetup->expectedCellId1, itSetup->expectedCellId2); + + if (lastCheckPoint < itSetup->checkPoint) + { + lastCheckPoint = itSetup->checkPoint; + } + } + + // Tests + NS_ASSERT (m_ueSetupList.size () == ueDevs.GetN ()); + for (itSetup = m_ueSetupList.begin (), itDev = ueDevs.Begin (); + itSetup != m_ueSetupList.end () || itDev != ueDevs.End (); + itSetup++, itDev++) + { + Ptr ueDev = (*itDev)->GetObject (); } if (m_isEpcMode) @@ -321,89 +303,71 @@ LteCellSelectionTestCase::DoRun () } // Connect to trace sources in UEs - Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/MibReceived", - MakeCallback (&LteCellSelectionTestCase::MibReceivedCallback, this)); - Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/Sib1Received", - MakeCallback (&LteCellSelectionTestCase::Sib1ReceivedCallback, this)); - Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/Sib2Received", - MakeCallback (&LteCellSelectionTestCase::Sib2ReceivedCallback, this)); Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/StateTransition", - MakeCallback (&LteCellSelectionTestCase::StateTransitionCallback, this)); + MakeCallback (&LteCellSelectionTestCase::StateTransitionCallback, + this)); Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/InitialCellSelectionEndOk", - MakeCallback (&LteCellSelectionTestCase::InitialCellSelectionEndOkCallback, this)); + MakeCallback (&LteCellSelectionTestCase::InitialCellSelectionEndOkCallback, + this)); Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/InitialCellSelectionEndError", - MakeCallback (&LteCellSelectionTestCase::InitialCellSelectionEndErrorCallback, this)); + MakeCallback (&LteCellSelectionTestCase::InitialCellSelectionEndErrorCallback, + this)); Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished", - MakeCallback (&LteCellSelectionTestCase::ConnectionEstablishedCallback, this)); + MakeCallback (&LteCellSelectionTestCase::ConnectionEstablishedCallback, + this)); // Enable Idle mode cell selection lteHelper->Attach (ueDevs); // Run simulation - Simulator::Stop (m_duration); + Simulator::Stop (lastCheckPoint); Simulator::Run (); - // Tests - NS_ASSERT (m_ueSetupList.size () == ueDevs.GetN ()); - for (itSetup = m_ueSetupList.begin (), itDev = ueDevs.Begin (); - itSetup != m_ueSetupList.end () || itDev != ueDevs.End (); - itSetup++, itDev++) - { - Ptr ueDev = (*itDev)->GetObject (); - NS_ASSERT (ueDev != 0); - uint16_t actualCellId = ueDev->GetRrc ()->GetCellId (); - uint16_t expectedCellId = itSetup->expectedCellId; - NS_TEST_ASSERT_MSG_EQ (actualCellId, expectedCellId, - "IMSI " << ueDev->GetImsi () - << " has attached to an unexpected cell"); - if (expectedCellId > 0) - { - NS_TEST_ASSERT_MSG_EQ (m_lastState.at (ueDev->GetImsi () - 1), - LteUeRrc::CONNECTED_NORMALLY, - "UE " << ueDev->GetImsi () - << " is not at CONNECTED_NORMALLY state"); - } - } - + NS_LOG_INFO ("Simulation ends"); Simulator::Destroy (); -} // end of void LteCellSelectionTestCase::DoRun () - +} // end of void LteCellSelection6CellTestCase::DoRun () void -LteCellSelectionTestCase::MibReceivedCallback ( +LteCellSelectionTestCase::CheckPoint (Ptr ueDev, + uint16_t expectedCellId1, + uint16_t expectedCellId2) +{ + uint16_t actualCellId = ueDev->GetRrc ()->GetCellId (); + + if (expectedCellId2 == 0) + { + NS_TEST_ASSERT_MSG_EQ (actualCellId, expectedCellId1, + "IMSI " << ueDev->GetImsi () + << " has attached to an unexpected cell"); + } + else + { + bool pass = (actualCellId == expectedCellId1) || + (actualCellId == expectedCellId2); + NS_TEST_ASSERT_MSG_EQ (pass, true, + "IMSI " << ueDev->GetImsi () + << " has attached to an unexpected cell" + << " (actual: " << actualCellId << "," + << " expected: " << expectedCellId1 + << " or " << expectedCellId2 << ")"); + } + + if (expectedCellId1 > 0) + { + NS_TEST_ASSERT_MSG_EQ (m_lastState.at (ueDev->GetImsi () - 1), + LteUeRrc::CONNECTED_NORMALLY, + "UE " << ueDev->GetImsi () + << " is not at CONNECTED_NORMALLY state"); + } +} + + +void +LteCellSelectionTestCase::StateTransitionCallback ( std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, - uint16_t sourceCellId) -{ - NS_LOG_FUNCTION (this << imsi << cellId << rnti << sourceCellId); -} - - -void -LteCellSelectionTestCase::Sib1ReceivedCallback ( - std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, - uint16_t sourceCellId) -{ - NS_LOG_FUNCTION (this << imsi << cellId << rnti << sourceCellId); -} - - -void -LteCellSelectionTestCase::Sib2ReceivedCallback ( - std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti) -{ - NS_LOG_FUNCTION (this << imsi << cellId << rnti); -} - - -void -LteCellSelectionTestCase::StateTransitionCallback (std::string context, - uint64_t imsi, - uint16_t cellId, - uint16_t rnti, - LteUeRrc::State oldState, - LteUeRrc::State newState) + LteUeRrc::State oldState, LteUeRrc::State newState) { NS_LOG_FUNCTION (this << imsi << cellId << rnti << oldState << newState); m_lastState.at (imsi - 1) = newState; diff --git a/src/lte/test/lte-test-cell-selection.h b/src/lte/test/lte-test-cell-selection.h index 3c763d366..65c029b76 100644 --- a/src/lte/test/lte-test-cell-selection.h +++ b/src/lte/test/lte-test-cell-selection.h @@ -46,6 +46,8 @@ public: +class LteUeNetDevice; + /** * \brief Testing the initial cell selection procedure by UE at IDLE state in * the beginning of simulation. @@ -58,22 +60,27 @@ public: */ struct UeSetup_t { - Vector position; ///< The position where the UE will be spawned in the simulation. - uint32_t csgIdentity; ///< Closed Subscriber Group identity of the UE. - uint16_t expectedCellId; ///< The cell ID that the UE is expected to attach to (0 means that the UE should not attach to any cell). - UeSetup_t (Vector position, uint32_t csgIdentity, uint16_t expectedCellId); + Vector position; ///< The position, relative to the inter site distance, where the UE will be spawned in the simulation. + bool isCsgMember; ///< Whether UE is allowed access to CSG cell. + Time checkPoint; ///< The time in simulation when the UE is verified by the test script. + uint16_t expectedCellId1; ///< The cell ID that the UE is expected to attach to (0 means that the UE should not attach to any cell). + uint16_t expectedCellId2; ///< An alternative cell ID that the UE is expected to attach to (0 means that this no alternative cell is expected). + UeSetup_t (double relPosX, double relPosY, bool isCsgMember, Time checkPoint, + uint16_t expectedCellId1, uint16_t expectedCellId2); }; /** * \brief Creates an instance of the initial cell selection test case. * \param name name of this test * \param isEpcMode set to true for setting up simulation with EPC enabled - * \param ueSetupList an array of UE setup parameters - * \param duration length of simulation + * \param isIdealRrc if true, simulation uses Ideal RRC protocol, otherwise + * simulation uses Real RRC protocol + * TODO */ - LteCellSelectionTestCase (std::string name, bool isEpcMode, - bool isIdealRrc, bool hasCsgDiversity, - std::vector ueSetupList, Time duration); + LteCellSelectionTestCase (std::string name, bool isEpcMode, bool isIdealRrc, + double interSiteDistance, double enbTxPower, + std::vector ueSetupList, + int64_t rngRun); virtual ~LteCellSelectionTestCase (); @@ -84,14 +91,9 @@ private: */ virtual void DoRun (); - void MibReceivedCallback (std::string context, uint64_t imsi, - uint16_t cellId, uint16_t rnti, - uint16_t sourceCellId); - void Sib1ReceivedCallback (std::string context, uint64_t imsi, - uint16_t cellId, uint16_t rnti, - uint16_t sourceCellId); - void Sib2ReceivedCallback (std::string context, uint64_t imsi, - uint16_t cellId, uint16_t rnti); + void CheckPoint (Ptr ueDev, uint16_t expectedCellId1, + uint16_t expectedCellId2); + void StateTransitionCallback (std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, LteUeRrc::State oldState, LteUeRrc::State newState); @@ -102,39 +104,12 @@ private: void ConnectionEstablishedCallback (std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti); - /** - * \brief If true, then the simulation should be set up with EPC enabled. - */ bool m_isEpcMode; - - /** - * \brief If true, then the simulation should be set up with ideal RRC - * protocol, otherwise real RRC protocol is used. - */ bool m_isIdealRrc; - - /** - * \brief If true, then the west cells in the simulation will be CSG cell, - * while the east cells will be non-CSG cells. - */ - bool m_hasCsgDiversity; - - /** - * \brief The list of UE setups to be used during the test execution. - */ + double m_interSiteDistance; + double m_enbTxPower; std::vector m_ueSetupList; - - /** - * \brief The length of the simulation. - * - * The shortest possible simulation length for testing initial cell selection - * is 206 milliseconds. If RRC_CONNECTED state is required, then the length - * should be extended to 261 milliseconds in ideal RRC protocol, or at least - * 278 milliseconds in real RRC protocol. Moreover, scenarios which expect - * failure in initial cell selection procedure might want to extend this even - * further to give the UE the chance to retry the procedure. - */ - Time m_duration; + int64_t m_rngRun; /// The current UE RRC state. std::vector m_lastState; @@ -142,6 +117,7 @@ private: }; // end of class LteCellSelectionTestCase + } // end of namespace ns3