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
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
double GetLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
double GetDistanceFrom(Ptr< const MobilityModel > position) const
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
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:209
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
Vector GetPosition(void) const
NS_ASSERT_MSG(false,"Ipv4AddressGenerator::MaskToIndex(): Impossible")
Hold variables of type enum.
Definition: enum.h:54
virtual int64_t DoAssignStreams(int64_t stream)
Subclasses must implement this; those not using random variables can return zero. ...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
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
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Returns the Rx Power taking into account only the particular PropagatinLossModel. ...
Ptr< const AttributeChecker > MakeEnumChecker(int v1, std::string n1, int v2, std::string n2, int v3, std::string n3, int v4, std::string n4, int v5, std::string n5, int v6, std::string n6, int v7, std::string n7, int v8, std::string n8, int v9, std::string n9, int v10, std::string n10, int v11, std::string n11, int v12, std::string n12, int v13, std::string n13, int v14, std::string n14, int v15, std::string n15, int v16, std::string n16, int v17, std::string n17, int v18, std::string n18, int v19, std::string n19, int v20, std::string n20, int v21, std::string n21, int v22, std::string n22)
Make an EnumChecker pre-configured with a set of allowed values by name.
Definition: enum.cc:184
Models the propagation loss through a transmission medium.
This class can be used to hold variables of floating point type such as &#39;double&#39; or &#39;float&#39;...
Definition: double.h:41
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:915