A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
random-direction-2d-mobility-model.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 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_DIRECTION_MOBILITY_MODEL_H
20
#define RANDOM_DIRECTION_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/ptr.h"
30
#include "ns3/random-variable-stream.h"
31
32
namespace
ns3
33
{
34
45
class
RandomDirection2dMobilityModel
:
public
MobilityModel
46
{
47
public
:
52
static
TypeId
GetTypeId
();
53
RandomDirection2dMobilityModel
();
54
55
private
:
59
void
ResetDirectionAndSpeed
();
63
void
BeginPause
();
68
void
SetDirectionAndSpeed
(
double
direction);
72
void
DoInitializePrivate
();
73
void
DoDispose
()
override
;
74
void
DoInitialize
()
override
;
75
Vector
DoGetPosition
()
const override
;
76
void
DoSetPosition
(
const
Vector& position)
override
;
77
Vector
DoGetVelocity
()
const override
;
78
int64_t
DoAssignStreams
(int64_t)
override
;
79
80
Ptr<UniformRandomVariable>
m_direction
;
81
Rectangle
m_bounds
;
82
Ptr<RandomVariableStream>
m_speed
;
83
Ptr<RandomVariableStream>
m_pause
;
84
EventId
m_event
;
85
ConstantVelocityHelper
m_helper
;
86
};
87
88
}
// namespace ns3
89
90
#endif
/* RANDOM_DIRECTION_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< UniformRandomVariable >
ns3::RandomDirection2dMobilityModel
Random direction mobility model.
Definition:
random-direction-2d-mobility-model.h:46
ns3::RandomDirection2dMobilityModel::DoGetPosition
Vector DoGetPosition() const override
Definition:
random-direction-2d-mobility-model.cc:156
ns3::RandomDirection2dMobilityModel::DoSetPosition
void DoSetPosition(const Vector &position) override
Definition:
random-direction-2d-mobility-model.cc:163
ns3::RandomDirection2dMobilityModel::SetDirectionAndSpeed
void SetDirectionAndSpeed(double direction)
Set new velocity and direction, and schedule next pause event.
Definition:
random-direction-2d-mobility-model.cc:101
ns3::RandomDirection2dMobilityModel::m_event
EventId m_event
event ID of next scheduled event
Definition:
random-direction-2d-mobility-model.h:84
ns3::RandomDirection2dMobilityModel::DoAssignStreams
int64_t DoAssignStreams(int64_t) override
The default implementation does nothing but return the passed-in parameter.
Definition:
random-direction-2d-mobility-model.cc:177
ns3::RandomDirection2dMobilityModel::m_helper
ConstantVelocityHelper m_helper
helper for velocity computations
Definition:
random-direction-2d-mobility-model.h:85
ns3::RandomDirection2dMobilityModel::BeginPause
void BeginPause()
Pause, cancel currently scheduled event, schedule end of pause event.
Definition:
random-direction-2d-mobility-model.cc:89
ns3::RandomDirection2dMobilityModel::DoInitializePrivate
void DoInitializePrivate()
Sets a new random direction and calls SetDirectionAndSpeed.
Definition:
random-direction-2d-mobility-model.cc:82
ns3::RandomDirection2dMobilityModel::DoInitialize
void DoInitialize() override
Initialize() implementation.
Definition:
random-direction-2d-mobility-model.cc:75
ns3::RandomDirection2dMobilityModel::GetTypeId
static TypeId GetTypeId()
Register this type with the TypeId system.
Definition:
random-direction-2d-mobility-model.cc:37
ns3::RandomDirection2dMobilityModel::DoDispose
void DoDispose() override
Destructor implementation.
Definition:
random-direction-2d-mobility-model.cc:68
ns3::RandomDirection2dMobilityModel::DoGetVelocity
Vector DoGetVelocity() const override
Definition:
random-direction-2d-mobility-model.cc:171
ns3::RandomDirection2dMobilityModel::m_speed
Ptr< RandomVariableStream > m_speed
a random variable to control speed
Definition:
random-direction-2d-mobility-model.h:82
ns3::RandomDirection2dMobilityModel::ResetDirectionAndSpeed
void ResetDirectionAndSpeed()
Set a new direction and speed.
Definition:
random-direction-2d-mobility-model.cc:118
ns3::RandomDirection2dMobilityModel::m_bounds
Rectangle m_bounds
the 2D bounding area
Definition:
random-direction-2d-mobility-model.h:81
ns3::RandomDirection2dMobilityModel::RandomDirection2dMobilityModel
RandomDirection2dMobilityModel()
Definition:
random-direction-2d-mobility-model.cc:62
ns3::RandomDirection2dMobilityModel::m_direction
Ptr< UniformRandomVariable > m_direction
rv to control direction
Definition:
random-direction-2d-mobility-model.h:80
ns3::RandomDirection2dMobilityModel::m_pause
Ptr< RandomVariableStream > m_pause
a random variable to control pause
Definition:
random-direction-2d-mobility-model.h:83
ns3::Rectangle
a 2d rectangle
Definition:
rectangle.h:35
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-direction-2d-mobility-model.h
Generated on Sun Mar 3 2024 17:11:05 for ns-3 by
1.9.1