|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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);
172 Vector posBs = Vector (0.0, 0.0, 35.0);
173 Vector posUt = Vector (testVector.
m_distance, 0.0, 1.5);
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);
329 Vector posBs = Vector (0.0, 0.0, 25.0);
330 Vector posUt = Vector (testVector.
m_distance, 0.0, 1.5);
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);
480 Vector posBs = Vector (0.0, 0.0, 10.0);
481 Vector posUt = Vector (testVector.
m_distance, 0.0, 1.5);
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);
637 Vector posBs = Vector (0.0, 0.0, 3.0);
638 Vector posUt = Vector (testVector.
m_distance, 0.0, 1.5);
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);
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);
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)
double m_tolerance
tolerance
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
void EvaluateLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b, uint8_t testNum)
Compute the propagation loss.
Test case for the class ThreeGppV2vUrbanPropagationLossModel.
AttributeValue implementation for Boolean.
bool m_isLos
if true LOS/NLOSv, if false NLOS
Struct containing the parameters for each test.
Test case for the class ThreeGppUmaPropagationLossModel.
double m_distance
2D distance between UT and BS in meters
TestVectors< TestVector > m_testVectors
array containing all the test vectors
virtual void DoRun(void)
Build the simulation scenario and run the tests.
double m_frequency
carrier frequency in Hz
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ThreeGppV2vHighwayPropagationLossModelTestCase()
Constructor.
bool m_isLos
if true LOS, if false NLOS
ThreeGppUmiPropagationLossModelTestCase()
Constructor.
Struct containing the parameters for each test.
virtual void DoRun(void)
Build the simulation scenario and run the tests.
double m_distance
2D distance between UT and BS in meters
double m_pr
received power in dBm
virtual ~ThreeGppV2vUrbanPropagationLossModelTestCase()
Destructor.
TestVectors< TestVector > m_testVectors
array containing all the test vectors
void SetVelocity(const Vector &speed)
void SetPosition(const Vector &position)
double m_pt
transmitted power in dBm
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.
double m_pr
received power in dBm
bool m_isLos
if true LOS/NLOSv, if false NLOS
double m_pr
received power in dBm
double m_tolerance
tolerance
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
double m_frequency
carrier frequency in Hz
Struct containing the parameters for each test.
virtual ~ThreeGppUmaPropagationLossModelTestCase()
Destructor.
void ChangeChannelCondition(Ptr< ChannelConditionModel > ccm)
ThreeGppRmaPropagationLossModelTestCase()
Constructor.
bool m_isLos
if true LOS, if false NLOS
This class can be used to hold variables of floating point type such as 'double' or 'float'.
ThreeGppPropagationLossModelsTestSuite()
Struct containing the parameters for each test.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual ~ThreeGppRmaPropagationLossModelTestCase()
Destructor.
Test case for the class ThreeGppV2vHighwayPropagationLossModel.
TestVectors< TestVector > m_testVectors
array containing all the test vectors
#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 ...
ThreeGppV2vUrbanPropagationLossModelTestCase()
Constructor.
double m_distance
2D distance between UT and BS in meters
double m_pr
received power in dBm
double m_distance
the initial 2D distance in meters between BS and UT in meters
double m_pt
transmitted power in dBm
virtual void DoRun(void)
Build the simulation scenario and run the tests.
ThreeGppIndoorOfficePropagationLossModelTestCase()
Constructor.
bool m_isLos
if true LOS, if false NLOS
virtual ~ThreeGppV2vHighwayPropagationLossModelTestCase()
Destructor.
double m_pt
transmitted power in dBm
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Instantiate subclasses of ns3::Object.
Struct containing the parameters for each test.
double m_pr
received power in dBm
double m_shadowingStdLos
the standard deviation of the shadowing component in the LOS case in dB
virtual void DoRun(void)
Build the simulation scenario and run the tests.
double m_pt
transmitted power in dBm
TestVectors< TestVector > m_testVectors
array containing all the test vectors
Test case for the class ThreeGppIndoorOfficePropagationLossModel.
ThreeGppUmaPropagationLossModelTestCase()
Constructor.
Test case for the class ThreeGppRmaPropagationLossModel.
double m_frequency
carrier frequency in Hz
std::map< uint16_t, std::vector< double > > m_results
used to store the test results
Struct containing the parameters for each test.
virtual ~ThreeGppUmiPropagationLossModelTestCase()
Destructor.
ThreeGppShadowingTestCase()
double m_hBs
the BS height in meters
double m_distance
2D distance between UT and BS in meters
Struct containing the parameters for each test.
double m_distance
2D distance between UT and BS in meters
Time Seconds(double value)
Construct a Time in the indicated unit.
double m_pt
transmitted power in dBm
static ThreeGppPropagationLossModelsTestSuite propagationLossModelsTestSuite
std::string m_propagationLossModelType
the propagation loss model type id
Ptr< ThreeGppPropagationLossModel > m_lossModel
the propagation loss model
double m_tolerance
tolerance
double m_frequency
carrier frequency in Hz
double m_tolerance
tolerance
bool m_isLos
if true LOS, if false NLOS
double m_pr
received power in dBm
keep track of a set of node pointers.
Base class for the 3GPP propagation models.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
TestVectors< TestVector > m_testVectors
array containing all the test vectors
double m_distance
2D distance between UT and BS in meters
double m_tolerance
tolerance
virtual ~ThreeGppShadowingTestCase()
TestVectors< TestVector > m_testVectors
array containing all the test vectors
Test case for the class ThreeGppUmiStreetCanyonPropagationLossModel.
double m_pt
transmitted power in dBm
A simple way to store test vectors (for stimulus or from responses)
virtual void DoRun(void)
Build the simulation scenario and run the tests.
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_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)
double m_hUt
the UT height in meters
double m_tolerance
tolerance
double m_frequency
carrier frequency in Hz
double m_shadowingStdNlos
the standard deviation of the shadowing component in the NLOS case in dB
virtual void DoRun(void)
Build the simulation scenario and run the tests.
virtual ~ThreeGppIndoorOfficePropagationLossModelTestCase()
Destructor.