|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
21 #include "ns3/simulator.h"
22 #include "ns3/boolean.h"
23 #include "ns3/double.h"
25 #include "ns3/config.h"
26 #include "ns3/steady-state-random-waypoint-mobility-model.h"
27 #include "ns3/rng-seed-manager.h"
41 :
TestCase (
"Check steady-state rwp mobility model velocity and position distributions") {}
48 virtual void DoRun (
void);
49 virtual void DoTeardown (
void);
51 void DistribCompare ();
57 mobilityStack.clear();
66 double totalTime = 1000;
69 mobilityFactory.
SetTypeId (
"ns3::SteadyStateRandomWaypointMobilityModel");
81 for (uint32_t i = 0; i < count; i++)
87 mobilityStack.push_back (model);
105 std::vector<Ptr<MobilityModel> >::iterator i;
107 for (i = mobilityStack.begin (); i != mobilityStack.end (); ++i)
115 double mean_x = sum_x / count;
116 double mean_y = sum_y / count;
117 double mean_v = sum_v / count;
127 for (i = mobilityStack.begin (); i != mobilityStack.end (); ++i)
135 tmp = velocity - mean_v;
138 double dev_x = std::sqrt (sum_x / (count - 1));
139 double dev_y = std::sqrt (sum_y / (count - 1));
140 double dev_v = std::sqrt (sum_v / (count - 1));
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
#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 ...
SteadyStateRandomWaypointTestSuite()
Vector GetVelocity(void) const
virtual void DoRun(void)
Implementation to actually run this TestCase.
Steady State Random Waypoint Test.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
std::vector< Ptr< MobilityModel > > mobilityStack
modility model
void DistribCompare()
Distribution compare function.
Instantiate subclasses of ns3::Object.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
static void SetSeed(uint32_t seed)
Set the seed.
static void Run(void)
Run the simulation.
Steady State Random Waypoint Test Suite.
SteadyStateRandomWaypointTestSuite g_steadyStateRandomWaypointTestSuite
the test suite
Time Seconds(double value)
Construct a Time in the indicated unit.
virtual ~SteadyStateRandomWaypointTest()
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
Keep track of the current position and velocity of an object.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
SteadyStateRandomWaypointTest()
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
Vector GetPosition(void) const