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 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Denis Fakhriev <fakhriev@iitp.ru>
18 */
19#ifndef STEADY_STATE_RANDOM_WAYPOINT_MOBILITY_MODEL_H
20#define STEADY_STATE_RANDOM_WAYPOINT_MOBILITY_MODEL_H
21
23#include "mobility-model.h"
24#include "position-allocator.h"
25
26#include "ns3/ptr.h"
27#include "ns3/random-variable-stream.h"
28
29namespace ns3
30{
31
32/**
33 * \ingroup mobility
34 * \brief Steady-state random waypoint mobility model.
35 *
36 * This model based on random waypoint mobility (RWM) model for case when
37 * speed, pause and position are uniformly distributed random variables.
38 * The difference is that the initial values of this parameters are not
39 * from uniform distribution but from stationary distribution of RWM model.
40 * The implementation of this model is 2D-specific and with nonzero nodes speeds.
41 * In the 3D ns-3 coordinate system, the movement occurs on the
42 * \f$ z=\overline{Z} \f$ plane, where \f$ \overline{Z} \f$ is a constant which
43 * can be configured using the Z attribute.
44 *
45 * Based on NS-2 implementation by Toilers Research Group -- Colorado
46 * School of Mines (http://toilers.mines.edu).
47 * The papers related to this code are:
48 * W. Navidi and T. Camp, Stationary Distributions for the Random
49 * Waypoint Mobility Model, IEEE Transactions on Mobile Computing,
50 * vol. 3, no. 1, pp. 99-108, January-March 2004.
51 * W. Navidi, T. Camp, and N. Bauer, Improving the Accuracy of
52 * Random Waypoint Simulations Through Steady-State Initialization,
53 * Proceedings of the 15th International Conference on Modeling and
54 * Simulation (MS '04), pp. 319-326, March 2004.
55 */
57{
58 public:
59 /**
60 * Register this type with the TypeId system.
61 * \return the object TypeId
62 */
63 static TypeId GetTypeId();
65
66 protected:
67 void DoInitialize() override;
68
69 private:
70 /**
71 * Configure random variables based on attributes; calculate the steady
72 * state probability that node is initially paused; schedule either end
73 * of pause time or initial motion of the node.
74 */
76 /**
77 * Use provided destination to calculate travel delay, and schedule a
78 * Start() event at that time.
79 * \param destination the destination to move to
80 */
81 void SteadyStateBeginWalk(const Vector& destination);
82 /**
83 * Start a pause period and schedule the ending of the pause
84 */
85 void Start();
86 /**
87 * Start a motion period and schedule the ending of the motion
88 */
89 void BeginWalk();
90 Vector DoGetPosition() const override;
91 void DoSetPosition(const Vector& position) override;
92 Vector DoGetVelocity() const override;
93 int64_t DoAssignStreams(int64_t) override;
94
95 ConstantVelocityHelper m_helper; //!< helper for velocity computations
96 double m_maxSpeed; //!< maximum speed value (m/s)
97 double m_minSpeed; //!< minimum speed value (m/s)
98 Ptr<UniformRandomVariable> m_speed; //!< random variable for speed values
99 double m_minX; //!< minimum x value of traveling region (m)
100 double m_maxX; //!< maximum x value of traveling region (m)
101 double m_minY; //!< minimum y value of traveling region (m)
102 double m_maxY; //!< maximum y value of traveling region (m)
103 double m_z; //!< z value of traveling region
105 double m_minPause; //!< minimum pause value (s)
106 double m_maxPause; //!< maximum pause value (s)
107 Ptr<UniformRandomVariable> m_pause; //!< random variable for pause values
108 EventId m_event; //!< current event ID
109 bool alreadyStarted; //!< flag for starting state
110 Ptr<UniformRandomVariable> m_x1_r; //!< rv used in rejection sampling phase
111 Ptr<UniformRandomVariable> m_y1_r; //!< rv used in rejection sampling phase
112 Ptr<UniformRandomVariable> m_x2_r; //!< rv used in rejection sampling phase
113 Ptr<UniformRandomVariable> m_y2_r; //!< rv used in rejection sampling phase
114 Ptr<UniformRandomVariable> m_u_r; //!< rv used in step 5 of algorithm
115 Ptr<UniformRandomVariable> m_x; //!< rv used for position allocator
116 Ptr<UniformRandomVariable> m_y; //!< rv used for position allocator
117};
118
119} // namespace ns3
120
121#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:55
Keep track of the current position and velocity of an object.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
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.
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:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.