A Discrete-Event Network Simulator
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 */
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
19namespace ns3
20{
21
22NS_LOG_COMPONENT_DEFINE("ItuR1411NlosOverRooftopPropagationLossModel");
23
25
28{
29 static TypeId tid =
30 TypeId("ns3::ItuR1411NlosOverRooftopPropagationLossModel")
32 .SetGroupName("Propagation")
34 .AddAttribute(
35 "Frequency",
36 "The Frequency (default is 2.106 GHz).",
37 DoubleValue(2160e6),
40 .AddAttribute("Environment",
41 "Environment Scenario",
46 "Urban",
48 "SubUrban",
50 "OpenAreas"))
51 .AddAttribute(
52 "CitySize",
53 "Dimension of the city",
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),
64 .AddAttribute("StreetsOrientation",
65 "The orientation of streets in degrees [0,90] with respect to the "
66 "direction of propagation",
67 DoubleValue(45.0),
71 .AddAttribute(
72 "StreetsWidth",
73 "The width of streets",
74 DoubleValue(20.0),
76 MakeDoubleChecker<double>(0.0, 1000.0))
77 .AddAttribute(
78 "BuildingsExtend",
79 "The distance over which the buildings extend",
80 DoubleValue(80.0),
83 .AddAttribute("BuildingSeparation",
84 "The separation between buildings",
85 DoubleValue(50.0),
89
90 return tid;
91}
92
97
101
102double
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
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 // ITU-R P.1411 eq. (13) for 55 <= phi <= 90 (@issueid{1164})
123 Lori = 4.0 - 0.114 * (m_streetsOrientation - 55);
124 }
125
126 double distance = a->GetDistanceFrom(b);
127 double hb = (a->GetPosition().z > b->GetPosition().z ? a->GetPosition().z : b->GetPosition().z);
128 double hm = (a->GetPosition().z < b->GetPosition().z ? a->GetPosition().z : b->GetPosition().z);
129 NS_ASSERT_MSG(hm > 0 && hb > 0, "nodes' height must be greater then 0");
130 double Dhb = hb - m_rooftopHeight;
131 double ds = (m_lambda * distance * distance) / (Dhb * Dhb);
132 double Lmsd = 0.0;
133 NS_LOG_LOGIC(this << " build " << m_buildingsExtend << " ds " << ds << " roof "
134 << m_rooftopHeight << " hb " << hb << " lambda " << m_lambda);
135 if (ds < m_buildingsExtend)
136 {
137 double Lbsh = 0.0;
138 double ka = 0.0;
139 double kd = 0.0;
140 double kf = 0.0;
141 if (hb > m_rooftopHeight)
142 {
143 Lbsh = -18 * std::log10(1 + Dhb);
144 ka = (fmhz > 2000 ? 71.4 : 54.0);
145 kd = 18.0;
146 }
147 else
148 {
149 Lbsh = 0;
150 // ITU-R P.1411 eq. (20): kd = 18 - 15 * Dhb / hr, where hr is the
151 // rooftop height, not the height of one of the terminals (@issueid{1164})
152 kd = 18.0 - 15 * Dhb / m_rooftopHeight;
153 if (distance < 500)
154 {
155 ka = 54.0 - 1.6 * Dhb * distance / 1000;
156 }
157 else
158 {
159 ka = 54.0 - 0.8 * Dhb;
160 }
161 }
162 if (fmhz > 2000)
163 {
164 kf = -8;
165 }
167 {
168 // ITU-R P.1411: metropolitan centres use 1.5, medium-sized cities /
169 // suburban centres use 0.7 (@issueid{1164})
170 kf = -4 + 1.5 * (fmhz / 925.0 - 1);
171 }
172 else
173 {
174 kf = -4 + 0.7 * (fmhz / 925.0 - 1);
175 }
176
177 Lmsd = Lbsh + ka + kd * std::log10(distance / 1000.0) + kf * std::log10(fmhz) -
178 9.0 * std::log10(m_buildingSeparation);
179 }
180 else
181 {
182 double theta = std::atan(Dhb / m_buildingSeparation);
183 double rho = std::sqrt(Dhb * Dhb + m_buildingSeparation * m_buildingSeparation);
184 double Qm = 0.0;
185 if ((hb > m_rooftopHeight - 1.0) && (hb < m_rooftopHeight + 1.0))
186 {
187 Qm = m_buildingSeparation / distance;
188 }
189 else if (hb > m_rooftopHeight)
190 {
191 Qm = 2.35 * pow(Dhb / distance * std::sqrt(m_buildingSeparation / m_lambda), 0.9);
192 }
193 else
194 {
195 Qm = m_buildingSeparation / (2 * M_PI * distance) * std::sqrt(m_lambda / rho) *
196 (1 / theta - (1 / (2 * M_PI + theta)));
197 }
198 Lmsd = -10 * std::log10(Qm * Qm);
199 }
200 double Lbf = 32.4 + 20 * std::log10(distance / 1000) + 20 * std::log10(fmhz);
201 double Dhm = m_rooftopHeight - hm;
202 double Lrts = -8.2 - 10 * std::log10(m_streetsWidth) + 10 * std::log10(fmhz) +
203 20 * std::log10(Dhm) + Lori;
204 NS_LOG_LOGIC(this << " Lbf " << Lbf << " Lrts " << Lrts << " Dhm" << Dhm << " Lmsd " << Lmsd);
205 double loss = 0.0;
206 if (Lrts + Lmsd > 0)
207 {
208 loss = Lbf + Lrts + Lmsd;
209 }
210 else
211 {
212 loss = Lbf;
213 }
214 return loss;
215}
216
217void
219{
220 m_frequency = freq;
221 m_lambda = 299792458.0 / freq;
222}
223
224double
227 Ptr<MobilityModel> b) const
228{
229 return (txPowerDbm - GetLoss(a, b));
230}
231
232int64_t
237
238} // namespace ns3
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition double.h:31
Hold variables of type enum.
Definition enum.h:52
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
double GetLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
a unique identifier for an interface.
Definition type-id.h:50
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1003
#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:76
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:201
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:281
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeDoubleChecker()
Definition double.h:82
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:181
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition double.h:32
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Definition enum.h:223