A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
jakes-propagation-loss-model.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2012 Telum (www.telum.ru)
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: Kirill Andreev <andreev@telum.ru>
19
*/
20
21
#include "
jakes-propagation-loss-model.h
"
22
#include "ns3/double.h"
23
#include "ns3/log.h"
24
25
NS_LOG_COMPONENT_DEFINE
(
"Jakes"
);
26
27
namespace
ns3
28
{
29
NS_OBJECT_ENSURE_REGISTERED
(JakesPropagationLossModel)
30
;
31
32
33
const
double
JakesPropagationLossModel::PI
= 3.14159265358979323846;
34
35
JakesPropagationLossModel::JakesPropagationLossModel
()
36
{
37
m_uniformVariable
= CreateObject<UniformRandomVariable> ();
38
m_uniformVariable
->
SetAttribute
(
"Min"
,
DoubleValue
(-1.0 *
PI
));
39
m_uniformVariable
->
SetAttribute
(
"Max"
,
DoubleValue
(
PI
));
40
}
41
42
JakesPropagationLossModel::~JakesPropagationLossModel
()
43
{}
44
45
TypeId
46
JakesPropagationLossModel::GetTypeId
()
47
{
48
static
TypeId
tid =
TypeId
(
"ns3::JakesPropagationLossModel"
)
49
.
SetParent
<
PropagationLossModel
> ()
50
.AddConstructor<JakesPropagationLossModel> ()
51
;
52
return
tid;
53
}
54
55
double
56
JakesPropagationLossModel::DoCalcRxPower
(
double
txPowerDbm,
57
Ptr<MobilityModel>
a,
58
Ptr<MobilityModel>
b)
const
59
{
60
Ptr<JakesProcess>
pathData =
m_propagationCache
.GetPathData (a, b, 0 );
61
if
(pathData == 0)
62
{
63
pathData = CreateObject<JakesProcess> ();
64
pathData->SetPropagationLossModel (
this
);
65
m_propagationCache
.AddPathData (pathData, a, b, 0);
66
}
67
return
txPowerDbm + pathData->GetChannelGainDb ();
68
}
69
70
Ptr<UniformRandomVariable>
71
JakesPropagationLossModel::GetUniformRandomVariable
()
const
72
{
73
return
m_uniformVariable
;
74
}
75
76
int64_t
77
JakesPropagationLossModel::DoAssignStreams
(int64_t stream)
78
{
79
m_uniformVariable
->
SetStream
(stream);
80
return
1;
81
}
82
83
}
// namespace ns3
84
ns3::Ptr< MobilityModel >
ns3::RandomVariableStream::SetStream
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
Definition:
random-variable-stream.cc:92
ns3::NS_OBJECT_ENSURE_REGISTERED
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
ns3::JakesPropagationLossModel::GetTypeId
static TypeId GetTypeId()
Definition:
jakes-propagation-loss-model.cc:46
ns3::JakesPropagationLossModel::DoCalcRxPower
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Definition:
jakes-propagation-loss-model.cc:56
NS_LOG_COMPONENT_DEFINE
NS_LOG_COMPONENT_DEFINE("Jakes")
ns3::JakesPropagationLossModel::m_propagationCache
PropagationCache< JakesProcess > m_propagationCache
Definition:
jakes-propagation-loss-model.h:55
ns3::JakesPropagationLossModel::~JakesPropagationLossModel
virtual ~JakesPropagationLossModel()
Definition:
jakes-propagation-loss-model.cc:42
ns3::PropagationLossModel
Modelize the propagation loss through a transmission medium.
Definition:
propagation-loss-model.h:49
ns3::JakesPropagationLossModel::GetUniformRandomVariable
Ptr< UniformRandomVariable > GetUniformRandomVariable() const
Definition:
jakes-propagation-loss-model.cc:71
ns3::JakesPropagationLossModel::DoAssignStreams
virtual int64_t DoAssignStreams(int64_t stream)
Subclasses must implement this; those not using random variables can return zero. ...
Definition:
jakes-propagation-loss-model.cc:77
ns3::JakesPropagationLossModel::PI
static const double PI
Definition:
jakes-propagation-loss-model.h:43
ns3::JakesPropagationLossModel::JakesPropagationLossModel
JakesPropagationLossModel()
Definition:
jakes-propagation-loss-model.cc:35
jakes-propagation-loss-model.h
ns3::DoubleValue
Hold a floating point type.
Definition:
double.h:41
ns3::ObjectBase::SetAttribute
void SetAttribute(std::string name, const AttributeValue &value)
Definition:
object-base.cc:161
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Definition:
type-id.cc:611
ns3::JakesPropagationLossModel::m_uniformVariable
Ptr< UniformRandomVariable > m_uniformVariable
Definition:
jakes-propagation-loss-model.h:53
src
propagation
model
jakes-propagation-loss-model.cc
Generated on Sat Apr 19 2014 14:07:07 for ns-3 by
1.8.6