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
jakes-propagation-loss-model.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2012 Telum (www.telum.ru)
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Kirill Andreev <andreev@telum.ru>
7
*/
8
9
#include "
jakes-propagation-loss-model.h
"
10
11
#include "ns3/double.h"
12
#include "ns3/log.h"
13
14
namespace
ns3
15
{
16
17
NS_LOG_COMPONENT_DEFINE
(
"Jakes"
);
18
19
NS_OBJECT_ENSURE_REGISTERED
(JakesPropagationLossModel);
20
21
JakesPropagationLossModel::JakesPropagationLossModel
()
22
{
23
m_uniformVariable
=
CreateObject<UniformRandomVariable>
();
24
m_uniformVariable
->SetAttribute(
"Min"
,
DoubleValue
(-1.0 * M_PI));
25
m_uniformVariable
->SetAttribute(
"Max"
,
DoubleValue
(M_PI));
26
}
27
28
JakesPropagationLossModel::~JakesPropagationLossModel
()
29
{
30
}
31
32
TypeId
33
JakesPropagationLossModel::GetTypeId
()
34
{
35
static
TypeId
tid =
TypeId
(
"ns3::JakesPropagationLossModel"
)
36
.
SetParent
<
PropagationLossModel
>()
37
.SetGroupName(
"Propagation"
)
38
.AddConstructor<
JakesPropagationLossModel
>();
39
return
tid;
40
}
41
42
void
43
JakesPropagationLossModel::DoDispose
()
44
{
45
m_uniformVariable
=
nullptr
;
46
m_propagationCache
.Cleanup();
47
}
48
49
double
50
JakesPropagationLossModel::DoCalcRxPower
(
double
txPowerDbm,
51
Ptr<MobilityModel>
a,
52
Ptr<MobilityModel>
b)
const
53
{
54
Ptr<JakesProcess>
pathData =
m_propagationCache
.GetPathData(
55
a,
56
b,
57
0
/**Spectrum model uid is not used in PropagationLossModel*/
);
58
if
(!pathData)
59
{
60
pathData =
CreateObject<JakesProcess>
();
61
pathData->SetPropagationLossModel(
this
);
62
m_propagationCache
.AddPathData(
63
pathData,
64
a,
65
b,
66
0
/**Spectrum model uid is not used in PropagationLossModel*/
);
67
}
68
return
txPowerDbm + pathData->GetChannelGainDb();
69
}
70
71
Ptr<UniformRandomVariable>
72
JakesPropagationLossModel::GetUniformRandomVariable
()
const
73
{
74
return
m_uniformVariable
;
75
}
76
77
int64_t
78
JakesPropagationLossModel::DoAssignStreams
(int64_t stream)
79
{
80
m_uniformVariable
->SetStream(stream);
81
return
1;
82
}
83
84
}
// namespace ns3
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition
double.h:31
ns3::JakesPropagationLossModel
a Jakes narrowband propagation model.
Definition
jakes-propagation-loss-model.h:25
ns3::JakesPropagationLossModel::GetUniformRandomVariable
Ptr< UniformRandomVariable > GetUniformRandomVariable() const
Get the underlying RNG stream.
Definition
jakes-propagation-loss-model.cc:72
ns3::JakesPropagationLossModel::JakesPropagationLossModel
JakesPropagationLossModel()
Definition
jakes-propagation-loss-model.cc:21
ns3::JakesPropagationLossModel::DoAssignStreams
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
Definition
jakes-propagation-loss-model.cc:78
ns3::JakesPropagationLossModel::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
jakes-propagation-loss-model.cc:33
ns3::JakesPropagationLossModel::m_propagationCache
PropagationCache< JakesProcess > m_propagationCache
Propagation cache.
Definition
jakes-propagation-loss-model.h:58
ns3::JakesPropagationLossModel::~JakesPropagationLossModel
~JakesPropagationLossModel() override
Definition
jakes-propagation-loss-model.cc:28
ns3::JakesPropagationLossModel::m_uniformVariable
Ptr< UniformRandomVariable > m_uniformVariable
random stream
Definition
jakes-propagation-loss-model.h:57
ns3::JakesPropagationLossModel::DoCalcRxPower
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
Definition
jakes-propagation-loss-model.cc:50
ns3::JakesPropagationLossModel::DoDispose
void DoDispose() override
Destructor implementation.
Definition
jakes-propagation-loss-model.cc:43
ns3::PropagationLossModel
Models the propagation loss through a transmission medium.
Definition
propagation-loss-model.h:45
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
ns3::CreateObject
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition
object.h:619
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
jakes-propagation-loss-model.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
propagation
model
jakes-propagation-loss-model.cc
Generated on Fri Nov 8 2024 13:59:05 for ns-3 by
1.11.0