20#include "ns3/boolean.h"
21#include "ns3/buildings-channel-condition-model.h"
22#include "ns3/buildings-module.h"
23#include "ns3/channel-condition-model.h"
24#include "ns3/config.h"
25#include "ns3/constant-position-mobility-model.h"
26#include "ns3/core-module.h"
27#include "ns3/double.h"
29#include "ns3/simulator.h"
31#include "ns3/three-gpp-v2v-channel-condition-model.h"
32#include "ns3/three-gpp-v2v-propagation-loss-model.h"
33#include "ns3/uinteger.h"
65 void DoRun()
override;
82 :
TestCase(
"Test case for the ThreeGppV2vUrban and ThreeGppV2vHighway ChannelConditionModel "
102 testVector.
m_losCond = ChannelCondition::LosConditionValue::NLOS;
108 testVector.
m_losCond = ChannelCondition::LosConditionValue::LOS;
113 testVector.
m_positionB = Vector(1000.0, 11.0, 1.5);
114 testVector.
m_losCond = ChannelCondition::LosConditionValue::NLOSv;
121 testVector.
m_losCond = ChannelCondition::LosConditionValue::NLOS;
127 testVector.
m_losCond = ChannelCondition::LosConditionValue::LOS;
132 testVector.
m_positionB = Vector(1000.0, 11.0, 1.5);
133 testVector.
m_losCond = ChannelCondition::LosConditionValue::NLOSv;
151 building->SetNRoomsX(1);
152 building->SetNRoomsY(1);
153 building->SetNFloors(1);
154 building->SetBoundaries(
Box(0.0, 10.0, 0.0, 10.0, 0.0, 5.0));
163 DynamicCast<ChannelConditionModel>(condModelFactory.
Create());
164 condModel->AssignStreams(1);
169 buildingInfoA->MakeConsistent(a);
171 buildingInfoB->MakeConsistent(b);
173 cond = condModel->GetChannelCondition(a, b);
175 NS_LOG_DEBUG(
"Got " << cond->GetLosCondition() <<
" expected condition "
179 "Got unexpected channel condition");
209 void DoRun()
override;
238 :
TestCase(
"Test case for the class ThreeGppV2vUrbanChannelConditionModel"),
253 if (cond->GetLosCondition() == ChannelCondition::LosConditionValue::LOS)
271 testVector.
m_pLos = std::min(1.0, 1.05 * exp(-0.0114 * 10.0));
277 testVector.
m_pLos = std::min(1.0, 1.05 * exp(-0.0114 * 100.0));
283 testVector.
m_pLos = std::min(1.0, 1.05 * exp(-0.0114 * 1000.0));
314 buildingInfoA->MakeConsistent(a);
316 buildingInfoB->MakeConsistent(b);
325 for (
uint32_t j = 0; j < numberOfReps; j++)
341 <<
" numberOfReps " << numberOfReps <<
" resultPlos "
342 << resultPlos <<
" ref " << testVector.
m_pLos);
346 "Got unexpected LOS probability");
374 void DoRun()
override;
403 :
TestCase(
"Test case for the class ThreeGppV2vHighwayChannelConditionModel"),
418 if (cond->GetLosCondition() == ChannelCondition::LosConditionValue::LOS)
436 testVector.
m_pLos = std::min(1.0, 0.0000021013 * 10.0 * 10.0 - 0.002 * 10.0 + 1.0193);
442 testVector.
m_pLos = std::min(1.0, 0.0000021013 * 100.0 * 100.0 - 0.002 * 100.0 + 1.0193);
448 testVector.
m_pLos = std::max(0.0, 0.54 - 0.001 * (1000.0 - 475));
486 for (
uint32_t j = 0; j < numberOfReps; j++)
499 double resultPlos =
static_cast<double>(
m_numLos) /
static_cast<double>(numberOfReps);
502 <<
" numberOfReps " << numberOfReps <<
" resultPlos "
503 << resultPlos <<
" ref " << testVector.
m_pLos);
507 "Got unexpected LOS probability");
540 :
TestSuite(
"three-gpp-v2v-channel-condition-model",
Type::SYSTEM)
543 TestCase::Duration::QUICK);
546 TestCase::Duration::QUICK);
549 TestCase::Duration::QUICK);
Test case for the classes ThreeGppV2vUrbanChannelConditionModel, and ThreeGppV2vHighwayChannelConditi...
ThreeGppV2vBuildingsChCondModelTestCase()
Constructor.
void DoRun() override
Builds the simulation scenario and perform the tests.
~ThreeGppV2vBuildingsChCondModelTestCase() override
Destructor.
TestVectors< TestVector > m_testVectors
array containing 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
ThreeGppV2vHighwayLosNlosvChCondModelTestCase()
Constructor.
void DoRun() override
Builds the simulation scenario and perform the tests.
~ThreeGppV2vHighwayLosNlosvChCondModelTestCase() override
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
void DoRun() override
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...
~ThreeGppV2vUrbanLosNlosvChCondModelTestCase() override
Destructor.
uint64_t m_numLos
the number of LOS occurrences
static void Install(Ptr< Node > node)
Install the MobilityBuildingInfo to a node.
LosConditionValue
Possible values for Line-of-Sight condition.
mobility buildings information (to be used by mobility models)
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.
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.
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)
int64_t AssignStreams(int64_t stream) override
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
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.
static TypeId GetTypeId()
Get the type ID.
Computes the channel condition for the V2V Urban scenario.
static TypeId GetTypeId()
Get the type ID.
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