author | Mitch Watrous |
Wed, 15 Aug 2012 18:08:46 -0700 | |
changeset 8985 | 7752dc4ce7e9 |
parent 7385 | 10beb0e53130 |
child 9063 | 32755d0516f4 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7256
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
2 |
/* |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
3 |
* Copyright (c) 2005,2006,2007 INRIA |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
4 |
* |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
8 |
* |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
13 |
* |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
17 |
* |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
19 |
* Contributions: Timo Bingmann <timo.bingmann@student.kit.edu> |
5972
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
20 |
* Contributions: Tom Hewer <tomhewer@mac.com> for Two Ray Ground Model |
6115
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
21 |
* Pavel Boyko <boyko@iitp.ru> for matrix |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
22 |
*/ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
23 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
24 |
#include "propagation-loss-model.h" |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
25 |
#include "ns3/log.h" |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
26 |
#include "ns3/mobility-model.h" |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
27 |
#include "ns3/boolean.h" |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
28 |
#include "ns3/double.h" |
8985
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
29 |
#include "ns3/string.h" |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
30 |
#include "ns3/pointer.h" |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
31 |
#include <math.h> |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
32 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
33 |
NS_LOG_COMPONENT_DEFINE ("PropagationLossModel"); |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
34 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
35 |
namespace ns3 { |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
36 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
37 |
// ------------------------------------------------------------------------- // |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
38 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
39 |
NS_OBJECT_ENSURE_REGISTERED (PropagationLossModel); |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
40 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
41 |
TypeId |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
42 |
PropagationLossModel::GetTypeId (void) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
43 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
44 |
static TypeId tid = TypeId ("ns3::PropagationLossModel") |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
45 |
.SetParent<Object> () |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
46 |
; |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
47 |
return tid; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
48 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
49 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
50 |
PropagationLossModel::PropagationLossModel () |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
51 |
: m_next (0) |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
52 |
{ |
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
53 |
} |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
54 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
55 |
PropagationLossModel::~PropagationLossModel () |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
56 |
{ |
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
57 |
} |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
58 |
|
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
59 |
void |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
60 |
PropagationLossModel::SetNext (Ptr<PropagationLossModel> next) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
61 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
62 |
m_next = next; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
63 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
64 |
|
8985
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
65 |
Ptr<PropagationLossModel> |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
66 |
PropagationLossModel::GetNext () |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
67 |
{ |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
68 |
return m_next; |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
69 |
} |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
70 |
|
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
71 |
double |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
72 |
PropagationLossModel::CalcRxPower (double txPowerDbm, |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
73 |
Ptr<MobilityModel> a, |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
74 |
Ptr<MobilityModel> b) const |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
75 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
76 |
double self = DoCalcRxPower (txPowerDbm, a, b); |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
77 |
if (m_next != 0) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
78 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
79 |
self = m_next->CalcRxPower (self, a, b); |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
80 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
81 |
return self; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
82 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
83 |
|
8985
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
84 |
int64_t |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
85 |
PropagationLossModel::AssignStreams (int64_t stream) |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
86 |
{ |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
87 |
int64_t currentStream = stream; |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
88 |
currentStream += DoAssignStreams (stream); |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
89 |
if (m_next != 0) |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
90 |
{ |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
91 |
currentStream += m_next->AssignStreams (currentStream); |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
92 |
} |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
93 |
return (currentStream - stream); |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
94 |
} |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
95 |
|
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
96 |
// ------------------------------------------------------------------------- // |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
97 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
98 |
NS_OBJECT_ENSURE_REGISTERED (RandomPropagationLossModel); |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
99 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
100 |
TypeId |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
101 |
RandomPropagationLossModel::GetTypeId (void) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
102 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
103 |
static TypeId tid = TypeId ("ns3::RandomPropagationLossModel") |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
104 |
.SetParent<PropagationLossModel> () |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
105 |
.AddConstructor<RandomPropagationLossModel> () |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
106 |
.AddAttribute ("Variable", "The random variable used to pick a loss everytime CalcRxPower is invoked.", |
8985
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
107 |
StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"), |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
108 |
MakePointerAccessor (&RandomPropagationLossModel::m_variable), |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
109 |
MakePointerChecker<RandomVariableStream> ()) |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
110 |
; |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
111 |
return tid; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
112 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
113 |
RandomPropagationLossModel::RandomPropagationLossModel () |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
114 |
: PropagationLossModel () |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
115 |
{ |
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
116 |
} |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
117 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
118 |
RandomPropagationLossModel::~RandomPropagationLossModel () |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
119 |
{ |
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
120 |
} |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
121 |
|
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
122 |
double |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
123 |
RandomPropagationLossModel::DoCalcRxPower (double txPowerDbm, |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
124 |
Ptr<MobilityModel> a, |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
125 |
Ptr<MobilityModel> b) const |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
126 |
{ |
8985
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
127 |
double rxc = -m_variable->GetValue (); |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
128 |
NS_LOG_DEBUG ("attenuation coefficent="<<rxc<<"Db"); |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
129 |
return txPowerDbm + rxc; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
130 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
131 |
|
8985
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
132 |
int64_t |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
133 |
RandomPropagationLossModel::DoAssignStreams (int64_t stream) |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
134 |
{ |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
135 |
m_variable->SetStream (stream); |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
136 |
return 1; |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
137 |
} |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
138 |
|
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
139 |
// ------------------------------------------------------------------------- // |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
140 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
141 |
NS_OBJECT_ENSURE_REGISTERED (FriisPropagationLossModel); |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
142 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
143 |
const double FriisPropagationLossModel::PI = 3.14159265358979323846; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
144 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
145 |
TypeId |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
146 |
FriisPropagationLossModel::GetTypeId (void) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
147 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
148 |
static TypeId tid = TypeId ("ns3::FriisPropagationLossModel") |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
149 |
.SetParent<PropagationLossModel> () |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
150 |
.AddConstructor<FriisPropagationLossModel> () |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
151 |
.AddAttribute ("Lambda", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
152 |
"The wavelength (default is 5.15 GHz at 300 000 km/s).", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
153 |
DoubleValue (300000000.0 / 5.150e9), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
154 |
MakeDoubleAccessor (&FriisPropagationLossModel::m_lambda), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
155 |
MakeDoubleChecker<double> ()) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
156 |
.AddAttribute ("SystemLoss", "The system loss", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
157 |
DoubleValue (1.0), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
158 |
MakeDoubleAccessor (&FriisPropagationLossModel::m_systemLoss), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
159 |
MakeDoubleChecker<double> ()) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
160 |
.AddAttribute ("MinDistance", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
161 |
"The distance under which the propagation model refuses to give results (m)", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
162 |
DoubleValue (0.5), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
163 |
MakeDoubleAccessor (&FriisPropagationLossModel::SetMinDistance, |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
164 |
&FriisPropagationLossModel::GetMinDistance), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
165 |
MakeDoubleChecker<double> ()) |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
166 |
; |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
167 |
return tid; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
168 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
169 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
170 |
FriisPropagationLossModel::FriisPropagationLossModel () |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
171 |
{ |
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
172 |
} |
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
173 |
void |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
174 |
FriisPropagationLossModel::SetSystemLoss (double systemLoss) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
175 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
176 |
m_systemLoss = systemLoss; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
177 |
} |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
178 |
double |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
179 |
FriisPropagationLossModel::GetSystemLoss (void) const |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
180 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
181 |
return m_systemLoss; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
182 |
} |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
183 |
void |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
184 |
FriisPropagationLossModel::SetMinDistance (double minDistance) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
185 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
186 |
m_minDistance = minDistance; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
187 |
} |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
188 |
double |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
189 |
FriisPropagationLossModel::GetMinDistance (void) const |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
190 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
191 |
return m_minDistance; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
192 |
} |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
193 |
void |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
194 |
FriisPropagationLossModel::SetLambda (double frequency, double speed) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
195 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
196 |
m_lambda = speed / frequency; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
197 |
} |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
198 |
void |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
199 |
FriisPropagationLossModel::SetLambda (double lambda) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
200 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
201 |
m_lambda = lambda; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
202 |
} |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
203 |
double |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
204 |
FriisPropagationLossModel::GetLambda (void) const |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
205 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
206 |
return m_lambda; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
207 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
208 |
|
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
209 |
double |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
210 |
FriisPropagationLossModel::DbmToW (double dbm) const |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
211 |
{ |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7188
diff
changeset
|
212 |
double mw = pow (10.0,dbm/10.0); |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
213 |
return mw / 1000.0; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
214 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
215 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
216 |
double |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
217 |
FriisPropagationLossModel::DbmFromW (double w) const |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
218 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
219 |
double dbm = log10 (w * 1000.0) * 10.0; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
220 |
return dbm; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
221 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
222 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
223 |
double |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
224 |
FriisPropagationLossModel::DoCalcRxPower (double txPowerDbm, |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
225 |
Ptr<MobilityModel> a, |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
226 |
Ptr<MobilityModel> b) const |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
227 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
228 |
/* |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
229 |
* Friis free space equation: |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
230 |
* where Pt, Gr, Gr and P are in Watt units |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
231 |
* L is in meter units. |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
232 |
* |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
233 |
* P Gt * Gr * (lambda^2) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
234 |
* --- = --------------------- |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
235 |
* Pt (4 * pi * d)^2 * L |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
236 |
* |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
237 |
* Gt: tx gain (unit-less) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
238 |
* Gr: rx gain (unit-less) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
239 |
* Pt: tx power (W) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
240 |
* d: distance (m) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
241 |
* L: system loss |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
242 |
* lambda: wavelength (m) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
243 |
* |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
244 |
* Here, we ignore tx and rx gain and the input and output values |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
245 |
* are in dB or dBm: |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
246 |
* |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
247 |
* lambda^2 |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
248 |
* rx = tx + 10 log10 (-------------------) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
249 |
* (4 * pi * d)^2 * L |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
250 |
* |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
251 |
* rx: rx power (dB) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
252 |
* tx: tx power (dB) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
253 |
* d: distance (m) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
254 |
* L: system loss (unit-less) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
255 |
* lambda: wavelength (m) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
256 |
*/ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
257 |
double distance = a->GetDistanceFrom (b); |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
258 |
if (distance <= m_minDistance) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
259 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
260 |
return txPowerDbm; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
261 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
262 |
double numerator = m_lambda * m_lambda; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
263 |
double denominator = 16 * PI * PI * distance * distance * m_systemLoss; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
264 |
double pr = 10 * log10 (numerator / denominator); |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
265 |
NS_LOG_DEBUG ("distance="<<distance<<"m, attenuation coefficient="<<pr<<"dB"); |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
266 |
return txPowerDbm + pr; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
267 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
268 |
|
8985
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
269 |
int64_t |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
270 |
FriisPropagationLossModel::DoAssignStreams (int64_t stream) |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
271 |
{ |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
272 |
return 0; |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
273 |
} |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
274 |
|
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
275 |
// ------------------------------------------------------------------------- // |
5972
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
276 |
// -- Two-Ray Ground Model ported from NS-2 -- tomhewer@mac.com -- Nov09 // |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
277 |
|
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
278 |
NS_OBJECT_ENSURE_REGISTERED (TwoRayGroundPropagationLossModel); |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
279 |
|
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
280 |
const double TwoRayGroundPropagationLossModel::PI = 3.14159265358979323846; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
281 |
|
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
282 |
TypeId |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
283 |
TwoRayGroundPropagationLossModel::GetTypeId (void) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
284 |
{ |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
285 |
static TypeId tid = TypeId ("ns3::TwoRayGroundPropagationLossModel") |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
286 |
.SetParent<PropagationLossModel> () |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
287 |
.AddConstructor<TwoRayGroundPropagationLossModel> () |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
288 |
.AddAttribute ("Lambda", |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
289 |
"The wavelength (default is 5.15 GHz at 300 000 km/s).", |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
290 |
DoubleValue (300000000.0 / 5.150e9), |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
291 |
MakeDoubleAccessor (&TwoRayGroundPropagationLossModel::m_lambda), |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
292 |
MakeDoubleChecker<double> ()) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
293 |
.AddAttribute ("SystemLoss", "The system loss", |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
294 |
DoubleValue (1.0), |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
295 |
MakeDoubleAccessor (&TwoRayGroundPropagationLossModel::m_systemLoss), |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
296 |
MakeDoubleChecker<double> ()) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
297 |
.AddAttribute ("MinDistance", |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
298 |
"The distance under which the propagation model refuses to give results (m)", |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
299 |
DoubleValue (0.5), |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
300 |
MakeDoubleAccessor (&TwoRayGroundPropagationLossModel::SetMinDistance, |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
301 |
&TwoRayGroundPropagationLossModel::GetMinDistance), |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
302 |
MakeDoubleChecker<double> ()) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
303 |
.AddAttribute ("HeightAboveZ", |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
304 |
"The height of the antenna (m) above the node's Z coordinate", |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
305 |
DoubleValue (0), |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
306 |
MakeDoubleAccessor (&TwoRayGroundPropagationLossModel::m_heightAboveZ), |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
307 |
MakeDoubleChecker<double> ()) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
308 |
; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
309 |
return tid; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
310 |
} |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
311 |
|
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
312 |
TwoRayGroundPropagationLossModel::TwoRayGroundPropagationLossModel () |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
313 |
{ |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
314 |
} |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
315 |
void |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
316 |
TwoRayGroundPropagationLossModel::SetSystemLoss (double systemLoss) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
317 |
{ |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
318 |
m_systemLoss = systemLoss; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
319 |
} |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
320 |
double |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
321 |
TwoRayGroundPropagationLossModel::GetSystemLoss (void) const |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
322 |
{ |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
323 |
return m_systemLoss; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
324 |
} |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
325 |
void |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
326 |
TwoRayGroundPropagationLossModel::SetMinDistance (double minDistance) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
327 |
{ |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
328 |
m_minDistance = minDistance; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
329 |
} |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
330 |
double |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
331 |
TwoRayGroundPropagationLossModel::GetMinDistance (void) const |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
332 |
{ |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
333 |
return m_minDistance; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
334 |
} |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
335 |
void |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
336 |
TwoRayGroundPropagationLossModel::SetHeightAboveZ (double heightAboveZ) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
337 |
{ |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
338 |
m_heightAboveZ = heightAboveZ; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
339 |
} |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
340 |
void |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
341 |
TwoRayGroundPropagationLossModel::SetLambda (double frequency, double speed) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
342 |
{ |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
343 |
m_lambda = speed / frequency; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
344 |
} |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
345 |
void |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
346 |
TwoRayGroundPropagationLossModel::SetLambda (double lambda) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
347 |
{ |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
348 |
m_lambda = lambda; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
349 |
} |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
350 |
double |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
351 |
TwoRayGroundPropagationLossModel::GetLambda (void) const |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
352 |
{ |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
353 |
return m_lambda; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
354 |
} |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
355 |
|
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
356 |
double |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
357 |
TwoRayGroundPropagationLossModel::DbmToW (double dbm) const |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
358 |
{ |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
359 |
double mw = pow (10.0,dbm / 10.0); |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
360 |
return mw / 1000.0; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
361 |
} |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
362 |
|
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
363 |
double |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
364 |
TwoRayGroundPropagationLossModel::DbmFromW (double w) const |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
365 |
{ |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
366 |
double dbm = log10 (w * 1000.0) * 10.0; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
367 |
return dbm; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
368 |
} |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
369 |
|
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
370 |
double |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
371 |
TwoRayGroundPropagationLossModel::DoCalcRxPower (double txPowerDbm, |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
372 |
Ptr<MobilityModel> a, |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
373 |
Ptr<MobilityModel> b) const |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
374 |
{ |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
375 |
/* |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
376 |
* Two-Ray Ground equation: |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
377 |
* |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
378 |
* where Pt, Gt and Gr are in dBm units |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
379 |
* L, Ht and Hr are in meter units. |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
380 |
* |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
381 |
* Pr Gt * Gr * (Ht^2 * Hr^2) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
382 |
* -- = (-------------------------) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
383 |
* Pt d^4 * L |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
384 |
* |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
385 |
* Gt: tx gain (unit-less) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
386 |
* Gr: rx gain (unit-less) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
387 |
* Pt: tx power (dBm) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
388 |
* d: distance (m) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
389 |
* L: system loss |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
390 |
* Ht: Tx antenna height (m) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
391 |
* Hr: Rx antenna height (m) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
392 |
* lambda: wavelength (m) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
393 |
* |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
394 |
* As with the Friis model we ignore tx and rx gain and output values |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
395 |
* are in dB or dBm |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
396 |
* |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
397 |
* (Ht * Ht) * (Hr * Hr) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
398 |
* rx = tx + 10 log10 (-----------------------) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
399 |
* (d * d * d * d) * L |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
400 |
*/ |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
401 |
double distance = a->GetDistanceFrom (b); |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
402 |
if (distance <= m_minDistance) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
403 |
{ |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
404 |
return txPowerDbm; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
405 |
} |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
406 |
|
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
407 |
// Set the height of the Tx and Rx antennae |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
408 |
double txAntHeight = a->GetPosition ().z + m_heightAboveZ; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
409 |
double rxAntHeight = b->GetPosition ().z + m_heightAboveZ; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
410 |
|
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
411 |
// Calculate a crossover distance, under which we use Friis |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
412 |
/* |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
413 |
* |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
414 |
* dCross = (4 * pi * Ht * Hr) / lambda |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
415 |
* |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
416 |
*/ |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
417 |
|
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
418 |
double dCross = (4 * PI * txAntHeight * rxAntHeight) / GetLambda (); |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
419 |
double tmp = 0; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
420 |
if (distance <= dCross) |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
421 |
{ |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
422 |
// We use Friis |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
423 |
double numerator = m_lambda * m_lambda; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
424 |
tmp = PI * distance; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
425 |
double denominator = 16 * tmp * tmp * m_systemLoss; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
426 |
double pr = 10 * log10 (numerator / denominator); |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
427 |
NS_LOG_DEBUG ("Receiver within crossover (" << dCross << "m) for Two_ray path; using Friis"); |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
428 |
NS_LOG_DEBUG ("distance=" << distance << "m, attenuation coefficient=" << pr << "dB"); |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
429 |
return txPowerDbm + pr; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
430 |
} |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
431 |
else // Use Two-Ray Pathloss |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
432 |
{ |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
433 |
tmp = txAntHeight * rxAntHeight; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
434 |
double rayNumerator = tmp * tmp; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
435 |
tmp = distance * distance; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
436 |
double rayDenominator = tmp * tmp * m_systemLoss; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
437 |
double rayPr = 10 * log10 (rayNumerator / rayDenominator); |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
438 |
NS_LOG_DEBUG ("distance=" << distance << "m, attenuation coefficient=" << rayPr << "dB"); |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
439 |
return txPowerDbm + rayPr; |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
440 |
|
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
441 |
} |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
442 |
} |
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
443 |
|
8985
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
444 |
int64_t |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
445 |
TwoRayGroundPropagationLossModel::DoAssignStreams (int64_t stream) |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
446 |
{ |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
447 |
return 0; |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
448 |
} |
5972
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
449 |
|
def0efbb0fd5
addition of two ray ground model and tests
tomhewer@blackbook.local
parents:
5944
diff
changeset
|
450 |
// ------------------------------------------------------------------------- // |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
451 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
452 |
NS_OBJECT_ENSURE_REGISTERED (LogDistancePropagationLossModel); |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
453 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
454 |
TypeId |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
455 |
LogDistancePropagationLossModel::GetTypeId (void) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
456 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
457 |
static TypeId tid = TypeId ("ns3::LogDistancePropagationLossModel") |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
458 |
.SetParent<PropagationLossModel> () |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
459 |
.AddConstructor<LogDistancePropagationLossModel> () |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
460 |
.AddAttribute ("Exponent", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
461 |
"The exponent of the Path Loss propagation model", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
462 |
DoubleValue (3.0), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
463 |
MakeDoubleAccessor (&LogDistancePropagationLossModel::m_exponent), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
464 |
MakeDoubleChecker<double> ()) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
465 |
.AddAttribute ("ReferenceDistance", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
466 |
"The distance at which the reference loss is calculated (m)", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
467 |
DoubleValue (1.0), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
468 |
MakeDoubleAccessor (&LogDistancePropagationLossModel::m_referenceDistance), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
469 |
MakeDoubleChecker<double> ()) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
470 |
.AddAttribute ("ReferenceLoss", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
471 |
"The reference loss at reference distance (dB). (Default is Friis at 1m with 5.15 GHz)", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
472 |
DoubleValue (46.6777), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
473 |
MakeDoubleAccessor (&LogDistancePropagationLossModel::m_referenceLoss), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
474 |
MakeDoubleChecker<double> ()) |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
475 |
; |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
476 |
return tid; |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
477 |
|
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
478 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
479 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
480 |
LogDistancePropagationLossModel::LogDistancePropagationLossModel () |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
481 |
{ |
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
482 |
} |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
483 |
|
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
484 |
void |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
485 |
LogDistancePropagationLossModel::SetPathLossExponent (double n) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
486 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
487 |
m_exponent = n; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
488 |
} |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
489 |
void |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
490 |
LogDistancePropagationLossModel::SetReference (double referenceDistance, double referenceLoss) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
491 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
492 |
m_referenceDistance = referenceDistance; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
493 |
m_referenceLoss = referenceLoss; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
494 |
} |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
495 |
double |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
496 |
LogDistancePropagationLossModel::GetPathLossExponent (void) const |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
497 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
498 |
return m_exponent; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
499 |
} |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
500 |
|
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
501 |
double |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
502 |
LogDistancePropagationLossModel::DoCalcRxPower (double txPowerDbm, |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
503 |
Ptr<MobilityModel> a, |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
504 |
Ptr<MobilityModel> b) const |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
505 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
506 |
double distance = a->GetDistanceFrom (b); |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
507 |
if (distance <= m_referenceDistance) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
508 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
509 |
return txPowerDbm; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
510 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
511 |
/** |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
512 |
* The formula is: |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
513 |
* rx = 10 * log (Pr0(tx)) - n * 10 * log (d/d0) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
514 |
* |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
515 |
* Pr0: rx power at reference distance d0 (W) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
516 |
* d0: reference distance: 1.0 (m) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
517 |
* d: distance (m) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
518 |
* tx: tx power (dB) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
519 |
* rx: dB |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
520 |
* |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
521 |
* Which, in our case is: |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
522 |
* |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
523 |
* rx = rx0(tx) - 10 * n * log (d/d0) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
524 |
*/ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
525 |
double pathLossDb = 10 * m_exponent * log10 (distance / m_referenceDistance); |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
526 |
double rxc = -m_referenceLoss - pathLossDb; |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
527 |
NS_LOG_DEBUG ("distance="<<distance<<"m, reference-attenuation="<< -m_referenceLoss<<"dB, "<< |
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
528 |
"attenuation coefficient="<<rxc<<"db"); |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
529 |
return txPowerDbm + rxc; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
530 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
531 |
|
8985
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
532 |
int64_t |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
533 |
LogDistancePropagationLossModel::DoAssignStreams (int64_t stream) |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
534 |
{ |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
535 |
return 0; |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
536 |
} |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
537 |
|
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
538 |
// ------------------------------------------------------------------------- // |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
539 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
540 |
NS_OBJECT_ENSURE_REGISTERED (ThreeLogDistancePropagationLossModel); |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
541 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
542 |
TypeId |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
543 |
ThreeLogDistancePropagationLossModel::GetTypeId (void) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
544 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
545 |
static TypeId tid = TypeId ("ns3::ThreeLogDistancePropagationLossModel") |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
546 |
.SetParent<PropagationLossModel> () |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
547 |
.AddConstructor<ThreeLogDistancePropagationLossModel> () |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
548 |
.AddAttribute ("Distance0", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
549 |
"Beginning of the first (near) distance field", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
550 |
DoubleValue (1.0), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
551 |
MakeDoubleAccessor (&ThreeLogDistancePropagationLossModel::m_distance0), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
552 |
MakeDoubleChecker<double> ()) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
553 |
.AddAttribute ("Distance1", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
554 |
"Beginning of the second (middle) distance field.", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
555 |
DoubleValue (200.0), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
556 |
MakeDoubleAccessor (&ThreeLogDistancePropagationLossModel::m_distance1), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
557 |
MakeDoubleChecker<double> ()) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
558 |
.AddAttribute ("Distance2", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
559 |
"Beginning of the third (far) distance field.", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
560 |
DoubleValue (500.0), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
561 |
MakeDoubleAccessor (&ThreeLogDistancePropagationLossModel::m_distance2), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
562 |
MakeDoubleChecker<double> ()) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
563 |
.AddAttribute ("Exponent0", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
564 |
"The exponent for the first field.", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
565 |
DoubleValue (1.9), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
566 |
MakeDoubleAccessor (&ThreeLogDistancePropagationLossModel::m_exponent0), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
567 |
MakeDoubleChecker<double> ()) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
568 |
.AddAttribute ("Exponent1", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
569 |
"The exponent for the second field.", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
570 |
DoubleValue (3.8), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
571 |
MakeDoubleAccessor (&ThreeLogDistancePropagationLossModel::m_exponent1), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
572 |
MakeDoubleChecker<double> ()) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
573 |
.AddAttribute ("Exponent2", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
574 |
"The exponent for the third field.", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
575 |
DoubleValue (3.8), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
576 |
MakeDoubleAccessor (&ThreeLogDistancePropagationLossModel::m_exponent2), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
577 |
MakeDoubleChecker<double> ()) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
578 |
.AddAttribute ("ReferenceLoss", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
579 |
"The reference loss at distance d0 (dB). (Default is Friis at 1m with 5.15 GHz)", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
580 |
DoubleValue (46.6777), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
581 |
MakeDoubleAccessor (&ThreeLogDistancePropagationLossModel::m_referenceLoss), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
582 |
MakeDoubleChecker<double> ()) |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
583 |
; |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
584 |
return tid; |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
585 |
|
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
586 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
587 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
588 |
ThreeLogDistancePropagationLossModel::ThreeLogDistancePropagationLossModel () |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
589 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
590 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
591 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
592 |
double |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
593 |
ThreeLogDistancePropagationLossModel::DoCalcRxPower (double txPowerDbm, |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
594 |
Ptr<MobilityModel> a, |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
595 |
Ptr<MobilityModel> b) const |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
596 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
597 |
double distance = a->GetDistanceFrom (b); |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7188
diff
changeset
|
598 |
NS_ASSERT (distance >= 0); |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
599 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
600 |
// See doxygen comments for the formula and explanation |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
601 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
602 |
double pathLossDb; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
603 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
604 |
if (distance < m_distance0) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
605 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
606 |
pathLossDb = 0; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
607 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
608 |
else if (distance < m_distance1) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
609 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
610 |
pathLossDb = m_referenceLoss |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7188
diff
changeset
|
611 |
+ 10 * m_exponent0 * log10 (distance / m_distance0); |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
612 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
613 |
else if (distance < m_distance2) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
614 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
615 |
pathLossDb = m_referenceLoss |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7188
diff
changeset
|
616 |
+ 10 * m_exponent0 * log10 (m_distance1 / m_distance0) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7188
diff
changeset
|
617 |
+ 10 * m_exponent1 * log10 (distance / m_distance1); |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
618 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
619 |
else |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
620 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
621 |
pathLossDb = m_referenceLoss |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7188
diff
changeset
|
622 |
+ 10 * m_exponent0 * log10 (m_distance1 / m_distance0) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7188
diff
changeset
|
623 |
+ 10 * m_exponent1 * log10 (m_distance2 / m_distance1) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7188
diff
changeset
|
624 |
+ 10 * m_exponent2 * log10 (distance / m_distance2); |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
625 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
626 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
627 |
NS_LOG_DEBUG ("ThreeLogDistance distance=" << distance << "m, " << |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
628 |
"attenuation=" << pathLossDb << "dB"); |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
629 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
630 |
return txPowerDbm - pathLossDb; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
631 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
632 |
|
8985
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
633 |
int64_t |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
634 |
ThreeLogDistancePropagationLossModel::DoAssignStreams (int64_t stream) |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
635 |
{ |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
636 |
return 0; |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
637 |
} |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
638 |
|
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
639 |
// ------------------------------------------------------------------------- // |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
640 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
641 |
NS_OBJECT_ENSURE_REGISTERED (NakagamiPropagationLossModel); |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
642 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
643 |
TypeId |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
644 |
NakagamiPropagationLossModel::GetTypeId (void) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
645 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
646 |
static TypeId tid = TypeId ("ns3::NakagamiPropagationLossModel") |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
647 |
.SetParent<PropagationLossModel> () |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
648 |
.AddConstructor<NakagamiPropagationLossModel> () |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
649 |
.AddAttribute ("Distance1", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
650 |
"Beginning of the second distance field. Default is 80m.", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
651 |
DoubleValue (80.0), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
652 |
MakeDoubleAccessor (&NakagamiPropagationLossModel::m_distance1), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
653 |
MakeDoubleChecker<double> ()) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
654 |
.AddAttribute ("Distance2", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
655 |
"Beginning of the third distance field. Default is 200m.", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
656 |
DoubleValue (200.0), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
657 |
MakeDoubleAccessor (&NakagamiPropagationLossModel::m_distance2), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
658 |
MakeDoubleChecker<double> ()) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
659 |
.AddAttribute ("m0", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
660 |
"m0 for distances smaller than Distance1. Default is 1.5.", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
661 |
DoubleValue (1.5), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
662 |
MakeDoubleAccessor (&NakagamiPropagationLossModel::m_m0), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
663 |
MakeDoubleChecker<double> ()) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
664 |
.AddAttribute ("m1", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
665 |
"m1 for distances smaller than Distance2. Default is 0.75.", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
666 |
DoubleValue (0.75), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
667 |
MakeDoubleAccessor (&NakagamiPropagationLossModel::m_m1), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
668 |
MakeDoubleChecker<double> ()) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
669 |
.AddAttribute ("m2", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
670 |
"m2 for distances greater than Distance2. Default is 0.75.", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
671 |
DoubleValue (0.75), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
672 |
MakeDoubleAccessor (&NakagamiPropagationLossModel::m_m2), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
673 |
MakeDoubleChecker<double> ()) |
8985
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
674 |
.AddAttribute ("ErlangRv", |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
675 |
"Access to the underlying ErlangRandomVariable", |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
676 |
StringValue ("ns3::ErlangRandomVariable"), |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
677 |
MakePointerAccessor (&NakagamiPropagationLossModel::m_erlangRandomVariable), |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
678 |
MakePointerChecker<ErlangRandomVariable> ()) |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
679 |
.AddAttribute ("GammaRv", |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
680 |
"Access to the underlying GammaRandomVariable", |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
681 |
StringValue ("ns3::GammaRandomVariable"), |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
682 |
MakePointerAccessor (&NakagamiPropagationLossModel::m_gammaRandomVariable), |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
683 |
MakePointerChecker<GammaRandomVariable> ()); |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
684 |
; |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
685 |
return tid; |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
686 |
|
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
687 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
688 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
689 |
NakagamiPropagationLossModel::NakagamiPropagationLossModel () |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
690 |
{ |
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
691 |
} |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
692 |
|
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
693 |
double |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
694 |
NakagamiPropagationLossModel::DoCalcRxPower (double txPowerDbm, |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
695 |
Ptr<MobilityModel> a, |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
696 |
Ptr<MobilityModel> b) const |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
697 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
698 |
// select m parameter |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
699 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
700 |
double distance = a->GetDistanceFrom (b); |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7188
diff
changeset
|
701 |
NS_ASSERT (distance >= 0); |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
702 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
703 |
double m; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
704 |
if (distance < m_distance1) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
705 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
706 |
m = m_m0; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
707 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
708 |
else if (distance < m_distance2) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
709 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
710 |
m = m_m1; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
711 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
712 |
else |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
713 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
714 |
m = m_m2; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
715 |
} |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
716 |
|
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
717 |
// the current power unit is dBm, but Watt is put into the Nakagami / |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
718 |
// Rayleigh distribution. |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7188
diff
changeset
|
719 |
double powerW = pow (10, (txPowerDbm - 30) / 10); |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
720 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
721 |
double resultPowerW; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
722 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
723 |
// switch between Erlang- and Gamma distributions: this is only for |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
724 |
// speed. (Gamma is equal to Erlang for any positive integer m.) |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7188
diff
changeset
|
725 |
unsigned int int_m = static_cast<unsigned int>(floor (m)); |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
726 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
727 |
if (int_m == m) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
728 |
{ |
8985
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
729 |
resultPowerW = m_erlangRandomVariable->GetValue (int_m, powerW / m); |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
730 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
731 |
else |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
732 |
{ |
8985
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
733 |
resultPowerW = m_gammaRandomVariable->GetValue (m, powerW / m); |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
734 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
735 |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7188
diff
changeset
|
736 |
double resultPowerDbm = 10 * log10 (resultPowerW) + 30; |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
737 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
738 |
NS_LOG_DEBUG ("Nakagami distance=" << distance << "m, " << |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
739 |
"power=" << powerW <<"W, " << |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
740 |
"resultPower=" << resultPowerW << "W=" << resultPowerDbm << "dBm"); |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
741 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
742 |
return resultPowerDbm; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
743 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
744 |
|
8985
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
745 |
int64_t |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
746 |
NakagamiPropagationLossModel::DoAssignStreams (int64_t stream) |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
747 |
{ |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
748 |
m_erlangRandomVariable->SetStream (stream); |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
749 |
m_gammaRandomVariable->SetStream (stream + 1); |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
750 |
return 2; |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
751 |
} |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
752 |
|
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
753 |
// ------------------------------------------------------------------------- // |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
754 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
755 |
NS_OBJECT_ENSURE_REGISTERED (FixedRssLossModel); |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
756 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
757 |
TypeId |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
758 |
FixedRssLossModel::GetTypeId (void) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
759 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
760 |
static TypeId tid = TypeId ("ns3::FixedRssLossModel") |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
761 |
.SetParent<PropagationLossModel> () |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
762 |
.AddConstructor<FixedRssLossModel> () |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
763 |
.AddAttribute ("Rss", "The fixed receiver Rss.", |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
764 |
DoubleValue (-150.0), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
765 |
MakeDoubleAccessor (&FixedRssLossModel::m_rss), |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
766 |
MakeDoubleChecker<double> ()) |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
767 |
; |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
768 |
return tid; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
769 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
770 |
FixedRssLossModel::FixedRssLossModel () |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
771 |
: PropagationLossModel () |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
772 |
{ |
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
773 |
} |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
774 |
|
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
775 |
FixedRssLossModel::~FixedRssLossModel () |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
776 |
{ |
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
777 |
} |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
778 |
|
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
779 |
void |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
780 |
FixedRssLossModel::SetRss (double rss) |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
781 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
782 |
m_rss = rss; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
783 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
784 |
|
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
785 |
double |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
786 |
FixedRssLossModel::DoCalcRxPower (double txPowerDbm, |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
787 |
Ptr<MobilityModel> a, |
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
788 |
Ptr<MobilityModel> b) const |
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
789 |
{ |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
790 |
return m_rss; |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
791 |
} |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
792 |
|
8985
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
793 |
int64_t |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
794 |
FixedRssLossModel::DoAssignStreams (int64_t stream) |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
795 |
{ |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
796 |
return 0; |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
797 |
} |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
798 |
|
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
799 |
// ------------------------------------------------------------------------- // |
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
800 |
|
6115
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
801 |
NS_OBJECT_ENSURE_REGISTERED (MatrixPropagationLossModel); |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
802 |
|
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
803 |
TypeId |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
804 |
MatrixPropagationLossModel::GetTypeId (void) |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
805 |
{ |
6445 | 806 |
static TypeId tid = TypeId ("ns3::MatrixPropagationLossModel") |
6115
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
807 |
.SetParent<PropagationLossModel> () |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
808 |
.AddConstructor<MatrixPropagationLossModel> () |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
809 |
.AddAttribute ("DefaultLoss", "The default value for propagation loss, dB.", |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
810 |
DoubleValue (std::numeric_limits<double>::max ()), |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
811 |
MakeDoubleAccessor (&MatrixPropagationLossModel::m_default), |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
812 |
MakeDoubleChecker<double> ()) |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
813 |
; |
6115
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
814 |
return tid; |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
815 |
} |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
816 |
|
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
817 |
MatrixPropagationLossModel::MatrixPropagationLossModel () |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
818 |
: PropagationLossModel (), m_default (std::numeric_limits<double>::max ()) |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
819 |
{ |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
820 |
} |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
821 |
|
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
822 |
MatrixPropagationLossModel::~MatrixPropagationLossModel () |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
823 |
{ |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
824 |
} |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
825 |
|
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
826 |
void |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
827 |
MatrixPropagationLossModel::SetDefaultLoss (double loss) |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
828 |
{ |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
829 |
m_default = loss; |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
830 |
} |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
831 |
|
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
832 |
void |
6803
f07c4f00b07e
Bug 1048: MatrixPropagationLossModel API changed from Ptr<Object> to Ptr<MobilityModel>
Pavel Boyko <boyko@iitp.ru>
parents:
6794
diff
changeset
|
833 |
MatrixPropagationLossModel::SetLoss (Ptr<MobilityModel> ma, Ptr<MobilityModel> mb, double loss, bool symmetric) |
6115
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
834 |
{ |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
835 |
NS_ASSERT (ma != 0 && mb != 0); |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
836 |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7188
diff
changeset
|
837 |
MobilityPair p = std::make_pair (ma, mb); |
6115
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
838 |
std::map<MobilityPair, double>::iterator i = m_loss.find (p); |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
839 |
|
6115
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
840 |
if (i == m_loss.end ()) |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
841 |
{ |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
842 |
m_loss.insert (std::make_pair (p, loss)); |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
843 |
} |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
844 |
else |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
845 |
{ |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
846 |
i->second = loss; |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
847 |
} |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
848 |
|
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
849 |
if (symmetric) |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
850 |
{ |
6803
f07c4f00b07e
Bug 1048: MatrixPropagationLossModel API changed from Ptr<Object> to Ptr<MobilityModel>
Pavel Boyko <boyko@iitp.ru>
parents:
6794
diff
changeset
|
851 |
SetLoss (mb, ma, loss, false); |
6115
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
852 |
} |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
853 |
} |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
854 |
|
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
855 |
double |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
856 |
MatrixPropagationLossModel::DoCalcRxPower (double txPowerDbm, |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
857 |
Ptr<MobilityModel> a, |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
858 |
Ptr<MobilityModel> b) const |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
859 |
{ |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
860 |
std::map<MobilityPair, double>::const_iterator i = m_loss.find (std::make_pair (a, b)); |
7188
ea48206d68bd
propagation coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6803
diff
changeset
|
861 |
|
6115
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
862 |
if (i != m_loss.end ()) |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
863 |
{ |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
864 |
return txPowerDbm - i->second; |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
865 |
} |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
866 |
else |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
867 |
{ |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
868 |
return txPowerDbm - m_default; |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
869 |
} |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
870 |
} |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
871 |
|
8985
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
872 |
int64_t |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
873 |
MatrixPropagationLossModel::DoAssignStreams (int64_t stream) |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
874 |
{ |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
875 |
return 0; |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
876 |
} |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
877 |
|
6115
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
878 |
// ------------------------------------------------------------------------- // |
edc1648e5ad4
Matrix propagation loss model added
Pavel Boyko <boyko@iitp.ru>
parents:
5972
diff
changeset
|
879 |
|
6461
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
880 |
NS_OBJECT_ENSURE_REGISTERED (RangePropagationLossModel); |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
881 |
|
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
882 |
TypeId |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
883 |
RangePropagationLossModel::GetTypeId (void) |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
884 |
{ |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
885 |
static TypeId tid = TypeId ("ns3::RangePropagationLossModel") |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
886 |
.SetParent<PropagationLossModel> () |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
887 |
.AddConstructor<RangePropagationLossModel> () |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
888 |
.AddAttribute ("MaxRange", |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
889 |
"Maximum Transmission Range (meters)", |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
890 |
DoubleValue (250), |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
891 |
MakeDoubleAccessor (&RangePropagationLossModel::m_range), |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
892 |
MakeDoubleChecker<double> ()) |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
893 |
; |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
894 |
return tid; |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
895 |
} |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
896 |
|
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
897 |
RangePropagationLossModel::RangePropagationLossModel () |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
898 |
{ |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
899 |
} |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
900 |
|
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
901 |
double |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
902 |
RangePropagationLossModel::DoCalcRxPower (double txPowerDbm, |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
903 |
Ptr<MobilityModel> a, |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
904 |
Ptr<MobilityModel> b) const |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
905 |
{ |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
906 |
double distance = a->GetDistanceFrom (b); |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
907 |
if (distance <= m_range) |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
908 |
{ |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
909 |
return txPowerDbm; |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
910 |
} |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
911 |
else |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
912 |
{ |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
913 |
return -1000; |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
914 |
} |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
915 |
} |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
916 |
|
8985
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
917 |
int64_t |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
918 |
RangePropagationLossModel::DoAssignStreams (int64_t stream) |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
919 |
{ |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
920 |
return 0; |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
921 |
} |
7752dc4ce7e9
Replace src/buildings and src/propagation usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents:
7385
diff
changeset
|
922 |
|
6461
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
923 |
// ------------------------------------------------------------------------- // |
99dd2b53fbfd
Range-based propagation loss model added
Tom Henderson <tomh@tomh.org>
parents:
6445
diff
changeset
|
924 |
|
5944
b1a245ae00d4
Moving the propagation models of wifi from src/devices/wifi to src/common. The idea is to share them with the other wireless devices.
Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
parents:
diff
changeset
|
925 |
} // namespace ns3 |