20#include "ns3/building-position-allocator.h"
21#include "ns3/building.h"
22#include "ns3/config.h"
23#include "ns3/double.h"
25#include "ns3/mobility-helper.h"
26#include "ns3/pointer.h"
27#include "ns3/random-walk-2d-outdoor-mobility-model.h"
28#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 double buildingSizeX = 100;
87 double buildingSizeY = 50;
88 double streetWidth = 25;
89 double buildingHeight = 10;
92 double maxAxisX = (buildingSizeX + streetWidth) * numBuildingsX;
93 double maxAxisY = (buildingSizeY + streetWidth) * numBuildingsY;
95 for (
uint32_t buildingIdX = 0; buildingIdX < numBuildingsX; ++buildingIdX)
97 for (
uint32_t buildingIdY = 0; buildingIdY < numBuildingsY; ++buildingIdY)
100 building = CreateObject<Building>();
102 building->SetBoundaries(
Box(buildingIdX * (buildingSizeX + streetWidth),
103 buildingIdX * (buildingSizeX + streetWidth) + buildingSizeX,
104 buildingIdY * (buildingSizeY + streetWidth),
105 buildingIdY * (buildingSizeY + streetWidth) + buildingSizeY,
108 building->SetNRoomsX(1);
109 building->SetNRoomsY(1);
110 building->SetNFloors(1);
121 mobility.SetMobilityModel(
122 "ns3::RandomWalk2dOutdoorMobilityModel",
129 xPos->SetAttribute(
"Min",
DoubleValue(-streetWidth));
132 yPos->SetAttribute(
"Min",
DoubleValue(-streetWidth));
136 mobility.SetPositionAllocator(position);
143 double testStep = 10;
144 int maxChecks = 1000;
145 for (
int i = 0; i < maxChecks; ++i)
171 :
TestSuite(
"outdoor-random-walk-model", UNIT)
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'.
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.
Hold objects of type Ptr<T>.
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, TestDuration 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.