8#include "ns3/boolean.h"
9#include "ns3/channel-condition-model.h"
10#include "ns3/config.h"
11#include "ns3/constant-position-mobility-model.h"
12#include "ns3/core-module.h"
13#include "ns3/double.h"
15#include "ns3/node-container.h"
16#include "ns3/probabilistic-v2v-channel-condition-model.h"
17#include "ns3/simulator.h"
19#include "ns3/three-gpp-v2v-propagation-loss-model.h"
20#include "ns3/uinteger.h"
55 void DoRun()
override;
87 :
TestCase(
"Test case for the class ProbabilisticV2vUrbanChannelConditionModel"),
102 if (cond->GetLosCondition() == ChannelCondition::LosConditionValue::LOS)
106 else if (cond->GetLosCondition() == ChannelCondition::LosConditionValue::NLOSv)
124 testVector.
m_pLos = std::min(1.0, std::max(0.0, 0.8548 * exp(-0.0064 * 10.0)));
129 1 / (0.0396 * 10.0) * exp(-(log(10.0) - 5.2718) * (log(10.0) - 5.2718) / 3.4827)));
135 testVector.
m_pLos = std::min(1.0, std::max(0.0, 0.8548 * exp(-0.0064 * 100.0)));
140 1 / (0.0396 * 100.0) *
141 exp(-(log(100.0) - 5.2718) * (log(100.0) - 5.2718) / 3.4827)));
147 testVector.
m_pLos = std::min(1.0, std::max(0.0, 0.8372 * exp(-0.0114 * 10.0)));
152 1 / (0.0312 * 10.0) * exp(-(log(10.0) - 5.0063) * (log(10.0) - 5.0063) / 2.4544)));
158 testVector.
m_pLos = std::min(1.0, std::max(0.0, 0.8372 * exp(-0.0114 * 100.0)));
163 1 / (0.0312 * 100.0) *
164 exp(-(log(100.0) - 5.0063) * (log(100.0) - 5.0063) / 2.4544)));
170 testVector.
m_pLos = std::min(1.0, std::max(0.0, 0.8962 * exp(-0.017 * 10.0)));
175 1 / (0.0242 * 10.0) * exp(-(log(10.0) - 5.0115) * (log(10.0) - 5.0115) / 2.2092)));
181 testVector.
m_pLos = std::min(1.0, std::max(0.0, 0.8962 * exp(-0.017 * 100.0)));
186 1 / (0.0242 * 100.0) *
187 exp(-(log(100.0) - 5.0115) * (log(100.0) - 5.0115) / 2.2092)));
225 for (
uint32_t j = 0; j < numberOfReps; j++)
241 <<
" numberOfReps " << numberOfReps <<
" resultPlos "
242 << resultPlos <<
" ref " << testVector.
m_pLos);
246 "Got unexpected LOS probability");
249 <<
" numberOfReps " << numberOfReps <<
" resultPnlosv "
250 << resultPnlosv <<
" ref " << testVector.
m_pNlosv);
254 "Got unexpected NLOSv probability");
287 void DoRun()
override;
319 :
TestCase(
"Test case for the class ProbabilisticV2vHighwayChannelConditionModel"),
334 if (cond->GetLosCondition() == ChannelCondition::LosConditionValue::LOS)
338 else if (cond->GetLosCondition() == ChannelCondition::LosConditionValue::NLOS)
356 double aLos = 1.5e-6;
357 double bLos = -0.0015;
359 testVector.
m_pLos = std::min(1.0, std::max(0.0, aLos * 10.0 * 10.0 + bLos * 10.0 + cLos));
361 double aNlos = -2.9e-7;
362 double bNlos = 0.00059;
363 double cNlos = 0.0017;
364 testVector.
m_pNlos = std::min(1.0, std::max(0.0, aNlos * 10.0 * 10.0 + bNlos * 10.0 + cNlos));
370 testVector.
m_pLos = std::min(1.0, std::max(0.0, aLos * 100.0 * 100.0 + bLos * 100.0 + cLos));
373 std::min(1.0, std::max(0.0, aNlos * 100.0 * 100.0 + bNlos * 100.0 + cNlos));
382 testVector.
m_pLos = std::min(1.0, std::max(0.0, aLos * 10.0 * 10.0 + bLos * 10.0 + cLos));
387 testVector.
m_pNlos = std::min(1.0, std::max(0.0, aNlos * 10.0 * 10.0 + bNlos * 10.0 + cNlos));
393 testVector.
m_pLos = std::min(1.0, std::max(0.0, aLos * 100.0 * 100.0 + bLos * 100.0 + cLos));
396 std::min(1.0, std::max(0.0, aNlos * 100.0 * 100.0 + bNlos * 100.0 + cNlos));
405 testVector.
m_pLos = std::min(1.0, std::max(0.0, aLos * 10.0 * 10.0 + bLos * 10.0 + cLos));
410 testVector.
m_pNlos = std::min(1.0, std::max(0.0, aNlos * 10.0 * 10.0 + bNlos * 10.0 + cNlos));
416 testVector.
m_pLos = std::min(1.0, std::max(0.0, aLos * 100.0 * 100.0 + bLos * 100.0 + cLos));
419 std::min(1.0, std::max(0.0, aNlos * 100.0 * 100.0 + bNlos * 100.0 + cNlos));
457 for (
uint32_t j = 0; j < numberOfReps; j++)
473 <<
" numberOfReps " << numberOfReps <<
" resultPlos "
474 << resultPlos <<
" ref " << testVector.
m_pLos);
478 "Got unexpected LOS probability");
481 <<
" numberOfReps " << numberOfReps <<
" resultPnlos "
482 << resultPnlos <<
" ref " << testVector.
m_pNlos);
486 "Got unexpected NLOS probability");
511 :
TestSuite(
"probabilistic-v2v-channel-condition-model",
Type::SYSTEM)
514 TestCase::Duration::QUICK);
517 TestCase::Duration::QUICK);
Test suite for the probabilistic V2V channel condition model.
ProbabilisticV2vChCondModelsTestSuite()
Test case for the V2V Highway channel condition models using a fully probabilistic model to determine...
void EvaluateChannelCondition(Ptr< MobilityModel > a, Ptr< MobilityModel > b)
Evaluates the channel condition between two nodes by calling the method GetChannelCondition on m_cond...
V2vHighwayProbChCondModelTestCase()
Constructor.
Ptr< ProbabilisticV2vHighwayChannelConditionModel > m_condModel
the channel condition model
void DoRun() override
Builds the simulation scenario and perform the tests.
TestVectors< TestVector > m_testVectors
array containing all the test vectors
uint64_t m_numNlos
the number of NLOS occurrences
~V2vHighwayProbChCondModelTestCase() override
Destructor.
double m_tolerance
tolerance
uint64_t m_numLos
the number of LOS occurrences
Test case for the V2V Urban channel condition models using a fully probabilistic model to determine L...
TestVectors< TestVector > m_testVectors
array containing all the test vectors
void DoRun() override
Builds the simulation scenario and perform the tests.
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
V2vUrbanProbChCondModelTestCase()
Constructor.
Ptr< ProbabilisticV2vUrbanChannelConditionModel > m_condModel
the channel condition model
uint64_t m_numNlosv
the number of NLOSv occurrences
double m_tolerance
tolerance
~V2vUrbanProbChCondModelTestCase() override
Destructor.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
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() 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.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Computes the channel condition for the V2V Highway scenario.
static TypeId GetTypeId()
Get the type ID.
Computes the channel condition for the V2V Urban scenario.
static TypeId GetTypeId()
Get the type ID.
Smart pointer class similar to boost::intrusive_ptr.
static void SetRun(uint64_t run)
Set the run number of simulation.
static void SetSeed(uint32_t seed)
Set the seed.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
Hold variables of type string.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
A simple way to store test vectors (for stimulus or from responses)
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.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#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.
static ProbabilisticV2vChCondModelsTestSuite g_probabilisticV2vChCondModelsTestSuite
Static variable for test initialization.
Struct containing the parameters for each test.
TypeId m_typeId
the type ID of the channel condition model to be used
std::string m_density
the vehicles density
double m_pNlos
NLOS probability.
Vector m_positionA
the position of the first node
double m_pLos
LOS probability.
Vector m_positionB
the position of the second node
Struct containing the parameters for each test.
std::string m_density
the vehicles density
TypeId m_typeId
the type ID of the channel condition model to be used
double m_pNlosv
NLOSv probability.
Vector m_positionB
the position of the second node
Vector m_positionA
the position of the first node
double m_pLos
LOS probability.