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
random-direction-2d-mobility-model.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2007 INRIA
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7
*/
8
#ifndef RANDOM_DIRECTION_MOBILITY_MODEL_H
9
#define RANDOM_DIRECTION_MOBILITY_MODEL_H
10
11
#include "
constant-velocity-helper.h
"
12
#include "
mobility-model.h
"
13
#include "
rectangle.h
"
14
15
#include "ns3/event-id.h"
16
#include "ns3/nstime.h"
17
#include "ns3/object.h"
18
#include "ns3/ptr.h"
19
#include "ns3/random-variable-stream.h"
20
21
namespace
ns3
22
{
23
24
/**
25
* \ingroup mobility
26
* \brief Random direction mobility model.
27
*
28
* The movement of objects is based on random directions: each object
29
* pauses for a specific delay, chooses a random direction and speed and
30
* then travels in the specific direction until it reaches one of
31
* the boundaries of the model. When it reaches the boundary, it pauses,
32
* and selects a new direction and speed.
33
*/
34
class
RandomDirection2dMobilityModel
:
public
MobilityModel
35
{
36
public
:
37
/**
38
* Register this type with the TypeId system.
39
* \return the object TypeId
40
*/
41
static
TypeId
GetTypeId
();
42
RandomDirection2dMobilityModel
();
43
~RandomDirection2dMobilityModel
()
override
;
44
45
private
:
46
/**
47
* Set a new direction and speed
48
*/
49
void
ResetDirectionAndSpeed
();
50
/**
51
* Pause, cancel currently scheduled event, schedule end of pause event
52
*/
53
void
BeginPause
();
54
/**
55
* Set new velocity and direction, and schedule next pause event
56
* \param direction (radians)
57
*/
58
void
SetDirectionAndSpeed
(
double
direction);
59
/**
60
* Sets a new random direction and calls SetDirectionAndSpeed
61
*/
62
void
DoInitializePrivate
();
63
void
DoDispose
()
override
;
64
void
DoInitialize
()
override
;
65
Vector
DoGetPosition
()
const override
;
66
void
DoSetPosition
(
const
Vector& position)
override
;
67
Vector
DoGetVelocity
()
const override
;
68
int64_t
DoAssignStreams
(int64_t)
override
;
69
70
Ptr<UniformRandomVariable>
m_direction
;
//!< rv to control direction
71
Rectangle
m_bounds
;
//!< the 2D bounding area
72
Ptr<RandomVariableStream>
m_speed
;
//!< a random variable to control speed
73
Ptr<RandomVariableStream>
m_pause
;
//!< a random variable to control pause
74
EventId
m_event
;
//!< event ID of next scheduled event
75
ConstantVelocityHelper
m_helper
;
//!< helper for velocity computations
76
};
77
78
}
// namespace ns3
79
80
#endif
/* RANDOM_DIRECTION_MOBILITY_MODEL_H */
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::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::RandomDirection2dMobilityModel
Random direction mobility model.
Definition
random-direction-2d-mobility-model.h:35
ns3::RandomDirection2dMobilityModel::DoGetPosition
Vector DoGetPosition() const override
Definition
random-direction-2d-mobility-model.cc:150
ns3::RandomDirection2dMobilityModel::~RandomDirection2dMobilityModel
~RandomDirection2dMobilityModel() override
Definition
random-direction-2d-mobility-model.cc:56
ns3::RandomDirection2dMobilityModel::DoSetPosition
void DoSetPosition(const Vector &position) override
Definition
random-direction-2d-mobility-model.cc:157
ns3::RandomDirection2dMobilityModel::SetDirectionAndSpeed
void SetDirectionAndSpeed(double direction)
Set new velocity and direction, and schedule next pause event.
Definition
random-direction-2d-mobility-model.cc:95
ns3::RandomDirection2dMobilityModel::m_event
EventId m_event
event ID of next scheduled event
Definition
random-direction-2d-mobility-model.h:74
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:171
ns3::RandomDirection2dMobilityModel::m_helper
ConstantVelocityHelper m_helper
helper for velocity computations
Definition
random-direction-2d-mobility-model.h:75
ns3::RandomDirection2dMobilityModel::BeginPause
void BeginPause()
Pause, cancel currently scheduled event, schedule end of pause event.
Definition
random-direction-2d-mobility-model.cc:83
ns3::RandomDirection2dMobilityModel::DoInitializePrivate
void DoInitializePrivate()
Sets a new random direction and calls SetDirectionAndSpeed.
Definition
random-direction-2d-mobility-model.cc:76
ns3::RandomDirection2dMobilityModel::DoInitialize
void DoInitialize() override
Initialize() implementation.
Definition
random-direction-2d-mobility-model.cc:69
ns3::RandomDirection2dMobilityModel::GetTypeId
static TypeId GetTypeId()
Register this type with the TypeId system.
Definition
random-direction-2d-mobility-model.cc:26
ns3::RandomDirection2dMobilityModel::DoDispose
void DoDispose() override
Destructor implementation.
Definition
random-direction-2d-mobility-model.cc:62
ns3::RandomDirection2dMobilityModel::DoGetVelocity
Vector DoGetVelocity() const override
Definition
random-direction-2d-mobility-model.cc:165
ns3::RandomDirection2dMobilityModel::m_speed
Ptr< RandomVariableStream > m_speed
a random variable to control speed
Definition
random-direction-2d-mobility-model.h:72
ns3::RandomDirection2dMobilityModel::ResetDirectionAndSpeed
void ResetDirectionAndSpeed()
Set a new direction and speed.
Definition
random-direction-2d-mobility-model.cc:112
ns3::RandomDirection2dMobilityModel::m_bounds
Rectangle m_bounds
the 2D bounding area
Definition
random-direction-2d-mobility-model.h:71
ns3::RandomDirection2dMobilityModel::RandomDirection2dMobilityModel
RandomDirection2dMobilityModel()
Definition
random-direction-2d-mobility-model.cc:51
ns3::RandomDirection2dMobilityModel::m_direction
Ptr< UniformRandomVariable > m_direction
rv to control direction
Definition
random-direction-2d-mobility-model.h:70
ns3::RandomDirection2dMobilityModel::m_pause
Ptr< RandomVariableStream > m_pause
a random variable to control pause
Definition
random-direction-2d-mobility-model.h:73
ns3::Rectangle
a 2d rectangle
Definition
rectangle.h:24
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.
rectangle.h
src
mobility
model
random-direction-2d-mobility-model.h
Generated on Fri Nov 8 2024 13:59:04 for ns-3 by
1.11.0