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
propagation-delay-model.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2005,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 PROPAGATION_DELAY_MODEL_H
20
#define PROPAGATION_DELAY_MODEL_H
21
22
#include "ns3/nstime.h"
23
#include "ns3/object.h"
24
#include "ns3/ptr.h"
25
#include "ns3/random-variable-stream.h"
26
27
namespace
ns3
28
{
29
30
class
MobilityModel;
31
32
/**
33
* \ingroup propagation
34
*
35
* \brief calculate a propagation delay.
36
*/
37
class
PropagationDelayModel
:
public
Object
38
{
39
public
:
40
/**
41
* \brief Get the type ID.
42
* \return the object TypeId
43
*/
44
static
TypeId
GetTypeId
();
45
~PropagationDelayModel
()
override
;
46
/**
47
* \param a the source
48
* \param b the destination
49
* \returns the calculated propagation delay
50
*
51
* Calculate the propagation delay between the specified
52
* source and destination.
53
*/
54
virtual
Time
GetDelay
(
Ptr<MobilityModel>
a,
Ptr<MobilityModel>
b)
const
= 0;
55
/**
56
* If this delay model uses objects of type RandomVariableStream,
57
* set the stream numbers to the integers starting with the offset
58
* 'stream'. Return the number of streams (possibly zero) that
59
* have been assigned.
60
*
61
* \param stream first stream index to use
62
* \return the number of stream indices assigned by this model
63
*/
64
int64_t
AssignStreams
(int64_t stream);
65
66
protected
:
67
/**
68
* Assign a fixed random variable stream number to the random variables used by this model.
69
*
70
* Subclasses must implement this; those not using random variables
71
* can return zero.
72
*
73
* \param stream first stream index to use
74
* \return the number of stream indices assigned by this model
75
*/
76
virtual
int64_t
DoAssignStreams
(int64_t stream) = 0;
77
};
78
79
/**
80
* \ingroup propagation
81
*
82
* \brief the propagation delay is random
83
*/
84
class
RandomPropagationDelayModel
:
public
PropagationDelayModel
85
{
86
public
:
87
/**
88
* \brief Get the type ID.
89
* \return the object TypeId
90
*/
91
static
TypeId
GetTypeId
();
92
93
/**
94
* Use the default parameters from PropagationDelayRandomDistribution.
95
*/
96
RandomPropagationDelayModel
();
97
~RandomPropagationDelayModel
()
override
;
98
Time
GetDelay
(
Ptr<MobilityModel>
a,
Ptr<MobilityModel>
b)
const override
;
99
100
private
:
101
int64_t
DoAssignStreams
(int64_t stream)
override
;
102
Ptr<RandomVariableStream>
m_variable
;
//!< random generator
103
};
104
105
/**
106
* \ingroup propagation
107
*
108
* \brief the propagation speed is constant
109
*/
110
class
ConstantSpeedPropagationDelayModel
:
public
PropagationDelayModel
111
{
112
public
:
113
/**
114
* \brief Get the type ID.
115
* \return the object TypeId
116
*/
117
static
TypeId
GetTypeId
();
118
119
/**
120
* Use the default parameters from PropagationDelayConstantSpeed.
121
*/
122
ConstantSpeedPropagationDelayModel
();
123
Time
GetDelay
(
Ptr<MobilityModel>
a,
Ptr<MobilityModel>
b)
const override
;
124
/**
125
* \param speed the new speed (m/s)
126
*/
127
void
SetSpeed
(
double
speed);
128
/**
129
* \returns the current propagation speed (m/s).
130
*/
131
double
GetSpeed
()
const
;
132
133
private
:
134
int64_t
DoAssignStreams
(int64_t stream)
override
;
135
double
m_speed
;
//!< speed
136
};
137
138
}
// namespace ns3
139
140
#endif
/* PROPAGATION_DELAY_MODEL_H */
ns3::ConstantSpeedPropagationDelayModel
the propagation speed is constant
Definition:
propagation-delay-model.h:111
ns3::ConstantSpeedPropagationDelayModel::GetDelay
Time GetDelay(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
Definition:
propagation-delay-model.cc:114
ns3::ConstantSpeedPropagationDelayModel::GetSpeed
double GetSpeed() const
Definition:
propagation-delay-model.cc:128
ns3::ConstantSpeedPropagationDelayModel::m_speed
double m_speed
speed
Definition:
propagation-delay-model.h:135
ns3::ConstantSpeedPropagationDelayModel::SetSpeed
void SetSpeed(double speed)
Definition:
propagation-delay-model.cc:122
ns3::ConstantSpeedPropagationDelayModel::DoAssignStreams
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
Definition:
propagation-delay-model.cc:134
ns3::ConstantSpeedPropagationDelayModel::ConstantSpeedPropagationDelayModel
ConstantSpeedPropagationDelayModel()
Use the default parameters from PropagationDelayConstantSpeed.
Definition:
propagation-delay-model.cc:109
ns3::ConstantSpeedPropagationDelayModel::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
propagation-delay-model.cc:93
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:89
ns3::PropagationDelayModel
calculate a propagation delay.
Definition:
propagation-delay-model.h:38
ns3::PropagationDelayModel::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
propagation-delay-model.cc:32
ns3::PropagationDelayModel::~PropagationDelayModel
~PropagationDelayModel() override
Definition:
propagation-delay-model.cc:39
ns3::PropagationDelayModel::DoAssignStreams
virtual int64_t DoAssignStreams(int64_t stream)=0
Assign a fixed random variable stream number to the random variables used by this model.
ns3::PropagationDelayModel::AssignStreams
int64_t AssignStreams(int64_t stream)
If this delay model uses objects of type RandomVariableStream, set the stream numbers to the integers...
Definition:
propagation-delay-model.cc:44
ns3::PropagationDelayModel::GetDelay
virtual Time GetDelay(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const =0
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
ns3::RandomPropagationDelayModel
the propagation delay is random
Definition:
propagation-delay-model.h:85
ns3::RandomPropagationDelayModel::RandomPropagationDelayModel
RandomPropagationDelayModel()
Use the default parameters from PropagationDelayRandomDistribution.
Definition:
propagation-delay-model.cc:69
ns3::RandomPropagationDelayModel::m_variable
Ptr< RandomVariableStream > m_variable
random generator
Definition:
propagation-delay-model.h:102
ns3::RandomPropagationDelayModel::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
propagation-delay-model.cc:54
ns3::RandomPropagationDelayModel::DoAssignStreams
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
Definition:
propagation-delay-model.cc:84
ns3::RandomPropagationDelayModel::~RandomPropagationDelayModel
~RandomPropagationDelayModel() override
Definition:
propagation-delay-model.cc:73
ns3::RandomPropagationDelayModel::GetDelay
Time GetDelay(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
Definition:
propagation-delay-model.cc:78
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
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
propagation
model
propagation-delay-model.h
Generated on Tue May 28 2024 23:39:04 for ns-3 by
1.9.6