8#include "ns3/boolean.h"
10#include "ns3/double.h"
11#include "ns3/rng-seed-manager.h"
12#include "ns3/simulator.h"
13#include "ns3/steady-state-random-waypoint-mobility-model.h"
29 :
TestCase(
"Check steady-state rwp mobility model velocity and position distributions")
41 void DoRun()
override;
59 double totalTime = 1000;
62 mobilityFactory.
SetTypeId(
"ns3::SteadyStateRandomWaypointMobilityModel");
78 model->AssignStreams(100 * (i + 1));
102 std::sqrt(std::pow(model->GetVelocity().x, 2) + std::pow(model->GetVelocity().y, 2));
103 sum_x += model->GetPosition().x;
104 sum_y += model->GetPosition().y;
107 double mean_x = sum_x /
count;
108 double mean_y = sum_y /
count;
109 double mean_v = sum_v /
count;
123 std::sqrt(std::pow(model->GetVelocity().x, 2) + std::pow(model->GetVelocity().y, 2));
124 tmp = model->GetPosition().x - mean_x;
126 tmp = model->GetPosition().y - mean_y;
128 tmp = velocity - mean_v;
131 double dev_x = std::sqrt(sum_x / (
count - 1));
132 double dev_y = std::sqrt(sum_y / (
count - 1));
133 double dev_v = std::sqrt(sum_v / (
count - 1));
Steady State Random Waypoint Test.
~SteadyStateRandomWaypointTest() override
std::vector< Ptr< MobilityModel > > mobilityStack
modility model
void DoRun() override
Implementation to actually run this TestCase.
SteadyStateRandomWaypointTest()
void DistribCompare()
Distribution compare function.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Keep track of the current position and velocity of an object.
Instantiate subclasses of ns3::Object.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
void Initialize()
Invoke DoInitialize on all Objects aggregated to this one.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Smart pointer class similar to boost::intrusive_ptr.
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.
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.
static constexpr auto UNIT
SteadyStateRandomWaypointTestSuite g_steadyStateRandomWaypointTestSuite
the test suite
#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 Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Steady State Random Waypoint Test Suite.
SteadyStateRandomWaypointTestSuite()