A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
gauss-markov-mobility-model.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009 Dan Broyles
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: Dan Broyles <dbroyl01@ku.edu>
18
* Thanks to Kevin Peters, faculty advisor James P.G. Sterbenz, and the ResiliNets
19
* initiative at The University of Kansas, https://resilinets.org
20
*/
21
#ifndef GAUSS_MARKOV_MOBILITY_MODEL_H
22
#define GAUSS_MARKOV_MOBILITY_MODEL_H
23
24
#include "
box.h
"
25
#include "
constant-velocity-helper.h
"
26
#include "
mobility-model.h
"
27
#include "
position-allocator.h
"
28
29
#include "ns3/event-id.h"
30
#include "ns3/nstime.h"
31
#include "ns3/object.h"
32
#include "ns3/ptr.h"
33
#include "ns3/random-variable-stream.h"
34
35
namespace
ns3
36
{
37
38
/**
39
* \ingroup mobility
40
* \brief Gauss-Markov mobility model
41
*
42
* This is a 3D version of the Gauss-Markov mobility model described in [1].
43
* Unlike the other mobility models in ns-3, which are memoryless, the Gauss
44
* Markov model has both memory and variability. The tunable alpha parameter
45
* determines the how much memory and randomness you want to model.
46
* Each object starts with a specific velocity, direction (radians), and pitch
47
* angle (radians) equivalent to the mean velocity, direction, and pitch.
48
* At each timestep, a new velocity, direction, and pitch angle are generated
49
* based upon the previous value, the mean value, and a gaussian random variable.
50
* This version is suited for simple airplane flight, where direction, velocity,
51
* and pitch are the key variables.
52
* The motion field is limited by a 3D bounding box (called "box") which is a 3D
53
* version of the "rectangle" field that is used in 2-dimensional ns-3 mobility models.
54
*
55
* Here is an example of how to implement the model and set the initial node positions:
56
* \code
57
MobilityHelper mobility;
58
59
mobility.SetMobilityModel ("ns3::GaussMarkovMobilityModel",
60
"Bounds", BoxValue (Box (0, 150000, 0, 150000, 0, 10000)),
61
"TimeStep", TimeValue (Seconds (0.5)),
62
"Alpha", DoubleValue (0.85),
63
"MeanVelocity", StringValue ("ns3::UniformRandomVariable[Min=800|Max=1200]"),
64
"MeanDirection", StringValue ("ns3::UniformRandomVariable[Min=0|Max=6.283185307]"),
65
"MeanPitch", StringValue ("ns3::UniformRandomVariable[Min=0.05|Max=0.05]"),
66
"NormalVelocity", StringValue ("ns3::NormalRandomVariable[Mean=0.0|Variance=0.0|Bound=0.0]"),
67
"NormalDirection", StringValue ("ns3::NormalRandomVariable[Mean=0.0|Variance=0.2|Bound=0.4]"),
68
"NormalPitch", StringValue ("ns3::NormalRandomVariable[Mean=0.0|Variance=0.02|Bound=0.04]"));
69
70
mobility.SetPositionAllocator ("ns3::RandomBoxPositionAllocator",
71
"X", StringValue ("ns3::UniformRandomVariable[Min=0|Max=150000]"),
72
"Y", StringValue ("ns3::UniformRandomVariable[Min=0|Max=150000]"),
73
"Z", StringValue ("ns3::UniformRandomVariable[Min=0|Max=10000]"));
74
75
mobility.Install (wifiStaNodes);
76
* \endcode
77
* [1] Tracy Camp, Jeff Boleng, Vanessa Davies, "A Survey of Mobility Models
78
* for Ad Hoc Network Research", Wireless Communications and Mobile Computing,
79
* Wiley, vol.2 iss.5, September 2002, pp.483-502
80
*/
81
class
GaussMarkovMobilityModel
:
public
MobilityModel
82
{
83
public
:
84
/**
85
* Register this type with the TypeId system.
86
* \return the object TypeId
87
*/
88
static
TypeId
GetTypeId
();
89
GaussMarkovMobilityModel
();
90
91
private
:
92
/**
93
* Initialize the model and calculate new velocity, direction, and pitch
94
*/
95
void
Start
();
96
/**
97
* Perform a walk operation
98
* \param timeLeft time until Start method is called again
99
*/
100
void
DoWalk
(
Time
timeLeft);
101
void
DoDispose
()
override
;
102
Vector
DoGetPosition
()
const override
;
103
void
DoSetPosition
(
const
Vector& position)
override
;
104
Vector
DoGetVelocity
()
const override
;
105
int64_t
DoAssignStreams
(int64_t)
override
;
106
ConstantVelocityHelper
m_helper
;
//!< constant velocity helper
107
Time
m_timeStep
;
//!< duraiton after which direction and speed should change
108
double
m_alpha
;
//!< tunable constant in the model
109
double
m_meanVelocity
;
//!< current mean velocity
110
double
m_meanDirection
;
//!< current mean direction
111
double
m_meanPitch
;
//!< current mean pitch
112
double
m_Velocity
;
//!< current velocity
113
double
m_Direction
;
//!< current direction
114
double
m_Pitch
;
//!< current pitch
115
Ptr<RandomVariableStream>
m_rndMeanVelocity
;
//!< rv used to assign avg velocity
116
Ptr<NormalRandomVariable>
m_normalVelocity
;
//!< Gaussian rv used to for next velocity
117
Ptr<RandomVariableStream>
m_rndMeanDirection
;
//!< rv used to assign avg direction
118
Ptr<NormalRandomVariable>
m_normalDirection
;
//!< Gaussian rv for next direction value
119
Ptr<RandomVariableStream>
m_rndMeanPitch
;
//!< rv used to assign avg. pitch
120
Ptr<NormalRandomVariable>
m_normalPitch
;
//!< Gaussian rv for next pitch
121
EventId
m_event
;
//!< event id of scheduled start
122
Box
m_bounds
;
//!< bounding box
123
};
124
125
}
// namespace ns3
126
127
#endif
/* GAUSS_MARKOV_MOBILITY_MODEL_H */
box.h
ns3::Box
a 3d box
Definition:
box.h:35
ns3::ConstantVelocityHelper
Utility class used to move node with constant velocity.
Definition:
constant-velocity-helper.h:38
ns3::EventId
An identifier for simulation events.
Definition:
event-id.h:56
ns3::GaussMarkovMobilityModel
Gauss-Markov mobility model.
Definition:
gauss-markov-mobility-model.h:82
ns3::GaussMarkovMobilityModel::m_Velocity
double m_Velocity
current velocity
Definition:
gauss-markov-mobility-model.h:112
ns3::GaussMarkovMobilityModel::m_normalDirection
Ptr< NormalRandomVariable > m_normalDirection
Gaussian rv for next direction value.
Definition:
gauss-markov-mobility-model.h:118
ns3::GaussMarkovMobilityModel::m_bounds
Box m_bounds
bounding box
Definition:
gauss-markov-mobility-model.h:122
ns3::GaussMarkovMobilityModel::m_Pitch
double m_Pitch
current pitch
Definition:
gauss-markov-mobility-model.h:114
ns3::GaussMarkovMobilityModel::DoDispose
void DoDispose() override
Destructor implementation.
Definition:
gauss-markov-mobility-model.cc:210
ns3::GaussMarkovMobilityModel::m_normalPitch
Ptr< NormalRandomVariable > m_normalPitch
Gaussian rv for next pitch.
Definition:
gauss-markov-mobility-model.h:120
ns3::GaussMarkovMobilityModel::Start
void Start()
Initialize the model and calculate new velocity, direction, and pitch.
Definition:
gauss-markov-mobility-model.cc:107
ns3::GaussMarkovMobilityModel::DoWalk
void DoWalk(Time timeLeft)
Perform a walk operation.
Definition:
gauss-markov-mobility-model.cc:159
ns3::GaussMarkovMobilityModel::m_meanVelocity
double m_meanVelocity
current mean velocity
Definition:
gauss-markov-mobility-model.h:109
ns3::GaussMarkovMobilityModel::m_meanDirection
double m_meanDirection
current mean direction
Definition:
gauss-markov-mobility-model.h:110
ns3::GaussMarkovMobilityModel::GetTypeId
static TypeId GetTypeId()
Register this type with the TypeId system.
Definition:
gauss-markov-mobility-model.cc:36
ns3::GaussMarkovMobilityModel::m_normalVelocity
Ptr< NormalRandomVariable > m_normalVelocity
Gaussian rv used to for next velocity.
Definition:
gauss-markov-mobility-model.h:116
ns3::GaussMarkovMobilityModel::m_event
EventId m_event
event id of scheduled start
Definition:
gauss-markov-mobility-model.h:121
ns3::GaussMarkovMobilityModel::m_helper
ConstantVelocityHelper m_helper
constant velocity helper
Definition:
gauss-markov-mobility-model.h:106
ns3::GaussMarkovMobilityModel::DoGetVelocity
Vector DoGetVelocity() const override
Definition:
gauss-markov-mobility-model.cc:232
ns3::GaussMarkovMobilityModel::DoAssignStreams
int64_t DoAssignStreams(int64_t) override
The default implementation does nothing but return the passed-in parameter.
Definition:
gauss-markov-mobility-model.cc:238
ns3::GaussMarkovMobilityModel::m_rndMeanPitch
Ptr< RandomVariableStream > m_rndMeanPitch
rv used to assign avg.
Definition:
gauss-markov-mobility-model.h:119
ns3::GaussMarkovMobilityModel::m_rndMeanVelocity
Ptr< RandomVariableStream > m_rndMeanVelocity
rv used to assign avg velocity
Definition:
gauss-markov-mobility-model.h:115
ns3::GaussMarkovMobilityModel::GaussMarkovMobilityModel
GaussMarkovMobilityModel()
Definition:
gauss-markov-mobility-model.cc:97
ns3::GaussMarkovMobilityModel::m_meanPitch
double m_meanPitch
current mean pitch
Definition:
gauss-markov-mobility-model.h:111
ns3::GaussMarkovMobilityModel::DoSetPosition
void DoSetPosition(const Vector &position) override
Definition:
gauss-markov-mobility-model.cc:224
ns3::GaussMarkovMobilityModel::m_rndMeanDirection
Ptr< RandomVariableStream > m_rndMeanDirection
rv used to assign avg direction
Definition:
gauss-markov-mobility-model.h:117
ns3::GaussMarkovMobilityModel::DoGetPosition
Vector DoGetPosition() const override
Definition:
gauss-markov-mobility-model.cc:217
ns3::GaussMarkovMobilityModel::m_alpha
double m_alpha
tunable constant in the model
Definition:
gauss-markov-mobility-model.h:108
ns3::GaussMarkovMobilityModel::m_Direction
double m_Direction
current direction
Definition:
gauss-markov-mobility-model.h:113
ns3::GaussMarkovMobilityModel::m_timeStep
Time m_timeStep
duraiton after which direction and speed should change
Definition:
gauss-markov-mobility-model.h:107
ns3::MobilityModel
Keep track of the current position and velocity of an object.
Definition:
mobility-model.h:40
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:105
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
constant-velocity-helper.h
mobility-model.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
position-allocator.h
src
mobility
model
gauss-markov-mobility-model.h
Generated on Tue May 28 2024 23:38:17 for ns-3 by
1.9.6