19 #include "ns3/abort.h"
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));
174 Vector posBs = Vector(0.0, 0.0, 35.0);
175 Vector posUt = Vector(testVector.
m_distance, 0.0, 1.5);
180 lossModel->SetChannelConditionModel(losCondModel);
184 lossModel->SetChannelConditionModel(nlosCondModel);
194 "Got unexpected rcv power");
197 Simulator::Destroy();
224 void DoRun()
override;
243 :
TestCase(
"Test for the ThreeGppUmaPropagationLossModel class"),
261 testVector.
m_pt = 0.0;
262 testVector.
m_pr = -72.9380;
268 testVector.
m_pt = 0.0;
269 testVector.
m_pr = -86.2362;
275 testVector.
m_pt = 0.0;
276 testVector.
m_pr = -109.7252;
282 testVector.
m_pt = 0.0;
283 testVector.
m_pr = -137.6794;
289 testVector.
m_pt = 0.0;
290 testVector.
m_pr = -82.5131;
296 testVector.
m_pt = 0.0;
297 testVector.
m_pr = -106.1356;
303 testVector.
m_pt = 0.0;
304 testVector.
m_pr = -144.7641;
310 testVector.
m_pt = 0.0;
311 testVector.
m_pr = -172.0753;
330 CreateObject<ThreeGppUmaPropagationLossModel>();
331 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
false));
337 Vector posBs = Vector(0.0, 0.0, 25.0);
338 Vector posUt = Vector(testVector.
m_distance, 0.0, 1.5);
343 lossModel->SetChannelConditionModel(losCondModel);
347 lossModel->SetChannelConditionModel(nlosCondModel);
357 "Got unexpected rcv power");
360 Simulator::Destroy();
387 void DoRun()
override;
406 :
TestCase(
"Test for the ThreeGppUmiPropagationLossModel class"),
424 testVector.
m_pt = 0.0;
425 testVector.
m_pr = -69.8591;
431 testVector.
m_pt = 0.0;
432 testVector.
m_pr = -88.4122;
438 testVector.
m_pt = 0.0;
439 testVector.
m_pr = -119.3114;
444 testVector.
m_pt = 0.0;
445 testVector.
m_pr = -147.2696;
450 testVector.
m_pt = 0.0;
451 testVector.
m_pr = -76.7563;
456 testVector.
m_pt = 0.0;
457 testVector.
m_pr = -107.9432;
462 testVector.
m_pt = 0.0;
463 testVector.
m_pr = -143.1886;
468 testVector.
m_pt = 0.0;
469 testVector.
m_pr = -167.8617;
487 CreateObject<ThreeGppUmiStreetCanyonPropagationLossModel>();
488 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
false));
494 Vector posBs = Vector(0.0, 0.0, 10.0);
495 Vector posUt = Vector(testVector.
m_distance, 0.0, 1.5);
500 lossModel->SetChannelConditionModel(losCondModel);
504 lossModel->SetChannelConditionModel(nlosCondModel);
514 "Got unexpected rcv power");
517 Simulator::Destroy();
544 void DoRun()
override;
563 :
TestCase(
"Test for the ThreeGppIndoorOfficePropagationLossModel class"),
582 testVector.
m_pt = 0.0;
583 testVector.
m_pr = -50.8072;
589 testVector.
m_pt = 0.0;
590 testVector.
m_pr = -63.7630;
596 testVector.
m_pt = 0.0;
597 testVector.
m_pr = -75.7750;
603 testVector.
m_pt = 0.0;
604 testVector.
m_pr = -80.9802;
610 testVector.
m_pt = 0.0;
611 testVector.
m_pr = -50.8072;
617 testVector.
m_pt = 0.0;
618 testVector.
m_pr = -73.1894;
624 testVector.
m_pt = 0.0;
625 testVector.
m_pr = -99.7824;
631 testVector.
m_pt = 0.0;
632 testVector.
m_pr = -111.3062;
651 CreateObject<ThreeGppIndoorOfficePropagationLossModel>();
652 lossModel->SetAttribute(
"ShadowingEnabled",
BooleanValue(
false));
658 Vector posBs = Vector(0.0, 0.0, 3.0);
659 Vector posUt = Vector(testVector.
m_distance, 0.0, 1.5);
664 lossModel->SetChannelConditionModel(losCondModel);
668 lossModel->SetChannelConditionModel(nlosCondModel);
678 "Got unexpected rcv power");
681 Simulator::Destroy();
718 void DoRun()
override;
737 :
TestCase(
"Test for the ThreeGppV2vUrbanPropagationLossModel class."),
755 testVector.
m_pt = 0.0;
756 testVector.
m_pr = -68.1913;
762 testVector.
m_pt = 0.0;
763 testVector.
m_pr = -84.8913;
769 testVector.
m_pt = 0.0;
770 testVector.
m_pr = -101.5913;
776 testVector.
m_pt = 0.0;
777 testVector.
m_pr = -80.0605;
783 testVector.
m_pt = 0.0;
784 testVector.
m_pr = -110.0605;
790 testVector.
m_pt = 0.0;
791 testVector.
m_pr = -140.0605;
810 CreateObject<ThreeGppV2vUrbanPropagationLossModel>();
817 Vector posUe1 = Vector(0.0, 0.0, 1.6);
818 Vector posUe2 = Vector(testVector.
m_distance, 0.0, 1.6);
837 "Got unexpected rcv power");
840 Simulator::Destroy();
877 void DoRun()
override;
896 :
TestCase(
"Test for the ThreeGppV2vHighwayPropagationLossModel"),
914 testVector.
m_pt = 0.0;
915 testVector.
m_pr = -66.3794;
921 testVector.
m_pt = 0.0;
922 testVector.
m_pr = -86.3794;
928 testVector.
m_pt = 0.0;
929 testVector.
m_pr = -106.3794;
935 testVector.
m_pt = 0.0;
936 testVector.
m_pr = -80.0605;
942 testVector.
m_pt = 0.0;
943 testVector.
m_pr = -110.0605;
949 testVector.
m_pt = 0.0;
950 testVector.
m_pr = -140.0605;
969 CreateObject<ThreeGppV2vHighwayPropagationLossModel>();
976 Vector posUe1 = Vector(0.0, 0.0, 1.6);
977 Vector posUe2 = Vector(testVector.
m_distance, 0.0, 1.6);
996 "Got unexpected rcv power");
999 Simulator::Destroy();
1014 void DoRun()
override;
1026 void RunTest(uint16_t testNum,
1027 std::string propagationLossModelType,
1031 bool shadowingEnabled);
1064 std::map<uint16_t , std::vector<double> >
1069 :
TestCase(
"Test to check if the shadow fading is correctly computed")
1092 std::string propagationLossModelType,
1096 bool shadowingEnabled)
1099 m_results[testNum] = std::vector<double>();
1112 b->SetPosition(Vector(0.0, distance, hUt));
1113 b->SetVelocity(Vector(1.0, 0.0, 0.0));
1127 Simulator::Schedule(
Seconds(99.5),
1134 for (
int i = 0; i < 200; i++)
1157 Simulator::Destroy();
1180 testVector.
m_hBs = 25;
1181 testVector.
m_hUt = 1.6;
1188 testVector.
m_hBs = 25;
1189 testVector.
m_hUt = 1.6;
1196 testVector.
m_hBs = 25;
1197 testVector.
m_hUt = 1.6;
1204 testVector.
m_hBs = 10;
1205 testVector.
m_hUt = 1.6;
1212 testVector.
m_hBs = 3;
1213 testVector.
m_hUt = 1;
1220 testVector.
m_hBs = 1.6;
1221 testVector.
m_hUt = 1.6;
1228 testVector.
m_hBs = 1.6;
1229 testVector.
m_hUt = 1.6;
1235 uint16_t numSamples = 250;
1237 for (std::size_t tvIndex = 0; tvIndex <
m_testVectors.GetN(); tvIndex++)
1242 for (uint16_t sampleIndex = 0; sampleIndex < numSamples; sampleIndex++)
1253 std::vector<double> mean_vector;
1256 uint16_t numPositions =
m_results.at(0).size();
1257 for (uint16_t
k = 0;
k < numPositions;
k++)
1263 mean += resIt.second.at(
k);
1266 mean_vector.push_back(mean);
1276 std::vector<double> true_mean =
1281 for (std::size_t i = 0; i < mean_vector.size() / 2; i++)
1283 double z = (mean_vector.at(i) - true_mean.at(i)) /
1289 "Null hypothesis test (LOS case) for the shadowing component rejected");
1294 for (std::size_t i = mean_vector.size() / 2; i < mean_vector.size(); i++)
1296 double z = (mean_vector.at(i) - true_mean.at(i)) /
1302 "Null hypothesis test (NLOS case) for the shadowing component rejected");
1328 :
TestSuite(
"three-gpp-propagation-loss-model", UNIT)
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'.
void SetPosition(const Vector &position)
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.
void AddTestCase(TestCase *testCase, TestDuration 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.