19 #include "ns3/abort.h"    21 #include "ns3/config.h"    22 #include "ns3/channel-condition-model.h"    23 #include "ns3/probabilistic-v2v-channel-condition-model.h"    24 #include "ns3/three-gpp-v2v-propagation-loss-model.h"    25 #include "ns3/constant-position-mobility-model.h"    27 #include "ns3/simulator.h"    28 #include "ns3/double.h"    29 #include "ns3/uinteger.h"    30 #include "ns3/boolean.h"    31 #include "ns3/core-module.h"    32 #include "ns3/node-container.h"    65   virtual void DoRun (
void);
    84     double m_pNlosv {0.0};  
    91   uint64_t m_numLos {0}; 
    92   uint64_t m_numNlosv {0}; 
    97   : 
TestCase (
"Test case for the class ProbabilisticV2vUrbanChannelConditionModel"),
   109   if (cond->
GetLosCondition () == ChannelCondition::LosConditionValue::LOS)
   113   else if (cond->
GetLosCondition () == ChannelCondition::LosConditionValue::NLOSv)
   122   RngSeedManager::SetSeed (1);
   123   RngSeedManager::SetRun (1);
   132   testVector.
m_typeId = ProbabilisticV2vUrbanChannelConditionModel::GetTypeId ();
   133   testVector.
m_pNlosv = 
std::min (1.0, 
std::max (0.0, 1 / (0.0396 * 10.0) * exp (-(log (10.0) - 5.2718) * (log (10.0) - 5.2718) / 3.4827)));
   140   testVector.
m_typeId = ProbabilisticV2vUrbanChannelConditionModel::GetTypeId ();
   141   testVector.
m_pNlosv = 
std::min (1.0, 
std::max (0.0, 1 / (0.0396 * 100.0) * exp (-(log (100.0) - 5.2718) * (log (100.0) - 5.2718) / 3.4827)));
   148   testVector.
m_typeId = ProbabilisticV2vUrbanChannelConditionModel::GetTypeId ();
   149   testVector.
m_pNlosv = 
std::min (1.0, 
std::max (0.0, 1 / (0.0312 * 10.0) * exp (-(log (10.0) - 5.0063) * (log (10.0) - 5.0063) / 2.4544)));
   156   testVector.
m_typeId = ProbabilisticV2vUrbanChannelConditionModel::GetTypeId ();
   157   testVector.
m_pNlosv = 
std::min (1.0, 
std::max (0.0, 1 / (0.0312 * 100.0) * exp (-(log (100.0) - 5.0063) * (log (100.0) - 5.0063) / 2.4544)));
   164   testVector.
m_typeId = ProbabilisticV2vUrbanChannelConditionModel::GetTypeId ();
   165   testVector.
m_pNlosv = 
std::min (1.0, 
std::max (0.0, 1 / (0.0242 * 10.0) * exp (-(log (10.0) - 5.0115) * (log (10.0) - 5.0115) / 2.2092)));
   172   testVector.
m_typeId = ProbabilisticV2vUrbanChannelConditionModel::GetTypeId ();
   173   testVector.
m_pNlosv = 
std::min (1.0, 
std::max (0.0, 1 / (0.0242 * 100.0) * exp (-(log (100.0) - 5.0115) * (log (100.0) - 5.0115) / 2.2092)));
   189   nodes.Get (0)->AggregateObject (a);
   190   nodes.Get (1)->AggregateObject (b);
   193   uint32_t numberOfReps = 500000;
   211       for (uint32_t j = 0; j < numberOfReps; j++)
   217       Simulator::Destroy ();
   219       double resultPlos = double (
m_numLos) / double (numberOfReps);
   220       double resultPnlosv = double (
m_numNlosv) / double (numberOfReps);
   255   virtual void DoRun (
void);
   287   : 
TestCase (
"Test case for the class ProbabilisticV2vHighwayChannelConditionModel"),
   299   if (cond->
GetLosCondition () == ChannelCondition::LosConditionValue::LOS)
   303   else if (cond->
GetLosCondition () == ChannelCondition::LosConditionValue::NLOS)
   312   RngSeedManager::SetSeed (1);
   313   RngSeedManager::SetRun (1);
   321   double aLos = 1.5e-6;
   322   double bLos = -0.0015;
   325   testVector.
m_typeId = ProbabilisticV2vHighwayChannelConditionModel::GetTypeId ();
   326   double aNlos = -2.9e-7;
   327   double bNlos = 0.00059;
   328   double cNlos = 0.0017;
   336   testVector.
m_typeId = ProbabilisticV2vHighwayChannelConditionModel::GetTypeId ();
   347   testVector.
m_typeId = ProbabilisticV2vHighwayChannelConditionModel::GetTypeId ();
   358   testVector.
m_typeId = ProbabilisticV2vHighwayChannelConditionModel::GetTypeId ();
   369   testVector.
m_typeId = ProbabilisticV2vHighwayChannelConditionModel::GetTypeId ();
   380   testVector.
m_typeId = ProbabilisticV2vHighwayChannelConditionModel::GetTypeId ();
   397   nodes.Get (0)->AggregateObject (a);
   398   nodes.Get (1)->AggregateObject (b);
   401   uint32_t numberOfReps = 500000;
   419       for (uint32_t j = 0; j < numberOfReps; j++)
   425       Simulator::Destroy ();
   427       double resultPlos = double (
m_numLos) / double (numberOfReps);
   428       double resultPnlos = double (
m_numNlos) / double (numberOfReps);
   455   : 
TestSuite (
"probabilistic-v2v-channel-condition-model", SYSTEM)
 Test case for the V2V Highway channel condition models using a fully probabilistic model to determine...
Vector m_positionA
the position of the first node 
TestVectors< TestVector > m_testVectors
array containing all the test vectors 
Hold variables of type string. 
uint64_t m_numLos
the number of LOS occurrences 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
uint64_t m_numNlos
the number of NLOS occurrences 
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. 
TestVectors< TestVector > m_testVectors
array containing all the test vectors 
uint64_t m_numLos
the number of LOS occurrences 
virtual void DoRun(void)
Builds the simulation scenario and perform the tests. 
Test suite for the probabilistic V2V channel condition model. 
LosConditionValue GetLosCondition() const
Get the LosConditionValue contaning the information about the LOS/NLOS state of the channel...
A simple way to store test vectors (for stimulus or from responses) 
uint64_t m_numNlosv
the number of NLOSv occurrences 
Test case for the V2V Urban channel condition models using a fully probabilistic model to determine L...
std::string m_density
the vehicles density 
static ProbabilisticV2vChCondModelsTestSuite probabilisticV2vChCondModelsTestSuite
  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. 
double m_tolerance
tolerance 
Struct containing the parameters for each test. 
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 ...
double m_tolerance
tolerance 
TypeId m_typeId
the type ID of the channel condition model to be used 
virtual ~V2vUrbanProbChCondModelTestCase()
Destructor. 
double m_pLos
LOS probability. 
V2vHighwayProbChCondModelTestCase()
Constructor. 
std::string m_density
the vehicles density 
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. 
ProbabilisticV2vChCondModelsTestSuite()
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_pNlos
NLOS probability. 
V2vUrbanProbChCondModelTestCase()
Constructor. 
Ptr< ProbabilisticV2vHighwayChannelConditionModel > m_condModel
the channel condition model 
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...
TypeId m_typeId
the type ID of the channel condition model to be used 
Vector m_positionB
the position of the second node 
Instantiate subclasses of ns3::Object. 
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. 
Computes the channel condition for the V2V Urban scenario. 
Vector m_positionB
the position of the second node 
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful. 
a unique identifier for an interface. 
virtual void DoRun(void)
Builds the simulation scenario and perform the tests. 
Computes the channel condition for the V2V Highway scenario. 
double m_pNlosv
NLOSv probability. 
Ptr< ProbabilisticV2vUrbanChannelConditionModel > m_condModel
the channel condition model 
virtual int64_t AssignStreams(int64_t stream) override
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
double m_pLos
LOS probability. 
virtual ~V2vHighwayProbChCondModelTestCase()
Destructor.