|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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)
Vector m_positionB
the position of the second node
virtual ~ThreeGppV2vUrbanLosNlosvChCondModelTestCase()
Destructor.
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
virtual ~ThreeGppV2vHighwayLosNlosvChCondModelTestCase()
Destructor.
Struct containing the parameters for each test.
void EvaluateChannelCondition(Ptr< MobilityModel > a, Ptr< MobilityModel > b)
Evaluates the channel condition between two nodes by calling the method GetChannelCondition on m_cond...
ThreeGppV2vChCondModelsTestSuite()
virtual void DoRun(void)
Builds the simulation scenario and perform the tests.
virtual void DoRun(void)
Builds the simulation scenario and perform the tests.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Vector m_positionA
the position of the first node
TestVectors< TestVector > m_testVectors
array containing all the test vectors
ChannelCondition::LosConditionValue m_losCond
the correct channel condition
uint64_t m_numLos
the number of LOS occurrences
Vector m_positionB
the position of the second node
TestVectors< TestVector > m_testVectors
array containing all the test vectors
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
double m_tolerance
tolerance
Struct containing the parameters for each test.
void SetPosition(const Vector &position)
Vector m_positionA
the position of the first node
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
virtual Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Retrieve the condition of the channel between a and b.
LosConditionValue
Possible values for Line-of-Sight condition.
TypeId m_typeId
the type ID of the channel condition model to be used
ThreeGppV2vUrbanLosNlosvChCondModelTestCase()
Constructor.
void SetNRoomsX(uint16_t nroomx)
virtual Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const =0
Computes the condition of the channel between a and b.
double m_pLos
LOS probability.
TypeId m_typeId
the type ID of the channel condition model to be used
ThreeGppV2vBuildingsChCondModelTestCase()
Constructor.
#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 ...
Computes the channel condition for the V2V Urban scenario.
void MakeConsistent(Ptr< MobilityModel > mm)
Make the given mobility model consistent, by determining whether its position falls inside any of the...
Test suite for the 3GPP V2V channel condition model.
mobility buildings information (to be used by mobility models)
void SetBoundaries(Box box)
Set the boundaries of the building.
LosConditionValue GetLosCondition() const
Get the LosConditionValue contaning the information about the LOS/NLOS state of the channel.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
ThreeGppV2vHighwayLosNlosvChCondModelTestCase()
Constructor.
Instantiate subclasses of ns3::Object.
Test case for the classes ThreeGppV2vUrbanChannelConditionModel, and ThreeGppV2vHighwayChannelConditi...
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 Highway scenario.
virtual ~ThreeGppV2vBuildingsChCondModelTestCase()
Destructor.
Struct containing the parameters for each test.
Ptr< ThreeGppV2vUrbanChannelConditionModel > m_condModel
the channel condition model
TestVectors< TestVector > m_testVectors
array containg all the test vectors
double m_pLos
LOS probability.
void SetNRoomsY(uint16_t nroomy)
TypeId m_typeId
the type ID of the channel condition model to be used
static ThreeGppV2vChCondModelsTestSuite ThreeGppV2vChCondModelsTestSuite
Vector m_positionA
the position of the first node
#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.
virtual void DoRun(void)
Builds the simulation scenario and perform the tests.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
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
Test case for the 3GPP V2V Highway channel condition models (probabilistic model for LOS/NLOSv states...
AttributeValue implementation for Time.
keep track of a set of node pointers.
double m_tolerance
tolerance
Ptr< ThreeGppV2vHighwayChannelConditionModel > m_condModel
the channel condition model
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.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
Test case for the 3GPP V2V Urban channel condition models (probabilistic model for LOS/NLOSv states).
A simple way to store test vectors (for stimulus or from responses)
virtual int64_t AssignStreams(int64_t stream)=0
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
void SetNFloors(uint16_t nfloors)