LEFT | RIGHT |
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) | 3 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 NS_LOG_COMPONENT_DEFINE ("LteUeMeasurementsTest"); | 58 NS_LOG_COMPONENT_DEFINE ("LteUeMeasurementsTest"); |
59 | 59 |
60 // ===== LTE-UE-MEASUREMENTS TEST SUITE ==================================== // | 60 // ===== LTE-UE-MEASUREMENTS TEST SUITE ==================================== // |
61 | 61 |
62 void | 62 void |
63 ReportUeMeasurementsCallback (LteUeMeasurementsTestCase *testcase, | 63 ReportUeMeasurementsCallback (LteUeMeasurementsTestCase *testcase, |
64 std::string path, uint16_t rnti, uint16_t cellId, | 64 std::string path, uint16_t rnti, uint16_t cellId, |
65 double rsrp, double rsrq, bool servingCell, uint8_
t componentCarrierId) | 65 double rsrp, double rsrq, bool servingCell, uint8_
t componentCarrierId) |
66 { | 66 { |
67 NS_UNUSED(componentCarrierId); | 67 NS_UNUSED (componentCarrierId); |
68 testcase->ReportUeMeasurements (rnti, cellId, rsrp, rsrq, servingCell); | 68 testcase->ReportUeMeasurements (rnti, cellId, rsrp, rsrq, servingCell); |
69 } | 69 } |
70 | 70 |
71 void | 71 void |
72 RecvMeasurementReportCallback (LteUeMeasurementsTestCase *testcase, | 72 RecvMeasurementReportCallback (LteUeMeasurementsTestCase *testcase, |
73 std::string path, uint64_t imsi, uint16_t cellId, | 73 std::string path, uint64_t imsi, uint16_t cellId, |
74 uint16_t rnti, LteRrcSap::MeasurementReport meas) | 74 uint16_t rnti, LteRrcSap::MeasurementReport meas) |
75 { | 75 { |
76 testcase->RecvMeasurementReport (imsi, cellId, rnti, meas); | 76 testcase->RecvMeasurementReport (imsi, cellId, rnti, meas); |
77 } | 77 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue
(false)); | 142 Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue
(false)); |
143 Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010)); | 143 Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010)); |
144 Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (0.00005)); | 144 Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (0.00005)); |
145 Ptr<LteHelper> lteHelper = CreateObject<LteHelper> (); | 145 Ptr<LteHelper> lteHelper = CreateObject<LteHelper> (); |
146 lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumProp
agationLossModel")); | 146 lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumProp
agationLossModel")); |
147 lteHelper->SetAttribute ("UseIdealRrc", BooleanValue (false)); | 147 lteHelper->SetAttribute ("UseIdealRrc", BooleanValue (false)); |
148 | 148 |
149 //Disable Uplink Power Control | 149 //Disable Uplink Power Control |
150 Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (f
alse)); | 150 Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (f
alse)); |
151 | 151 |
152 #if 0 | 152 // LogComponentEnable ("LteUeMeasurementsTest", LOG_LEVEL_ALL); |
153 LogComponentEnable ("LteUeMeasurementsTest", LOG_LEVEL_ALL); | |
154 #endif | |
155 | 153 |
156 // Create Nodes: eNodeB and UE | 154 // Create Nodes: eNodeB and UE |
157 NodeContainer enbNodes; | 155 NodeContainer enbNodes; |
158 NodeContainer ueNodes1; | 156 NodeContainer ueNodes1; |
159 NodeContainer ueNodes2; | 157 NodeContainer ueNodes2; |
160 enbNodes.Create (2); | 158 enbNodes.Create (2); |
161 ueNodes1.Create (1); | 159 ueNodes1.Create (1); |
162 ueNodes2.Create (1); | 160 ueNodes2.Create (1); |
163 NodeContainer allNodes = NodeContainer (enbNodes, ueNodes1, ueNodes2); | 161 NodeContainer allNodes = NodeContainer (enbNodes, ueNodes1, ueNodes2); |
164 | 162 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 215 |
218 Simulator::Destroy (); | 216 Simulator::Destroy (); |
219 | 217 |
220 } | 218 } |
221 | 219 |
222 void | 220 void |
223 LteUeMeasurementsTestCase::ReportUeMeasurements (uint16_t rnti, uint16_t cellId, | 221 LteUeMeasurementsTestCase::ReportUeMeasurements (uint16_t rnti, uint16_t cellId, |
224 double rsrp, double rsrq, | 222 double rsrp, double rsrq, |
225 bool servingCell) | 223 bool servingCell) |
226 { | 224 { |
227 NS_UNUSED(rnti); | 225 NS_UNUSED (rnti); |
228 // need to allow for RRC connection establishment + CQI feedback reception + U
E measurements filtering (200 ms) | 226 // need to allow for RRC connection establishment + CQI feedback reception + U
E measurements filtering (200 ms) |
229 if (Simulator::Now () > MilliSeconds (400)) | 227 if (Simulator::Now () > MilliSeconds (400)) |
230 { | 228 { |
231 if (servingCell) | 229 if (servingCell) |
232 { | 230 { |
233 NS_LOG_DEBUG ("UE serving cellId " << cellId << " Rxed RSRP " << rsrp
<< " thr " << m_rsrpDbmUeServingCell << " RSRQ " << rsrq << " thr " << m_rsrqDbU
eServingCell); | 231 NS_LOG_DEBUG ("UE serving cellId " << cellId << " Rxed RSRP " << rsrp
<< " thr " << m_rsrpDbmUeServingCell << " RSRQ " << rsrq << " thr " << m_rsrqDbU
eServingCell); |
234 NS_TEST_ASSERT_MSG_EQ_TOL (m_rsrpDbmUeServingCell, rsrp, 0.2, "Wrong R
SRP UE 1"); | 232 NS_TEST_ASSERT_MSG_EQ_TOL (m_rsrpDbmUeServingCell, rsrp, 0.2, "Wrong R
SRP UE 1"); |
235 NS_TEST_ASSERT_MSG_EQ_TOL (m_rsrqDbUeServingCell, rsrq, 0.2, "Wrong RS
RQ UE 1"); | 233 NS_TEST_ASSERT_MSG_EQ_TOL (m_rsrqDbUeServingCell, rsrq, 0.2, "Wrong RS
RQ UE 1"); |
236 } | 234 } |
237 else | 235 else |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 | 521 |
524 LteUeMeasurementsPiecewiseTestCase1::LteUeMeasurementsPiecewiseTestCase1 ( | 522 LteUeMeasurementsPiecewiseTestCase1::LteUeMeasurementsPiecewiseTestCase1 ( |
525 std::string name, LteRrcSap::ReportConfigEutra config, | 523 std::string name, LteRrcSap::ReportConfigEutra config, |
526 std::vector<Time> expectedTime, std::vector<uint8_t> expectedRsrp) | 524 std::vector<Time> expectedTime, std::vector<uint8_t> expectedRsrp) |
527 : TestCase (name), | 525 : TestCase (name), |
528 m_config (config), | 526 m_config (config), |
529 m_expectedTime (expectedTime), | 527 m_expectedTime (expectedTime), |
530 m_expectedRsrp (expectedRsrp) | 528 m_expectedRsrp (expectedRsrp) |
531 { | 529 { |
532 // input sanity check | 530 // input sanity check |
533 uint16_t size = static_cast<uint16_t>(m_expectedTime.size ()); | 531 uint16_t size = static_cast<uint16_t> (m_expectedTime.size ()); |
534 | 532 |
535 if (size != m_expectedRsrp.size ()) | 533 if (size != m_expectedRsrp.size ()) |
536 { | 534 { |
537 NS_FATAL_ERROR ("Vectors of expected results are not of the same size"); | 535 NS_FATAL_ERROR ("Vectors of expected results are not of the same size"); |
538 } | 536 } |
539 | 537 |
540 m_itExpectedTime = m_expectedTime.begin (); | 538 m_itExpectedTime = m_expectedTime.begin (); |
541 m_itExpectedRsrp = m_expectedRsrp.begin (); | 539 m_itExpectedRsrp = m_expectedRsrp.begin (); |
542 | 540 |
543 NS_LOG_INFO (this << " name=" << name); | 541 NS_LOG_INFO (this << " name=" << name); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 hasEnded = m_itExpectedRsrp == m_expectedRsrp.end (); | 663 hasEnded = m_itExpectedRsrp == m_expectedRsrp.end (); |
666 NS_ASSERT (hasEnded); | 664 NS_ASSERT (hasEnded); |
667 } | 665 } |
668 | 666 |
669 void | 667 void |
670 LteUeMeasurementsPiecewiseTestCase1::RecvMeasurementReportCallback ( | 668 LteUeMeasurementsPiecewiseTestCase1::RecvMeasurementReportCallback ( |
671 std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, | 669 std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, |
672 LteRrcSap::MeasurementReport report) | 670 LteRrcSap::MeasurementReport report) |
673 { | 671 { |
674 NS_LOG_FUNCTION (this << context); | 672 NS_LOG_FUNCTION (this << context); |
675 NS_UNUSED(imsi); | 673 NS_UNUSED (imsi); |
676 NS_ASSERT (rnti == 1); | 674 NS_ASSERT (rnti == 1); |
677 (void)rnti; // make compiler happy | 675 (void)rnti; // make compiler happy |
678 NS_ASSERT (cellId == 1); | 676 NS_ASSERT (cellId == 1); |
679 (void)cellId; //make compiler happy | 677 (void)cellId; //make compiler happy |
680 | 678 |
681 if (report.measResults.measId == m_expectedMeasId) | 679 if (report.measResults.measId == m_expectedMeasId) |
682 { | 680 { |
683 // verifying the report completeness | 681 // verifying the report completeness |
684 LteRrcSap::MeasResults measResults = report.measResults; | 682 LteRrcSap::MeasResults measResults = report.measResults; |
685 NS_LOG_DEBUG (this << " rsrp=" << (uint16_t) measResults.rsrpResult | 683 NS_LOG_DEBUG (this << " rsrp=" << (uint16_t) measResults.rsrpResult |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 | 1109 |
1112 LteUeMeasurementsPiecewiseTestCase2::LteUeMeasurementsPiecewiseTestCase2 ( | 1110 LteUeMeasurementsPiecewiseTestCase2::LteUeMeasurementsPiecewiseTestCase2 ( |
1113 std::string name, LteRrcSap::ReportConfigEutra config, | 1111 std::string name, LteRrcSap::ReportConfigEutra config, |
1114 std::vector<Time> expectedTime, std::vector<uint8_t> expectedRsrp) | 1112 std::vector<Time> expectedTime, std::vector<uint8_t> expectedRsrp) |
1115 : TestCase (name), | 1113 : TestCase (name), |
1116 m_config (config), | 1114 m_config (config), |
1117 m_expectedTime (expectedTime), | 1115 m_expectedTime (expectedTime), |
1118 m_expectedRsrp (expectedRsrp) | 1116 m_expectedRsrp (expectedRsrp) |
1119 { | 1117 { |
1120 // input sanity check | 1118 // input sanity check |
1121 uint16_t size = static_cast<uint16_t>(m_expectedTime.size ()); | 1119 uint16_t size = static_cast<uint16_t> (m_expectedTime.size ()); |
1122 | 1120 |
1123 if (size != m_expectedRsrp.size ()) | 1121 if (size != m_expectedRsrp.size ()) |
1124 { | 1122 { |
1125 NS_FATAL_ERROR ("Vectors of expected results are not of the same size"); | 1123 NS_FATAL_ERROR ("Vectors of expected results are not of the same size"); |
1126 } | 1124 } |
1127 | 1125 |
1128 m_itExpectedTime = m_expectedTime.begin (); | 1126 m_itExpectedTime = m_expectedTime.begin (); |
1129 m_itExpectedRsrp = m_expectedRsrp.begin (); | 1127 m_itExpectedRsrp = m_expectedRsrp.begin (); |
1130 | 1128 |
1131 NS_LOG_INFO (this << " name=" << name); | 1129 NS_LOG_INFO (this << " name=" << name); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1258 hasEnded = m_itExpectedRsrp == m_expectedRsrp.end (); | 1256 hasEnded = m_itExpectedRsrp == m_expectedRsrp.end (); |
1259 NS_ASSERT (hasEnded); | 1257 NS_ASSERT (hasEnded); |
1260 } | 1258 } |
1261 | 1259 |
1262 void | 1260 void |
1263 LteUeMeasurementsPiecewiseTestCase2::RecvMeasurementReportCallback ( | 1261 LteUeMeasurementsPiecewiseTestCase2::RecvMeasurementReportCallback ( |
1264 std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, | 1262 std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, |
1265 LteRrcSap::MeasurementReport report) | 1263 LteRrcSap::MeasurementReport report) |
1266 { | 1264 { |
1267 NS_LOG_FUNCTION (this << context); | 1265 NS_LOG_FUNCTION (this << context); |
1268 NS_UNUSED(imsi); | 1266 NS_UNUSED (imsi); |
1269 NS_ASSERT (rnti == 1); | 1267 NS_ASSERT (rnti == 1); |
1270 (void)rnti; // make compiler happy | 1268 (void)rnti; // make compiler happy |
1271 NS_ASSERT (cellId == 1); | 1269 NS_ASSERT (cellId == 1); |
1272 (void)cellId; // make compiler happy | 1270 (void)cellId; // make compiler happy |
1273 | 1271 |
1274 if (report.measResults.measId == m_expectedMeasId) | 1272 if (report.measResults.measId == m_expectedMeasId) |
1275 { | 1273 { |
1276 // verifying the report completeness | 1274 // verifying the report completeness |
1277 LteRrcSap::MeasResults measResults = report.measResults; | 1275 LteRrcSap::MeasResults measResults = report.measResults; |
1278 NS_LOG_DEBUG (this << " Serving cellId=" << cellId | 1276 NS_LOG_DEBUG (this << " Serving cellId=" << cellId |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1665 std::vector<Time> expectedTime, std::vector<uint8_t> expectedRsrp, | 1663 std::vector<Time> expectedTime, std::vector<uint8_t> expectedRsrp, |
1666 Time duration) | 1664 Time duration) |
1667 : TestCase (name), | 1665 : TestCase (name), |
1668 m_sourceConfigList (sourceConfigList), | 1666 m_sourceConfigList (sourceConfigList), |
1669 m_targetConfigList (targetConfigList), | 1667 m_targetConfigList (targetConfigList), |
1670 m_expectedTime (expectedTime), | 1668 m_expectedTime (expectedTime), |
1671 m_expectedRsrp (expectedRsrp), | 1669 m_expectedRsrp (expectedRsrp), |
1672 m_duration (duration) | 1670 m_duration (duration) |
1673 { | 1671 { |
1674 // input sanity check | 1672 // input sanity check |
1675 uint16_t size = static_cast<uint16_t>(m_expectedTime.size ()); | 1673 uint16_t size = static_cast<uint16_t> (m_expectedTime.size ()); |
1676 | 1674 |
1677 if (size != m_expectedRsrp.size ()) | 1675 if (size != m_expectedRsrp.size ()) |
1678 { | 1676 { |
1679 NS_FATAL_ERROR ("Vectors of expected results are not of the same size"); | 1677 NS_FATAL_ERROR ("Vectors of expected results are not of the same size"); |
1680 } | 1678 } |
1681 | 1679 |
1682 m_itExpectedTime = m_expectedTime.begin (); | 1680 m_itExpectedTime = m_expectedTime.begin (); |
1683 m_itExpectedRsrp = m_expectedRsrp.begin (); | 1681 m_itExpectedRsrp = m_expectedRsrp.begin (); |
1684 | 1682 |
1685 NS_LOG_INFO (this << " name=" << name); | 1683 NS_LOG_INFO (this << " name=" << name); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1840 "Reporting should have occurred at " << m_itExpectedTim
e->GetSeconds () << "s"); | 1838 "Reporting should have occurred at " << m_itExpectedTim
e->GetSeconds () << "s"); |
1841 hasEnded = m_itExpectedRsrp == m_expectedRsrp.end (); | 1839 hasEnded = m_itExpectedRsrp == m_expectedRsrp.end (); |
1842 NS_ASSERT (hasEnded); | 1840 NS_ASSERT (hasEnded); |
1843 } | 1841 } |
1844 | 1842 |
1845 void | 1843 void |
1846 LteUeMeasurementsHandoverTestCase::RecvMeasurementReportCallback ( | 1844 LteUeMeasurementsHandoverTestCase::RecvMeasurementReportCallback ( |
1847 std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, | 1845 std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, |
1848 LteRrcSap::MeasurementReport report) | 1846 LteRrcSap::MeasurementReport report) |
1849 { | 1847 { |
1850 NS_UNUSED(imsi); | 1848 NS_UNUSED (imsi); |
1851 NS_UNUSED(rnti); | 1849 NS_UNUSED (rnti); |
1852 uint8_t measId = report.measResults.measId; | 1850 uint8_t measId = report.measResults.measId; |
1853 NS_LOG_FUNCTION (this << context << (uint16_t) measId); | 1851 NS_LOG_FUNCTION (this << context << (uint16_t) measId); |
1854 | 1852 |
1855 bool isCorrectMeasId; | 1853 bool isCorrectMeasId; |
1856 if (cellId == 1) | 1854 if (cellId == 1) |
1857 { | 1855 { |
1858 std::set<uint8_t>::iterator itMeasId = m_expectedSourceCellMeasId.find (me
asId); | 1856 std::set<uint8_t>::iterator itMeasId = m_expectedSourceCellMeasId.find (me
asId); |
1859 isCorrectMeasId = (itMeasId != m_expectedSourceCellMeasId.end ()); | 1857 isCorrectMeasId = (itMeasId != m_expectedSourceCellMeasId.end ()); |
1860 } | 1858 } |
1861 else if (cellId == 2) | 1859 else if (cellId == 2) |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1928 NS_TEST_ASSERT_MSG_EQ (timeNowMs, timeExpectedMs, | 1926 NS_TEST_ASSERT_MSG_EQ (timeNowMs, timeExpectedMs, |
1929 "Reporting should not have occurred at this tim
e"); | 1927 "Reporting should not have occurred at this tim
e"); |
1930 NS_TEST_ASSERT_MSG_EQ (observedRsrp, referenceRsrp, | 1928 NS_TEST_ASSERT_MSG_EQ (observedRsrp, referenceRsrp, |
1931 "The RSRP observed differs with the reference R
SRP"); | 1929 "The RSRP observed differs with the reference R
SRP"); |
1932 | 1930 |
1933 } // end of if (!hasEnded) | 1931 } // end of if (!hasEnded) |
1934 | 1932 |
1935 } // end of if (report.measResults.measId == correctMeasId) | 1933 } // end of if (report.measResults.measId == correctMeasId) |
1936 | 1934 |
1937 } // end of void LteUeMeasurementsHandoverTestCase::RecvMeasurementReportCallbac
k | 1935 } // end of void LteUeMeasurementsHandoverTestCase::RecvMeasurementReportCallbac
k |
LEFT | RIGHT |