A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
random-walk-2d-mobility-model.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2006,2007 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18
*/
19
#ifndef RANDOM_WALK_2D_MOBILITY_MODEL_H
20
#define RANDOM_WALK_2D_MOBILITY_MODEL_H
21
22
#include "
constant-velocity-helper.h
"
23
#include "
mobility-model.h
"
24
#include "
rectangle.h
"
25
26
#include "ns3/event-id.h"
27
#include "ns3/nstime.h"
28
#include "ns3/object.h"
29
#include "ns3/random-variable-stream.h"
30
31
namespace
ns3
32
{
33
51
class
RandomWalk2dMobilityModel
:
public
MobilityModel
52
{
53
public
:
58
static
TypeId
GetTypeId
();
59
61
enum
Mode
62
{
63
MODE_DISTANCE
,
64
MODE_TIME
65
};
66
67
private
:
72
void
Rebound
(
Time
timeLeft);
78
void
DoWalk
(
Time
timeLeft);
82
void
DoInitializePrivate
();
83
void
DoDispose
()
override
;
84
void
DoInitialize
()
override
;
85
Vector
DoGetPosition
()
const override
;
86
void
DoSetPosition
(
const
Vector& position)
override
;
87
Vector
DoGetVelocity
()
const override
;
88
int64_t
DoAssignStreams
(int64_t)
override
;
89
90
ConstantVelocityHelper
m_helper
;
91
EventId
m_event
;
92
Mode
m_mode
;
93
double
m_modeDistance
;
94
Time
m_modeTime
;
95
Ptr<RandomVariableStream>
m_speed
;
96
Ptr<RandomVariableStream>
m_direction
;
97
Rectangle
m_bounds
;
98
};
99
100
}
// namespace ns3
101
102
#endif
/* RANDOM_WALK_2D_MOBILITY_MODEL_H */
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:55
ns3::MobilityModel
Keep track of the current position and velocity of an object.
Definition:
mobility-model.h:40
ns3::Ptr< RandomVariableStream >
ns3::RandomWalk2dMobilityModel
2D random walk mobility model.
Definition:
random-walk-2d-mobility-model.h:52
ns3::RandomWalk2dMobilityModel::m_speed
Ptr< RandomVariableStream > m_speed
rv for picking speed
Definition:
random-walk-2d-mobility-model.h:95
ns3::RandomWalk2dMobilityModel::GetTypeId
static TypeId GetTypeId()
Register this type with the TypeId system.
Definition:
random-walk-2d-mobility-model.cc:38
ns3::RandomWalk2dMobilityModel::DoInitialize
void DoInitialize() override
Initialize() implementation.
Definition:
random-walk-2d-mobility-model.cc:84
ns3::RandomWalk2dMobilityModel::m_modeDistance
double m_modeDistance
Change direction and speed after this distance.
Definition:
random-walk-2d-mobility-model.h:93
ns3::RandomWalk2dMobilityModel::DoInitializePrivate
void DoInitializePrivate()
Perform initialization of the object before MobilityModel::DoInitialize ()
Definition:
random-walk-2d-mobility-model.cc:91
ns3::RandomWalk2dMobilityModel::DoWalk
void DoWalk(Time timeLeft)
Walk according to position and velocity, until distance is reached, time is reached,...
Definition:
random-walk-2d-mobility-model.cc:151
ns3::RandomWalk2dMobilityModel::Mode
Mode
An enum representing the different working modes of this module.
Definition:
random-walk-2d-mobility-model.h:62
ns3::RandomWalk2dMobilityModel::MODE_TIME
@ MODE_TIME
Definition:
random-walk-2d-mobility-model.h:64
ns3::RandomWalk2dMobilityModel::MODE_DISTANCE
@ MODE_DISTANCE
Definition:
random-walk-2d-mobility-model.h:63
ns3::RandomWalk2dMobilityModel::Rebound
void Rebound(Time timeLeft)
Performs the rebound of the node if it reaches a boundary.
Definition:
random-walk-2d-mobility-model.cc:193
ns3::RandomWalk2dMobilityModel::DoGetPosition
Vector DoGetPosition() const override
Definition:
random-walk-2d-mobility-model.cc:230
ns3::RandomWalk2dMobilityModel::m_helper
ConstantVelocityHelper m_helper
helper for this object
Definition:
random-walk-2d-mobility-model.h:90
ns3::RandomWalk2dMobilityModel::DoGetVelocity
Vector DoGetVelocity() const override
Definition:
random-walk-2d-mobility-model.cc:246
ns3::RandomWalk2dMobilityModel::m_modeTime
Time m_modeTime
Change current direction and speed after this delay.
Definition:
random-walk-2d-mobility-model.h:94
ns3::RandomWalk2dMobilityModel::m_bounds
Rectangle m_bounds
Bounds of the area to cruise.
Definition:
random-walk-2d-mobility-model.h:97
ns3::RandomWalk2dMobilityModel::DoSetPosition
void DoSetPosition(const Vector &position) override
Definition:
random-walk-2d-mobility-model.cc:237
ns3::RandomWalk2dMobilityModel::DoDispose
void DoDispose() override
Destructor implementation.
Definition:
random-walk-2d-mobility-model.cc:223
ns3::RandomWalk2dMobilityModel::m_direction
Ptr< RandomVariableStream > m_direction
rv for picking direction
Definition:
random-walk-2d-mobility-model.h:96
ns3::RandomWalk2dMobilityModel::DoAssignStreams
int64_t DoAssignStreams(int64_t) override
The default implementation does nothing but return the passed-in parameter.
Definition:
random-walk-2d-mobility-model.cc:252
ns3::RandomWalk2dMobilityModel::m_mode
Mode m_mode
whether in time or distance mode
Definition:
random-walk-2d-mobility-model.h:92
ns3::RandomWalk2dMobilityModel::m_event
EventId m_event
stored event ID
Definition:
random-walk-2d-mobility-model.h:91
ns3::Rectangle
a 2d rectangle
Definition:
rectangle.h:35
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.
rectangle.h
src
mobility
model
random-walk-2d-mobility-model.h
Generated on Sun Mar 3 2024 17:11:05 for ns-3 by
1.9.1