A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011, 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Marco Miozzo <marco.miozzo@cttc.es>,
7
* Nicola Baldo <nbaldo@cttc.es>
8
*
9
*/
10
#include "
itu-r-1411-nlos-over-rooftop-propagation-loss-model.h
"
11
12
#include "ns3/double.h"
13
#include "ns3/enum.h"
14
#include "ns3/log.h"
15
#include "ns3/mobility-model.h"
16
17
#include <cmath>
18
19
namespace
ns3
20
{
21
22
NS_LOG_COMPONENT_DEFINE
(
"ItuR1411NlosOverRooftopPropagationLossModel"
);
23
24
NS_OBJECT_ENSURE_REGISTERED
(
ItuR1411NlosOverRooftopPropagationLossModel
);
25
26
TypeId
27
ItuR1411NlosOverRooftopPropagationLossModel::GetTypeId
()
28
{
29
static
TypeId
tid =
30
TypeId
(
"ns3::ItuR1411NlosOverRooftopPropagationLossModel"
)
31
.
SetParent
<
PropagationLossModel
>()
32
.SetGroupName(
"Propagation"
)
33
.AddConstructor<
ItuR1411NlosOverRooftopPropagationLossModel
>()
34
.AddAttribute(
35
"Frequency"
,
36
"The Frequency (default is 2.106 GHz)."
,
37
DoubleValue
(2160e6),
38
MakeDoubleAccessor
(&
ItuR1411NlosOverRooftopPropagationLossModel::SetFrequency
),
39
MakeDoubleChecker<double>
())
40
.AddAttribute(
"Environment"
,
41
"Environment Scenario"
,
42
EnumValue
(
UrbanEnvironment
),
43
MakeEnumAccessor<EnvironmentType>
(
44
&
ItuR1411NlosOverRooftopPropagationLossModel::m_environment
),
45
MakeEnumChecker
(
UrbanEnvironment
,
46
"Urban"
,
47
SubUrbanEnvironment
,
48
"SubUrban"
,
49
OpenAreasEnvironment
,
50
"OpenAreas"
))
51
.AddAttribute(
52
"CitySize"
,
53
"Dimension of the city"
,
54
EnumValue
(
LargeCity
),
55
MakeEnumAccessor<CitySize>
(
56
&
ItuR1411NlosOverRooftopPropagationLossModel::m_citySize
),
57
MakeEnumChecker
(
SmallCity
,
"Small"
,
MediumCity
,
"Medium"
,
LargeCity
,
"Large"
))
58
.AddAttribute(
59
"RooftopLevel"
,
60
"The height of the rooftop level in meters"
,
61
DoubleValue
(20.0),
62
MakeDoubleAccessor
(&
ItuR1411NlosOverRooftopPropagationLossModel::m_rooftopHeight
),
63
MakeDoubleChecker<double>
(0.0, 90.0))
64
.AddAttribute(
"StreetsOrientation"
,
65
"The orientation of streets in degrees [0,90] with respect to the "
66
"direction of propagation"
,
67
DoubleValue
(45.0),
68
MakeDoubleAccessor
(
69
&
ItuR1411NlosOverRooftopPropagationLossModel::m_streetsOrientation
),
70
MakeDoubleChecker<double>
(0.0, 90.0))
71
.AddAttribute(
72
"StreetsWidth"
,
73
"The width of streets"
,
74
DoubleValue
(20.0),
75
MakeDoubleAccessor
(&
ItuR1411NlosOverRooftopPropagationLossModel::m_streetsWidth
),
76
MakeDoubleChecker<double>
(0.0, 1000.0))
77
.AddAttribute(
78
"BuildingsExtend"
,
79
"The distance over which the buildings extend"
,
80
DoubleValue
(80.0),
81
MakeDoubleAccessor
(&
ItuR1411NlosOverRooftopPropagationLossModel::m_buildingsExtend
),
82
MakeDoubleChecker<double>
())
83
.AddAttribute(
"BuildingSeparation"
,
84
"The separation between buildings"
,
85
DoubleValue
(50.0),
86
MakeDoubleAccessor
(
87
&
ItuR1411NlosOverRooftopPropagationLossModel::m_buildingSeparation
),
88
MakeDoubleChecker<double>
());
89
90
return
tid;
91
}
92
93
ItuR1411NlosOverRooftopPropagationLossModel::ItuR1411NlosOverRooftopPropagationLossModel
()
94
:
PropagationLossModel
()
95
{
96
}
97
98
ItuR1411NlosOverRooftopPropagationLossModel::~ItuR1411NlosOverRooftopPropagationLossModel
()
99
{
100
}
101
102
double
103
ItuR1411NlosOverRooftopPropagationLossModel::GetLoss
(
Ptr<MobilityModel>
a,
104
Ptr<MobilityModel>
b)
const
105
{
106
NS_LOG_FUNCTION
(
this
<< a << b);
107
double
Lori = 0.0;
108
double
fmhz =
m_frequency
/ 1e6;
109
110
NS_ASSERT_MSG
(((
m_streetsOrientation
>= 0) && (
m_streetsOrientation
<= 90)),
111
" Street Orientation must be in [0,90]"
);
112
if
(
m_streetsOrientation
< 35)
113
{
114
Lori = -10.0 + 0.354 *
m_streetsOrientation
;
115
}
116
else
if
((
m_streetsOrientation
>= 35) && (
m_streetsOrientation
< 55))
117
{
118
Lori = 2.5 + 0.075 * (
m_streetsOrientation
- 35);
119
}
120
else
// m_streetsOrientation >= 55
121
{
122
Lori = 2.5 + 0.075 * (
m_streetsOrientation
- 55);
123
}
124
125
double
distance = a->GetDistanceFrom(b);
126
double
hb = (a->GetPosition().z > b->GetPosition().z ? a->GetPosition().z : b->GetPosition().z);
127
double
hm = (a->GetPosition().z < b->GetPosition().z ? a->GetPosition().z : b->GetPosition().z);
128
NS_ASSERT_MSG
(hm > 0 && hb > 0,
"nodes' height must be greater then 0"
);
129
double
Dhb = hb -
m_rooftopHeight
;
130
double
ds = (
m_lambda
* distance * distance) / (Dhb * Dhb);
131
double
Lmsd = 0.0;
132
NS_LOG_LOGIC
(
this
<<
" build "
<<
m_buildingsExtend
<<
" ds "
<< ds <<
" roof "
133
<<
m_rooftopHeight
<<
" hb "
<< hb <<
" lambda "
<<
m_lambda
);
134
if
(ds <
m_buildingsExtend
)
135
{
136
double
Lbsh = 0.0;
137
double
ka = 0.0;
138
double
kd = 0.0;
139
double
kf = 0.0;
140
if
(hb >
m_rooftopHeight
)
141
{
142
Lbsh = -18 * std::log10(1 + Dhb);
143
ka = (fmhz > 2000 ? 71.4 : 54.0);
144
kd = 18.0;
145
}
146
else
147
{
148
Lbsh = 0;
149
kd = 18.0 - 15 * Dhb / a->GetPosition().z;
150
if
(distance < 500)
151
{
152
ka = 54.0 - 1.6 * Dhb * distance / 1000;
153
}
154
else
155
{
156
ka = 54.0 - 0.8 * Dhb;
157
}
158
}
159
if
(fmhz > 2000)
160
{
161
kf = -8;
162
}
163
else
if
((
m_environment
==
UrbanEnvironment
) && (
m_citySize
==
LargeCity
))
164
{
165
kf = -4 + 0.7 * (fmhz / 925.0 - 1);
166
}
167
else
168
{
169
kf = -4 + 1.5 * (fmhz / 925.0 - 1);
170
}
171
172
Lmsd = Lbsh + ka + kd * std::log10(distance / 1000.0) + kf * std::log10(fmhz) -
173
9.0 * std::log10(
m_buildingSeparation
);
174
}
175
else
176
{
177
double
theta = std::atan(Dhb /
m_buildingSeparation
);
178
double
rho = std::sqrt(Dhb * Dhb +
m_buildingSeparation
*
m_buildingSeparation
);
179
double
Qm = 0.0;
180
if
((hb >
m_rooftopHeight
- 1.0) && (hb <
m_rooftopHeight
+ 1.0))
181
{
182
Qm =
m_buildingSeparation
/ distance;
183
}
184
else
if
(hb >
m_rooftopHeight
)
185
{
186
Qm = 2.35 * pow(Dhb / distance * std::sqrt(
m_buildingSeparation
/
m_lambda
), 0.9);
187
}
188
else
189
{
190
Qm =
m_buildingSeparation
/ (2 * M_PI * distance) * std::sqrt(
m_lambda
/ rho) *
191
(1 / theta - (1 / (2 * M_PI + theta)));
192
}
193
Lmsd = -10 * std::log10(Qm * Qm);
194
}
195
double
Lbf = 32.4 + 20 * std::log10(distance / 1000) + 20 * std::log10(fmhz);
196
double
Dhm =
m_rooftopHeight
- hm;
197
double
Lrts = -8.2 - 10 * std::log10(
m_streetsWidth
) + 10 * std::log10(fmhz) +
198
20 * std::log10(Dhm) + Lori;
199
NS_LOG_LOGIC
(
this
<<
" Lbf "
<< Lbf <<
" Lrts "
<< Lrts <<
" Dhm"
<< Dhm <<
" Lmsd "
<< Lmsd);
200
double
loss = 0.0;
201
if
(Lrts + Lmsd > 0)
202
{
203
loss = Lbf + Lrts + Lmsd;
204
}
205
else
206
{
207
loss = Lbf;
208
}
209
return
loss;
210
}
211
212
void
213
ItuR1411NlosOverRooftopPropagationLossModel::SetFrequency
(
double
freq)
214
{
215
m_frequency
= freq;
216
m_lambda
= 299792458.0 / freq;
217
}
218
219
double
220
ItuR1411NlosOverRooftopPropagationLossModel::DoCalcRxPower
(
double
txPowerDbm,
221
Ptr<MobilityModel>
a,
222
Ptr<MobilityModel>
b)
const
223
{
224
return
(txPowerDbm -
GetLoss
(a, b));
225
}
226
227
int64_t
228
ItuR1411NlosOverRooftopPropagationLossModel::DoAssignStreams
(int64_t stream)
229
{
230
return
0;
231
}
232
233
}
// namespace ns3
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition
double.h:31
ns3::EnumValue
Hold variables of type enum.
Definition
enum.h:52
ns3::ItuR1411NlosOverRooftopPropagationLossModel
the ITU-R 1411 NLOS over rooftop propagation model
Definition
itu-r-1411-nlos-over-rooftop-propagation-loss-model.h:32
ns3::ItuR1411NlosOverRooftopPropagationLossModel::m_buildingSeparation
double m_buildingSeparation
in meters
Definition
itu-r-1411-nlos-over-rooftop-propagation-loss-model.h:81
ns3::ItuR1411NlosOverRooftopPropagationLossModel::DoAssignStreams
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
Definition
itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc:228
ns3::ItuR1411NlosOverRooftopPropagationLossModel::~ItuR1411NlosOverRooftopPropagationLossModel
~ItuR1411NlosOverRooftopPropagationLossModel() override
Definition
itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc:98
ns3::ItuR1411NlosOverRooftopPropagationLossModel::SetFrequency
void SetFrequency(double freq)
Set the operating frequency.
Definition
itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc:213
ns3::ItuR1411NlosOverRooftopPropagationLossModel::m_buildingsExtend
double m_buildingsExtend
in meters
Definition
itu-r-1411-nlos-over-rooftop-propagation-loss-model.h:80
ns3::ItuR1411NlosOverRooftopPropagationLossModel::m_streetsWidth
double m_streetsWidth
in meters
Definition
itu-r-1411-nlos-over-rooftop-propagation-loss-model.h:79
ns3::ItuR1411NlosOverRooftopPropagationLossModel::m_citySize
CitySize m_citySize
Dimension of the city.
Definition
itu-r-1411-nlos-over-rooftop-propagation-loss-model.h:76
ns3::ItuR1411NlosOverRooftopPropagationLossModel::m_rooftopHeight
double m_rooftopHeight
in meters
Definition
itu-r-1411-nlos-over-rooftop-propagation-loss-model.h:77
ns3::ItuR1411NlosOverRooftopPropagationLossModel::DoCalcRxPower
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
Definition
itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc:220
ns3::ItuR1411NlosOverRooftopPropagationLossModel::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc:27
ns3::ItuR1411NlosOverRooftopPropagationLossModel::m_environment
EnvironmentType m_environment
Environment Scenario.
Definition
itu-r-1411-nlos-over-rooftop-propagation-loss-model.h:75
ns3::ItuR1411NlosOverRooftopPropagationLossModel::m_frequency
double m_frequency
frequency in MHz
Definition
itu-r-1411-nlos-over-rooftop-propagation-loss-model.h:73
ns3::ItuR1411NlosOverRooftopPropagationLossModel::ItuR1411NlosOverRooftopPropagationLossModel
ItuR1411NlosOverRooftopPropagationLossModel()
Definition
itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc:93
ns3::ItuR1411NlosOverRooftopPropagationLossModel::GetLoss
double GetLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Definition
itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc:103
ns3::ItuR1411NlosOverRooftopPropagationLossModel::m_lambda
double m_lambda
wavelength
Definition
itu-r-1411-nlos-over-rooftop-propagation-loss-model.h:74
ns3::ItuR1411NlosOverRooftopPropagationLossModel::m_streetsOrientation
double m_streetsOrientation
in degrees [0,90]
Definition
itu-r-1411-nlos-over-rooftop-propagation-loss-model.h:78
ns3::PropagationLossModel::PropagationLossModel
PropagationLossModel()
Definition
propagation-loss-model.cc:40
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
ptr.h:66
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:49
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
NS_ASSERT_MSG
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition
assert.h:75
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
NS_LOG_LOGIC
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition
log.h:271
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition
log-macros-enabled.h:229
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
ns3::SubUrbanEnvironment
@ SubUrbanEnvironment
Definition
propagation-environment.h:26
ns3::OpenAreasEnvironment
@ OpenAreasEnvironment
Definition
propagation-environment.h:27
ns3::UrbanEnvironment
@ UrbanEnvironment
Definition
propagation-environment.h:25
ns3::LargeCity
@ LargeCity
Definition
propagation-environment.h:40
ns3::SmallCity
@ SmallCity
Definition
propagation-environment.h:38
ns3::MediumCity
@ MediumCity
Definition
propagation-environment.h:39
itu-r-1411-nlos-over-rooftop-propagation-loss-model.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::MakeDoubleChecker
Ptr< const AttributeChecker > MakeDoubleChecker()
Definition
double.h:82
ns3::MakeEnumChecker
Ptr< const AttributeChecker > MakeEnumChecker(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
Definition
enum.h:179
ns3::MakeDoubleAccessor
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition
double.h:32
ns3::MakeEnumAccessor
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Definition
enum.h:221
src
propagation
model
itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc
Generated on Wed Jun 11 2025 13:15:37 for ns-3 by
1.13.2