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"
17#include "ns3/simulator.h"
19#include "ns3/three-gpp-propagation-loss-model.h"
20#include "ns3/three-gpp-v2v-propagation-loss-model.h"
50 void DoRun()
override;
69 :
TestCase(
"Test for the ThreeGppRmaPropagationLossModel class"),
87 testVector.
m_pt = 0.0;
88 testVector.
m_pr = -77.3784;
94 testVector.
m_pt = 0.0;
95 testVector.
m_pr = -87.2965;
101 testVector.
m_pt = 0.0;
102 testVector.
m_pr = -108.5577;
108 testVector.
m_pt = 0.0;
109 testVector.
m_pr = -140.3896;
115 testVector.
m_pt = 0.0;
116 testVector.
m_pr = -77.3784;
122 testVector.
m_pt = 0.0;
123 testVector.
m_pr = -95.7718;
129 testVector.
m_pt = 0.0;
130 testVector.
m_pr = -133.5223;
136 testVector.
m_pt = 0.0;
137 testVector.
m_pr = -160.5169;
157 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
false));
161 Vector posBs = Vector(0.0, 0.0, 35.0);
162 Vector posUt = Vector(testVector.
m_distance, 0.0, 1.5);
167 lossModel->SetChannelConditionModel(losCondModel);
171 lossModel->SetChannelConditionModel(nlosCondModel);
174 a->SetPosition(posBs);
175 b->SetPosition(posUt);
181 "Got unexpected rcv power");
211 void DoRun()
override;
230 :
TestCase(
"Test for the ThreeGppUmaPropagationLossModel class"),
248 testVector.
m_pt = 0.0;
249 testVector.
m_pr = -72.9380;
255 testVector.
m_pt = 0.0;
256 testVector.
m_pr = -86.2362;
262 testVector.
m_pt = 0.0;
263 testVector.
m_pr = -109.7252;
269 testVector.
m_pt = 0.0;
270 testVector.
m_pr = -137.6794;
276 testVector.
m_pt = 0.0;
277 testVector.
m_pr = -82.5131;
283 testVector.
m_pt = 0.0;
284 testVector.
m_pr = -106.1356;
290 testVector.
m_pt = 0.0;
291 testVector.
m_pr = -144.7641;
297 testVector.
m_pt = 0.0;
298 testVector.
m_pr = -172.0753;
318 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
false));
324 Vector posBs = Vector(0.0, 0.0, 25.0);
325 Vector posUt = Vector(testVector.
m_distance, 0.0, 1.5);
330 lossModel->SetChannelConditionModel(losCondModel);
334 lossModel->SetChannelConditionModel(nlosCondModel);
337 a->SetPosition(posBs);
338 b->SetPosition(posUt);
344 "Got unexpected rcv power");
374 void DoRun()
override;
393 :
TestCase(
"Test for the ThreeGppUmiPropagationLossModel class"),
411 testVector.
m_pt = 0.0;
412 testVector.
m_pr = -69.8591;
418 testVector.
m_pt = 0.0;
419 testVector.
m_pr = -88.4122;
425 testVector.
m_pt = 0.0;
426 testVector.
m_pr = -119.3114;
431 testVector.
m_pt = 0.0;
432 testVector.
m_pr = -147.2696;
437 testVector.
m_pt = 0.0;
438 testVector.
m_pr = -76.7563;
443 testVector.
m_pt = 0.0;
444 testVector.
m_pr = -107.9432;
449 testVector.
m_pt = 0.0;
450 testVector.
m_pr = -143.1886;
455 testVector.
m_pt = 0.0;
456 testVector.
m_pr = -167.8617;
475 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
false));
481 Vector posBs = Vector(0.0, 0.0, 10.0);
482 Vector posUt = Vector(testVector.
m_distance, 0.0, 1.5);
487 lossModel->SetChannelConditionModel(losCondModel);
491 lossModel->SetChannelConditionModel(nlosCondModel);
494 a->SetPosition(posBs);
495 b->SetPosition(posUt);
501 "Got unexpected rcv power");
531 void DoRun()
override;
550 :
TestCase(
"Test for the ThreeGppIndoorOfficePropagationLossModel class"),
569 testVector.
m_pt = 0.0;
570 testVector.
m_pr = -50.8072;
576 testVector.
m_pt = 0.0;
577 testVector.
m_pr = -63.7630;
583 testVector.
m_pt = 0.0;
584 testVector.
m_pr = -75.7750;
590 testVector.
m_pt = 0.0;
591 testVector.
m_pr = -80.9802;
597 testVector.
m_pt = 0.0;
598 testVector.
m_pr = -50.8072;
604 testVector.
m_pt = 0.0;
605 testVector.
m_pr = -73.1894;
611 testVector.
m_pt = 0.0;
612 testVector.
m_pr = -99.7824;
618 testVector.
m_pt = 0.0;
619 testVector.
m_pr = -111.3062;
639 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
false));
645 Vector posBs = Vector(0.0, 0.0, 3.0);
646 Vector posUt = Vector(testVector.
m_distance, 0.0, 1.5);
651 lossModel->SetChannelConditionModel(losCondModel);
655 lossModel->SetChannelConditionModel(nlosCondModel);
658 a->SetPosition(posBs);
659 b->SetPosition(posUt);
665 "Got unexpected rcv power");
705 void DoRun()
override;
724 :
TestCase(
"Test for the ThreeGppV2vUrbanPropagationLossModel class."),
742 testVector.
m_pt = 0.0;
743 testVector.
m_pr = -68.1913;
749 testVector.
m_pt = 0.0;
750 testVector.
m_pr = -84.8913;
756 testVector.
m_pt = 0.0;
757 testVector.
m_pr = -101.5913;
763 testVector.
m_pt = 0.0;
764 testVector.
m_pr = -80.0605;
770 testVector.
m_pt = 0.0;
771 testVector.
m_pr = -110.0605;
777 testVector.
m_pt = 0.0;
778 testVector.
m_pr = -140.0605;
798 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
false));
804 Vector posUe1 = Vector(0.0, 0.0, 1.6);
805 Vector posUe2 = Vector(testVector.
m_distance, 0.0, 1.6);
810 lossModel->SetChannelConditionModel(losCondModel);
814 lossModel->SetChannelConditionModel(nlosCondModel);
817 a->SetPosition(posUe1);
818 b->SetPosition(posUe2);
824 "Got unexpected rcv power");
864 void DoRun()
override;
883 :
TestCase(
"Test for the ThreeGppV2vHighwayPropagationLossModel"),
901 testVector.
m_pt = 0.0;
902 testVector.
m_pr = -66.3794;
908 testVector.
m_pt = 0.0;
909 testVector.
m_pr = -86.3794;
915 testVector.
m_pt = 0.0;
916 testVector.
m_pr = -106.3794;
922 testVector.
m_pt = 0.0;
923 testVector.
m_pr = -80.0605;
929 testVector.
m_pt = 0.0;
930 testVector.
m_pr = -110.0605;
936 testVector.
m_pt = 0.0;
937 testVector.
m_pr = -140.0605;
957 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
false));
963 Vector posUe1 = Vector(0.0, 0.0, 1.6);
964 Vector posUe2 = Vector(testVector.
m_distance, 0.0, 1.6);
969 lossModel->SetChannelConditionModel(losCondModel);
973 lossModel->SetChannelConditionModel(nlosCondModel);
976 a->SetPosition(posUe1);
977 b->SetPosition(posUe2);
983 "Got unexpected rcv power");
1001 void DoRun()
override;
1013 void RunTest(uint16_t testNum,
1014 std::string propagationLossModelType,
1018 bool shadowingEnabled);
1051 std::map<uint16_t , std::vector<double> >
1056 :
TestCase(
"Test to check if the shadow fading is correctly computed")
1079 std::string propagationLossModelType,
1083 bool shadowingEnabled)
1086 m_results[testNum] = std::vector<double>();
1094 a->SetPosition(Vector(0.0, 0.0, hBs));
1099 b->SetPosition(Vector(0.0, distance, hUt));
1100 b->SetVelocity(Vector(1.0, 0.0, 0.0));
1111 m_lossModel->SetChannelConditionModel(losCondModel);
1121 for (
int i = 0; i < 200; i++)
1167 testVector.
m_hBs = 25;
1168 testVector.
m_hUt = 1.6;
1175 testVector.
m_hBs = 25;
1176 testVector.
m_hUt = 1.6;
1183 testVector.
m_hBs = 25;
1184 testVector.
m_hUt = 1.6;
1191 testVector.
m_hBs = 10;
1192 testVector.
m_hUt = 1.6;
1199 testVector.
m_hBs = 3;
1200 testVector.
m_hUt = 1;
1207 testVector.
m_hBs = 1.6;
1208 testVector.
m_hUt = 1.6;
1215 testVector.
m_hBs = 1.6;
1216 testVector.
m_hUt = 1.6;
1222 uint16_t numSamples = 250;
1224 for (std::size_t tvIndex = 0; tvIndex <
m_testVectors.GetN(); tvIndex++)
1229 for (uint16_t sampleIndex = 0; sampleIndex < numSamples; sampleIndex++)
1240 std::vector<double> mean_vector;
1243 uint16_t numPositions =
m_results.at(0).size();
1244 for (uint16_t k = 0; k < numPositions; k++)
1250 mean += resIt.second.at(k);
1253 mean_vector.push_back(mean);
1263 std::vector<double> true_mean =
1268 for (std::size_t i = 0; i < mean_vector.size() / 2; i++)
1270 double z = (mean_vector.at(i) - true_mean.at(i)) /
1276 "Null hypothesis test (LOS case) for the shadowing component rejected");
1281 for (std::size_t i = mean_vector.size() / 2; i < mean_vector.size(); i++)
1283 double z = (mean_vector.at(i) - true_mean.at(i)) /
1289 "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.
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.
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.
#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_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.