19 #include "ns3/abort.h"
20 #include "ns3/channel-condition-model.h"
21 #include "ns3/config.h"
22 #include "ns3/constant-position-mobility-model.h"
23 #include "ns3/double.h"
25 #include "ns3/node-container.h"
26 #include "ns3/simulator.h"
58 void DoRun()
override;
87 :
TestCase(
"Test case for the child classes of ThreeGppChannelConditionModel"),
102 if (cond->GetLosCondition() == ChannelCondition::LosConditionValue::LOS)
118 testVector.
m_typeId = ThreeGppRmaChannelConditionModel::GetTypeId();
123 testVector.
m_pLos = exp(-(100.0 - 10.0) / 1000.0);
124 testVector.
m_typeId = ThreeGppRmaChannelConditionModel::GetTypeId();
129 testVector.
m_pLos = exp(-(1000.0 - 10.0) / 1000.0);
130 testVector.
m_typeId = ThreeGppRmaChannelConditionModel::GetTypeId();
137 testVector.
m_typeId = ThreeGppUmaChannelConditionModel::GetTypeId();
142 testVector.
m_pLos = (18.0 / 50.0 + exp(-50.0 / 63.0) * (1.0 - 18.0 / 50.0)) * (1.0 + 0);
143 testVector.
m_typeId = ThreeGppUmaChannelConditionModel::GetTypeId();
149 (18.0 / 50.0 + exp(-50.0 / 63.0) * (1.0 - 18.0 / 50.0)) *
150 (1.0 + pow(2.0 / 10.0, 1.5) * 5.0 / 4.0 * pow(50.0 / 100.0, 3) * exp(-50.0 / 150.0));
151 testVector.
m_typeId = ThreeGppUmaChannelConditionModel::GetTypeId();
156 testVector.
m_pLos = (18.0 / 100.0 + exp(-100.0 / 63.0) * (1.0 - 18.0 / 100.0)) * (1.0 + 0);
157 testVector.
m_typeId = ThreeGppUmaChannelConditionModel::GetTypeId();
162 testVector.
m_pLos = (18.0 / 100.0 + exp(-100.0 / 63.0) * (1.0 - 18.0 / 100.0)) *
163 (1.0 + pow(2.0 / 10.0, 1.5) * 5.0 / 4.0 * 1.0 * exp(-100.0 / 150.0));
164 testVector.
m_typeId = ThreeGppUmaChannelConditionModel::GetTypeId();
171 testVector.
m_typeId = ThreeGppUmiStreetCanyonChannelConditionModel::GetTypeId();
176 testVector.
m_pLos = (18.0 / 50.0 + exp(-50.0 / 36.0) * (1.0 - 18.0 / 50.0));
177 testVector.
m_typeId = ThreeGppUmiStreetCanyonChannelConditionModel::GetTypeId();
183 testVector.
m_pLos = (18.0 / 100.0 + exp(-100.0 / 36.0) * (1.0 - 18.0 / 100.0));
184 testVector.
m_typeId = ThreeGppUmiStreetCanyonChannelConditionModel::GetTypeId();
191 testVector.
m_typeId = ThreeGppIndoorMixedOfficeChannelConditionModel::GetTypeId();
196 testVector.
m_pLos = exp(-(5.0 - 1.2) / 4.7);
197 testVector.
m_typeId = ThreeGppIndoorMixedOfficeChannelConditionModel::GetTypeId();
202 testVector.
m_pLos = exp(-(10.0 - 6.5) / 32.6) * 0.32;
203 testVector.
m_typeId = ThreeGppIndoorMixedOfficeChannelConditionModel::GetTypeId();
210 testVector.
m_typeId = ThreeGppIndoorOpenOfficeChannelConditionModel::GetTypeId();
215 testVector.
m_pLos = exp(-(30.0 - 5.0) / 70.8);
216 testVector.
m_typeId = ThreeGppIndoorOpenOfficeChannelConditionModel::GetTypeId();
221 testVector.
m_pLos = exp(-(100.0 - 49.0) / 211.7) * 0.54;
222 testVector.
m_typeId = ThreeGppIndoorOpenOfficeChannelConditionModel::GetTypeId();
241 uint32_t numberOfReps = 500000;
256 for (uint32_t j = 0; j < numberOfReps; j++)
266 Simulator::Destroy();
268 double resultPlos = double(
m_numLos) / double(numberOfReps);
271 <<
" numberOfReps " << numberOfReps <<
" resultPlos "
272 << resultPlos <<
" ref " << testVector.
m_pLos);
276 "Got unexpected LOS probability");
292 :
TestSuite(
"propagation-channel-condition-model", UNIT)
static ChannelConditionModelsTestSuite g_channelConditionModelsTestSuite
Static variable for test initialization.
Test suite for the channel condition models.
ChannelConditionModelsTestSuite()
Test case for the 3GPP channel condition models.
void DoRun() override
Builds the simulation scenario and perform the tests.
void EvaluateChannelCondition(Ptr< MobilityModel > a, Ptr< MobilityModel > b)
Evaluates the channel condition between two nodes by calling the method GetChannelCondition on m_cond...
Ptr< ThreeGppChannelConditionModel > m_condModel
the channel condition model
ThreeGppChannelConditionModelTestCase()
Constructor.
TestVectors< TestVector > m_testVectors
array containing all the test vectors
~ThreeGppChannelConditionModelTestCase() override
Destructor.
double m_tolerance
tolerance
uint64_t m_numLos
the number of LOS occurrences
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 SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
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 channel condition models.
Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Retrieve the condition of the channel between a and b.
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#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 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_pLos
LOS probability.
Vector m_positionA
the position of the first node
Vector m_positionB
the position of the second node
TypeId m_typeId
the type ID of the channel condition model to be used