21 #include "ns3/abort.h"
23 #include "ns3/config.h"
24 #include "ns3/double.h"
25 #include "ns3/boolean.h"
26 #include "ns3/channel-condition-model.h"
27 #include "ns3/three-gpp-propagation-loss-model.h"
28 #include "ns3/three-gpp-v2v-propagation-loss-model.h"
29 #include "ns3/constant-position-mobility-model.h"
30 #include "ns3/constant-velocity-mobility-model.h"
31 #include "ns3/mobility-helper.h"
32 #include "ns3/simulator.h"
62 virtual void DoRun (
void);
81 :
TestCase (
"Test for the ThreeGppRmaPropagationLossModel class"),
99 testVector.
m_pt = 0.0;
100 testVector.
m_pr = -77.3784;
106 testVector.
m_pt = 0.0;
107 testVector.
m_pr = -87.2965;
113 testVector.
m_pt = 0.0;
114 testVector.
m_pr = -108.5577;
120 testVector.
m_pt = 0.0;
121 testVector.
m_pr = -140.3896;
127 testVector.
m_pt = 0.0;
128 testVector.
m_pr = -77.3784;
134 testVector.
m_pt = 0.0;
135 testVector.
m_pr = -95.7718;
141 testVector.
m_pt = 0.0;
142 testVector.
m_pr = -133.5223;
148 testVector.
m_pt = 0.0;
149 testVector.
m_pr = -160.5169;
158 nodes.Get (0)->AggregateObject (a);
160 nodes.Get (1)->AggregateObject (b);
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 Simulator::Destroy ();
221 virtual void DoRun (
void);
240 :
TestCase (
"Test for the ThreeGppUmaPropagationLossModel class"),
258 testVector.
m_pt = 0.0;
259 testVector.
m_pr = -72.9380;
265 testVector.
m_pt = 0.0;
266 testVector.
m_pr = -86.2362;
272 testVector.
m_pt = 0.0;
273 testVector.
m_pr = -109.7252;
279 testVector.
m_pt = 0.0;
280 testVector.
m_pr = -137.6794;
286 testVector.
m_pt = 0.0;
287 testVector.
m_pr = -82.5131;
293 testVector.
m_pt = 0.0;
294 testVector.
m_pr = -106.1356;
300 testVector.
m_pt = 0.0;
301 testVector.
m_pr = -144.7641;
307 testVector.
m_pt = 0.0;
308 testVector.
m_pr = -172.0753;
317 nodes.Get (0)->AggregateObject (a);
319 nodes.Get (1)->AggregateObject (b);
327 lossModel->SetAttribute (
"ShadowingEnabled",
BooleanValue (
false));
333 Vector posBs = Vector (0.0, 0.0, 25.0);
334 Vector posUt = Vector (testVector.
m_distance, 0.0, 1.5);
339 lossModel->SetChannelConditionModel (losCondModel);
343 lossModel->SetChannelConditionModel (nlosCondModel);
353 Simulator::Destroy ();
380 virtual void DoRun (
void);
399 :
TestCase (
"Test for the ThreeGppUmiPropagationLossModel class"),
417 testVector.
m_pt = 0.0;
418 testVector.
m_pr = -69.8591;
424 testVector.
m_pt = 0.0;
425 testVector.
m_pr = -88.4122;
431 testVector.
m_pt = 0.0;
432 testVector.
m_pr = -119.3114;
437 testVector.
m_pt = 0.0;
438 testVector.
m_pr = -147.2696;
443 testVector.
m_pt = 0.0;
444 testVector.
m_pr = -76.7563;
449 testVector.
m_pt = 0.0;
450 testVector.
m_pr = -107.9432;
455 testVector.
m_pt = 0.0;
456 testVector.
m_pr = -143.1886;
461 testVector.
m_pt = 0.0;
462 testVector.
m_pr = -167.8617;
470 nodes.Get (0)->AggregateObject (a);
472 nodes.Get (1)->AggregateObject (b);
480 lossModel->SetAttribute (
"ShadowingEnabled",
BooleanValue (
false));
486 Vector posBs = Vector (0.0, 0.0, 10.0);
487 Vector posUt = Vector (testVector.
m_distance, 0.0, 1.5);
492 lossModel->SetChannelConditionModel (losCondModel);
496 lossModel->SetChannelConditionModel (nlosCondModel);
506 Simulator::Destroy ();
533 virtual void DoRun (
void);
552 :
TestCase (
"Test for the ThreeGppIndoorOfficePropagationLossModel class"),
570 testVector.
m_pt = 0.0;
571 testVector.
m_pr = -50.8072;
577 testVector.
m_pt = 0.0;
578 testVector.
m_pr = -63.7630;
584 testVector.
m_pt = 0.0;
585 testVector.
m_pr = -75.7750;
591 testVector.
m_pt = 0.0;
592 testVector.
m_pr = -80.9802;
598 testVector.
m_pt = 0.0;
599 testVector.
m_pr = -50.8072;
605 testVector.
m_pt = 0.0;
606 testVector.
m_pr = -73.1894;
612 testVector.
m_pt = 0.0;
613 testVector.
m_pr = -99.7824;
619 testVector.
m_pt = 0.0;
620 testVector.
m_pr = -111.3062;
629 nodes.Get (0)->AggregateObject (a);
631 nodes.Get (1)->AggregateObject (b);
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);
665 Simulator::Destroy ();
702 virtual void DoRun (
void);
721 :
TestCase (
"Test for the ThreeGppV2vUrbanPropagationLossModel class."),
739 testVector.
m_pt = 0.0;
740 testVector.
m_pr = -68.1913;
746 testVector.
m_pt = 0.0;
747 testVector.
m_pr = -84.8913;
753 testVector.
m_pt = 0.0;
754 testVector.
m_pr = -101.5913;
760 testVector.
m_pt = 0.0;
761 testVector.
m_pr = -80.0605;
767 testVector.
m_pt = 0.0;
768 testVector.
m_pr = -110.0605;
774 testVector.
m_pt = 0.0;
775 testVector.
m_pr = -140.0605;
784 nodes.Get (0)->AggregateObject (a);
786 nodes.Get (1)->AggregateObject (b);
800 Vector posUe1 = Vector (0.0, 0.0, 1.6);
801 Vector posUe2 = Vector (testVector.
m_distance, 0.0, 1.6);
820 Simulator::Destroy ();
857 virtual void DoRun (
void);
876 :
TestCase (
"Test for the ThreeGppV2vHighwayPropagationLossModel"),
894 testVector.
m_pt = 0.0;
895 testVector.
m_pr = -66.3794;
901 testVector.
m_pt = 0.0;
902 testVector.
m_pr = -86.3794;
908 testVector.
m_pt = 0.0;
909 testVector.
m_pr = -106.3794;
915 testVector.
m_pt = 0.0;
916 testVector.
m_pr = -80.0605;
922 testVector.
m_pt = 0.0;
923 testVector.
m_pr = -110.0605;
929 testVector.
m_pt = 0.0;
930 testVector.
m_pr = -140.0605;
939 nodes.Get (0)->AggregateObject (a);
941 nodes.Get (1)->AggregateObject (b);
955 Vector posUe1 = Vector (0.0, 0.0, 1.6);
956 Vector posUe2 = Vector (testVector.
m_distance, 0.0, 1.6);
975 Simulator::Destroy ();
990 virtual void DoRun (
void);
1002 void RunTest (uint16_t testNum, std::string propagationLossModelType,
double hBs,
double hUt,
double distance,
bool shadowingEnabled);
1038 :
TestCase (
"Test to check if the shadow fading is correctly computed")
1050 m_results.at (testNum).push_back (loss);
1063 m_results [testNum] = std::vector<double> ();
1072 nodes.Get (0)->AggregateObject (a);
1075 nodes.Get (1)->AggregateObject (b);
1076 b->SetPosition (Vector (0.0, distance, hUt));
1077 b->SetVelocity (Vector (1.0, 0.0, 0.0));
1094 for (
int i = 0; i < 200; i++)
1103 Simulator::Destroy ();
1126 testVector.
m_hBs = 25;
1127 testVector.
m_hUt = 1.6;
1134 testVector.
m_hBs = 25;
1135 testVector.
m_hUt = 1.6;
1142 testVector.
m_hBs = 25;
1143 testVector.
m_hUt = 1.6;
1150 testVector.
m_hBs = 10;
1151 testVector.
m_hUt = 1.6;
1158 testVector.
m_hBs = 3;
1159 testVector.
m_hUt = 1;
1166 testVector.
m_hBs = 1.6;
1167 testVector.
m_hUt = 1.6;
1174 testVector.
m_hBs = 1.6;
1175 testVector.
m_hUt = 1.6;
1181 uint16_t numSamples = 250;
1183 for (uint16_t tvIndex = 0; tvIndex <
m_testVectors.GetN (); tvIndex++)
1188 for (uint16_t sampleIndex = 0; sampleIndex < numSamples; sampleIndex++)
1194 std::vector<double> mean_vector;
1196 uint16_t numPositions =
m_results.at (0).size ();
1197 for (uint16_t
k = 0;
k < numPositions;
k++)
1203 mean += resIt.second.at (
k);
1206 mean_vector.push_back (mean);
1211 std::vector<double> true_mean =
m_results.at (numSamples);
1215 for (uint16_t i = 0; i < mean_vector.size () / 2; i++)
1217 double z = (mean_vector.at (i) - true_mean.at (i)) / (tv.
m_shadowingStdLos / std::sqrt (mean_vector.size () / 2));
1223 for (uint16_t i = mean_vector.size () / 2; i < mean_vector.size (); i++)
1225 double z = (mean_vector.at (i) - true_mean.at (i)) / (tv.
m_shadowingStdNlos / std::sqrt (mean_vector.size () / 2));
1252 :
TestSuite (
"three-gpp-propagation-loss-model", UNIT)
Test case for the class ThreeGppIndoorOfficePropagationLossModel.
virtual void DoRun(void)
Build the simulation scenario and run the tests.
ThreeGppIndoorOfficePropagationLossModelTestCase()
Constructor.
virtual ~ThreeGppIndoorOfficePropagationLossModelTestCase()
Destructor.
double m_tolerance
tolerance
TestVectors< TestVector > m_testVectors
array containing all the test vectors
3GPP Propagation models TestSuite
ThreeGppPropagationLossModelsTestSuite()
Test case for the class ThreeGppRmaPropagationLossModel.
ThreeGppRmaPropagationLossModelTestCase()
Constructor.
virtual void DoRun(void)
Build the simulation scenario and run the tests.
virtual ~ThreeGppRmaPropagationLossModelTestCase()
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()
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual ~ThreeGppShadowingTestCase()
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
TestVectors< TestVector > m_testVectors
array containing all the test vectors
virtual ~ThreeGppUmaPropagationLossModelTestCase()
Destructor.
virtual void DoRun(void)
Build the simulation scenario and run the tests.
ThreeGppUmaPropagationLossModelTestCase()
Constructor.
Test case for the class ThreeGppUmiStreetCanyonPropagationLossModel.
ThreeGppUmiPropagationLossModelTestCase()
Constructor.
virtual void DoRun(void)
Build the simulation scenario and run the tests.
virtual ~ThreeGppUmiPropagationLossModelTestCase()
Destructor.
TestVectors< TestVector > m_testVectors
array containing all the test vectors
double m_tolerance
tolerance
Test case for the class ThreeGppV2vHighwayPropagationLossModel.
ThreeGppV2vHighwayPropagationLossModelTestCase()
Constructor.
virtual void DoRun(void)
Build the simulation scenario and run the tests.
TestVectors< TestVector > m_testVectors
array containing all the test vectors
double m_tolerance
tolerance
virtual ~ThreeGppV2vHighwayPropagationLossModelTestCase()
Destructor.
Test case for the class ThreeGppV2vUrbanPropagationLossModel.
ThreeGppV2vUrbanPropagationLossModelTestCase()
Constructor.
virtual ~ThreeGppV2vUrbanPropagationLossModelTestCase()
Destructor.
TestVectors< TestVector > m_testVectors
array containing all the test vectors
double m_tolerance
tolerance
virtual void DoRun(void)
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'.
void SetPosition(const Vector &position)
keep track of a set of node pointers.
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(void) const
Create an Object instance of the configured TypeId.
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.