20#include "ns3/boolean.h"
21#include "ns3/channel-condition-model.h"
22#include "ns3/config.h"
23#include "ns3/constant-position-mobility-model.h"
24#include "ns3/constant-velocity-mobility-model.h"
25#include "ns3/double.h"
27#include "ns3/mobility-helper.h"
28#include "ns3/simulator.h"
30#include "ns3/three-gpp-propagation-loss-model.h"
31#include "ns3/three-gpp-v2v-propagation-loss-model.h"
61 void DoRun()
override;
80 :
TestCase(
"Test for the ThreeGppRmaPropagationLossModel class"),
98 testVector.
m_pt = 0.0;
99 testVector.
m_pr = -77.3784;
105 testVector.
m_pt = 0.0;
106 testVector.
m_pr = -87.2965;
112 testVector.
m_pt = 0.0;
113 testVector.
m_pr = -108.5577;
119 testVector.
m_pt = 0.0;
120 testVector.
m_pr = -140.3896;
126 testVector.
m_pt = 0.0;
127 testVector.
m_pr = -77.3784;
133 testVector.
m_pt = 0.0;
134 testVector.
m_pr = -95.7718;
140 testVector.
m_pt = 0.0;
141 testVector.
m_pr = -133.5223;
147 testVector.
m_pt = 0.0;
148 testVector.
m_pr = -160.5169;
167 CreateObject<ThreeGppRmaPropagationLossModel>();
168 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
false));
172 Vector posBs = Vector(0.0, 0.0, 35.0);
173 Vector posUt = Vector(testVector.
m_distance, 0.0, 1.5);
178 lossModel->SetChannelConditionModel(losCondModel);
182 lossModel->SetChannelConditionModel(nlosCondModel);
185 a->SetPosition(posBs);
186 b->SetPosition(posUt);
192 "Got unexpected rcv power");
222 void DoRun()
override;
241 :
TestCase(
"Test for the ThreeGppUmaPropagationLossModel class"),
259 testVector.
m_pt = 0.0;
260 testVector.
m_pr = -72.9380;
266 testVector.
m_pt = 0.0;
267 testVector.
m_pr = -86.2362;
273 testVector.
m_pt = 0.0;
274 testVector.
m_pr = -109.7252;
280 testVector.
m_pt = 0.0;
281 testVector.
m_pr = -137.6794;
287 testVector.
m_pt = 0.0;
288 testVector.
m_pr = -82.5131;
294 testVector.
m_pt = 0.0;
295 testVector.
m_pr = -106.1356;
301 testVector.
m_pt = 0.0;
302 testVector.
m_pr = -144.7641;
308 testVector.
m_pt = 0.0;
309 testVector.
m_pr = -172.0753;
328 CreateObject<ThreeGppUmaPropagationLossModel>();
329 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
false));
335 Vector posBs = Vector(0.0, 0.0, 25.0);
336 Vector posUt = Vector(testVector.
m_distance, 0.0, 1.5);
341 lossModel->SetChannelConditionModel(losCondModel);
345 lossModel->SetChannelConditionModel(nlosCondModel);
348 a->SetPosition(posBs);
349 b->SetPosition(posUt);
355 "Got unexpected rcv power");
385 void DoRun()
override;
404 :
TestCase(
"Test for the ThreeGppUmiPropagationLossModel class"),
422 testVector.
m_pt = 0.0;
423 testVector.
m_pr = -69.8591;
429 testVector.
m_pt = 0.0;
430 testVector.
m_pr = -88.4122;
436 testVector.
m_pt = 0.0;
437 testVector.
m_pr = -119.3114;
442 testVector.
m_pt = 0.0;
443 testVector.
m_pr = -147.2696;
448 testVector.
m_pt = 0.0;
449 testVector.
m_pr = -76.7563;
454 testVector.
m_pt = 0.0;
455 testVector.
m_pr = -107.9432;
460 testVector.
m_pt = 0.0;
461 testVector.
m_pr = -143.1886;
466 testVector.
m_pt = 0.0;
467 testVector.
m_pr = -167.8617;
485 CreateObject<ThreeGppUmiStreetCanyonPropagationLossModel>();
486 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
false));
492 Vector posBs = Vector(0.0, 0.0, 10.0);
493 Vector posUt = Vector(testVector.
m_distance, 0.0, 1.5);
498 lossModel->SetChannelConditionModel(losCondModel);
502 lossModel->SetChannelConditionModel(nlosCondModel);
505 a->SetPosition(posBs);
506 b->SetPosition(posUt);
512 "Got unexpected rcv power");
542 void DoRun()
override;
561 :
TestCase(
"Test for the ThreeGppIndoorOfficePropagationLossModel class"),
580 testVector.
m_pt = 0.0;
581 testVector.
m_pr = -50.8072;
587 testVector.
m_pt = 0.0;
588 testVector.
m_pr = -63.7630;
594 testVector.
m_pt = 0.0;
595 testVector.
m_pr = -75.7750;
601 testVector.
m_pt = 0.0;
602 testVector.
m_pr = -80.9802;
608 testVector.
m_pt = 0.0;
609 testVector.
m_pr = -50.8072;
615 testVector.
m_pt = 0.0;
616 testVector.
m_pr = -73.1894;
622 testVector.
m_pt = 0.0;
623 testVector.
m_pr = -99.7824;
629 testVector.
m_pt = 0.0;
630 testVector.
m_pr = -111.3062;
649 CreateObject<ThreeGppIndoorOfficePropagationLossModel>();
650 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
false));
656 Vector posBs = Vector(0.0, 0.0, 3.0);
657 Vector posUt = Vector(testVector.
m_distance, 0.0, 1.5);
662 lossModel->SetChannelConditionModel(losCondModel);
666 lossModel->SetChannelConditionModel(nlosCondModel);
669 a->SetPosition(posBs);
670 b->SetPosition(posUt);
676 "Got unexpected rcv power");
716 void DoRun()
override;
735 :
TestCase(
"Test for the ThreeGppV2vUrbanPropagationLossModel class."),
753 testVector.
m_pt = 0.0;
754 testVector.
m_pr = -68.1913;
760 testVector.
m_pt = 0.0;
761 testVector.
m_pr = -84.8913;
767 testVector.
m_pt = 0.0;
768 testVector.
m_pr = -101.5913;
774 testVector.
m_pt = 0.0;
775 testVector.
m_pr = -80.0605;
781 testVector.
m_pt = 0.0;
782 testVector.
m_pr = -110.0605;
788 testVector.
m_pt = 0.0;
789 testVector.
m_pr = -140.0605;
808 CreateObject<ThreeGppV2vUrbanPropagationLossModel>();
809 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
false));
815 Vector posUe1 = Vector(0.0, 0.0, 1.6);
816 Vector posUe2 = Vector(testVector.
m_distance, 0.0, 1.6);
821 lossModel->SetChannelConditionModel(losCondModel);
825 lossModel->SetChannelConditionModel(nlosCondModel);
828 a->SetPosition(posUe1);
829 b->SetPosition(posUe2);
835 "Got unexpected rcv power");
875 void DoRun()
override;
894 :
TestCase(
"Test for the ThreeGppV2vHighwayPropagationLossModel"),
912 testVector.
m_pt = 0.0;
913 testVector.
m_pr = -66.3794;
919 testVector.
m_pt = 0.0;
920 testVector.
m_pr = -86.3794;
926 testVector.
m_pt = 0.0;
927 testVector.
m_pr = -106.3794;
933 testVector.
m_pt = 0.0;
934 testVector.
m_pr = -80.0605;
940 testVector.
m_pt = 0.0;
941 testVector.
m_pr = -110.0605;
947 testVector.
m_pt = 0.0;
948 testVector.
m_pr = -140.0605;
967 CreateObject<ThreeGppV2vHighwayPropagationLossModel>();
968 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
false));
974 Vector posUe1 = Vector(0.0, 0.0, 1.6);
975 Vector posUe2 = Vector(testVector.
m_distance, 0.0, 1.6);
980 lossModel->SetChannelConditionModel(losCondModel);
984 lossModel->SetChannelConditionModel(nlosCondModel);
987 a->SetPosition(posUe1);
988 b->SetPosition(posUe2);
994 "Got unexpected rcv power");
1012 void DoRun()
override;
1024 void RunTest(uint16_t testNum,
1025 std::string propagationLossModelType,
1029 bool shadowingEnabled);
1062 std::map<uint16_t , std::vector<double> >
1067 :
TestCase(
"Test to check if the shadow fading is correctly computed")
1090 std::string propagationLossModelType,
1094 bool shadowingEnabled)
1097 m_results[testNum] = std::vector<double>();
1105 a->SetPosition(Vector(0.0, 0.0, hBs));
1110 b->SetPosition(Vector(0.0, distance, hUt));
1111 b->SetVelocity(Vector(1.0, 0.0, 0.0));
1132 for (
int i = 0; i < 200; i++)
1178 testVector.
m_hBs = 25;
1179 testVector.
m_hUt = 1.6;
1186 testVector.
m_hBs = 25;
1187 testVector.
m_hUt = 1.6;
1194 testVector.
m_hBs = 25;
1195 testVector.
m_hUt = 1.6;
1202 testVector.
m_hBs = 10;
1203 testVector.
m_hUt = 1.6;
1210 testVector.
m_hBs = 3;
1211 testVector.
m_hUt = 1;
1218 testVector.
m_hBs = 1.6;
1219 testVector.
m_hUt = 1.6;
1226 testVector.
m_hBs = 1.6;
1227 testVector.
m_hUt = 1.6;
1233 uint16_t numSamples = 250;
1235 for (std::size_t tvIndex = 0; tvIndex <
m_testVectors.GetN(); tvIndex++)
1240 for (uint16_t sampleIndex = 0; sampleIndex < numSamples; sampleIndex++)
1251 std::vector<double> mean_vector;
1254 uint16_t numPositions =
m_results.at(0).size();
1255 for (uint16_t k = 0; k < numPositions; k++)
1261 mean += resIt.second.at(k);
1264 mean_vector.push_back(mean);
1274 std::vector<double> true_mean =
1279 for (std::size_t i = 0; i < mean_vector.size() / 2; i++)
1281 double z = (mean_vector.at(i) - true_mean.at(i)) /
1287 "Null hypothesis test (LOS case) for the shadowing component rejected");
1292 for (std::size_t i = mean_vector.size() / 2; i < mean_vector.size(); i++)
1294 double z = (mean_vector.at(i) - true_mean.at(i)) /
1300 "Null hypothesis test (NLOS case) for the shadowing component rejected");
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.
void EvaluateLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b, uint8_t testNum)
Compute the propagation loss.
~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)
Run the experiment.
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.
AttributeValue implementation for Boolean.
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.
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.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Instantiate subclasses of ns3::Object.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
double CalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Returns the Rx Power taking into account all the PropagationLossModel(s) chained to the current one.
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 void Run()
Run the simulation.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
A simple way to store test vectors (for stimulus or from responses)
Base class for the 3GPP propagation models.
void SetChannelConditionModel(Ptr< ChannelConditionModel > model)
Set the channel condition model used to determine the channel state (e.g., the LOS/NLOS condition)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#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 ...
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.
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_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
static ThreeGppPropagationLossModelsTestSuite g_propagationLossModelsTestSuite
Static variable for test initialization.