9#include "ns3/building-position-allocator.h"
10#include "ns3/building.h"
11#include "ns3/config.h"
12#include "ns3/double.h"
15#include "ns3/mobility-helper.h"
16#include "ns3/pointer.h"
17#include "ns3/random-walk-2d-outdoor-mobility-model.h"
18#include "ns3/simulator.h"
38 void DoRun()
override;
50 :
TestCase(
"Test case for the BuildingsChannelConditionModel"),
62 auto position = model->GetPosition();
67 "Position " << position <<
" is inside");
75 constexpr double TEST_STEP_S = 10;
76 constexpr int MAX_CHECKS = 1000;
79 double buildingSizeX = 100;
80 double buildingSizeY = 50;
81 double streetWidth = 25;
82 double buildingHeight = 10;
85 double maxAxisX = (buildingSizeX + streetWidth) * numBuildingsX;
86 double maxAxisY = (buildingSizeY + streetWidth) * numBuildingsY;
88 for (
uint32_t buildingIdX = 0; buildingIdX < numBuildingsX; ++buildingIdX)
90 for (
uint32_t buildingIdY = 0; buildingIdY < numBuildingsY; ++buildingIdY)
95 building->SetBoundaries(
Box(buildingIdX * (buildingSizeX + streetWidth),
96 buildingIdX * (buildingSizeX + streetWidth) + buildingSizeX,
97 buildingIdY * (buildingSizeY + streetWidth),
98 buildingIdY * (buildingSizeY + streetWidth) + buildingSizeY,
101 building->SetNRoomsX(1);
102 building->SetNRoomsY(1);
103 building->SetNFloors(1);
114 mobility.SetMobilityModel(
115 "ns3::RandomWalk2dOutdoorMobilityModel",
126 xPos->SetAttribute(
"Min",
DoubleValue(-streetWidth));
129 yPos->SetAttribute(
"Min",
DoubleValue(-streetWidth));
133 mobility.SetPositionAllocator(position);
140 for (
int i = 0; i < MAX_CHECKS; i++)
Test case for the class OutdoorRandomWalkTestCase.
~OutdoorRandomWalkTestCase() override
void DoRun() override
Implementation to actually run this TestCase.
std::vector< Ptr< Building > > m_buildings
Buildings.
OutdoorRandomWalkTestCase()
void CheckPositionOutdoor(Ptr< RandomWalk2dOutdoorMobilityModel > model)
Check that the position is the expected one.
Test suite for the buildings channel condition model.
OutdoorRandomWalkTestSuite()
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Hold variables of type enum.
Helper class used to assign positions and mobility models to nodes.
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.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
2D random walk mobility model which avoids buildings.
AttributeValue implementation for Rectangle.
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.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
AttributeValue implementation for Time.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#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.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static OutdoorRandomWalkTestSuite OutdoorRandomWalkTestSuite
Static variable for test initialization.