9#include "ns3/boolean.h"
10#include "ns3/channel-condition-model.h"
11#include "ns3/config.h"
12#include "ns3/constant-position-mobility-model.h"
13#include "ns3/constant-velocity-mobility-model.h"
14#include "ns3/double.h"
16#include "ns3/mobility-helper.h"
18#include "ns3/rng-seed-manager.h"
19#include "ns3/simple-net-device.h"
20#include "ns3/simulator.h"
21#include "ns3/string.h"
23#include "ns3/three-gpp-propagation-loss-model.h"
24#include "ns3/three-gpp-v2v-propagation-loss-model.h"
54 void DoRun()
override;
73 :
TestCase(
"Test for the ThreeGppRmaPropagationLossModel class"),
91 testVector.
m_pt = 0.0;
92 testVector.
m_pr = -77.3784;
98 testVector.
m_pt = 0.0;
99 testVector.
m_pr = -87.2965;
105 testVector.
m_pt = 0.0;
106 testVector.
m_pr = -108.5577;
112 testVector.
m_pt = 0.0;
113 testVector.
m_pr = -140.3896;
119 testVector.
m_pt = 0.0;
120 testVector.
m_pr = -77.3784;
126 testVector.
m_pt = 0.0;
127 testVector.
m_pr = -95.7718;
133 testVector.
m_pt = 0.0;
134 testVector.
m_pr = -133.5223;
140 testVector.
m_pt = 0.0;
141 testVector.
m_pr = -160.5169;
150 nodes.Get(0)->AggregateObject(a);
152 nodes.Get(1)->AggregateObject(b);
161 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
false));
165 Vector posBs = Vector(0.0, 0.0, 35.0);
166 Vector posUt = Vector(testVector.
m_distance, 0.0, 1.5);
171 lossModel->SetChannelConditionModel(losCondModel);
175 lossModel->SetChannelConditionModel(nlosCondModel);
178 a->SetPosition(posBs);
179 b->SetPosition(posUt);
185 "Got unexpected rcv power");
215 void DoRun()
override;
234 :
TestCase(
"Test for the ThreeGppUmaPropagationLossModel class"),
252 testVector.
m_pt = 0.0;
253 testVector.
m_pr = -72.9380;
259 testVector.
m_pt = 0.0;
260 testVector.
m_pr = -86.2362;
266 testVector.
m_pt = 0.0;
267 testVector.
m_pr = -109.7252;
273 testVector.
m_pt = 0.0;
274 testVector.
m_pr = -137.6794;
280 testVector.
m_pt = 0.0;
281 testVector.
m_pr = -82.5131;
287 testVector.
m_pt = 0.0;
288 testVector.
m_pr = -106.1356;
294 testVector.
m_pt = 0.0;
295 testVector.
m_pr = -144.7641;
301 testVector.
m_pt = 0.0;
302 testVector.
m_pr = -172.0753;
311 nodes.Get(0)->AggregateObject(a);
313 nodes.Get(1)->AggregateObject(b);
322 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
false));
328 Vector posBs = Vector(0.0, 0.0, 25.0);
329 Vector posUt = Vector(testVector.
m_distance, 0.0, 1.5);
334 lossModel->SetChannelConditionModel(losCondModel);
338 lossModel->SetChannelConditionModel(nlosCondModel);
341 a->SetPosition(posBs);
342 b->SetPosition(posUt);
348 "Got unexpected rcv power");
378 void DoRun()
override;
397 :
TestCase(
"Test for the ThreeGppUmiPropagationLossModel class"),
415 testVector.
m_pt = 0.0;
416 testVector.
m_pr = -69.8591;
422 testVector.
m_pt = 0.0;
423 testVector.
m_pr = -88.4122;
429 testVector.
m_pt = 0.0;
430 testVector.
m_pr = -119.3114;
435 testVector.
m_pt = 0.0;
436 testVector.
m_pr = -147.2696;
441 testVector.
m_pt = 0.0;
442 testVector.
m_pr = -76.7563;
447 testVector.
m_pt = 0.0;
448 testVector.
m_pr = -107.9432;
453 testVector.
m_pt = 0.0;
454 testVector.
m_pr = -143.1886;
459 testVector.
m_pt = 0.0;
460 testVector.
m_pr = -167.8617;
468 nodes.Get(0)->AggregateObject(a);
470 nodes.Get(1)->AggregateObject(b);
479 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
false));
485 Vector posBs = Vector(0.0, 0.0, 10.0);
486 Vector posUt = Vector(testVector.
m_distance, 0.0, 1.5);
491 lossModel->SetChannelConditionModel(losCondModel);
495 lossModel->SetChannelConditionModel(nlosCondModel);
498 a->SetPosition(posBs);
499 b->SetPosition(posUt);
505 "Got unexpected rcv power");
535 void DoRun()
override;
554 :
TestCase(
"Test for the ThreeGppIndoorOfficePropagationLossModel class"),
573 testVector.
m_pt = 0.0;
574 testVector.
m_pr = -50.8072;
580 testVector.
m_pt = 0.0;
581 testVector.
m_pr = -63.7630;
587 testVector.
m_pt = 0.0;
588 testVector.
m_pr = -75.7750;
594 testVector.
m_pt = 0.0;
595 testVector.
m_pr = -80.9802;
601 testVector.
m_pt = 0.0;
602 testVector.
m_pr = -50.8072;
608 testVector.
m_pt = 0.0;
609 testVector.
m_pr = -73.1894;
615 testVector.
m_pt = 0.0;
616 testVector.
m_pr = -99.7824;
622 testVector.
m_pt = 0.0;
623 testVector.
m_pr = -111.3062;
632 nodes.Get(0)->AggregateObject(a);
634 nodes.Get(1)->AggregateObject(b);
643 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
false));
649 Vector posBs = Vector(0.0, 0.0, 3.0);
650 Vector posUt = Vector(testVector.
m_distance, 0.0, 1.5);
655 lossModel->SetChannelConditionModel(losCondModel);
659 lossModel->SetChannelConditionModel(nlosCondModel);
662 a->SetPosition(posBs);
663 b->SetPosition(posUt);
669 "Got unexpected rcv power");
709 void DoRun()
override;
728 :
TestCase(
"Test for the ThreeGppV2vUrbanPropagationLossModel class."),
746 testVector.
m_pt = 0.0;
747 testVector.
m_pr = -68.1913;
753 testVector.
m_pt = 0.0;
754 testVector.
m_pr = -84.8913;
760 testVector.
m_pt = 0.0;
761 testVector.
m_pr = -101.5913;
767 testVector.
m_pt = 0.0;
768 testVector.
m_pr = -80.0605;
774 testVector.
m_pt = 0.0;
775 testVector.
m_pr = -110.0605;
781 testVector.
m_pt = 0.0;
782 testVector.
m_pr = -140.0605;
791 nodes.Get(0)->AggregateObject(a);
793 nodes.Get(1)->AggregateObject(b);
802 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
false));
808 Vector posUe1 = Vector(0.0, 0.0, 1.6);
809 Vector posUe2 = Vector(testVector.
m_distance, 0.0, 1.6);
814 lossModel->SetChannelConditionModel(losCondModel);
818 lossModel->SetChannelConditionModel(nlosCondModel);
821 a->SetPosition(posUe1);
822 b->SetPosition(posUe2);
828 "Got unexpected rcv power");
868 void DoRun()
override;
887 :
TestCase(
"Test for the ThreeGppV2vHighwayPropagationLossModel"),
905 testVector.
m_pt = 0.0;
906 testVector.
m_pr = -66.3794;
912 testVector.
m_pt = 0.0;
913 testVector.
m_pr = -86.3794;
919 testVector.
m_pt = 0.0;
920 testVector.
m_pr = -106.3794;
926 testVector.
m_pt = 0.0;
927 testVector.
m_pr = -80.0605;
933 testVector.
m_pt = 0.0;
934 testVector.
m_pr = -110.0605;
940 testVector.
m_pt = 0.0;
941 testVector.
m_pr = -140.0605;
950 nodes.Get(0)->AggregateObject(a);
952 nodes.Get(1)->AggregateObject(b);
961 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
false));
967 Vector posUe1 = Vector(0.0, 0.0, 1.6);
968 Vector posUe2 = Vector(testVector.
m_distance, 0.0, 1.6);
973 lossModel->SetChannelConditionModel(losCondModel);
977 lossModel->SetChannelConditionModel(nlosCondModel);
980 a->SetPosition(posUe1);
981 b->SetPosition(posUe2);
987 "Got unexpected rcv power");
1005 void DoRun()
override;
1018 void RunTest(uint16_t testNum,
1019 std::string propagationLossModelType,
1023 bool shadowingEnabled,
1058 std::map<uint16_t , std::vector<double> >
1063 :
TestCase(
"Test to check if the shadow fading is correctly computed")
1088 std::string propagationLossModelType,
1092 bool shadowingEnabled,
1096 m_results[testNum] = std::vector<double>();
1104 a->SetPosition(Vector(0.0, 0.0, hBs));
1105 nodes.Get(0)->AggregateObject(a);
1108 nodes.Get(1)->AggregateObject(b);
1109 b->SetPosition(Vector(0.0, distance, hUt));
1110 b->SetVelocity(Vector(1.0, 0.0, 0.0));
1122 m_lossModel->SetChannelConditionModel(losCondModel);
1132 for (
int i = 0; i < 200; i++)
1181 testVector.
m_hBs = 25;
1182 testVector.
m_hUt = 1.6;
1190 testVector.
m_hBs = 25;
1191 testVector.
m_hUt = 1.6;
1199 testVector.
m_hBs = 25;
1200 testVector.
m_hUt = 1.6;
1208 testVector.
m_hBs = 10;
1209 testVector.
m_hUt = 1.6;
1217 testVector.
m_hBs = 3;
1218 testVector.
m_hUt = 1;
1226 testVector.
m_hBs = 1.6;
1227 testVector.
m_hUt = 1.6;
1235 testVector.
m_hBs = 1.6;
1236 testVector.
m_hUt = 1.6;
1245 testVector.
m_hBs = 25;
1246 testVector.
m_hUt = 1.6;
1254 testVector.
m_hBs = 10;
1255 testVector.
m_hUt = 1.6;
1261 uint16_t numSamples = 400;
1263 for (std::size_t tvIndex = 0; tvIndex <
m_testVectors.GetN(); tvIndex++)
1268 for (uint16_t sampleIndex = 0; sampleIndex < numSamples; sampleIndex++)
1280 std::vector<double> mean_vector;
1283 uint16_t numPositions =
m_results.at(0).size();
1284 for (uint16_t k = 0; k < numPositions; k++)
1290 mean += resIt.second.at(k);
1293 mean_vector.push_back(mean);
1304 std::vector<double> true_mean =
1309 for (std::size_t i = 0; i < mean_vector.size() / 2; i++)
1311 double z = (mean_vector.at(i) - true_mean.at(i)) /
1317 "Null hypothesis test (LOS case) for the shadowing component rejected");
1322 for (std::size_t i = mean_vector.size() / 2; i < mean_vector.size(); i++)
1324 double z = (mean_vector.at(i) - true_mean.at(i)) /
1330 "Null hypothesis test (NLOS case) for the shadowing component rejected");
1356 void DoRun()
override;
1388 bool interUeSpatialConsistency,
1389 const Vector& position,
1391 double o2iThreshold);
1395 :
TestCase(
"Test that co-located terminals perceive the same loss with "
1396 "InterUeSpatialConsistency")
1407 node->AddDevice(dev);
1411 mob->SetPosition(pos);
1412 node->AggregateObject(mob);
1418 bool interUeSpatialConsistency,
1419 const Vector& position,
1421 double o2iThreshold)
1426 if (scenario ==
"RMa")
1432 else if (scenario ==
"UMa")
1438 else if (scenario ==
"UMi")
1452 lossModel->SetAttribute(
"Frequency",
DoubleValue(frequency));
1453 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
true));
1454 condModel->SetAttribute(
"InterUeSpatialConsistency",
BooleanValue(interUeSpatialConsistency));
1455 condModel->SetAttribute(
"O2iThreshold",
DoubleValue(o2iThreshold));
1456 condModel->SetAttribute(
"O2iLowLossThreshold",
DoubleValue(0.5));
1457 condModel->SetAttribute(
"SiteNetDeviceTypes",
StringValue(
"ns3::SimpleNetDevice"));
1458 lossModel->SetChannelConditionModel(condModel);
1469 return {lossModel->CalcRxPower(0.0, tx, rx1),
1470 lossModel->CalcRxPower(0.0, rx2, tx),
1471 cond1->GetLosCondition() == cond2->GetLosCondition() &&
1472 cond1->GetO2iCondition() == cond2->GetO2iCondition() &&
1473 cond1->GetO2iLowHighCondition() == cond2->GetO2iLowHighCondition(),
1474 cond1->GetO2iCondition() == cond1Site2->GetO2iCondition()};
1483 const std::vector<Vector> positions{Vector(60.0, 0.0, 1.5),
1484 Vector(-35.0, 120.0, 1.5),
1485 Vector(200.0, -150.0, 1.5),
1486 Vector(90.0, 90.0, 1.5),
1487 Vector(-140.0, -30.0, 1.5)};
1488 for (
const std::string scenario : {
"RMa",
"UMa",
"UMi",
"InH"})
1492 for (
double frequency : {3.5e9, 28e9})
1494 for (
double o2iThreshold : {0.0, 0.5, 1.0})
1496 for (
const Vector& pos : positions)
1502 "Co-located terminals must obtain the same channel "
1503 "condition with InterUeSpatialConsistency ("
1504 << scenario <<
", O2iThreshold " << o2iThreshold
1508 "A terminal must obtain the same indoor state towards "
1509 "every site with InterUeSpatialConsistency ("
1510 << scenario <<
", O2iThreshold " << o2iThreshold
1515 "Co-located terminals must perceive the same loss "
1516 "with InterUeSpatialConsistency ("
1517 << scenario <<
", " << frequency / 1e9
1518 <<
" GHz, O2iThreshold " << o2iThreshold <<
")");
1526 bool anyDifferent =
false;
1527 for (
const Vector& pos : positions)
1530 anyDifferent |=
r.sameCondition && std::abs(
r.loss1 -
r.loss2) > 0.1;
1534 "Without InterUeSpatialConsistency, co-located terminals should "
1535 "draw independent shadowing realizations ("
1536 << scenario <<
")");
Test case for the inter-UE (drop-based) spatial consistency of TR 38.901 Sec.
ThreeGppColocatedSpatialConsistencyTestCase()
Ptr< MobilityModel > CreateNodeAt(const Vector &pos, bool site)
Create a node with an aggregated constant-position mobility model.
void DoRun() override
Implementation to actually run this TestCase.
ColocatedLosses ComputeColocatedLosses(const std::string &scenario, bool interUeSpatialConsistency, const Vector &position, double frequency, double o2iThreshold)
Compute the losses perceived by two co-located terminals.
Test case for the class ThreeGppIndoorOfficePropagationLossModel.
ThreeGppIndoorOfficePropagationLossModelTestCase()
Constructor.
void DoRun() override
Build the simulation scenario and run the tests.
double m_tolerance
tolerance
TestVectors< TestVector > m_testVectors
array containing all the test vectors
~ThreeGppIndoorOfficePropagationLossModelTestCase() override
Destructor.
3GPP Propagation models TestSuite
ThreeGppPropagationLossModelsTestSuite()
Test case for the class ThreeGppRmaPropagationLossModel.
ThreeGppRmaPropagationLossModelTestCase()
Constructor.
void DoRun() override
Build the simulation scenario and run the tests.
~ThreeGppRmaPropagationLossModelTestCase() override
Destructor.
double m_tolerance
tolerance
TestVectors< TestVector > m_testVectors
array containing all the test vectors
Test to check if the shadowing fading is correctly computed.
~ThreeGppShadowingTestCase() override
ThreeGppShadowingTestCase()
void DoRun() override
Implementation to actually run this TestCase.
std::map< uint16_t, std::vector< double > > m_results
used to store the test results
void ChangeChannelCondition(Ptr< ChannelConditionModel > ccm)
Change the channel condition model.
Ptr< ThreeGppPropagationLossModel > m_lossModel
the propagation loss model
TestVectors< TestVector > m_testVectors
array containing all the test vectors
void RunTest(uint16_t testNum, std::string propagationLossModelType, double hBs, double hUt, double distance, bool shadowingEnabled, double frequency)
Run the experiment.
void EvaluateLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b, uint16_t testNum)
Compute the propagation loss.
Test case for the class ThreeGppUmaPropagationLossModel.
double m_tolerance
tolerance
~ThreeGppUmaPropagationLossModelTestCase() override
Destructor.
TestVectors< TestVector > m_testVectors
array containing all the test vectors
void DoRun() override
Build the simulation scenario and run the tests.
ThreeGppUmaPropagationLossModelTestCase()
Constructor.
Test case for the class ThreeGppUmiStreetCanyonPropagationLossModel.
ThreeGppUmiPropagationLossModelTestCase()
Constructor.
~ThreeGppUmiPropagationLossModelTestCase() override
Destructor.
TestVectors< TestVector > m_testVectors
array containing all the test vectors
double m_tolerance
tolerance
void DoRun() override
Build the simulation scenario and run the tests.
Test case for the class ThreeGppV2vHighwayPropagationLossModel.
ThreeGppV2vHighwayPropagationLossModelTestCase()
Constructor.
~ThreeGppV2vHighwayPropagationLossModelTestCase() override
Destructor.
TestVectors< TestVector > m_testVectors
array containing all the test vectors
double m_tolerance
tolerance
void DoRun() override
Build the simulation scenario and run the tests.
Test case for the class ThreeGppV2vUrbanPropagationLossModel.
ThreeGppV2vUrbanPropagationLossModelTestCase()
Constructor.
~ThreeGppV2vUrbanPropagationLossModelTestCase() override
Destructor.
TestVectors< TestVector > m_testVectors
array containing all the test vectors
double m_tolerance
tolerance
void DoRun() override
Build the simulation scenario and run the tests.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
keep track of a set of node pointers.
Instantiate subclasses of ns3::Object.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
Smart pointer class similar to boost::intrusive_ptr.
static void SetRun(uint64_t run)
Set the run number of simulation.
static void SetSeed(uint32_t seed)
Set the seed.
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 void Run()
Run the simulation.
Hold variables of type string.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
TestCase(const TestCase &)=delete
Caller graph was not generated because of its size.
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
A simple way to store test vectors (for stimulus or from responses).
Base class for the 3GPP propagation models.
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if a condition is false, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#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_EXPECT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report if ...
#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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static PropagationLossModelsTestSuite g_propagationLossModelsTestSuite
Static variable for test initialization.
Result of ComputeColocatedLosses().
bool sameCondition
whether the two terminals obtain the same channel condition
double loss2
loss of the second terminal, in dB
bool sameIndoorStates
whether the first terminal obtains the same indoor state towards both sites
double loss1
loss of the first terminal, in dB
Struct containing the parameters for each test.
double m_frequency
carrier frequency in Hz
double m_pt
transmitted power in dBm
double m_pr
received power in dBm
bool m_isLos
if true LOS, if false NLOS
double m_distance
2D distance between UT and BS in meters
Struct containing the parameters for each test.
double m_pr
received power in dBm
double m_pt
transmitted power in dBm
bool m_isLos
if true LOS, if false NLOS
double m_distance
2D distance between UT and BS in meters
double m_frequency
carrier frequency in Hz
Struct containing the parameters for each test.
double m_distance
the initial 2D distance in meters between BS and UT in meters
double m_hBs
the BS height in meters
double m_frequency
channel frequency
double m_hUt
the UT height in meters
std::string m_propagationLossModelType
the propagation loss model type id
double m_shadowingStdLos
the standard deviation of the shadowing component in the LOS case in dB
double m_shadowingStdNlos
the standard deviation of the shadowing component in the NLOS case in dB
Struct containing the parameters for each test.
double m_pt
transmitted power in dBm
bool m_isLos
if true LOS, if false NLOS
double m_pr
received power in dBm
double m_frequency
carrier frequency in Hz
double m_distance
2D distance between UT and BS in meters
Struct containing the parameters for each test.
double m_frequency
carrier frequency in Hz
bool m_isLos
if true LOS, if false NLOS
double m_pr
received power in dBm
double m_distance
2D distance between UT and BS in meters
double m_pt
transmitted power in dBm
Struct containing the parameters for each test.
double m_distance
2D distance between UT and BS in meters
double m_pr
received power in dBm
double m_pt
transmitted power in dBm
double m_frequency
carrier frequency in Hz
bool m_isLos
if true LOS/NLOSv, if false NLOS
Struct containing the parameters for each test.
double m_frequency
carrier frequency in Hz
bool m_isLos
if true LOS/NLOSv, if false NLOS
double m_distance
2D distance between UT and BS in meters
double m_pt
transmitted power in dBm
double m_pr
received power in dBm