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" 60 virtual void DoRun (
void);
79 :
TestCase (
"Test for the ThreeGppRmaPropagationLossModel class"),
97 testVector.
m_pt = 0.0;
98 testVector.
m_pr = -77.3784;
104 testVector.
m_pt = 0.0;
105 testVector.
m_pr = -87.2965;
111 testVector.
m_pt = 0.0;
112 testVector.
m_pr = -108.5577;
118 testVector.
m_pt = 0.0;
119 testVector.
m_pr = -140.3896;
125 testVector.
m_pt = 0.0;
126 testVector.
m_pr = -77.3784;
132 testVector.
m_pt = 0.0;
133 testVector.
m_pr = -95.7718;
139 testVector.
m_pt = 0.0;
140 testVector.
m_pr = -133.5223;
146 testVector.
m_pt = 0.0;
147 testVector.
m_pr = -160.5169;
156 nodes.Get (0)->AggregateObject (a);
158 nodes.Get (1)->AggregateObject (b);
166 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);
192 Simulator::Destroy ();
217 virtual void DoRun (
void);
236 :
TestCase (
"Test for the ThreeGppUmaPropagationLossModel class"),
254 testVector.
m_pt = 0.0;
255 testVector.
m_pr = -72.9380;
261 testVector.
m_pt = 0.0;
262 testVector.
m_pr = -86.2362;
268 testVector.
m_pt = 0.0;
269 testVector.
m_pr = -109.7252;
275 testVector.
m_pt = 0.0;
276 testVector.
m_pr = -137.6794;
282 testVector.
m_pt = 0.0;
283 testVector.
m_pr = -82.5131;
289 testVector.
m_pt = 0.0;
290 testVector.
m_pr = -106.1356;
296 testVector.
m_pt = 0.0;
297 testVector.
m_pr = -144.7641;
303 testVector.
m_pt = 0.0;
304 testVector.
m_pr = -172.0753;
313 nodes.Get (0)->AggregateObject (a);
315 nodes.Get (1)->AggregateObject (b);
323 lossModel->SetAttribute (
"ShadowingEnabled",
BooleanValue (
false));
329 Vector posBs = Vector (0.0, 0.0, 25.0);
330 Vector posUt = Vector (testVector.
m_distance, 0.0, 1.5);
335 lossModel->SetChannelConditionModel (losCondModel);
339 lossModel->SetChannelConditionModel (nlosCondModel);
349 Simulator::Destroy ();
374 virtual void DoRun (
void);
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;
464 nodes.Get (0)->AggregateObject (a);
466 nodes.Get (1)->AggregateObject (b);
474 lossModel->SetAttribute (
"ShadowingEnabled",
BooleanValue (
false));
480 Vector posBs = Vector (0.0, 0.0, 10.0);
481 Vector posUt = Vector (testVector.
m_distance, 0.0, 1.5);
486 lossModel->SetChannelConditionModel (losCondModel);
490 lossModel->SetChannelConditionModel (nlosCondModel);
500 Simulator::Destroy ();
525 virtual void DoRun (
void);
544 :
TestCase (
"Test for the ThreeGppIndoorOfficePropagationLossModel class"),
562 testVector.
m_pt = 0.0;
563 testVector.
m_pr = -50.8072;
569 testVector.
m_pt = 0.0;
570 testVector.
m_pr = -63.7630;
576 testVector.
m_pt = 0.0;
577 testVector.
m_pr = -75.7750;
583 testVector.
m_pt = 0.0;
584 testVector.
m_pr = -80.9802;
590 testVector.
m_pt = 0.0;
591 testVector.
m_pr = -50.8072;
597 testVector.
m_pt = 0.0;
598 testVector.
m_pr = -73.1894;
604 testVector.
m_pt = 0.0;
605 testVector.
m_pr = -99.7824;
611 testVector.
m_pt = 0.0;
612 testVector.
m_pr = -111.3062;
621 nodes.Get (0)->AggregateObject (a);
623 nodes.Get (1)->AggregateObject (b);
631 lossModel->SetAttribute (
"ShadowingEnabled",
BooleanValue (
false));
637 Vector posBs = Vector (0.0, 0.0, 3.0);
638 Vector posUt = Vector (testVector.
m_distance, 0.0, 1.5);
643 lossModel->SetChannelConditionModel (losCondModel);
647 lossModel->SetChannelConditionModel (nlosCondModel);
657 Simulator::Destroy ();
692 virtual void DoRun (
void);
711 :
TestCase (
"Test for the ThreeGppV2vUrbanPropagationLossModel class."),
729 testVector.
m_pt = 0.0;
730 testVector.
m_pr = -68.1913;
736 testVector.
m_pt = 0.0;
737 testVector.
m_pr = -84.8913;
743 testVector.
m_pt = 0.0;
744 testVector.
m_pr = -101.5913;
750 testVector.
m_pt = 0.0;
751 testVector.
m_pr = -80.0605;
757 testVector.
m_pt = 0.0;
758 testVector.
m_pr = -110.0605;
764 testVector.
m_pt = 0.0;
765 testVector.
m_pr = -140.0605;
774 nodes.Get (0)->AggregateObject (a);
776 nodes.Get (1)->AggregateObject (b);
790 Vector posUe1 = Vector (0.0, 0.0, 1.6);
791 Vector posUe2 = Vector (testVector.
m_distance, 0.0, 1.6);
796 lossModel->SetChannelConditionModel (losCondModel);
800 lossModel->SetChannelConditionModel (nlosCondModel);
810 Simulator::Destroy ();
845 virtual void DoRun (
void);
864 :
TestCase (
"Test for the ThreeGppV2vHighwayPropagationLossModel"),
882 testVector.
m_pt = 0.0;
883 testVector.
m_pr = -66.3794;
889 testVector.
m_pt = 0.0;
890 testVector.
m_pr = -86.3794;
896 testVector.
m_pt = 0.0;
897 testVector.
m_pr = -106.3794;
903 testVector.
m_pt = 0.0;
904 testVector.
m_pr = -80.0605;
910 testVector.
m_pt = 0.0;
911 testVector.
m_pr = -110.0605;
917 testVector.
m_pt = 0.0;
918 testVector.
m_pr = -140.0605;
927 nodes.Get (0)->AggregateObject (a);
929 nodes.Get (1)->AggregateObject (b);
943 Vector posUe1 = Vector (0.0, 0.0, 1.6);
944 Vector posUe2 = Vector (testVector.
m_distance, 0.0, 1.6);
949 lossModel->SetChannelConditionModel (losCondModel);
953 lossModel->SetChannelConditionModel (nlosCondModel);
963 Simulator::Destroy ();
974 virtual void DoRun (
void);
985 void RunTest (uint16_t testNum, std::string propagationLossModelType,
double hBs,
double hUt,
double distance,
bool shadowingEnabled);
1017 :
TestCase (
"Test to check if the shadow fading is correctly computed")
1029 m_results.at (testNum).push_back (loss);
1042 m_results [testNum] = std::vector<double> ();
1051 nodes.Get (0)->AggregateObject (a);
1054 nodes.Get (1)->AggregateObject (b);
1073 for (
int i = 0; i < 200; i++)
1082 Simulator::Destroy ();
1105 testVector.
m_hBs = 25;
1106 testVector.
m_hUt = 1.6;
1113 testVector.
m_hBs = 25;
1114 testVector.
m_hUt = 1.6;
1121 testVector.
m_hBs = 25;
1122 testVector.
m_hUt = 1.6;
1129 testVector.
m_hBs = 10;
1130 testVector.
m_hUt = 1.6;
1137 testVector.
m_hBs = 3;
1138 testVector.
m_hUt = 1;
1145 testVector.
m_hBs = 1.6;
1146 testVector.
m_hUt = 1.6;
1153 testVector.
m_hBs = 1.6;
1154 testVector.
m_hUt = 1.6;
1160 uint16_t numSamples = 250;
1162 for (uint16_t tvIndex = 0; tvIndex <
m_testVectors.GetN (); tvIndex++)
1167 for (uint16_t sampleIndex = 0; sampleIndex < numSamples; sampleIndex++)
1173 std::vector<double> mean_vector;
1175 uint16_t numPositions =
m_results.at (0).size ();
1176 for (uint16_t
k = 0;
k < numPositions;
k++)
1182 mean += resIt.second.at (
k);
1185 mean_vector.push_back (mean);
1190 std::vector<double> true_mean =
m_results.at (numSamples);
1194 for (uint16_t i = 0; i < mean_vector.size () / 2; i++)
1196 double z = (mean_vector.at (i) - true_mean.at (i)) / (tv.
m_shadowingStdLos / std::sqrt (mean_vector.size () / 2));
1202 for (uint16_t i = mean_vector.size () / 2; i < mean_vector.size (); i++)
1204 double z = (mean_vector.at (i) - true_mean.at (i)) / (tv.
m_shadowingStdNlos / std::sqrt (mean_vector.size () / 2));
1217 :
TestSuite (
"three-gpp-propagation-loss-model", UNIT)
ThreeGppUmiPropagationLossModelTestCase()
Constructor.
ThreeGppV2vUrbanPropagationLossModelTestCase()
Constructor.
virtual void DoRun(void)
Build the simulation scenario and run the tests.
double m_pt
transmitted power in dBm
bool m_isLos
if true LOS, if false NLOS
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...
AttributeValue implementation for Boolean.
double m_tolerance
tolerance
Test case for the class ThreeGppIndoorOfficePropagationLossModel.
TestVectors< TestVector > m_testVectors
array containing all the test vectors
Test case for the class ThreeGppRmaPropagationLossModel.
Struct containing the parameters for each test.
double m_shadowingStdNlos
the standard deviation of the shadowing component in the NLOS case in dB
double m_distance
2D distance between UT and BS in meters
double m_distance
2D distance between UT and BS in meters
ThreeGppV2vHighwayPropagationLossModelTestCase()
Constructor.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
virtual void DoRun(void)
Build the simulation scenario and run the tests.
double m_pt
transmitted power in dBm
void ChangeChannelCondition(Ptr< ChannelConditionModel > ccm)
virtual void DoRun(void)
Build the simulation scenario and run the tests.
virtual ~ThreeGppUmiPropagationLossModelTestCase()
Destructor.
Struct containing the parameters for each test.
ThreeGppIndoorOfficePropagationLossModelTestCase()
Constructor.
Ptr< ThreeGppPropagationLossModel > m_lossModel
the propagation loss model
A simple way to store test vectors (for stimulus or from responses)
double m_distance
2D distance between UT and BS in meters
bool m_isLos
if true LOS/NLOSv, if false NLOS
double m_frequency
carrier frequency in Hz
ThreeGppRmaPropagationLossModelTestCase()
Constructor.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
Struct containing the parameters for each test.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
TestVectors< TestVector > m_testVectors
array containing all the test vectors
virtual ~ThreeGppUmaPropagationLossModelTestCase()
Destructor.
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.
double m_distance
2D distance between UT and BS in meters
virtual void DoRun(void)
Build the simulation scenario and run the tests.
bool m_isLos
if true LOS/NLOSv, if false NLOS
ThreeGppUmaPropagationLossModelTestCase()
Constructor.
double m_frequency
carrier frequency in Hz
Struct containing the parameters for each test.
void EvaluateLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b, uint8_t testNum)
Compute the propagation loss.
TestVectors< TestVector > m_testVectors
array containing all the test vectors
double m_pt
transmitted power in dBm
Test case for the class ThreeGppV2vUrbanPropagationLossModel.
bool m_isLos
if true LOS, if false NLOS
virtual ~ThreeGppV2vUrbanPropagationLossModelTestCase()
Destructor.
virtual void DoRun(void)
Implementation to actually run this TestCase.
double m_pr
received power in dBm
double m_distance
the initial 2D distance in meters between BS and UT in meters
#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 ...
Struct containing the parameters for each test.
std::string m_propagationLossModelType
the propagation loss model type id
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
Struct containing the parameters for each test.
ThreeGppShadowingTestCase()
virtual void DoRun(void)
Build the simulation scenario and run the tests.
virtual void DoRun(void)
Build the simulation scenario and run the tests.
double m_pr
received power in dBm
TestVectors< TestVector > m_testVectors
array containing all the test vectors
double m_hBs
the BS height in meters
Test case for the class ThreeGppUmiStreetCanyonPropagationLossModel.
double m_pr
received power in dBm
double m_tolerance
tolerance
TestVectors< TestVector > m_testVectors
array containing all the test vectors
bool m_isLos
if true LOS, if false NLOS
Test case for the class ThreeGppV2vHighwayPropagationLossModel.
double m_tolerance
tolerance
double m_shadowingStdLos
the standard deviation of the shadowing component in the LOS case in dB
double m_frequency
carrier frequency in Hz
void SetPosition(const Vector &position)
double m_pr
received power in dBm
double m_tolerance
tolerance
virtual ~ThreeGppV2vHighwayPropagationLossModelTestCase()
Destructor.
Instantiate subclasses of ns3::Object.
virtual ~ThreeGppRmaPropagationLossModelTestCase()
Destructor.
static ThreeGppPropagationLossModelsTestSuite propagationLossModelsTestSuite
double m_pt
transmitted power in dBm
double m_frequency
carrier frequency in Hz
std::map< uint16_t, std::vector< double > > m_results
used to store the test results
ThreeGppPropagationLossModelsTestSuite()
double m_frequency
carrier frequency in Hz
void SetChannelConditionModel(Ptr< ChannelConditionModel > model)
Set the channel condition model used to determine the channel state (e.g., the LOS/NLOS condition) ...
Time Seconds(double value)
Construct a Time in the indicated unit.
virtual ~ThreeGppShadowingTestCase()
double m_tolerance
tolerance
Test case for the class ThreeGppUmaPropagationLossModel.
TestVectors< TestVector > m_testVectors
array containing all the test vectors
Base class for the 3GPP propagation models.
virtual ~ThreeGppIndoorOfficePropagationLossModelTestCase()
Destructor.
double m_hUt
the UT height in meters
double m_distance
2D distance between UT and BS in meters
bool m_isLos
if true LOS, if false NLOS
double m_pr
received power in dBm
This class can be used to hold variables of floating point type such as 'double' or 'float'...
Struct containing the parameters for each test.
double m_frequency
carrier frequency in Hz
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
void SetVelocity(const Vector &speed)
double m_pt
transmitted power in dBm
double m_pt
transmitted power in dBm
double m_pr
received power in dBm
double m_distance
2D distance between UT and BS in meters
double m_tolerance
tolerance