A Discrete-Event Network Simulator
API
itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011, 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Marco Miozzo <marco.miozzo@cttc.es>,
19  * Nicola Baldo <nbaldo@cttc.es>
20  *
21  */
22 #include "ns3/log.h"
23 #include "ns3/double.h"
24 #include "ns3/enum.h"
25 #include "ns3/mobility-model.h"
26 #include <cmath>
27 
29 
30 namespace ns3 {
31 
32 NS_LOG_COMPONENT_DEFINE ("ItuR1411NlosOverRooftopPropagationLossModel");
33 
34 NS_OBJECT_ENSURE_REGISTERED (ItuR1411NlosOverRooftopPropagationLossModel);
35 
36 
37 TypeId
39 {
40  static TypeId tid = TypeId ("ns3::ItuR1411NlosOverRooftopPropagationLossModel")
42  .SetGroupName ("Propagation")
44  .AddAttribute ("Frequency",
45  "The Frequency (default is 2.106 GHz).",
46  DoubleValue (2160e6),
48  MakeDoubleChecker<double> ())
49  .AddAttribute ("Environment",
50  "Environment Scenario",
54  SubUrbanEnvironment, "SubUrban",
55  OpenAreasEnvironment, "OpenAreas"))
56  .AddAttribute ("CitySize",
57  "Dimension of the city",
60  MakeEnumChecker (SmallCity, "Small",
61  MediumCity, "Medium",
62  LargeCity, "Large"))
63  .AddAttribute ("RooftopLevel",
64  "The height of the rooftop level in meters",
65  DoubleValue (20.0),
67  MakeDoubleChecker<double> (0.0, 90.0))
68  .AddAttribute ("StreetsOrientation",
69  "The orientation of streets in degrees [0,90] with respect to the direction of propagation",
70  DoubleValue (45.0),
72  MakeDoubleChecker<double> (0.0, 90.0))
73  .AddAttribute ("StreetsWidth",
74  "The width of streets",
75  DoubleValue (20.0),
77  MakeDoubleChecker<double> (0.0, 1000.0))
78  .AddAttribute ("BuildingsExtend",
79  "The distance over which the buildings extend",
80  DoubleValue (80.0),
82  MakeDoubleChecker<double> ())
83  .AddAttribute ("BuildingSeparation",
84  "The separation between buildings",
85  DoubleValue (50.0),
87  MakeDoubleChecker<double> ());
88 
89  return tid;
90 }
91 
94 {
95 }
96 
98 {
99 }
100 
101 double
103 {
104  NS_LOG_FUNCTION (this << a << b);
105  double Lori = 0.0;
106  double fmhz = m_frequency / 1e6;
107 
109  " Street Orientation must be in [0,90]");
110  if (m_streetsOrientation < 35)
111  {
112  Lori = -10.0 + 0.354 * m_streetsOrientation;
113  }
114  else if ((m_streetsOrientation >= 35)&&(m_streetsOrientation < 55))
115  {
116  Lori = 2.5 + 0.075 * (m_streetsOrientation - 35);
117  }
118  else // m_streetsOrientation >= 55
119  {
120  Lori = 2.5 + 0.075 * (m_streetsOrientation - 55);
121  }
122 
123  double distance = a->GetDistanceFrom (b);
124  double hb = (a->GetPosition ().z > b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z);
125  double hm = (a->GetPosition ().z < b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z);
126  NS_ASSERT_MSG (hm > 0 && hb > 0, "nodes' height must be greater then 0");
127  double Dhb = hb - m_rooftopHeight;
128  double ds = (m_lambda * distance * distance) / (Dhb * Dhb);
129  double Lmsd = 0.0;
130  NS_LOG_LOGIC (this << " build " << m_buildingsExtend << " ds " << ds << " roof " << m_rooftopHeight << " hb " << hb << " lambda " << m_lambda);
131  if (ds < m_buildingsExtend)
132  {
133  double Lbsh = 0.0;
134  double ka = 0.0;
135  double kd = 0.0;
136  double kf = 0.0;
137  if (hb > m_rooftopHeight)
138  {
139  Lbsh = -18 * std::log10 (1 + Dhb);
140  ka = (fmhz > 2000 ? 71.4 : 54.0);
141  kd = 18.0;
142  }
143  else
144  {
145  Lbsh = 0;
146  kd = 18.0 - 15 * Dhb / a->GetPosition ().z;
147  if (distance < 500)
148  {
149  ka = 54.0 - 1.6 * Dhb * distance / 1000;
150  }
151  else
152  {
153  ka = 54.0 - 0.8 * Dhb;
154  }
155  }
156  if (fmhz > 2000)
157  {
158  kf = -8;
159  }
161  {
162  kf = -4 + 0.7 * (fmhz / 925.0 - 1);
163  }
164  else
165  {
166  kf = -4 + 1.5 * (fmhz / 925.0 - 1);
167  }
168 
169  Lmsd = Lbsh + ka + kd * std::log10 (distance / 1000.0) + kf * std::log10 (fmhz) - 9.0 * std::log10 (m_buildingSeparation);
170  }
171  else
172  {
173  double theta = std::atan (Dhb / m_buildingSeparation);
174  double rho = std::sqrt (Dhb * Dhb + m_buildingSeparation * m_buildingSeparation);
175  double Qm = 0.0;
176  if ((hb > m_rooftopHeight - 1.0) && (hb < m_rooftopHeight + 1.0))
177  {
178  Qm = m_buildingSeparation / distance;
179  }
180  else if (hb > m_rooftopHeight)
181  {
182  Qm = 2.35 * pow (Dhb / distance * std::sqrt (m_buildingSeparation / m_lambda), 0.9);
183  }
184  else
185  {
186  Qm = m_buildingSeparation / (2 * M_PI * distance) * std::sqrt (m_lambda / rho) * (1 / theta - (1 / (2 * M_PI + theta)));
187  }
188  Lmsd = -10 * std::log10 (Qm * Qm);
189  }
190  double Lbf = 32.4 + 20 * std::log10 (distance / 1000) + 20 * std::log10 (fmhz);
191  double Dhm = m_rooftopHeight - hm;
192  double Lrts = -8.2 - 10 * std::log10 (m_streetsWidth) + 10 * std::log10 (fmhz) + 20 * std::log10 (Dhm) + Lori;
193  NS_LOG_LOGIC (this << " Lbf " << Lbf << " Lrts " << Lrts << " Dhm" << Dhm << " Lmsd " << Lmsd);
194  double loss = 0.0;
195  if (Lrts + Lmsd > 0)
196  {
197  loss = Lbf + Lrts + Lmsd;
198  }
199  else
200  {
201  loss = Lbf;
202  }
203  return loss;
204 }
205 
206 
207 void
209 {
210  m_frequency = freq;
211  m_lambda = 299792458.0 / freq;
212 }
213 
214 
215 double
218  Ptr<MobilityModel> b) const
219 {
220  return (txPowerDbm - GetLoss (a, b));
221 }
222 
223 int64_t
225 {
226  return 0;
227 }
228 
229 
230 } // namespace ns3
ns3::SubUrbanEnvironment
@ SubUrbanEnvironment
Definition: propagation-environment.h:38
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::ItuR1411NlosOverRooftopPropagationLossModel::m_buildingSeparation
double m_buildingSeparation
in meters
Definition: itu-r-1411-nlos-over-rooftop-propagation-loss-model.h:102
ns3::MakeEnumChecker
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:161
ns3::ItuR1411NlosOverRooftopPropagationLossModel::DoCalcRxPower
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Returns the Rx Power taking into account only the particular PropagationLossModel.
Definition: itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc:216
ns3::SmallCity
@ SmallCity
Definition: propagation-environment.h:50
ns3::LargeCity
@ LargeCity
Definition: propagation-environment.h:50
ns3::UrbanEnvironment
@ UrbanEnvironment
Definition: propagation-environment.h:38
ns3::MobilityModel::GetDistanceFrom
double GetDistanceFrom(Ptr< const MobilityModel > position) const
Definition: mobility-model.cc:94
ns3::ItuR1411NlosOverRooftopPropagationLossModel
the ITU-R 1411 NLOS over rooftop propagation model
Definition: itu-r-1411-nlos-over-rooftop-propagation-loss-model.h:43
itu-r-1411-nlos-over-rooftop-propagation-loss-model.h
ns3::PropagationLossModel
Models the propagation loss through a transmission medium.
Definition: propagation-loss-model.h:50
ns3::ItuR1411NlosOverRooftopPropagationLossModel::GetLoss
double GetLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Definition: itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc:102
ns3::ItuR1411NlosOverRooftopPropagationLossModel::m_rooftopHeight
double m_rooftopHeight
in meters
Definition: itu-r-1411-nlos-over-rooftop-propagation-loss-model.h:98
ns3::MediumCity
@ MediumCity
Definition: propagation-environment.h:50
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
ns3::EnumValue
Hold variables of type enum.
Definition: enum.h:55
ns3::Ptr< MobilityModel >
ns3::OpenAreasEnvironment
@ OpenAreasEnvironment
Definition: propagation-environment.h:38
ns3::ItuR1411NlosOverRooftopPropagationLossModel::m_buildingsExtend
double m_buildingsExtend
in meters
Definition: itu-r-1411-nlos-over-rooftop-propagation-loss-model.h:101
ns3::ItuR1411NlosOverRooftopPropagationLossModel::m_frequency
double m_frequency
frequency in MHz
Definition: itu-r-1411-nlos-over-rooftop-propagation-loss-model.h:94
ns3::ItuR1411NlosOverRooftopPropagationLossModel::SetFrequency
void SetFrequency(double freq)
Set the operating frequency.
Definition: itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc:208
ns3::ItuR1411NlosOverRooftopPropagationLossModel::DoAssignStreams
virtual int64_t DoAssignStreams(int64_t stream)
Subclasses must implement this; those not using random variables can return zero.
Definition: itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc:224
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:88
ns3::ItuR1411NlosOverRooftopPropagationLossModel::m_lambda
double m_lambda
wavelength
Definition: itu-r-1411-nlos-over-rooftop-propagation-loss-model.h:95
NS_LOG_LOGIC
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
ns3::MakeDoubleAccessor
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: double.h:42
ns3::ItuR1411NlosOverRooftopPropagationLossModel::~ItuR1411NlosOverRooftopPropagationLossModel
virtual ~ItuR1411NlosOverRooftopPropagationLossModel()
Definition: itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc:97
ns3::ItuR1411NlosOverRooftopPropagationLossModel::ItuR1411NlosOverRooftopPropagationLossModel
ItuR1411NlosOverRooftopPropagationLossModel()
Definition: itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc:92
ns3::MakeEnumAccessor
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: enum.h:203
ns3::ItuR1411NlosOverRooftopPropagationLossModel::m_citySize
CitySize m_citySize
Dimension of the city.
Definition: itu-r-1411-nlos-over-rooftop-propagation-loss-model.h:97
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:244
ns3::ItuR1411NlosOverRooftopPropagationLossModel::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc:38
ns3::ItuR1411NlosOverRooftopPropagationLossModel::m_environment
EnvironmentType m_environment
Environment Scenario.
Definition: itu-r-1411-nlos-over-rooftop-propagation-loss-model.h:96
ns3::ItuR1411NlosOverRooftopPropagationLossModel::m_streetsWidth
double m_streetsWidth
in meters
Definition: itu-r-1411-nlos-over-rooftop-propagation-loss-model.h:100
ns3::MobilityModel::GetPosition
Vector GetPosition(void) const
Definition: mobility-model.cc:64
ns3::ItuR1411NlosOverRooftopPropagationLossModel::m_streetsOrientation
double m_streetsOrientation
in degrees [0,90]
Definition: itu-r-1411-nlos-over-rooftop-propagation-loss-model.h:99