A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
mobility
model
random-direction-2d-mobility-model.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007 INRIA
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
*/
20
#ifndef RANDOM_DIRECTION_MOBILITY_MODEL_H
21
#define RANDOM_DIRECTION_MOBILITY_MODEL_H
22
23
#include "ns3/object.h"
24
#include "ns3/ptr.h"
25
#include "ns3/nstime.h"
26
#include "ns3/event-id.h"
27
#include "ns3/rectangle.h"
28
#include "ns3/random-variable-stream.h"
29
#include "
mobility-model.h
"
30
#include "
constant-velocity-helper.h
"
31
32
namespace
ns3
{
33
44
class
RandomDirection2dMobilityModel
:
public
MobilityModel
45
{
46
public
:
51
static
TypeId
GetTypeId
(
void
);
52
RandomDirection2dMobilityModel
();
53
54
private
:
58
void
ResetDirectionAndSpeed
(
void
);
62
void
BeginPause
(
void
);
67
void
SetDirectionAndSpeed
(
double
direction);
71
void
DoInitializePrivate
(
void
);
72
virtual
void
DoDispose
(
void
);
73
virtual
void
DoInitialize
(
void
);
74
virtual
Vector
DoGetPosition
(
void
)
const
;
75
virtual
void
DoSetPosition
(
const
Vector &position);
76
virtual
Vector
DoGetVelocity
(
void
)
const
;
77
virtual
int64_t
DoAssignStreams
(int64_t);
78
79
Ptr<UniformRandomVariable>
m_direction
;
80
Rectangle
m_bounds
;
81
Ptr<RandomVariableStream>
m_speed
;
82
Ptr<RandomVariableStream>
m_pause
;
83
EventId
m_event
;
84
ConstantVelocityHelper
m_helper
;
85
};
86
87
}
// namespace ns3
88
89
#endif
/* RANDOM_DIRECTION_MOBILITY_MODEL_H */
ns3::RandomDirection2dMobilityModel::m_direction
Ptr< UniformRandomVariable > m_direction
rv to control direction
Definition:
random-direction-2d-mobility-model.h:79
ns3::Ptr< UniformRandomVariable >
ns3::RandomDirection2dMobilityModel::m_speed
Ptr< RandomVariableStream > m_speed
a random variable to control speed
Definition:
random-direction-2d-mobility-model.h:81
ns3::RandomDirection2dMobilityModel::ResetDirectionAndSpeed
void ResetDirectionAndSpeed(void)
Set a new direction and speed.
Definition:
random-direction-2d-mobility-model.cc:114
ns3::RandomDirection2dMobilityModel::m_helper
ConstantVelocityHelper m_helper
helper for velocity computations
Definition:
random-direction-2d-mobility-model.h:84
ns3::RandomDirection2dMobilityModel::DoInitialize
virtual void DoInitialize(void)
Initialize() implementation.
Definition:
random-direction-2d-mobility-model.cc:70
ns3::RandomDirection2dMobilityModel::DoInitializePrivate
void DoInitializePrivate(void)
Sets a new random direction and calls SetDirectionAndSpeed.
Definition:
random-direction-2d-mobility-model.cc:77
ns3::ConstantVelocityHelper
Utility class used to move node with constant velocity.
Definition:
constant-velocity-helper.h:36
ns3::MobilityModel
Keep track of the current position and velocity of an object.
Definition:
mobility-model.h:39
constant-velocity-helper.h
ns3::RandomDirection2dMobilityModel::DoGetPosition
virtual Vector DoGetPosition(void) const
Definition:
random-direction-2d-mobility-model.cc:138
ns3::RandomDirection2dMobilityModel::DoSetPosition
virtual void DoSetPosition(const Vector &position)
Definition:
random-direction-2d-mobility-model.cc:144
ns3::RandomDirection2dMobilityModel::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition:
random-direction-2d-mobility-model.cc:64
ns3::RandomDirection2dMobilityModel::DoAssignStreams
virtual int64_t DoAssignStreams(int64_t)
The default implementation does nothing but return the passed-in parameter.
Definition:
random-direction-2d-mobility-model.cc:157
ns3::RandomDirection2dMobilityModel::DoGetVelocity
virtual Vector DoGetVelocity(void) const
Definition:
random-direction-2d-mobility-model.cc:152
mobility-model.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::RandomDirection2dMobilityModel::RandomDirection2dMobilityModel
RandomDirection2dMobilityModel()
Definition:
random-direction-2d-mobility-model.cc:58
ns3::RandomDirection2dMobilityModel::m_event
EventId m_event
event ID of next scheduled event
Definition:
random-direction-2d-mobility-model.h:83
ns3::RandomDirection2dMobilityModel::GetTypeId
static TypeId GetTypeId(void)
Register this type with the TypeId system.
Definition:
random-direction-2d-mobility-model.cc:36
ns3::EventId
An identifier for simulation events.
Definition:
event-id.h:53
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_bounds
Rectangle m_bounds
the 2D bounding area
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:82
ns3::RandomDirection2dMobilityModel::BeginPause
void BeginPause(void)
Pause, cancel currently scheduled event, schedule end of pause event.
Definition:
random-direction-2d-mobility-model.cc:84
ns3::RandomDirection2dMobilityModel
Random direction mobility model.
Definition:
random-direction-2d-mobility-model.h:44
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:58
ns3::Rectangle
a 2d rectangle
Definition:
rectangle.h:34
Generated on Wed Nov 7 2018 10:02:05 for ns-3 by
1.8.14