A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
uan-prop-model-thorp.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2009 University of Washington
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: Leonard Tracy <lentracy@gmail.com>
19
*/
20
#include "
uan-prop-model-thorp.h
"
21
#include "
uan-tx-mode.h
"
22
#include "ns3/double.h"
23
#include "ns3/log.h"
24
25
namespace
ns3
{
26
27
NS_LOG_COMPONENT_DEFINE
(
"UanPropModelThorp"
);
28
29
NS_OBJECT_ENSURE_REGISTERED
(UanPropModelThorp);
30
31
UanPropModelThorp::UanPropModelThorp
()
32
{
33
}
34
35
UanPropModelThorp::~UanPropModelThorp
()
36
{
37
}
38
39
TypeId
40
UanPropModelThorp::GetTypeId
(
void
)
41
{
42
static
TypeId
tid =
TypeId
(
"ns3::UanPropModelThorp"
)
43
.
SetParent
<
UanPropModel
> ()
44
.SetGroupName (
"Uan"
)
45
.AddConstructor<
UanPropModelThorp
> ()
46
.AddAttribute (
"SpreadCoef"
,
47
"Spreading coefficient used in calculation of Thorp's approximation."
,
48
DoubleValue
(1.5),
49
MakeDoubleAccessor
(&
UanPropModelThorp::m_SpreadCoef
),
50
MakeDoubleChecker<double> ())
51
;
52
return
tid;
53
}
54
55
double
56
UanPropModelThorp::GetPathLossDb
(
Ptr<MobilityModel>
a,
Ptr<MobilityModel>
b,
UanTxMode
mode)
57
{
58
double
dist = a->
GetDistanceFrom
(b);
59
60
return
m_SpreadCoef
* 10.0 * std::log10 (dist)
61
+ (dist / 1000.0) *
GetAttenDbKm
(mode.
GetCenterFreqHz
() / 1000.0);
62
}
63
64
UanPdp
65
UanPropModelThorp::GetPdp
(
Ptr<MobilityModel>
a,
Ptr<MobilityModel>
b,
UanTxMode
mode)
66
{
67
return
UanPdp::CreateImpulsePdp
();
68
}
69
70
Time
71
UanPropModelThorp::GetDelay
(
Ptr<MobilityModel>
a,
Ptr<MobilityModel>
b,
UanTxMode
mode)
72
{
73
return
Seconds
(a->
GetDistanceFrom
(b) / 1500.0);
74
}
75
76
double
77
UanPropModelThorp::GetAttenDbKyd
(
double
freqKhz)
78
{
79
80
return
GetAttenDbKm
(freqKhz) / 1.093613298;
81
}
82
83
double
84
UanPropModelThorp::GetAttenDbKm
(
double
freqKhz)
85
{
86
87
double
fsq = freqKhz * freqKhz;
88
double
atten;
89
90
if
(freqKhz >= 0.4)
91
{
92
atten = 0.11 * fsq / (1 + fsq) + 44 * fsq / (4100 + fsq)
93
+ 2.75 * 0.0001 * fsq + 0.003;
94
}
95
else
96
{
97
atten = 0.002 + 0.11 * (freqKhz / (1 + freqKhz)) + 0.011 * freqKhz;
98
}
99
100
return
atten;
101
}
102
103
}
// namespace ns3
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:205
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:45
ns3::UanPropModelThorp::UanPropModelThorp
UanPropModelThorp()
Default constructor.
Definition:
uan-prop-model-thorp.cc:31
ns3::UanPdp
The power delay profile returned by propagation models.
Definition:
uan-prop-model.h:92
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::MobilityModel::GetDistanceFrom
double GetDistanceFrom(Ptr< const MobilityModel > position) const
Definition:
mobility-model.cc:94
ns3::UanPropModelThorp::GetAttenDbKm
double GetAttenDbKm(double freqKhz)
Get the attenuation in dB / km.
Definition:
uan-prop-model-thorp.cc:84
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:923
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition:
double.h:41
ns3::UanPropModelThorp::~UanPropModelThorp
virtual ~UanPropModelThorp()
Destructor.
Definition:
uan-prop-model-thorp.cc:35
ns3::UanPropModelThorp::GetPathLossDb
virtual double GetPathLossDb(Ptr< MobilityModel > a, Ptr< MobilityModel > b, UanTxMode mode)
Computes pathloss between nodes a and b.
Definition:
uan-prop-model-thorp.cc:56
ns3::UanTxMode::GetCenterFreqHz
uint32_t GetCenterFreqHz(void) const
Get the transmission center frequency.
Definition:
uan-tx-mode.cc:57
ns3::UanPropModelThorp::GetDelay
virtual Time GetDelay(Ptr< MobilityModel > a, Ptr< MobilityModel > b, UanTxMode mode)
Finds propagation delay between nodes a and b.
Definition:
uan-prop-model-thorp.cc:71
ns3::UanPropModelThorp::GetPdp
virtual UanPdp GetPdp(Ptr< MobilityModel > a, Ptr< MobilityModel > b, UanTxMode mode)
Get the PDP for the path between two nodes.
Definition:
uan-prop-model-thorp.cc:65
ns3::Ptr< MobilityModel >
uan-tx-mode.h
ns3::UanPdp::CreateImpulsePdp
static UanPdp CreateImpulsePdp(void)
Get a unit impulse PDP at time 0.
Definition:
uan-prop-model.cc:352
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:104
ns3::UanTxMode
Abstraction of packet modulation information.
Definition:
uan-tx-mode.h:42
ns3::MakeDoubleAccessor
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition:
double.h:42
ns3::UanPropModelThorp::GetAttenDbKyd
double GetAttenDbKyd(double freqKhz)
Get the attenuation in dB / 1000 yards.
Definition:
uan-prop-model-thorp.cc:77
ns3::UanPropModelThorp::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition:
uan-prop-model-thorp.cc:40
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition:
nstime.h:1289
ns3::UanPropModelThorp::m_SpreadCoef
double m_SpreadCoef
Spreading coefficient used in calculation of Thorp's approximation.
Definition:
uan-prop-model-thorp.h:68
ns3::UanPropModel
Base class for implemented underwater propagation models.
Definition:
uan-prop-model.h:287
ns3::UanPropModelThorp
Uses Thorp's approximation to compute pathloss.
Definition:
uan-prop-model-thorp.h:36
uan-prop-model-thorp.h
src
uan
model
uan-prop-model-thorp.cc
Generated on Fri Oct 1 2021 17:03:40 for ns-3 by
1.8.20