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
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
NS_LOG_COMPONENT_DEFINE
(
"UanPropModelThorp"
);
26
27
namespace
ns3 {
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
<
Object
> ()
44
.AddConstructor<UanPropModelThorp> ()
45
.AddAttribute (
"SpreadCoef"
,
46
"Spreading coefficient used in calculation of Thorp's approximation"
,
47
DoubleValue
(1.5),
48
MakeDoubleAccessor (&
UanPropModelThorp::m_SpreadCoef
),
49
MakeDoubleChecker<double> ())
50
;
51
return
tid;
52
}
53
54
double
55
UanPropModelThorp::GetPathLossDb
(
Ptr<MobilityModel>
a,
Ptr<MobilityModel>
b,
UanTxMode
mode)
56
{
57
double
dist = a->
GetDistanceFrom
(b);
58
59
return
m_SpreadCoef
* 10.0 * std::log10 (dist)
60
+ (dist / 1000.0) *
GetAttenDbKm
(mode.
GetCenterFreqHz
() / 1000.0);
61
}
62
63
UanPdp
64
UanPropModelThorp::GetPdp
(
Ptr<MobilityModel>
a,
Ptr<MobilityModel>
b,
UanTxMode
mode)
65
{
66
return
UanPdp::CreateImpulsePdp
();
67
}
68
69
Time
70
UanPropModelThorp::GetDelay
(
Ptr<MobilityModel>
a,
Ptr<MobilityModel>
b,
UanTxMode
mode)
71
{
72
return
Seconds (a->
GetDistanceFrom
(b) / 1500.0);
73
}
74
75
double
76
UanPropModelThorp::GetAttenDbKyd
(
double
freqKhz)
77
{
78
79
return
GetAttenDbKm
(freqKhz) / 1.093613298;
80
}
81
82
double
83
UanPropModelThorp::GetAttenDbKm
(
double
freqKhz)
84
{
85
86
double
fsq = freqKhz * freqKhz;
87
double
atten;
88
89
if
(freqKhz >= 0.4)
90
{
91
atten = 0.11 * fsq / (1 + fsq) + 44 * fsq / (4100 + fsq)
92
+ 2.75 * 0.0001 * fsq + 0.003;
93
}
94
else
95
{
96
atten = 0.002 + 0.11 * (freqKhz / (1 + freqKhz)) + 0.011 * freqKhz;
97
}
98
99
return
atten;
100
}
101
102
}
// namespace ns3
ns3::UanPropModelThorp::GetAttenDbKm
double GetAttenDbKm(double freqKhz)
Definition:
uan-prop-model-thorp.cc:83
ns3::Time
keep track of time values and allow control of global simulation resolution
Definition:
nstime.h:81
ns3::Ptr< MobilityModel >
ns3::MobilityModel::GetDistanceFrom
double GetDistanceFrom(Ptr< const MobilityModel > position) const
Definition:
mobility-model.cc:79
ns3::UanPropModelThorp::GetDelay
virtual Time GetDelay(Ptr< MobilityModel > a, Ptr< MobilityModel > b, UanTxMode mode)
Definition:
uan-prop-model-thorp.cc:70
ns3::UanPropModelThorp::GetAttenDbKyd
double GetAttenDbKyd(double freqKhz)
Definition:
uan-prop-model-thorp.cc:76
ns3::UanPdp::CreateImpulsePdp
static UanPdp CreateImpulsePdp(void)
Definition:
uan-prop-model.cc:331
ns3::UanPropModelThorp::GetTypeId
static TypeId GetTypeId(void)
Definition:
uan-prop-model-thorp.cc:40
ns3::UanPropModelThorp::m_SpreadCoef
double m_SpreadCoef
Definition:
uan-prop-model-thorp.h:50
NS_LOG_COMPONENT_DEFINE
NS_LOG_COMPONENT_DEFINE("UanPropModelThorp")
ns3::NS_OBJECT_ENSURE_REGISTERED
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
ns3::UanPdp
Definition:
uan-prop-model.h:83
ns3::UanTxMode
Abstraction of packet modulation information.
Definition:
uan-tx-mode.h:36
ns3::UanTxMode::GetCenterFreqHz
uint32_t GetCenterFreqHz(void) const
Definition:
uan-tx-mode.cc:57
uan-tx-mode.h
ns3::UanPropModelThorp::GetPathLossDb
virtual double GetPathLossDb(Ptr< MobilityModel > a, Ptr< MobilityModel > b, UanTxMode mode)
Definition:
uan-prop-model-thorp.cc:55
ns3::UanPropModelThorp::UanPropModelThorp
UanPropModelThorp()
Definition:
uan-prop-model-thorp.cc:31
uan-prop-model-thorp.h
ns3::UanPropModelThorp::~UanPropModelThorp
virtual ~UanPropModelThorp()
Definition:
uan-prop-model-thorp.cc:35
ns3::Object
a base class which provides memory management and object aggregation
Definition:
object.h:63
ns3::DoubleValue
Hold an floating point type.
Definition:
double.h:41
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Definition:
type-id.cc:610
ns3::UanPropModelThorp::GetPdp
virtual UanPdp GetPdp(Ptr< MobilityModel > a, Ptr< MobilityModel > b, UanTxMode mode)
Definition:
uan-prop-model-thorp.cc:64
src
uan
model
uan-prop-model-thorp.cc
Generated on Sun Apr 20 2014 11:15:03 for ns-3 by
1.8.6