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