A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
steady-state-random-waypoint-mobility-model.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 IITP RAS
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Denis Fakhriev <fakhriev@iitp.ru>
7 */
8#ifndef STEADY_STATE_RANDOM_WAYPOINT_MOBILITY_MODEL_H
9#define STEADY_STATE_RANDOM_WAYPOINT_MOBILITY_MODEL_H
10
12#include "mobility-model.h"
13#include "position-allocator.h"
14
15#include "ns3/ptr.h"
16#include "ns3/random-variable-stream.h"
17
18namespace ns3
19{
20
21/**
22 * @ingroup mobility
23 * @brief Steady-state random waypoint mobility model.
24 *
25 * This model based on random waypoint mobility (RWM) model for case when
26 * speed, pause and position are uniformly distributed random variables.
27 * The difference is that the initial values of this parameters are not
28 * from uniform distribution but from stationary distribution of RWM model.
29 * The implementation of this model is 2D-specific and with nonzero nodes speeds.
30 * In the 3D ns-3 coordinate system, the movement occurs on the
31 * \f$ z=\overline{Z} \f$ plane, where \f$ \overline{Z} \f$ is a constant which
32 * can be configured using the Z attribute.
33 *
34 * Based on NS-2 implementation by Toilers Research Group -- Colorado
35 * School of Mines (http://toilers.mines.edu).
36 * The papers related to this code are:
37 * W. Navidi and T. Camp, Stationary Distributions for the Random
38 * Waypoint Mobility Model, IEEE Transactions on Mobile Computing,
39 * vol. 3, no. 1, pp. 99-108, January-March 2004.
40 * W. Navidi, T. Camp, and N. Bauer, Improving the Accuracy of
41 * Random Waypoint Simulations Through Steady-State Initialization,
42 * Proceedings of the 15th International Conference on Modeling and
43 * Simulation (MS '04), pp. 319-326, March 2004.
44 */
46{
47 public:
48 /**
49 * Register this type with the TypeId system.
50 * @return the object TypeId
51 */
52 static TypeId GetTypeId();
55
56 // Inherited from MobilityModel
61
62 protected:
63 void DoInitialize() override;
64
65 private:
66 /**
67 * Configure random variables based on attributes; calculate the steady
68 * state probability that node is initially paused; schedule either end
69 * of pause time or initial motion of the node.
70 */
72 /**
73 * Use provided destination to calculate travel delay, and schedule a
74 * Start() event at that time.
75 * @param destination the destination to move to
76 */
77 void SteadyStateBeginWalk(const Vector& destination);
78 /**
79 * Start a pause period and schedule the ending of the pause
80 */
81 void Start();
82 /**
83 * Start a motion period and schedule the ending of the motion
84 */
85 void BeginWalk();
86 Vector DoGetPosition() const override;
87 void DoSetPosition(const Vector& position) override;
88 Vector DoGetVelocity() const override;
89 int64_t DoAssignStreams(int64_t) override;
90
91 ConstantVelocityHelper m_helper; //!< helper for velocity computations
92 double m_maxSpeed; //!< maximum speed value (m/s)
93 double m_minSpeed; //!< minimum speed value (m/s)
94 Ptr<UniformRandomVariable> m_speed; //!< random variable for speed values
95 double m_minX; //!< minimum x value of traveling region (m)
96 double m_maxX; //!< maximum x value of traveling region (m)
97 double m_minY; //!< minimum y value of traveling region (m)
98 double m_maxY; //!< maximum y value of traveling region (m)
99 double m_z; //!< z value of traveling region
101 double m_minPause; //!< minimum pause value (s)
102 double m_maxPause; //!< maximum pause value (s)
103 Ptr<UniformRandomVariable> m_pause; //!< random variable for pause values
104 EventId m_event; //!< current event ID
105 bool alreadyStarted; //!< flag for starting state
106 Ptr<UniformRandomVariable> m_x1_r; //!< rv used in rejection sampling phase
107 Ptr<UniformRandomVariable> m_y1_r; //!< rv used in rejection sampling phase
108 Ptr<UniformRandomVariable> m_x2_r; //!< rv used in rejection sampling phase
109 Ptr<UniformRandomVariable> m_y2_r; //!< rv used in rejection sampling phase
110 Ptr<UniformRandomVariable> m_u_r; //!< rv used in step 5 of algorithm
111 Ptr<UniformRandomVariable> m_x; //!< rv used for position allocator
112 Ptr<UniformRandomVariable> m_y; //!< rv used for position allocator
113};
114
115} // namespace ns3
116
117#endif /* STEADY_STATE_RANDOM_WAYPOINT_MOBILITY_MODEL_H */
Utility class used to move node with constant velocity.
An identifier for simulation events.
Definition event-id.h:44
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:67
Ptr< UniformRandomVariable > m_u_r
rv used in step 5 of algorithm
int64_t DoAssignStreams(int64_t) override
The default implementation does nothing but return the passed-in parameter.
Ptr< UniformRandomVariable > m_y2_r
rv used in rejection sampling phase
Ptr< UniformRandomVariable > m_pause
random variable for pause values
Ptr< UniformRandomVariable > m_x2_r
rv used in rejection sampling phase
void SteadyStateBeginWalk(const Vector &destination)
Use provided destination to calculate travel delay, and schedule a Start() event at that time.
Ptr< UniformRandomVariable > m_y
rv used for position allocator
Ptr< UniformRandomVariable > m_speed
random variable for speed values
static TypeId GetTypeId()
Register this type with the TypeId system.
Ptr< UniformRandomVariable > m_x1_r
rv used in rejection sampling phase
void DoInitializePrivate()
Configure random variables based on attributes; calculate the steady state probability that node is i...
void BeginWalk()
Start a motion period and schedule the ending of the motion.
Ptr< MobilityModel > Copy() const override
Copy function allows one to copy the underlying MobilityModel from a MobilityModel pointer,...
void Start()
Start a pause period and schedule the ending of the pause.
Ptr< UniformRandomVariable > m_x
rv used for position allocator
ConstantVelocityHelper m_helper
helper for velocity computations
Ptr< UniformRandomVariable > m_y1_r
rv used in rejection sampling phase
Ptr< RandomBoxPositionAllocator > m_position
position allocator
a unique identifier for an interface.
Definition type-id.h:49
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
Every class exported by the ns3 library is enclosed in the ns3 namespace.