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 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Marco Miozzo <marco.miozzo@cttc.es>,
18 * Nicola Baldo <nbaldo@cttc.es>
19 *
20 */
22
23#include "ns3/double.h"
24#include "ns3/enum.h"
25#include "ns3/log.h"
26#include "ns3/mobility-model.h"
27
28#include <cmath>
29
30namespace ns3
31{
32
33NS_LOG_COMPONENT_DEFINE("ItuR1411NlosOverRooftopPropagationLossModel");
34
35NS_OBJECT_ENSURE_REGISTERED(ItuR1411NlosOverRooftopPropagationLossModel);
36
37TypeId
39{
40 static TypeId tid =
41 TypeId("ns3::ItuR1411NlosOverRooftopPropagationLossModel")
43 .SetGroupName("Propagation")
45 .AddAttribute(
46 "Frequency",
47 "The Frequency (default is 2.106 GHz).",
48 DoubleValue(2160e6),
50 MakeDoubleChecker<double>())
51 .AddAttribute(
52 "Environment",
53 "Environment Scenario",
57 "Urban",
59 "SubUrban",
61 "OpenAreas"))
62 .AddAttribute(
63 "CitySize",
64 "Dimension of the city",
67 MakeEnumChecker(SmallCity, "Small", MediumCity, "Medium", LargeCity, "Large"))
68 .AddAttribute(
69 "RooftopLevel",
70 "The height of the rooftop level in meters",
71 DoubleValue(20.0),
73 MakeDoubleChecker<double>(0.0, 90.0))
74 .AddAttribute("StreetsOrientation",
75 "The orientation of streets in degrees [0,90] with respect to the "
76 "direction of propagation",
77 DoubleValue(45.0),
80 MakeDoubleChecker<double>(0.0, 90.0))
81 .AddAttribute(
82 "StreetsWidth",
83 "The width of streets",
84 DoubleValue(20.0),
86 MakeDoubleChecker<double>(0.0, 1000.0))
87 .AddAttribute(
88 "BuildingsExtend",
89 "The distance over which the buildings extend",
90 DoubleValue(80.0),
92 MakeDoubleChecker<double>())
93 .AddAttribute("BuildingSeparation",
94 "The separation between buildings",
95 DoubleValue(50.0),
98 MakeDoubleChecker<double>());
99
100 return tid;
101}
102
105{
106}
107
109{
110}
111
112double
114 Ptr<MobilityModel> b) const
115{
116 NS_LOG_FUNCTION(this << a << b);
117 double Lori = 0.0;
118 double fmhz = m_frequency / 1e6;
119
121 " Street Orientation must be in [0,90]");
122 if (m_streetsOrientation < 35)
123 {
124 Lori = -10.0 + 0.354 * m_streetsOrientation;
125 }
126 else if ((m_streetsOrientation >= 35) && (m_streetsOrientation < 55))
127 {
128 Lori = 2.5 + 0.075 * (m_streetsOrientation - 35);
129 }
130 else // m_streetsOrientation >= 55
131 {
132 Lori = 2.5 + 0.075 * (m_streetsOrientation - 55);
133 }
134
135 double distance = a->GetDistanceFrom(b);
136 double hb = (a->GetPosition().z > b->GetPosition().z ? a->GetPosition().z : b->GetPosition().z);
137 double hm = (a->GetPosition().z < b->GetPosition().z ? a->GetPosition().z : b->GetPosition().z);
138 NS_ASSERT_MSG(hm > 0 && hb > 0, "nodes' height must be greater then 0");
139 double Dhb = hb - m_rooftopHeight;
140 double ds = (m_lambda * distance * distance) / (Dhb * Dhb);
141 double Lmsd = 0.0;
142 NS_LOG_LOGIC(this << " build " << m_buildingsExtend << " ds " << ds << " roof "
143 << m_rooftopHeight << " hb " << hb << " lambda " << m_lambda);
144 if (ds < m_buildingsExtend)
145 {
146 double Lbsh = 0.0;
147 double ka = 0.0;
148 double kd = 0.0;
149 double kf = 0.0;
150 if (hb > m_rooftopHeight)
151 {
152 Lbsh = -18 * std::log10(1 + Dhb);
153 ka = (fmhz > 2000 ? 71.4 : 54.0);
154 kd = 18.0;
155 }
156 else
157 {
158 Lbsh = 0;
159 kd = 18.0 - 15 * Dhb / a->GetPosition().z;
160 if (distance < 500)
161 {
162 ka = 54.0 - 1.6 * Dhb * distance / 1000;
163 }
164 else
165 {
166 ka = 54.0 - 0.8 * Dhb;
167 }
168 }
169 if (fmhz > 2000)
170 {
171 kf = -8;
172 }
174 {
175 kf = -4 + 0.7 * (fmhz / 925.0 - 1);
176 }
177 else
178 {
179 kf = -4 + 1.5 * (fmhz / 925.0 - 1);
180 }
181
182 Lmsd = Lbsh + ka + kd * std::log10(distance / 1000.0) + kf * std::log10(fmhz) -
183 9.0 * std::log10(m_buildingSeparation);
184 }
185 else
186 {
187 double theta = std::atan(Dhb / m_buildingSeparation);
188 double rho = std::sqrt(Dhb * Dhb + m_buildingSeparation * m_buildingSeparation);
189 double Qm = 0.0;
190 if ((hb > m_rooftopHeight - 1.0) && (hb < m_rooftopHeight + 1.0))
191 {
192 Qm = m_buildingSeparation / distance;
193 }
194 else if (hb > m_rooftopHeight)
195 {
196 Qm = 2.35 * pow(Dhb / distance * std::sqrt(m_buildingSeparation / m_lambda), 0.9);
197 }
198 else
199 {
200 Qm = m_buildingSeparation / (2 * M_PI * distance) * std::sqrt(m_lambda / rho) *
201 (1 / theta - (1 / (2 * M_PI + theta)));
202 }
203 Lmsd = -10 * std::log10(Qm * Qm);
204 }
205 double Lbf = 32.4 + 20 * std::log10(distance / 1000) + 20 * std::log10(fmhz);
206 double Dhm = m_rooftopHeight - hm;
207 double Lrts = -8.2 - 10 * std::log10(m_streetsWidth) + 10 * std::log10(fmhz) +
208 20 * std::log10(Dhm) + Lori;
209 NS_LOG_LOGIC(this << " Lbf " << Lbf << " Lrts " << Lrts << " Dhm" << Dhm << " Lmsd " << Lmsd);
210 double loss = 0.0;
211 if (Lrts + Lmsd > 0)
212 {
213 loss = Lbf + Lrts + Lmsd;
214 }
215 else
216 {
217 loss = Lbf;
218 }
219 return loss;
220}
221
222void
224{
225 m_frequency = freq;
226 m_lambda = 299792458.0 / freq;
227}
228
229double
232 Ptr<MobilityModel> b) const
233{
234 return (txPowerDbm - GetLoss(a, b));
235}
236
237int64_t
239{
240 return 0;
241}
242
243} // namespace ns3
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
Hold variables of type enum.
Definition: enum.h:56
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
Models the propagation loss through a transmission medium.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:936
#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:86
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition: double.h:43
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Definition: enum.h:205
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:282
#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:46
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeEnumChecker(int v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
Definition: enum.h:163