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);
146 building->SetNRoomsX (1);
147 building->SetNRoomsY (1);
148 building->SetNFloors (1);
149 building->SetBoundaries (
Box (0.0, 10.0, 0.0, 10.0, 0.0, 5.0));
151 BuildingsHelper::Install (
nodes);
158 condModel->AssignStreams (1);
163 buildingInfoA->MakeConsistent (a);
165 buildingInfoB->MakeConsistent (b);
167 cond = condModel->GetChannelCondition (a, b);
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;
302 buildingInfoA->MakeConsistent (a);
304 buildingInfoB->MakeConsistent (b);
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)
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