21 #include "ns3/abort.h"
23 #include "ns3/config.h"
24 #include "ns3/double.h"
25 #include "ns3/channel-condition-model.h"
26 #include "ns3/constant-position-mobility-model.h"
27 #include "ns3/simulator.h"
28 #include "ns3/node-container.h"
59 virtual void DoRun (
void);
88 :
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 ();
148 testVector.
m_pLos = (18.0 / 50.0 + exp (-50.0 / 63.0) * (1.0 - 18.0 / 50.0)) * (1.0 + pow (2.0 / 10.0, 1.5) * 5.0 / 4.0 * pow (50.0 / 100.0, 3) * exp (-50.0 / 150.0));
149 testVector.
m_typeId = ThreeGppUmaChannelConditionModel::GetTypeId ();
154 testVector.
m_pLos = (18.0 / 100.0 + exp (-100.0 / 63.0) * (1.0 - 18.0 / 100.0)) * (1.0 + 0);
155 testVector.
m_typeId = ThreeGppUmaChannelConditionModel::GetTypeId ();
160 testVector.
m_pLos = (18.0 / 100.0 + exp (-100.0 / 63.0) * (1.0 - 18.0 / 100.0)) * (1.0 + pow (2.0 / 10.0, 1.5) * 5.0 / 4.0 * 1.0 * exp (-100.0 / 150.0));
161 testVector.
m_typeId = ThreeGppUmaChannelConditionModel::GetTypeId ();
168 testVector.
m_typeId = ThreeGppUmiStreetCanyonChannelConditionModel::GetTypeId ();
173 testVector.
m_pLos = (18.0 / 50.0 + exp (-50.0 / 36.0) * (1.0 - 18.0 / 50.0));
174 testVector.
m_typeId = ThreeGppUmiStreetCanyonChannelConditionModel::GetTypeId ();
180 testVector.
m_pLos = (18.0 / 100.0 + exp (-100.0 / 36.0) * (1.0 - 18.0 / 100.0));
181 testVector.
m_typeId = ThreeGppUmiStreetCanyonChannelConditionModel::GetTypeId ();
188 testVector.
m_typeId = ThreeGppIndoorMixedOfficeChannelConditionModel::GetTypeId ();
193 testVector.
m_pLos = exp (-(5.0 - 1.2) / 4.7);
194 testVector.
m_typeId = ThreeGppIndoorMixedOfficeChannelConditionModel::GetTypeId ();
199 testVector.
m_pLos = exp (-(10.0 - 6.5) / 32.6) * 0.32;
200 testVector.
m_typeId = ThreeGppIndoorMixedOfficeChannelConditionModel::GetTypeId ();
207 testVector.
m_typeId = ThreeGppIndoorOpenOfficeChannelConditionModel::GetTypeId ();
212 testVector.
m_pLos = exp (-(30.0 - 5.0) / 70.8);
213 testVector.
m_typeId = ThreeGppIndoorOpenOfficeChannelConditionModel::GetTypeId ();
218 testVector.
m_pLos = exp (-(100.0 - 49.0) / 211.7) * 0.54;
219 testVector.
m_typeId = ThreeGppIndoorOpenOfficeChannelConditionModel::GetTypeId ();
234 nodes.Get (0)->AggregateObject (a);
235 nodes.Get (1)->AggregateObject (b);
238 uint32_t numberOfReps = 500000;
253 for (uint32_t j = 0; j < numberOfReps; j++)
259 Simulator::Destroy ();
261 double resultPlos = double (
m_numLos) / double (numberOfReps);
279 :
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.
virtual void DoRun(void)
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
virtual ~ThreeGppChannelConditionModelTestCase()
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 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.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
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.
virtual Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Retrieve the condition of the channel between a and b.
AttributeValue implementation for Time.
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