20#include "ns3/building-position-allocator.h"
21#include "ns3/building.h"
22#include "ns3/config.h"
23#include "ns3/double.h"
26#include "ns3/mobility-helper.h"
27#include "ns3/pointer.h"
28#include "ns3/random-walk-2d-outdoor-mobility-model.h"
29#include "ns3/simulator.h"
49 void DoRun()
override;
61 :
TestCase(
"Test case for the BuildingsChannelConditionModel"),
73 auto position = model->GetPosition();
78 "Position " << position <<
" is inside");
86 constexpr double TEST_STEP_S = 10;
87 constexpr int MAX_CHECKS = 1000;
90 double buildingSizeX = 100;
91 double buildingSizeY = 50;
92 double streetWidth = 25;
93 double buildingHeight = 10;
96 double maxAxisX = (buildingSizeX + streetWidth) * numBuildingsX;
97 double maxAxisY = (buildingSizeY + streetWidth) * numBuildingsY;
99 for (
uint32_t buildingIdX = 0; buildingIdX < numBuildingsX; ++buildingIdX)
101 for (
uint32_t buildingIdY = 0; buildingIdY < numBuildingsY; ++buildingIdY)
104 building = CreateObject<Building>();
106 building->SetBoundaries(
Box(buildingIdX * (buildingSizeX + streetWidth),
107 buildingIdX * (buildingSizeX + streetWidth) + buildingSizeX,
108 buildingIdY * (buildingSizeY + streetWidth),
109 buildingIdY * (buildingSizeY + streetWidth) + buildingSizeY,
112 building->SetNRoomsX(1);
113 building->SetNRoomsY(1);
114 building->SetNFloors(1);
125 mobility.SetMobilityModel(
126 "ns3::RandomWalk2dOutdoorMobilityModel",
137 xPos->SetAttribute(
"Min",
DoubleValue(-streetWidth));
140 yPos->SetAttribute(
"Min",
DoubleValue(-streetWidth));
144 mobility.SetPositionAllocator(position);
151 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.
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.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#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.