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"
67 virtual void DoRun (
void);
84 :
TestCase (
"Test case for the ThreeGppV2vUrban and ThreeGppV2vHighway ChannelConditionModel with building"), m_testVectors ()
93 RngSeedManager::SetSeed (1);
94 RngSeedManager::SetRun (1);
100 testVector.
m_losCond = ChannelCondition::LosConditionValue::NLOS;
101 testVector.
m_typeId = ThreeGppV2vUrbanChannelConditionModel::GetTypeId ();
106 testVector.
m_losCond = ChannelCondition::LosConditionValue::LOS;
107 testVector.
m_typeId = ThreeGppV2vUrbanChannelConditionModel::GetTypeId ();
111 testVector.
m_positionB = Vector (1000.0, 11.0, 1.5);
112 testVector.
m_losCond = ChannelCondition::LosConditionValue::NLOSv;
113 testVector.
m_typeId = ThreeGppV2vUrbanChannelConditionModel::GetTypeId ();
119 testVector.
m_losCond = ChannelCondition::LosConditionValue::NLOS;
120 testVector.
m_typeId = ThreeGppV2vHighwayChannelConditionModel::GetTypeId ();
125 testVector.
m_losCond = ChannelCondition::LosConditionValue::LOS;
126 testVector.
m_typeId = ThreeGppV2vHighwayChannelConditionModel::GetTypeId ();
130 testVector.
m_positionB = Vector (1000.0, 11.0, 1.5);
131 testVector.
m_losCond = ChannelCondition::LosConditionValue::NLOSv;
132 testVector.
m_typeId = ThreeGppV2vHighwayChannelConditionModel::GetTypeId ();
143 nodes.Get (0)->AggregateObject (a);
146 nodes.Get (1)->AggregateObject (b);
149 building->SetNRoomsX (1);
150 building->SetNRoomsY (1);
151 building->SetNFloors (1);
152 building->SetBoundaries (
Box (0.0, 10.0, 0.0, 10.0, 0.0, 5.0));
154 BuildingsHelper::Install (
nodes);
161 condModel->AssignStreams (1);
166 buildingInfoA->MakeConsistent (a);
168 buildingInfoB->MakeConsistent (b);
170 cond = condModel->GetChannelCondition (a, b);
176 Simulator::Destroy ();
203 virtual void DoRun (
void);
232 :
TestCase (
"Test case for the class ThreeGppV2vUrbanChannelConditionModel"),
244 if (cond->GetLosCondition () == ChannelCondition::LosConditionValue::LOS)
253 RngSeedManager::SetSeed (1);
254 RngSeedManager::SetRun (1);
263 testVector.
m_typeId = ThreeGppV2vUrbanChannelConditionModel::GetTypeId ();
269 testVector.
m_typeId = ThreeGppV2vUrbanChannelConditionModel::GetTypeId ();
274 testVector.
m_pLos =
std::min (1.0, 1.05 * exp (-0.0114 * 1000.0));
275 testVector.
m_typeId = ThreeGppV2vUrbanChannelConditionModel::GetTypeId ();
290 nodes.Get (0)->AggregateObject (a);
291 nodes.Get (1)->AggregateObject (b);
293 BuildingsHelper::Install (
nodes);
296 uint32_t numberOfReps = 500000;
305 buildingInfoA->MakeConsistent (a);
307 buildingInfoB->MakeConsistent (b);
316 for (uint32_t j = 0; j < numberOfReps; j++)
322 Simulator::Destroy ();
324 double resultPlos = double (
m_numLos) / double (numberOfReps);
354 virtual void DoRun (
void);
383 :
TestCase (
"Test case for the class ThreeGppV2vHighwayChannelConditionModel"),
395 if (cond->GetLosCondition () == ChannelCondition::LosConditionValue::LOS)
404 RngSeedManager::SetSeed (1);
405 RngSeedManager::SetRun (1);
413 testVector.
m_pLos =
std::min (1.0, 0.0000021013 * 10.0 * 10.0 - 0.002 * 10.0 + 1.0193);
414 testVector.
m_typeId = ThreeGppV2vHighwayChannelConditionModel::GetTypeId ();
419 testVector.
m_pLos =
std::min (1.0, 0.0000021013 * 100.0 * 100.0 - 0.002 * 100.0 + 1.0193);
420 testVector.
m_typeId = ThreeGppV2vHighwayChannelConditionModel::GetTypeId ();
425 testVector.
m_pLos =
std::max (0.0, 0.54 - 0.001 * (1000.0 - 475));
426 testVector.
m_typeId = ThreeGppV2vHighwayChannelConditionModel::GetTypeId ();
441 nodes.Get (0)->AggregateObject (a);
442 nodes.Get (1)->AggregateObject (b);
444 BuildingsHelper::Install (
nodes);
447 uint32_t numberOfReps = 500000;
463 for (uint32_t j = 0; j < numberOfReps; j++)
469 Simulator::Destroy ();
471 double resultPlos =
static_cast<double> (
m_numLos) /
static_cast<double> (numberOfReps);
508 :
TestSuite (
"three-gpp-v2v-channel-condition-model", SYSTEM)
Test case for the classes ThreeGppV2vUrbanChannelConditionModel, and ThreeGppV2vHighwayChannelConditi...
ThreeGppV2vBuildingsChCondModelTestCase()
Constructor.
virtual void DoRun(void)
Builds the simulation scenario and perform the tests.
virtual ~ThreeGppV2vBuildingsChCondModelTestCase()
Destructor.
TestVectors< TestVector > m_testVectors
array containg all the test vectors
Test suite for the 3GPP V2V channel condition model.
ThreeGppV2vChCondModelsTestSuite()
Test case for the 3GPP V2V Highway channel condition models (probabilistic model for LOS/NLOSv states...
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
virtual void DoRun(void)
Builds the simulation scenario and perform the tests.
ThreeGppV2vHighwayLosNlosvChCondModelTestCase()
Constructor.
virtual ~ThreeGppV2vHighwayLosNlosvChCondModelTestCase()
Destructor.
TestVectors< TestVector > m_testVectors
array containing all the test vectors
uint64_t m_numLos
the number of LOS occurrences
Ptr< ThreeGppV2vHighwayChannelConditionModel > m_condModel
the channel condition model
Test case for the 3GPP V2V Urban channel condition models (probabilistic model for LOS/NLOSv states).
Ptr< ThreeGppV2vUrbanChannelConditionModel > m_condModel
the channel condition model
ThreeGppV2vUrbanLosNlosvChCondModelTestCase()
Constructor.
double m_tolerance
tolerance
virtual void DoRun(void)
Builds the simulation scenario and perform the tests.
TestVectors< TestVector > m_testVectors
array containing all the test vectors
void EvaluateChannelCondition(Ptr< MobilityModel > a, Ptr< MobilityModel > b)
Evaluates the channel condition between two nodes by calling the method GetChannelCondition on m_cond...
uint64_t m_numLos
the number of LOS occurrences
virtual ~ThreeGppV2vUrbanLosNlosvChCondModelTestCase()
Destructor.
LosConditionValue
Possible values for Line-of-Sight condition.
mobility buildings information (to be used by mobility models)
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.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
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)
virtual int64_t AssignStreams(int64_t stream) override
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
virtual Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Retrieve the condition of the channel between a and b.
Computes the channel condition for the V2V Highway scenario.
Computes the channel condition for the V2V Urban scenario.
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_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
#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.
TypeId m_typeId
the type ID of the channel condition model to be used
Vector m_positionA
the position of the first node
Vector m_positionB
the position of the second node
ChannelCondition::LosConditionValue m_losCond
the correct channel condition
Struct containing the parameters for each test.
TypeId m_typeId
the type ID of the channel condition model to be used
Vector m_positionB
the position of the second node
Vector m_positionA
the position of the first node
double m_pLos
LOS probability.
Struct containing the parameters for each test.
Vector m_positionA
the position of the first node
double m_pLos
LOS probability.
TypeId m_typeId
the type ID of the channel condition model to be used
Vector m_positionB
the position of the second node
static ThreeGppV2vChCondModelsTestSuite ThreeGppV2vChCondModelsTestSuite
Static variable for test initialization.