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" 57 virtual void DoRun (
void);
86 :
TestCase (
"Test case for the child classes of ThreeGppChannelConditionModel"),
100 if (cond->
GetLosCondition () == ChannelCondition::LosConditionValue::LOS)
116 testVector.
m_typeId = ThreeGppRmaChannelConditionModel::GetTypeId ();
121 testVector.
m_pLos = exp (-(100.0 - 10.0) / 1000.0);
122 testVector.
m_typeId = ThreeGppRmaChannelConditionModel::GetTypeId ();
127 testVector.
m_pLos = exp (-(1000.0 - 10.0) / 1000.0);
128 testVector.
m_typeId = ThreeGppRmaChannelConditionModel::GetTypeId ();
135 testVector.
m_typeId = ThreeGppUmaChannelConditionModel::GetTypeId ();
140 testVector.
m_pLos = (18.0 / 50.0 + exp (-50.0 / 63.0) * (1.0 - 18.0 / 50.0)) * (1.0 + 0);
141 testVector.
m_typeId = ThreeGppUmaChannelConditionModel::GetTypeId ();
146 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));
147 testVector.
m_typeId = ThreeGppUmaChannelConditionModel::GetTypeId ();
152 testVector.
m_pLos = (18.0 / 100.0 + exp (-100.0 / 63.0) * (1.0 - 18.0 / 100.0)) * (1.0 + 0);
153 testVector.
m_typeId = ThreeGppUmaChannelConditionModel::GetTypeId ();
158 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));
159 testVector.
m_typeId = ThreeGppUmaChannelConditionModel::GetTypeId ();
166 testVector.
m_typeId = ThreeGppUmiStreetCanyonChannelConditionModel::GetTypeId ();
171 testVector.
m_pLos = (18.0 / 50.0 + exp (-50.0 / 36.0) * (1.0 - 18.0 / 50.0));
172 testVector.
m_typeId = ThreeGppUmiStreetCanyonChannelConditionModel::GetTypeId ();
178 testVector.
m_pLos = (18.0 / 100.0 + exp (-100.0 / 36.0) * (1.0 - 18.0 / 100.0));
179 testVector.
m_typeId = ThreeGppUmiStreetCanyonChannelConditionModel::GetTypeId ();
186 testVector.
m_typeId = ThreeGppIndoorMixedOfficeChannelConditionModel::GetTypeId ();
191 testVector.
m_pLos = exp (-(5.0 - 1.2) / 4.7);
192 testVector.
m_typeId = ThreeGppIndoorMixedOfficeChannelConditionModel::GetTypeId ();
197 testVector.
m_pLos = exp (-(10.0 - 6.5) / 32.6) * 0.32;
198 testVector.
m_typeId = ThreeGppIndoorMixedOfficeChannelConditionModel::GetTypeId ();
205 testVector.
m_typeId = ThreeGppIndoorOpenOfficeChannelConditionModel::GetTypeId ();
210 testVector.
m_pLos = exp (-(30.0 - 5.0) / 70.8);
211 testVector.
m_typeId = ThreeGppIndoorOpenOfficeChannelConditionModel::GetTypeId ();
216 testVector.
m_pLos = exp (-(100.0 - 49.0) / 211.7) * 0.54;
217 testVector.
m_typeId = ThreeGppIndoorOpenOfficeChannelConditionModel::GetTypeId ();
232 nodes.Get (0)->AggregateObject (a);
233 nodes.Get (1)->AggregateObject (b);
236 uint32_t numberOfReps = 500000;
251 for (uint32_t j = 0; j < numberOfReps; j++)
257 Simulator::Destroy ();
259 double resultPlos = double (
m_numLos) / double (numberOfReps);
275 :
TestSuite (
"propagation-channel-condition-model", UNIT)
double m_pLos
LOS probability.
#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.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
virtual ~ThreeGppChannelConditionModelTestCase()
Destructor.
LosConditionValue GetLosCondition() const
Get the LosConditionValue contaning the information about the LOS/NLOS state of the channel...
Struct containing the parameters for each test.
A simple way to store test vectors (for stimulus or from responses)
Test suite for the channel condition models.
AttributeValue implementation for Time.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Base class for the 3GPP channel condition models.
double m_tolerance
tolerance
Ptr< ThreeGppChannelConditionModel > m_condModel
the channel condition model
#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 ...
uint64_t m_numLos
the number of LOS occurrences
Test case for the 3GPP channel condition models.
ChannelConditionModelsTestSuite()
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
virtual Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Retrieve the condition of the channel between a and b.
Vector m_positionB
the position of the second node
void SetPosition(const Vector &position)
TypeId m_typeId
the type ID of the channel condition model to be used
Vector m_positionA
the position of the first node
virtual void DoRun(void)
Builds the simulation scenario and perform the tests.
Instantiate subclasses of ns3::Object.
void EvaluateChannelCondition(Ptr< MobilityModel > a, Ptr< MobilityModel > b)
Evaluates the channel condition between two nodes by calling the method GetChannelCondition on m_cond...
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
ThreeGppChannelConditionModelTestCase()
Constructor.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
a unique identifier for an interface.
static ChannelConditionModelsTestSuite ChannelConditionModelsTestSuite
TestVectors< TestVector > m_testVectors
array containing all the test vectors