20 #include "ns3/abort.h" 22 #include "ns3/config.h" 23 #include "ns3/buildings-channel-condition-model.h" 24 #include "ns3/channel-condition-model.h" 25 #include "ns3/three-gpp-v2v-channel-condition-model.h" 26 #include "ns3/three-gpp-v2v-propagation-loss-model.h" 27 #include "ns3/constant-position-mobility-model.h" 28 #include "ns3/buildings-module.h" 30 #include "ns3/simulator.h" 31 #include "ns3/double.h" 32 #include "ns3/uinteger.h" 33 #include "ns3/boolean.h" 34 #include "ns3/core-module.h" 64 virtual void DoRun (
void);
81 :
TestCase (
"Test case for the ThreeGppV2vUrban and ThreeGppV2vHighway ChannelConditionModel with building"), m_testVectors ()
90 RngSeedManager::SetSeed (1);
91 RngSeedManager::SetRun (1);
97 testVector.
m_losCond = ChannelCondition::LosConditionValue::NLOS;
98 testVector.
m_typeId = ThreeGppV2vUrbanChannelConditionModel::GetTypeId ();
103 testVector.
m_losCond = ChannelCondition::LosConditionValue::LOS;
104 testVector.
m_typeId = ThreeGppV2vUrbanChannelConditionModel::GetTypeId ();
108 testVector.
m_positionB = Vector (1000.0, 11.0, 1.5);
109 testVector.
m_losCond = ChannelCondition::LosConditionValue::NLOSv;
110 testVector.
m_typeId = ThreeGppV2vUrbanChannelConditionModel::GetTypeId ();
116 testVector.
m_losCond = ChannelCondition::LosConditionValue::NLOS;
117 testVector.
m_typeId = ThreeGppV2vHighwayChannelConditionModel::GetTypeId ();
122 testVector.
m_losCond = ChannelCondition::LosConditionValue::LOS;
123 testVector.
m_typeId = ThreeGppV2vHighwayChannelConditionModel::GetTypeId ();
127 testVector.
m_positionB = Vector (1000.0, 11.0, 1.5);
128 testVector.
m_losCond = ChannelCondition::LosConditionValue::NLOSv;
129 testVector.
m_typeId = ThreeGppV2vHighwayChannelConditionModel::GetTypeId ();
140 nodes.Get (0)->AggregateObject (a);
143 nodes.Get (1)->AggregateObject (b);
151 BuildingsHelper::Install (
nodes);
173 Simulator::Destroy ();
200 virtual void DoRun (
void);
229 :
TestCase (
"Test case for the class ThreeGppV2vUrbanChannelConditionModel"),
241 if (cond->
GetLosCondition () == ChannelCondition::LosConditionValue::LOS)
250 RngSeedManager::SetSeed (1);
251 RngSeedManager::SetRun (1);
260 testVector.
m_typeId = ThreeGppV2vUrbanChannelConditionModel::GetTypeId ();
266 testVector.
m_typeId = ThreeGppV2vUrbanChannelConditionModel::GetTypeId ();
271 testVector.
m_pLos =
std::min (1.0, 1.05 * exp (-0.0114 * 1000.0));
272 testVector.
m_typeId = ThreeGppV2vUrbanChannelConditionModel::GetTypeId ();
287 nodes.Get (0)->AggregateObject (a);
288 nodes.Get (1)->AggregateObject (b);
290 BuildingsHelper::Install (
nodes);
293 uint32_t numberOfReps = 500000;
313 for (uint32_t j = 0; j < numberOfReps; j++)
319 Simulator::Destroy ();
321 double resultPlos = double (
m_numLos) / double (numberOfReps);
351 virtual void DoRun (
void);
380 :
TestCase (
"Test case for the class ThreeGppV2vHighwayChannelConditionModel"),
392 if (cond->
GetLosCondition () == ChannelCondition::LosConditionValue::LOS)
401 RngSeedManager::SetSeed (1);
402 RngSeedManager::SetRun (1);
410 testVector.
m_pLos =
std::min (1.0, 0.0000021013 * 10.0 * 10.0 - 0.002 * 10.0 + 1.0193);
411 testVector.
m_typeId = ThreeGppV2vHighwayChannelConditionModel::GetTypeId ();
416 testVector.
m_pLos =
std::min (1.0, 0.0000021013 * 100.0 * 100.0 - 0.002 * 100.0 + 1.0193);
417 testVector.
m_typeId = ThreeGppV2vHighwayChannelConditionModel::GetTypeId ();
422 testVector.
m_pLos =
std::max (0.0, 0.54 - 0.001 * (1000.0 - 475));
423 testVector.
m_typeId = ThreeGppV2vHighwayChannelConditionModel::GetTypeId ();
438 nodes.Get (0)->AggregateObject (a);
439 nodes.Get (1)->AggregateObject (b);
441 BuildingsHelper::Install (
nodes);
444 uint32_t numberOfReps = 500000;
460 for (uint32_t j = 0; j < numberOfReps; j++)
466 Simulator::Destroy ();
468 double resultPlos =
static_cast<double> (
m_numLos) / static_cast<double> (numberOfReps);
502 :
TestSuite (
"three-gpp-v2v-channel-condition-model", SYSTEM)
Ptr< ThreeGppV2vHighwayChannelConditionModel > m_condModel
the channel condition model
static ThreeGppV2vChCondModelsTestSuite ThreeGppV2vChCondModelsTestSuite
void SetNRoomsY(uint16_t nroomy)
virtual void DoRun(void)
Builds the simulation scenario and perform the tests.
TypeId m_typeId
the type ID of the channel condition model to be used
Vector m_positionA
the position of the first node
ChannelCondition::LosConditionValue m_losCond
the correct channel condition
#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.
Vector m_positionB
the position of the second node
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
LosConditionValue GetLosCondition() const
Get the LosConditionValue contaning the information about the LOS/NLOS state of the channel...
Struct containing the parameters for each test.
TypeId m_typeId
the type ID of the channel condition model to be used
virtual ~ThreeGppV2vBuildingsChCondModelTestCase()
Destructor.
A simple way to store test vectors (for stimulus or from responses)
void EvaluateChannelCondition(Ptr< MobilityModel > a, Ptr< MobilityModel > b)
Evaluates the channel condition between two nodes by calling the method GetChannelCondition on m_cond...
double m_tolerance
tolerance
ThreeGppV2vHighwayLosNlosvChCondModelTestCase()
Constructor.
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.
Test case for the 3GPP V2V Highway channel condition models (probabilistic model for LOS/NLOSv states...
uint64_t m_numLos
the number of LOS occurrences
void SetNFloors(uint16_t nfloors)
virtual int64_t AssignStreams(int64_t stream)=0
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
ThreeGppV2vChCondModelsTestSuite()
Test case for the 3GPP V2V Urban channel condition models (probabilistic model for LOS/NLOSv states)...
double m_pLos
LOS probability.
Struct containing the parameters for each test.
#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 ...
Vector m_positionA
the position of the first node
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
TypeId m_typeId
the type ID of the channel condition model to be used
virtual Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const =0
Computes the condition of the channel between a and b.
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.
Computes the channel condition for the V2V Highway scenario.
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
virtual ~ThreeGppV2vUrbanLosNlosvChCondModelTestCase()
Destructor.
ThreeGppV2vBuildingsChCondModelTestCase()
Constructor.
TestVectors< TestVector > m_testVectors
array containing all the test vectors
void SetPosition(const Vector &position)
void EvaluateChannelCondition(Ptr< MobilityModel > a, Ptr< MobilityModel > b)
Evaluates the channel condition between two nodes by calling the method GetChannelCondition on m_cond...
TestVectors< TestVector > m_testVectors
array containg all the test vectors
Ptr< ThreeGppV2vUrbanChannelConditionModel > m_condModel
the channel condition model
Instantiate subclasses of ns3::Object.
virtual ~ThreeGppV2vHighwayLosNlosvChCondModelTestCase()
Destructor.
ThreeGppV2vUrbanLosNlosvChCondModelTestCase()
Constructor.
double m_pLos
LOS probability.
Vector m_positionA
the position of the first node
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
mobility buildings information (to be used by mobility models)
TestVectors< TestVector > m_testVectors
array containing all the test vectors
virtual void DoRun(void)
Builds the simulation scenario and perform the tests.
void SetNRoomsX(uint16_t nroomx)
Vector m_positionB
the position of the second node
virtual void DoRun(void)
Builds the simulation scenario and perform the tests.
void MakeConsistent(Ptr< MobilityModel > mm)
Make the given mobility model consistent, by determining whether its position falls inside any of the...
LosConditionValue
Possible values for Line-of-Sight condition.
Test suite for the 3GPP V2V channel condition model.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
uint64_t m_numLos
the number of LOS occurrences
a unique identifier for an interface.
void SetBoundaries(Box box)
Set the boundaries of the building.
virtual int64_t AssignStreams(int64_t stream) override
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
Computes the channel condition for the V2V Urban scenario.
Test case for the classes ThreeGppV2vUrbanChannelConditionModel, and ThreeGppV2vHighwayChannelConditi...
double m_tolerance
tolerance