26 #include "ns3/mobility-model.h"
27 #include "ns3/double.h"
28 #include "ns3/pointer.h"
29 #include "ns3/okumura-hata-propagation-loss-model.h"
30 #include "ns3/itu-r-1411-los-propagation-loss-model.h"
31 #include "ns3/itu-r-1411-nlos-over-rooftop-propagation-loss-model.h"
32 #include "ns3/itu-r-1238-propagation-loss-model.h"
33 #include "ns3/kun-2600-mhz-propagation-loss-model.h"
34 #include "ns3/buildings-mobility-model.h"
37 #include "hybrid-buildings-propagation-loss-model.h"
44 NS_OBJECT_ENSURE_REGISTERED (HybridBuildingsPropagationLossModel);
48 HybridBuildingsPropagationLossModel::HybridBuildingsPropagationLossModel ()
50 m_okumuraHata = CreateObject<OkumuraHataPropagationLossModel> ();
51 m_ituR1411Los = CreateObject<ItuR1411LosPropagationLossModel> ();
52 m_ituR1411NlosOverRooftop = CreateObject<ItuR1411NlosOverRooftopPropagationLossModel> ();
53 m_ituR1238 = CreateObject<ItuR1238PropagationLossModel> ();
54 m_kun2600Mhz = CreateObject<Kun2600MhzPropagationLossModel> ();
57 HybridBuildingsPropagationLossModel::~HybridBuildingsPropagationLossModel ()
62 HybridBuildingsPropagationLossModel::GetTypeId (
void)
64 static TypeId tid = TypeId (
"ns3::HybridBuildingsPropagationLossModel")
66 .SetParent<BuildingsPropagationLossModel> ()
68 .AddConstructor<HybridBuildingsPropagationLossModel> ()
70 .AddAttribute (
"Frequency",
71 "The Frequency (default is 2.106 GHz).",
74 MakeDoubleChecker<double> ())
76 .AddAttribute (
"Los2NlosThr",
77 " Threshold from LoS to NLoS in ITU 1411 [m].",
80 MakeDoubleChecker<double> ())
82 .AddAttribute (
"Environment",
83 "Environment Scenario",
84 EnumValue (UrbanEnvironment),
86 MakeEnumChecker (UrbanEnvironment,
"Urban",
87 SubUrbanEnvironment,
"SubUrban",
88 OpenAreasEnvironment,
"OpenAreas"))
90 .AddAttribute (
"CitySize",
91 "Dimension of the city",
92 EnumValue (LargeCity),
94 MakeEnumChecker (SmallCity,
"Small",
98 .AddAttribute (
"RooftopLevel",
99 "The height of the rooftop level in meters",
102 MakeDoubleChecker<double> (0.0, 90.0))
112 m_okumuraHata->SetAttribute (
"Environment",
EnumValue (env));
113 m_ituR1411NlosOverRooftop->SetAttribute (
"Environment",
EnumValue (env));
119 m_okumuraHata->SetAttribute (
"CitySize",
EnumValue (size));
120 m_ituR1411NlosOverRooftop->SetAttribute (
"CitySize",
EnumValue (size));
126 m_okumuraHata->SetAttribute (
"Frequency",
DoubleValue (freq));
127 m_ituR1411Los->SetAttribute (
"Frequency",
DoubleValue (freq));
128 m_ituR1411NlosOverRooftop->SetAttribute (
"Frequency",
DoubleValue (freq));
129 m_ituR1238->SetAttribute (
"Frequency",
DoubleValue (freq));
136 m_rooftopHeight = rooftopHeight;
137 m_ituR1411NlosOverRooftop->SetAttribute (
"RooftopLevel",
DoubleValue (rooftopHeight));
152 NS_ASSERT_MSG ((a1 != 0) && (b1 != 0),
"HybridBuildingsPropagationLossModel only works with BuildingsMobilityModel");
156 if (a1->IsOutdoor ())
158 if (b1->IsOutdoor ())
162 NS_LOG_INFO (
this << a1->GetPosition ().z << b1->GetPosition ().z << m_rooftopHeight);
163 if ((a1->GetPosition ().z < m_rooftopHeight)
164 && (b1->GetPosition ().z < m_rooftopHeight))
166 loss = ItuR1411 (a1, b1);
167 NS_LOG_INFO (
this <<
" 0-0 (>1000): below rooftop -> ITUR1411 : " << loss);
172 loss = OkumuraHata (a1, b1);
173 NS_LOG_INFO (
this <<
" O-O (>1000): above rooftop -> OH : " << loss);
179 loss = ItuR1411 (a1, b1);
180 NS_LOG_INFO (
this <<
" 0-0 (<1000) Street canyon -> ITUR1411 : " << loss);
188 if ((a1->GetPosition ().z < m_rooftopHeight)
189 && (b1->GetPosition ().z < m_rooftopHeight))
191 loss = ItuR1411 (a1, b1) + ExternalWallLoss (b1) + HeightLoss (a1);
192 NS_LOG_INFO (
this <<
" 0-I (>1000): below rooftop -> ITUR1411 : " << loss);
196 loss = OkumuraHata (a1, b1) + ExternalWallLoss (b1);
197 NS_LOG_INFO (
this <<
" O-I (>1000): above the rooftop -> OH : " << loss);
202 loss = ItuR1411 (a1, b1) + ExternalWallLoss (b1) + HeightLoss (b1);
203 NS_LOG_INFO (
this <<
" 0-I (<1000) ITUR1411 + BEL : " << loss);
212 if (a1->GetBuilding () == b1->GetBuilding ())
215 loss = ItuR1238 (a1, b1) + InternalWallsLoss (a1, b1);;
216 NS_LOG_INFO (
this <<
" I-I (same building) ITUR1238 : " << loss);
222 loss = ItuR1411 (a1, b1) + ExternalWallLoss (a1) + ExternalWallLoss (b1);
223 NS_LOG_INFO (
this <<
" I-I (different) ITUR1238 + 2*BEL : " << loss);
231 if ((a1->GetPosition ().z < m_rooftopHeight)
232 && (b1->GetPosition ().z < m_rooftopHeight))
234 loss = ItuR1411 (a1, b1) + ExternalWallLoss (a1) + HeightLoss (a1);
235 NS_LOG_INFO (
this <<
" I-O (>1000): down rooftop -> ITUR1411 : " << loss);
240 loss = OkumuraHata (a1, b1) + ExternalWallLoss (a1) + HeightLoss (a1);
241 NS_LOG_INFO (
this <<
" =I-O (>1000) over rooftop OH + BEL + HG: " << loss);
246 loss = ItuR1411 (a1, b1) + ExternalWallLoss (a1) + HeightLoss (a1);
247 NS_LOG_INFO (
this <<
" I-O (<1000) ITUR1411 + BEL + HG: " << loss);
252 loss = std::max (loss, 0.0);
261 if (m_frequency <= 2.3e9)
263 return m_okumuraHata->GetLoss (a, b);
267 return m_kun2600Mhz->GetLoss (a, b);
272 HybridBuildingsPropagationLossModel::ItuR1411 (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b)
const
276 return (m_ituR1411Los->GetLoss (a, b));
280 return (m_ituR1411NlosOverRooftop->GetLoss (a, b));
285 HybridBuildingsPropagationLossModel::ItuR1238 (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b)
const
287 return m_ituR1238->GetLoss (a,b);
void SetEnvironment(EnvironmentType env)
void SetFrequency(double freq)
double GetDistanceFrom(Ptr< const MobilityModel > position) const
virtual double GetLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
#define NS_LOG_COMPONENT_DEFINE(name)
Vector GetPosition(void) const
hold variables of type 'enum'
void SetRooftopHeight(double rooftopHeight)
void SetCitySize(CitySize size)
double m_itu1411NlosThreshold
in meters (switch Los -> NLoS)
#define NS_ASSERT_MSG(condition, message)
Hold an floating point type.