25#include <ns3/boolean.h>
26#include <ns3/callback.h>
27#include <ns3/config.h>
28#include <ns3/double.h>
30#include <ns3/ff-mac-scheduler.h>
31#include <ns3/internet-stack-helper.h>
32#include <ns3/ipv4-address-helper.h>
33#include <ns3/ipv4-interface-container.h>
34#include <ns3/ipv4-static-routing-helper.h>
36#include <ns3/lte-common.h>
37#include <ns3/lte-enb-net-device.h>
38#include <ns3/lte-enb-phy.h>
39#include <ns3/lte-enb-rrc.h>
40#include <ns3/lte-helper.h>
41#include <ns3/lte-ue-net-device.h>
42#include <ns3/lte-ue-phy.h>
43#include <ns3/lte-ue-rrc.h>
44#include <ns3/mobility-helper.h>
45#include <ns3/net-device-container.h>
46#include <ns3/node-container.h>
47#include <ns3/point-to-point-epc-helper.h>
48#include <ns3/point-to-point-helper.h>
49#include <ns3/simulator.h>
50#include <ns3/string.h>
66 uint8_t componentCarrierId)
87 :
TestSuite(
"lte-ue-measurements", SYSTEM)
255 m_rsrpDbmUeServingCell(rsrpDbmUe1),
256 m_rsrpDbmUeNeighborCell(rsrpDbmUe2),
257 m_rsrqDbUeServingCell(rsrqDbUe1),
258 m_rsrqDbUeNeighborCell(rsrqDbUe2)
260 NS_LOG_INFO(
"Test UE Measurements d1 = " << d1 <<
" m. and d2 = " << d2 <<
" m.");
277 lteHelper->SetAttribute(
"PathlossModel",
StringValue(
"ns3::FriisSpectrumPropagationLossModel"));
278 lteHelper->SetAttribute(
"UseIdealRrc",
BooleanValue(
false));
303 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
304 positionAlloc->Add(Vector(
m_d2,
m_d1, 0.0));
305 positionAlloc->Add(Vector(0.0,
m_d1, 0.0));
306 positionAlloc->Add(Vector(
m_d2, 0.0, 0.0));
308 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
309 mobility.SetPositionAllocator(positionAlloc);
310 mobility.Install(allNodes);
316 lteHelper->SetSchedulerType(
"ns3::RrFfMacScheduler");
318 enbDevs = lteHelper->InstallEnbDevice(enbNodes);
319 ueDevs1 = lteHelper->InstallUeDevice(ueNodes1);
320 ueDevs2 = lteHelper->InstallUeDevice(ueNodes2);
323 lteHelper->Attach(ueDevs1, enbDevs.
Get(0));
324 lteHelper->Attach(ueDevs2, enbDevs.
Get(1));
329 lteHelper->ActivateDataRadioBearer(ueDevs1, bearer);
330 lteHelper->ActivateDataRadioBearer(ueDevs2, bearer);
333 "/NodeList/2/DeviceList/0/ComponentCarrierMapUe/0/LteUePhy/ReportUeMeasurements",
335 Config::Connect(
"/NodeList/0/DeviceList/0/LteEnbRrc/RecvMeasurementReport",
339 "/NodeList/3/DeviceList/0/ComponentCarrierMapUe/0/LteUePhy/ReportUeMeasurements",
341 Config::Connect(
"/NodeList/1/DeviceList/0/LteEnbRrc/RecvMeasurementReport",
364 NS_LOG_DEBUG(
"UE serving cellId " << cellId <<
" Rxed RSRP " << rsrp <<
" thr "
372 NS_LOG_DEBUG(
"UE neighbor cellId " << cellId <<
" Rxed RSRP " << rsrp <<
" thr "
394 this <<
"Serving Cell: received IMSI " << imsi <<
" CellId " << cellId <<
" RNTI "
410 this <<
"Neighbor cell: received IMSI " << imsi <<
" CellId " << cellId <<
" RNTI "
433operator<<(std::vector<Time>& v,
const uint64_t& ms)
444operator<<(std::vector<uint8_t>& v,
const uint8_t& range)
455 :
TestSuite(
"lte-ue-measurements-piecewise-1", SYSTEM)
457 std::vector<Time> expectedTime;
458 std::vector<uint8_t> expectedRsrp;
470 expectedTime.clear();
471 expectedTime << 200 << 320 << 440 << 560 << 680 << 800 << 920 << 1040 << 1160 << 1280 << 1400
472 << 1520 << 1640 << 1760 << 1880 << 2000 << 2120;
473 expectedRsrp.clear();
474 expectedRsrp << 67 << 67 << 57 << 57 << 66 << 47 << 47 << 66 << 66 << 57 << 51 << 51 << 47 << 47
477 "Piecewise test case 1 - Event A1 with very low threshold",
485 expectedTime.clear();
486 expectedTime << 200 << 320 << 440 << 560 << 680 << 1000 << 1120 << 1240 << 1360 << 2000 << 2120;
487 expectedRsrp.clear();
488 expectedRsrp << 67 << 67 << 57 << 57 << 66 << 66 << 66 << 57 << 57 << 57 << 57;
490 "Piecewise test case 1 - Event A1 with normal threshold",
498 expectedTime.clear();
499 expectedTime << 264 << 384 << 504 << 624 << 744 << 1064 << 1184 << 1304 << 1424 << 2064 << 2184;
500 expectedRsrp.clear();
501 expectedRsrp << 67 << 67 << 57 << 66 << 66 << 66 << 66 << 57 << 51 << 57 << 57;
503 "Piecewise test case 1 - Event A1 with short time-to-trigger",
511 expectedTime.clear();
512 expectedTime << 328 << 448 << 568 << 688 << 808 << 1128 << 1248 << 1368 << 1488 << 2128;
513 expectedRsrp.clear();
514 expectedRsrp << 67 << 57 << 57 << 66 << 47 << 66 << 57 << 57 << 51 << 57;
516 "Piecewise test case 1 - Event A1 with long time-to-trigger",
524 expectedTime.clear();
525 expectedTime << 456 << 576 << 696 << 816 << 936 << 1056 << 1176 << 1296 << 1416 << 1536;
526 expectedRsrp.clear();
527 expectedRsrp << 57 << 57 << 66 << 47 << 47 << 66 << 66 << 57 << 51 << 51;
529 "Piecewise test case 1 - Event A1 with super time-to-trigger",
538 expectedTime.clear();
539 expectedTime << 200 << 320 << 440 << 560 << 680 << 1000 << 1120 << 1240 << 1360 << 1480 << 2200;
540 expectedRsrp.clear();
541 expectedRsrp << 67 << 67 << 57 << 57 << 66 << 66 << 66 << 57 << 57 << 51 << 67;
552 expectedTime.clear();
553 expectedRsrp.clear();
555 "Piecewise test case 1 - Event A1 with very high threshold",
566 expectedTime.clear();
567 expectedRsrp.clear();
569 "Piecewise test case 1 - Event A2 with very low threshold",
577 expectedTime.clear();
578 expectedTime << 800 << 920 << 1400 << 1520 << 1640 << 1760 << 1880;
579 expectedRsrp.clear();
580 expectedRsrp << 47 << 47 << 51 << 51 << 47 << 47 << 51;
582 "Piecewise test case 1 - Event A2 with normal threshold",
590 expectedTime.clear();
591 expectedTime << 864 << 984 << 1464 << 1584 << 1704 << 1824 << 1944;
592 expectedRsrp.clear();
593 expectedRsrp << 47 << 47 << 51 << 51 << 47 << 51 << 51;
595 "Piecewise test case 1 - Event A2 with short time-to-trigger",
603 expectedTime.clear();
604 expectedTime << 928 << 1048 << 1528 << 1648 << 1768 << 1888 << 2008;
605 expectedRsrp.clear();
606 expectedRsrp << 47 << 66 << 51 << 47 << 47 << 51 << 57;
608 "Piecewise test case 1 - Event A2 with long time-to-trigger",
616 expectedTime.clear();
617 expectedTime << 1656 << 1776 << 1896 << 2016 << 2136;
618 expectedRsrp.clear();
619 expectedRsrp << 47 << 47 << 51 << 57 << 57;
621 "Piecewise test case 1 - Event A2 with super time-to-trigger",
630 expectedTime.clear();
631 expectedTime << 800 << 920 << 1600 << 1720 << 1840 << 1960 << 2080;
632 expectedRsrp.clear();
633 expectedRsrp << 47 << 47 << 47 << 47 << 51 << 51 << 57;
644 expectedTime.clear();
645 expectedTime << 200 << 320 << 440 << 560 << 680 << 800 << 920 << 1040 << 1160 << 1280 << 1400
646 << 1520 << 1640 << 1760 << 1880 << 2000 << 2120;
647 expectedRsrp.clear();
648 expectedRsrp << 67 << 67 << 57 << 57 << 66 << 47 << 47 << 66 << 66 << 57 << 51 << 51 << 47 << 47
651 "Piecewise test case 1 - Event A2 with very high threshold",
664 expectedTime.clear();
665 expectedRsrp.clear();
713 std::vector<Time> expectedTime,
714 std::vector<uint8_t> expectedRsrp)
717 m_expectedTime(expectedTime),
718 m_expectedRsrp(expectedRsrp)
725 NS_FATAL_ERROR(
"Vectors of expected results are not of the same size");
745 lteHelper->SetAttribute(
"PathlossModel",
StringValue(
"ns3::FriisSpectrumPropagationLossModel"));
746 lteHelper->SetAttribute(
"UseIdealRrc",
BooleanValue(
true));
769 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
770 positionAlloc->Add(Vector(100.0, 0.0, 0.0));
772 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
773 mobility.SetPositionAllocator(positionAlloc);
774 mobility.Install(enbNodes);
775 mobility.Install(ueNodes);
784 lteHelper->SetSchedulerType(
"ns3::RrFfMacScheduler");
786 enbDevs = lteHelper->InstallEnbDevice(enbNodes);
787 ueDevs = lteHelper->InstallUeDevice(ueNodes);
794 lteHelper->Attach(ueDevs.
Get(0), enbDevs.
Get(0));
799 lteHelper->ActivateDataRadioBearer(ueDevs, bearer);
803 "/NodeList/0/DeviceList/0/LteEnbRrc/RecvMeasurementReport",
890 "Report should not have neighboring cells information");
896 "Reporting should not have occurred at "
914 "Reporting should not have occurred at this time");
917 "The RSRP observed differs with the reference RSRP");
959 :
TestSuite(
"lte-ue-measurements-piecewise-2", SYSTEM)
961 std::vector<Time> expectedTime;
962 std::vector<uint8_t> expectedRsrp;
979 expectedTime.clear();
980 expectedTime << 200 << 440 << 680 << 920 << 1160 << 1400 << 1640 << 1880 << 2120;
981 expectedRsrp.clear();
982 expectedRsrp << 73 << 63 << 72 << 52 << 72 << 56 << 52 << 56 << 59;
984 "Piecewise test case 2 - Event A1 with very low threshold",
992 expectedTime.clear();
993 expectedTime << 200 << 440 << 680 << 1000 << 1240 << 2000;
994 expectedRsrp.clear();
995 expectedRsrp << 73 << 63 << 72 << 72 << 59 << 59;
997 "Piecewise test case 2 - Event A1 with normal threshold",
1005 expectedTime.clear();
1006 expectedTime << 200 << 440 << 680 << 1000 << 1240 << 1480 << 2200;
1007 expectedRsrp.clear();
1008 expectedRsrp << 73 << 63 << 72 << 72 << 59 << 56 << 72;
1019 expectedTime.clear();
1020 expectedRsrp.clear();
1022 "Piecewise test case 2 - Event A1 with very high threshold",
1033 expectedTime.clear();
1034 expectedRsrp.clear();
1036 "Piecewise test case 2 - Event A2 with very low threshold",
1044 expectedTime.clear();
1045 expectedTime << 800 << 1400 << 1640 << 1880;
1046 expectedRsrp.clear();
1047 expectedRsrp << 52 << 56 << 52 << 56;
1049 "Piecewise test case 2 - Event A2 with normal threshold",
1057 expectedTime.clear();
1058 expectedTime << 800 << 1600 << 1840 << 2080;
1059 expectedRsrp.clear();
1060 expectedRsrp << 52 << 52 << 56 << 59;
1071 expectedTime.clear();
1072 expectedTime << 200 << 440 << 680 << 920 << 1160 << 1400 << 1640 << 1880 << 2120;
1073 expectedRsrp.clear();
1074 expectedRsrp << 73 << 63 << 72 << 52 << 72 << 56 << 52 << 56 << 59;
1076 "Piecewise test case 2 - Event A2 with very high threshold",
1088 expectedTime.clear();
1089 expectedTime << 800 << 1600;
1090 expectedRsrp.clear();
1091 expectedRsrp << 52 << 52;
1093 "Piecewise test case 2 - Event A3 with positive offset",
1101 expectedTime.clear();
1102 expectedTime << 800 << 1400 << 1640 << 1880;
1103 expectedRsrp.clear();
1104 expectedRsrp << 52 << 56 << 52 << 56;
1114 expectedTime.clear();
1115 expectedTime << 960 << 1560 << 1800 << 2040;
1116 expectedRsrp.clear();
1117 expectedRsrp << 52 << 56 << 56 << 59;
1119 "Piecewise test case 2 - Event A3 with short time-to-trigger",
1127 expectedTime.clear();
1128 expectedTime << 1720 << 1960 << 2200;
1129 expectedRsrp.clear();
1130 expectedRsrp << 52 << 56 << 72;
1132 "Piecewise test case 2 - Event A3 with super time-to-trigger",
1142 expectedTime.clear();
1143 expectedTime << 800 << 1000 << 1600 << 1840 << 2080 << 2200;
1144 expectedRsrp.clear();
1145 expectedRsrp << 52 << 72 << 52 << 56 << 59 << 72;
1157 expectedTime.clear();
1158 expectedTime << 400 << 800 << 1200 << 1440 << 1680 << 1920 << 2160;
1159 expectedRsrp.clear();
1160 expectedRsrp << 63 << 52 << 59 << 56 << 52 << 56 << 59;
1162 "Piecewise test case 2 - Event A3 with negative offset",
1174 expectedTime.clear();
1175 expectedTime << 200 << 440 << 680 << 920 << 1160 << 1400 << 1640 << 1880 << 2120;
1176 expectedRsrp.clear();
1177 expectedRsrp << 73 << 63 << 72 << 52 << 72 << 56 << 52 << 56 << 59;
1179 "Piecewise test case 2 - Event A4 with very low threshold",
1187 expectedTime.clear();
1188 expectedTime << 400 << 800 << 1400 << 1640 << 1880;
1189 expectedRsrp.clear();
1190 expectedRsrp << 63 << 52 << 56 << 52 << 56;
1192 "Piecewise test case 2 - Event A4 with normal threshold",
1200 expectedTime.clear();
1201 expectedTime << 560 << 960 << 1560 << 1800 << 2040;
1202 expectedRsrp.clear();
1203 expectedRsrp << 63 << 52 << 56 << 56 << 59;
1205 "Piecewise test case 2 - Event A4 with short time-to-trigger",
1213 expectedTime.clear();
1214 expectedTime << 1720 << 1960 << 2200;
1215 expectedRsrp.clear();
1216 expectedRsrp << 52 << 56 << 72;
1218 "Piecewise test case 2 - Event A4 with super time-to-trigger",
1227 expectedTime.clear();
1228 expectedTime << 400 << 800 << 1600 << 1840 << 2080;
1229 expectedRsrp.clear();
1230 expectedRsrp << 63 << 52 << 52 << 56 << 59;
1241 expectedTime.clear();
1242 expectedRsrp.clear();
1244 "Piecewise test case 2 - Event A4 with very high threshold",
1257 expectedTime.clear();
1258 expectedRsrp.clear();
1260 "Piecewise test case 2 - Event A5 with low-low threshold",
1269 "Piecewise test case 2 - Event A5 with low-normal threshold",
1278 "Piecewise test case 2 - Event A5 with low-high threshold",
1287 expectedTime.clear();
1288 expectedTime << 800 << 1400 << 1640 << 1880;
1289 expectedRsrp.clear();
1290 expectedRsrp << 52 << 56 << 52 << 56;
1292 "Piecewise test case 2 - Event A5 with normal-low threshold",
1300 expectedTime.clear();
1301 expectedTime << 800 << 1400 << 1640 << 1880;
1302 expectedRsrp.clear();
1303 expectedRsrp << 52 << 56 << 52 << 56;
1305 "Piecewise test case 2 - Event A5 with normal-normal threshold",
1313 expectedTime.clear();
1314 expectedTime << 960 << 1560 << 1800 << 2040;
1315 expectedRsrp.clear();
1316 expectedRsrp << 52 << 56 << 56 << 59;
1318 "Piecewise test case 2 - Event A5 with short time-to-trigger",
1326 expectedTime.clear();
1327 expectedTime << 1720 << 1960 << 2200;
1328 expectedRsrp.clear();
1329 expectedRsrp << 52 << 56 << 72;
1331 "Piecewise test case 2 - Event A5 with super time-to-trigger",
1340 expectedTime.clear();
1341 expectedTime << 800 << 1600 << 1840 << 2080;
1342 expectedRsrp.clear();
1343 expectedRsrp << 52 << 52 << 56 << 59;
1354 expectedTime.clear();
1355 expectedRsrp.clear();
1357 "Piecewise test case 2 - Event A5 with normal-high threshold",
1366 expectedTime.clear();
1367 expectedTime << 200 << 440 << 680 << 920 << 1160 << 1400 << 1640 << 1880 << 2120;
1368 expectedRsrp.clear();
1369 expectedRsrp << 73 << 63 << 72 << 52 << 72 << 56 << 52 << 56 << 59;
1371 "Piecewise test case 2 - Event A5 with high-low threshold",
1379 expectedTime.clear();
1380 expectedTime << 400 << 800 << 1400 << 1640 << 1880;
1381 expectedRsrp.clear();
1382 expectedRsrp << 63 << 52 << 56 << 52 << 56;
1384 "Piecewise test case 2 - Event A5 with high-normal threshold",
1392 expectedTime.clear();
1393 expectedRsrp.clear();
1395 "Piecewise test case 2 - Event A5 with high-high threshold",
1416 std::vector<Time> expectedTime,
1417 std::vector<uint8_t> expectedRsrp)
1420 m_expectedTime(expectedTime),
1421 m_expectedRsrp(expectedRsrp)
1428 NS_FATAL_ERROR(
"Vectors of expected results are not of the same size");
1448 lteHelper->SetAttribute(
"PathlossModel",
StringValue(
"ns3::FriisSpectrumPropagationLossModel"));
1449 lteHelper->SetAttribute(
"UseIdealRrc",
BooleanValue(
true));
1472 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
1473 positionAlloc->Add(Vector(600.0, 0.0, 0.0));
1474 positionAlloc->Add(Vector(50.0, 0.0, 0.0));
1476 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
1477 mobility.SetPositionAllocator(positionAlloc);
1478 mobility.Install(enbNodes);
1479 mobility.Install(ueNodes);
1488 lteHelper->SetSchedulerType(
"ns3::RrFfMacScheduler");
1490 enbDevs = lteHelper->InstallEnbDevice(enbNodes);
1491 ueDevs = lteHelper->InstallUeDevice(ueNodes);
1499 enbRrc2->SetAttribute(
"AdmitHandoverRequest",
BooleanValue(
false));
1502 lteHelper->Attach(ueDevs.
Get(0), enbDevs.
Get(0));
1507 lteHelper->ActivateDataRadioBearer(ueDevs, bearer);
1511 "/NodeList/0/DeviceList/0/LteEnbRrc/RecvMeasurementReport",
1575 std::string context,
1590 this <<
" Serving cellId=" << cellId
1603 "Unexpected report content");
1609 "Unexpected report content");
1610 std::list<LteRrcSap::MeasResultEutra>::iterator it =
1616 "Report contains cgi-info, which is not supported");
1619 "Report does not contain measured RSRP result");
1622 "Report does not contain measured RSRQ result");
1623 NS_LOG_DEBUG(
this <<
" Neighbour cellId=" << it->physCellId
1624 <<
" rsrp=" << (uint16_t)it->rsrpResult <<
" ("
1626 <<
" rsrq=" << (uint16_t)it->rsrqResult <<
" ("
1635 "Reporting should not have occurred at "
1653 "Reporting should not have occurred at this time");
1656 "The RSRP observed differs with the reference RSRP");
1699 :
TestSuite(
"lte-ue-measurements-piecewise-3", SYSTEM)
1701 std::vector<Time> expectedTime;
1722 expectedTime.clear();
1723 expectedTime << 200 << 440 << 680 << 920 << 1160 << 1400 << 1640 << 1880 << 2120;
1744 std::vector<Time> expectedTime)
1747 m_expectedTime(expectedTime)
1767 lteHelper->SetAttribute(
"PathlossModel",
StringValue(
"ns3::FriisSpectrumPropagationLossModel"));
1768 lteHelper->SetAttribute(
"UseIdealRrc",
BooleanValue(
true));
1793 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
1794 positionAlloc->Add(Vector(200.0, 0.0, 0.0));
1795 positionAlloc->Add(Vector(1000700.0, 0.0, 0.0));
1796 positionAlloc->Add(Vector(50.0, 0.0, 0.0));
1798 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
1799 mobility.SetPositionAllocator(positionAlloc);
1800 mobility.Install(enbNodes);
1801 mobility.Install(ueNodes);
1810 lteHelper->SetSchedulerType(
"ns3::RrFfMacScheduler");
1812 enbDevs = lteHelper->InstallEnbDevice(enbNodes);
1813 ueDevs = lteHelper->InstallUeDevice(ueNodes);
1821 enbRrc2->SetAttribute(
"AdmitHandoverRequest",
BooleanValue(
false));
1823 enbRrc3->SetAttribute(
"AdmitHandoverRequest",
BooleanValue(
false));
1826 lteHelper->Attach(ueDevs.
Get(0), enbDevs.
Get(0));
1831 lteHelper->ActivateDataRadioBearer(ueDevs, bearer);
1835 "/NodeList/0/DeviceList/0/LteEnbRrc/RecvMeasurementReport",
1868 std::string context,
1883 this <<
" Serving cellId=" << cellId
1896 "Unexpected report content");
1902 "Unexpected report content");
1903 std::list<LteRrcSap::MeasResultEutra>::iterator it =
1908 NS_ASSERT(it.physCellId == 2 || it.physCellId == 3);
1911 "Report contains cgi-info, which is not supported");
1914 "Report does not contain measured RSRP result");
1917 "Report does not contain measured RSRQ result");
1919 this <<
" Neighbour cellId=" << it.physCellId
1920 <<
" rsrp=" << (uint16_t)it.rsrpResult <<
" ("
1922 <<
" rsrq=" << (uint16_t)it.rsrqResult <<
" ("
1932 "Reporting should not have occurred at "
1943 "Reporting should not have occurred at this time");
1965 :
TestSuite(
"lte-ue-measurements-handover", SYSTEM)
1967 std::list<LteRrcSap::ReportConfigEutra> sourceConfigList;
1968 std::list<LteRrcSap::ReportConfigEutra> targetConfigList;
1969 std::vector<Time> expectedTime;
1970 std::vector<uint8_t> expectedRsrp;
1979 sourceConfigList.push_back(sourceConfig);
1988 targetConfigList.push_back(targetConfig);
1995 expectedTime.clear();
1996 expectedTime << 200 << 680 << 1200 << 1440 << 1680 << 1920;
1997 expectedRsrp.clear();
1998 expectedRsrp << 55 << 55 << 53 << 53 << 53 << 53;
2011 expectedTime.clear();
2012 expectedTime << 200 << 320 << 440 << 560 << 680 << 800 << 920 << 1200 << 1840;
2013 expectedRsrp.clear();
2014 expectedRsrp << 55 << 55 << 55 << 55 << 55 << 55 << 55 << 53 << 53;
2028 sourceConfigList.front().threshold1.range = 54;
2029 sourceConfigList.front().threshold2.range = 54;
2030 sourceConfigList.front().a3Offset = 1;
2031 targetConfigList.front().threshold1.range = 54;
2032 targetConfigList.front().threshold2.range = 54;
2033 targetConfigList.front().a3Offset = 1;
2038 expectedTime.clear();
2039 expectedTime << 200 << 440 << 680 << 920 << 1200 << 1440 << 1680 << 1920;
2040 expectedRsrp.clear();
2041 expectedRsrp << 55 << 55 << 55 << 55 << 53 << 53 << 53 << 53;
2053 expectedTime.clear();
2054 expectedRsrp.clear();
2066 expectedTime.clear();
2067 expectedTime << 1200 << 1440 << 1680 << 1920;
2068 expectedRsrp.clear();
2069 expectedRsrp << 53 << 53 << 53 << 53;
2081 expectedTime.clear();
2082 expectedTime << 1200 << 1440 << 1680 << 1920;
2083 expectedRsrp.clear();
2084 expectedRsrp << 53 << 53 << 53 << 53;
2096 expectedTime.clear();
2097 expectedTime << 1200 << 1440 << 1680 << 1920;
2098 expectedRsrp.clear();
2099 expectedRsrp << 53 << 53 << 53 << 53;
2111 expectedTime.clear();
2112 expectedTime << 1200 << 1440 << 1680 << 1920;
2113 expectedRsrp.clear();
2114 expectedRsrp << 53 << 53 << 53 << 53;
2126 expectedTime.clear();
2127 expectedTime << 1200 << 1440 << 1680 << 1920;
2128 expectedRsrp.clear();
2129 expectedRsrp << 53 << 53 << 53 << 53;
2141 expectedTime.clear();
2142 expectedTime << 1200 << 1440 << 1680 << 1920;
2143 expectedRsrp.clear();
2144 expectedRsrp << 53 << 53 << 53 << 53;
2155 sourceConfigList.front().threshold1.range = 52;
2156 targetConfigList.front().threshold1.range = 56;
2161 expectedTime.clear();
2162 expectedTime << 200 << 440 << 680 << 920;
2163 expectedRsrp.clear();
2164 expectedRsrp << 55 << 55 << 55 << 55;
2177 expectedTime.clear();
2178 expectedTime << 1200 << 1440 << 1680 << 1920;
2179 expectedRsrp.clear();
2180 expectedRsrp << 53 << 53 << 53 << 53;
2192 sourceConfigList.front().a3Offset = -30;
2194 targetConfigList.front().a3Offset = 30;
2195 expectedTime.clear();
2196 expectedTime << 200 << 440 << 680 << 920;
2197 expectedRsrp.clear();
2198 expectedRsrp << 55 << 55 << 55 << 55;
2211 expectedTime.clear();
2212 expectedTime << 200 << 440 << 680 << 920;
2213 expectedRsrp.clear();
2214 expectedRsrp << 55 << 55 << 55 << 55;
2226 sourceConfigList.front().threshold2.range = 52;
2228 targetConfigList.front().threshold2.range = 56;
2229 expectedTime.clear();
2230 expectedRsrp.clear();
2243 sourceConfigList.front().a3Offset = 1;
2244 sourceConfigList.front().threshold1.range = 0;
2245 sourceConfigList.front().threshold2.range = 0;
2247 targetConfigList.front().a3Offset = 1;
2248 targetConfigList.front().threshold1.range = 0;
2249 targetConfigList.front().threshold2.range = 0;
2252 sourceConfigList.front().timeToTrigger = 1024;
2253 targetConfigList.front().timeToTrigger = 100;
2254 expectedTime.clear();
2255 expectedTime << 1300 << 1540 << 1780;
2256 expectedRsrp.clear();
2257 expectedRsrp << 53 << 53 << 53;
2267 sourceConfigList.front().timeToTrigger = 1024;
2268 targetConfigList.front().timeToTrigger = 640;
2269 expectedTime.clear();
2270 expectedTime << 1224 << 1464 << 1704 << 1944 << 2840 << 3080 << 3320 << 3560 << 3800 << 4040;
2271 expectedRsrp.clear();
2272 expectedRsrp << 55 << 55 << 55 << 55 << 53 << 53 << 53 << 53 << 53 << 53;
2295 std::list<LteRrcSap::ReportConfigEutra> sourceConfigList,
2296 std::list<LteRrcSap::ReportConfigEutra> targetConfigList,
2297 std::vector<Time> expectedTime,
2298 std::vector<uint8_t> expectedRsrp,
2301 m_sourceConfigList(sourceConfigList),
2302 m_targetConfigList(targetConfigList),
2303 m_expectedTime(expectedTime),
2304 m_expectedRsrp(expectedRsrp),
2305 m_duration(duration)
2312 NS_FATAL_ERROR(
"Vectors of expected results are not of the same size");
2333 lteHelper->SetEpcHelper(epcHelper);
2334 lteHelper->SetAttribute(
"PathlossModel",
StringValue(
"ns3::FriisSpectrumPropagationLossModel"));
2335 lteHelper->SetAttribute(
"UseIdealRrc",
BooleanValue(
true));
2356 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2357 positionAlloc->Add(Vector(900.0, 0.0, 0.0));
2358 positionAlloc->Add(Vector(400.0, 0.0, 0.0));
2360 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2361 mobility.SetPositionAllocator(positionAlloc);
2362 mobility.Install(enbNodes);
2363 mobility.Install(ueNodes);
2366 Ptr<Node> pgw = epcHelper->GetPgwNode();
2370 remoteHostContainer.
Create(1);
2373 internet.Install(remoteHostContainer);
2382 ipv4h.
SetBase(
"1.0.0.0",
"255.0.0.0");
2389 remoteHostStaticRouting->AddNetworkRouteTo(
Ipv4Address(
"7.0.0.0"),
Ipv4Mask(
"255.0.0.0"), 1);
2400 enbDevs = lteHelper->InstallEnbDevice(enbNodes);
2401 ueDevs = lteHelper->InstallUeDevice(ueNodes);
2405 std::list<LteRrcSap::ReportConfigEutra>::const_iterator itReportConfig;
2412 measId = enbRrc1->AddUeMeasReportConfig(*itReportConfig).at(0);
2419 measId = enbRrc2->AddUeMeasReportConfig(*itReportConfig).at(0);
2424 internet.Install(ueNodes);
2435 ueStaticRouting->SetDefaultRoute(epcHelper->GetUeDefaultGatewayAddress(), 1);
2439 lteHelper->Attach(ueDevs.
Get(0), enbDevs.
Get(0));
2442 lteHelper->AddX2Interface(enbNodes);
2446 "/NodeList/3/DeviceList/0/LteEnbRrc/RecvMeasurementReport",
2451 "/NodeList/4/DeviceList/0/LteEnbRrc/RecvMeasurementReport",
2481 std::string context,
2490 bool isCorrectMeasId;
2496 else if (cellId == 2)
2506 if (isCorrectMeasId)
2511 this <<
" Serving cellId=" << cellId
2524 "Unexpected report content");
2530 "Unexpected report content");
2531 std::list<LteRrcSap::MeasResultEutra>::iterator it =
2538 "Report contains cgi-info, which is not supported");
2541 "Report does not contain measured RSRP result");
2544 "Report does not contain measured RSRQ result");
2545 NS_LOG_DEBUG(
this <<
" Neighbour cellId=" << it->physCellId
2546 <<
" rsrp=" << (uint16_t)it->rsrpResult <<
" ("
2548 <<
" rsrq=" << (uint16_t)it->rsrqResult <<
" ("
2557 "Reporting should not have occurred at "
2575 "Reporting should not have occurred at this time");
2578 "The RSRP observed differs with the reference RSRP");
Testing UE measurements in LTE with simulation of 2 eNodeB and 1 UE in a handover configuration.
~LteUeMeasurementsHandoverTestCase() override
std::vector< uint8_t >::iterator m_itExpectedRsrp
Pointer to the element of m_expectedRsrp which is expected to occur next in the simulation.
std::vector< Time > m_expectedTime
The list of expected time when measurement reports are received by eNodeB.
std::list< LteRrcSap::ReportConfigEutra > m_sourceConfigList
The list of active report triggering configuration for the source eNodeB.
void DoRun() override
Setup the simulation with the intended UE measurement reporting configuration, run it,...
std::set< uint8_t > m_expectedTargetCellMeasId
The list of measurement identities being tested in the target cell.
LteUeMeasurementsHandoverTestCase(std::string name, std::list< LteRrcSap::ReportConfigEutra > sourceConfigList, std::list< LteRrcSap::ReportConfigEutra > targetConfigList, std::vector< Time > expectedTime, std::vector< uint8_t > expectedRsrp, Time duration)
Constructor.
void RecvMeasurementReportCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, LteRrcSap::MeasurementReport report)
Triggers when either one of the eNodeBs receives measurement report from UE, then perform verificatio...
void DoTeardown() override
Runs at the end of the simulation, verifying that all expected measurement reports have been examined...
Time m_duration
Duration of simulation.
std::vector< Time >::iterator m_itExpectedTime
Pointer to the element of m_expectedTime which is expected to occur next in the simulation.
std::list< LteRrcSap::ReportConfigEutra > m_targetConfigList
The list of active report triggering configuration for the target eNodeB.
std::set< uint8_t > m_expectedSourceCellMeasId
The list of measurement identities being tested in the source cell.
std::vector< uint8_t > m_expectedRsrp
The list of expected values of RSRP (in 3GPP range unit) from the measurement reports received.
Test suite for generating calls to UE measurements test case ns3::LteUeMeasurementsHandoverTestCase.
LteUeMeasurementsHandoverTestSuite()
Testing UE measurements in LTE with simulation of 1 eNodeB and 1 UE in piecewise configuration and 12...
std::vector< Time > m_expectedTime
The list of expected time when measurement reports are received by eNodeB.
void TeleportVeryFar()
Teleport far function.
LteRrcSap::ReportConfigEutra m_config
The active report triggering configuration.
uint8_t m_expectedMeasId
The measurement identity being tested.
LteUeMeasurementsPiecewiseTestCase1(std::string name, LteRrcSap::ReportConfigEutra config, std::vector< Time > expectedTime, std::vector< uint8_t > expectedRsrp)
Constructor.
std::vector< Time >::iterator m_itExpectedTime
Pointer to the element of m_expectedTime which is expected to occur next in the simulation.
~LteUeMeasurementsPiecewiseTestCase1() override
void TeleportFar()
Teleport far function.
Ptr< MobilityModel > m_ueMobility
the mobility model
void TeleportVeryNear()
Teleport very near function.
void TeleportNear()
Teleport near function.
std::vector< uint8_t > m_expectedRsrp
The list of expected values of RSRP (in 3GPP range unit) from the measurement reports received.
void DoTeardown() override
Runs at the end of the simulation, verifying that all expected measurement reports have been examined...
std::vector< uint8_t >::iterator m_itExpectedRsrp
Pointer to the element of m_expectedRsrp which is expected to occur next in the simulation.
void RecvMeasurementReportCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, LteRrcSap::MeasurementReport report)
Triggers when eNodeB receives measurement report from UE, then perform verification on it.
void DoRun() override
Setup the simulation with the intended UE measurement reporting configuration, run it,...
Testing UE measurements in LTE with simulation of 2 eNodeB and 1 UE in piecewise configuration and 24...
Ptr< MobilityModel > m_ueMobility
the mobility model
~LteUeMeasurementsPiecewiseTestCase2() override
std::vector< Time >::iterator m_itExpectedTime
Pointer to the element of m_expectedTime which is expected to occur next in the simulation.
void TeleportVeryNear()
Teleport very near function.
std::vector< uint8_t > m_expectedRsrp
The list of expected values of RSRP (in 3GPP range unit) from the measurement reports received.
void DoTeardown() override
Runs at the end of the simulation, verifying that all expected measurement reports have been examined...
LteUeMeasurementsPiecewiseTestCase2(std::string name, LteRrcSap::ReportConfigEutra config, std::vector< Time > expectedTime, std::vector< uint8_t > expectedRsrp)
Constructor.
LteRrcSap::ReportConfigEutra m_config
The active report triggering configuration.
void TeleportFar()
Teleport far function.
void DoRun() override
Setup the simulation with the intended UE measurement reporting configuration, run it,...
void RecvMeasurementReportCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, LteRrcSap::MeasurementReport report)
Triggers when eNodeB receives measurement report from UE, then perform verification on it.
void TeleportVeryFar()
Teleport very far function.
void TeleportNear()
Teleport near function.
std::vector< uint8_t >::iterator m_itExpectedRsrp
Pointer to the element of m_expectedRsrp which is expected to occur next in the simulation.
uint8_t m_expectedMeasId
The measurement identity being tested.
std::vector< Time > m_expectedTime
The list of expected time when measurement reports are received by eNodeB.
Testing UE measurements in LTE with simulation of 3 eNodeB and 1 UE in piecewise configuration and 24...
Ptr< MobilityModel > m_enbMobility
the mobility model
LteUeMeasurementsPiecewiseTestCase3(std::string name, LteRrcSap::ReportConfigEutra config, std::vector< Time > expectedTime)
Constructor.
void DoTeardown() override
Runs at the end of the simulation, verifying that all expected measurement reports have been examined...
void DoRun() override
Setup the simulation with the intended UE measurement reporting configuration, run it,...
~LteUeMeasurementsPiecewiseTestCase3() override
void RecvMeasurementReportCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, LteRrcSap::MeasurementReport report)
Triggers when eNodeB receives measurement report from UE, then perform verification on it.
LteRrcSap::ReportConfigEutra m_config
The active report triggering configuration.
uint8_t m_expectedMeasId
The measurement identity being tested.
std::vector< Time > m_expectedTime
The list of expected time when measurement reports are received by eNodeB.
void TeleportEnbNear()
Teleport the eNb near function.
std::vector< Time >::iterator m_itExpectedTime
Pointer to the element of m_expectedTime which is expected to occur next in the simulation.
Test suite for generating calls to UE measurements test case ns3::LteUeMeasurementsPiecewiseTestCase1...
LteUeMeasurementsPiecewiseTestSuite1()
Test suite for generating calls to UE measurements test case ns3::LteUeMeasurementsPiecewiseTestCase2...
LteUeMeasurementsPiecewiseTestSuite2()
Test suite for generating calls to UE measurements test case ns3::LteUeMeasurementsPiecewiseTestCase3...
LteUeMeasurementsPiecewiseTestSuite3()
Test that UE measurements calculation works properly in a scenario with 2 eNodeBs and 2UEs.
double m_d1
distance between UE and ENB node pair
double m_rsrqDbUeServingCell
RSRQ in dBm UE 1.
double m_rsrpDbmUeServingCell
RSRP in dBm UE 1.
LteUeMeasurementsTestCase(std::string name, double d1, double d2, double rsrpDbmUe1, double rsrpDbmUe2, double rsrqDbUe1, double rsrqDbUe2)
Constructor.
void ReportUeMeasurements(uint16_t rnti, uint16_t cellId, double rsrp, double rsrq, bool servingCell)
Report UE measurements function.
void DoRun() override
Implementation to actually run this TestCase.
double m_rsrqDbUeNeighborCell
RSRQ in dBm UE 2.
double m_d2
distance between UE and other ENB node
double m_rsrpDbmUeNeighborCell
RSRP in dBm UE 2.
~LteUeMeasurementsTestCase() override
void RecvMeasurementReport(uint64_t imsi, uint16_t cellId, uint16_t rnti, LteRrcSap::MeasurementReport meas)
Reeive measurement report function.
Test that UE Measurements (see 36.214) calculation works fine in a multi-cell interference scenario.
LteUeMeasurementsTestSuite()
AttributeValue implementation for Boolean.
Class for representing data rates.
AttributeValue implementation for DataRate.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Hold variables of type enum.
This class contains the specification of EPS Bearers.
@ GBR_CONV_VOICE
GBR Conversational Voice.
static uint8_t Dbm2RsrpRange(double dbm)
convert an RSRP value in dBm to the corresponding range as per 3GPP TS 36.133 section 9....
static double RsrpRange2Dbm(uint8_t range)
converts an RSRP range to dBm as per 3GPP TS 36.133 section 9.1.4 RSRP Measurement Report Mapping
static double RsrqRange2Db(uint8_t range)
converts an RSRQ range to dB as per 3GPP TS 36.133 section 9.1.7 RSRQ Measurement Report Mapping
static uint8_t Db2RsrqRange(double db)
convert an RSRQ value in dB to the corresponding range as per 3GPP TS 36.133 section 9....
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Ipv4 addresses are stored in host order in this class.
Access to the IPv4 forwarding table, interfaces, and configuration.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
a class to represent an Ipv4 address mask
Helper class that adds ns3::Ipv4StaticRouting objects.
Ptr< Ipv4StaticRouting > GetStaticRouting(Ptr< Ipv4 > ipv4) const
Try and find the static routing protocol as either the main routing protocol or in the list of routin...
The eNodeB device implementation.
Helper class used to assign positions and mobility models to nodes.
Keep track of the current position and velocity of an object.
void SetPosition(const Vector &position)
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
uint32_t GetN() const
Get the number of Ptr<Node> stored in this container.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Build a set of PointToPointNetDevice objects.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
NetDeviceContainer Install(NodeContainer c)
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Hold variables of type string.
@ EXTENSIVE
Medium length test.
@ TAKES_FOREVER
Very long running test.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
std::string GetName() const
Simulation virtual time values and global simulation resolution.
int64_t GetMilliSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
AttributeValue implementation for Time.
Hold an unsigned integer type.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
void SetDefault(std::string name, const AttributeValue &value)
void Connect(std::string path, const CallbackBase &cb)
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
static LteUeMeasurementsPiecewiseTestSuite2 lteUeMeasurementsPiecewiseTestSuite2
Static variable for test initialization.
static LteUeMeasurementsHandoverTestSuite lteUeMeasurementsHandoverTestSuite
Static variable for test initialization.
static LteUeMeasurementsTestSuite lteUeMeasurementsTestSuite
Static variable for test initialization.
static LteUeMeasurementsPiecewiseTestSuite1 lteUeMeasurementsPiecewiseTestSuite1
Static variable for test initialization.
static LteUeMeasurementsPiecewiseTestSuite3 lteUeMeasurementsPiecewiseTestSuite3
Static variable for test initialization.
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
void ReportUeMeasurementsCallback(LteUeMeasurementsTestCase *testcase, std::string path, uint16_t rnti, uint16_t cellId, double rsrp, double rsrq, bool servingCell, uint8_t componentCarrierId)
std::vector< Time > & operator<<(std::vector< Time > &v, const uint64_t &ms)
void RecvMeasurementReportCallback(LteUeMeasurementsTestCase *testcase, std::string path, uint64_t imsi, uint16_t cellId, uint16_t rnti, LteRrcSap::MeasurementReport meas)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
static const Time UE_MEASUREMENT_REPORT_DELAY
Artificial delay of UE measurements procedure.
uint8_t rsrqResult
the RSRQ result
uint8_t rsrpResult
the RSRP result
bool haveMeasResultNeighCells
have measure result neighbor cells
std::list< MeasResultEutra > measResultListEutra
measure result list eutra
MeasResultPCell measResultPCell
measurement result primary cell
MeasurementReport structure.
MeasResults measResults
measure results
Specifies criteria for triggering of an E-UTRA measurement reporting event.
bool reportOnLeave
Indicates whether or not the UE shall initiate the measurement reporting procedure when the leaving c...
enum ns3::LteRrcSap::ReportConfigEutra::@62 eventId
Event enumeration.
enum ns3::LteRrcSap::ReportConfigEutra::@61 triggerType
Trigger enumeration.
uint8_t hysteresis
Parameter used within the entry and leave condition of an event triggered reporting condition.
@ RSRP
Reference Signal Received Power.
@ EVENT_A2
Event A2: Serving becomes worse than absolute threshold.
@ EVENT_A3
Event A3: Neighbour becomes amount of offset better than PCell.
@ EVENT_A4
Event A4: Neighbour becomes better than absolute threshold.
@ EVENT_A1
Event A1: Serving becomes better than absolute threshold.
@ EVENT_A5
Event A5: PCell becomes worse than absolute threshold1 AND Neighbour becomes better than another abso...
enum ns3::LteRrcSap::ReportConfigEutra::@65 reportInterval
Report interval enumeration.
ThresholdEutra threshold2
Threshold for event A5.
enum ns3::LteRrcSap::ReportConfigEutra::@63 triggerQuantity
Trigger type enumeration.
ThresholdEutra threshold1
Threshold for event A1, A2, A4, and A5.
int8_t a3Offset
Offset value for Event A3.
uint16_t timeToTrigger
Time during which specific criteria for the event needs to be met in order to trigger a measurement r...
@ THRESHOLD_RSRP
RSRP is used for the threshold.
enum ns3::LteRrcSap::ThresholdEutra::@60 choice
Threshold enumeration.
uint8_t range
Value range used in RSRP/RSRQ threshold.