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 protected:
57 void DoInitialize() override;
58
59 private:
60 /**
61 * Configure random variables based on attributes; calculate the steady
62 * state probability that node is initially paused; schedule either end
63 * of pause time or initial motion of the node.
64 */
66 /**
67 * Use provided destination to calculate travel delay, and schedule a
68 * Start() event at that time.
69 * @param destination the destination to move to
70 */
71 void SteadyStateBeginWalk(const Vector& destination);
72 /**
73 * Start a pause period and schedule the ending of the pause
74 */
75 void Start();
76 /**
77 * Start a motion period and schedule the ending of the motion
78 */
79 void BeginWalk();
80 Vector DoGetPosition() const override;
81 void DoSetPosition(const Vector& position) override;
82 Vector DoGetVelocity() const override;
83 int64_t DoAssignStreams(int64_t) override;
84
85 ConstantVelocityHelper m_helper; //!< helper for velocity computations
86 double m_maxSpeed; //!< maximum speed value (m/s)
87 double m_minSpeed; //!< minimum speed value (m/s)
88 Ptr<UniformRandomVariable> m_speed; //!< random variable for speed values
89 double m_minX; //!< minimum x value of traveling region (m)
90 double m_maxX; //!< maximum x value of traveling region (m)
91 double m_minY; //!< minimum y value of traveling region (m)
92 double m_maxY; //!< maximum y value of traveling region (m)
93 double m_z; //!< z value of traveling region
95 double m_minPause; //!< minimum pause value (s)
96 double m_maxPause; //!< maximum pause value (s)
97 Ptr<UniformRandomVariable> m_pause; //!< random variable for pause values
98 EventId m_event; //!< current event ID
99 bool alreadyStarted; //!< flag for starting state
100 Ptr<UniformRandomVariable> m_x1_r; //!< rv used in rejection sampling phase
101 Ptr<UniformRandomVariable> m_y1_r; //!< rv used in rejection sampling phase
102 Ptr<UniformRandomVariable> m_x2_r; //!< rv used in rejection sampling phase
103 Ptr<UniformRandomVariable> m_y2_r; //!< rv used in rejection sampling phase
104 Ptr<UniformRandomVariable> m_u_r; //!< rv used in step 5 of algorithm
105 Ptr<UniformRandomVariable> m_x; //!< rv used for position allocator
106 Ptr<UniformRandomVariable> m_y; //!< rv used for position allocator
107};
108
109} // namespace ns3
110
111#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:45
Keep track of the current position and velocity of an object.
Smart pointer class similar to boost::intrusive_ptr.
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:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.