13#include "ns3/boolean.h"
14#include "ns3/double.h"
15#include "ns3/geocentric-constant-position-mobility-model.h"
17#include "ns3/mobility-model.h"
19#include "ns3/pointer.h"
20#include "ns3/simulator.h"
82 return u * maxDistance;
93 const double lGlass = 2 + 0.2 * frequency / 1e9;
94 const double lConcrete = 5 + 4 * frequency / 1e9;
95 return 5 - 10 * log10(0.3 * std::pow(10, -lGlass / 10) + 0.7 * std::pow(10, -lConcrete / 10));
106 const double lIIRGlass = 23 + 0.3 * frequency / 1e9;
107 const double lConcrete = 5 + 4 * frequency / 1e9;
109 10 * log10(0.7 * std::pow(10, -lIIRGlass / 10) + 0.3 * std::pow(10, -lConcrete / 10));
130 {10, {3.5, 15.5, 34.3, 2.9, 17.1, 44.3}},
131 {20, {3.4, 13.9, 30.9, 2.4, 17.1, 39.9}},
132 {30, {2.9, 12.4, 29.0, 2.7, 15.6, 37.5}},
133 {40, {3.0, 11.7, 27.7, 2.4, 14.6, 35.8}},
134 {50, {3.1, 10.6, 26.8, 2.4, 14.2, 34.6}},
135 {60, {2.7, 10.5, 26.2, 2.7, 12.6, 33.8}},
136 {70, {2.5, 10.1, 25.8, 2.6, 12.1, 33.3}},
137 {80, {2.3, 9.2, 25.5, 2.8, 12.3, 33.0}},
138 {90, {1.2, 9.2, 25.5, 0.6, 12.3, 32.9}},
146 {10, {4, 6, 34.3, 4, 6, 44.3}},
147 {20, {4, 6, 30.9, 4, 6, 39.9}},
148 {30, {4, 6, 29.0, 4, 6, 37.5}},
149 {40, {4, 6, 27.7, 4, 6, 35.8}},
150 {50, {4, 6, 26.8, 4, 6, 34.6}},
151 {60, {4, 6, 26.2, 4, 6, 33.8}},
152 {70, {4, 6, 25.8, 4, 6, 33.3}},
153 {80, {4, 6, 25.5, 4, 6, 33.0}},
154 {90, {4, 6, 25.5, 4, 6, 32.9}},
162 {10, {1.79, 8.93, 19.52, 1.9, 10.7, 29.5}},
163 {20, {1.14, 9.08, 18.17, 1.6, 10.0, 24.6}},
164 {30, {1.14, 8.78, 18.42, 1.9, 11.2, 21.9}},
165 {40, {0.92, 10.25, 18.28, 2.3, 11.6, 20.0}},
166 {50, {1.42, 10.56, 18.63, 2.7, 11.8, 18.7}},
167 {60, {1.56, 10.74, 17.68, 3.1, 10.8, 17.8}},
168 {70, {0.85, 10.17, 16.5, 3.0, 10.8, 17.2}},
169 {80, {0.72, 11.52, 16.3, 3.6, 10.8, 16.9}},
170 {90, {0.72, 11.52, 16.3, 0.4, 10.8, 16.8}},
181 0, 0.0300, 0.0350, 0.0380, 0.0390, 0.0410, 0.0420, 0.0450, 0.0480, 0.0500,
182 0.0530, 0.0587, 0.0674, 0.0789, 0.0935, 0.1113, 0.1322, 0.1565, 0.1841, 0.2153,
183 0.2500, 0.3362, 0.4581, 0.5200, 0.5200, 0.5000, 0.4500, 0.3850, 0.3200, 0.2700,
184 0.2500, 0.2517, 0.2568, 0.2651, 0.2765, 0.2907, 0.3077, 0.3273, 0.3493, 0.3736,
185 0.4000, 0.4375, 0.4966, 0.5795, 0.6881, 0.8247, 0.9912, 1.1900, 1.4229, 1.6922,
186 2.0000, 4.2654, 10.1504, 19.2717, 31.2457, 45.6890, 62.2182, 80.4496, 100.0000, 140.0205,
187 170.0000, 100.0000, 78.1682, 59.3955, 43.5434, 30.4733, 20.0465, 12.1244, 6.5683, 3.2397,
188 2.0000, 1.7708, 1.5660, 1.3858, 1.2298, 1.0981, 0.9905, 0.9070, 0.8475, 0.8119,
189 0.8000, 0.8000, 0.8000, 0.8000, 0.8000, 0.8000, 0.8000, 0.8000, 0.8000, 0.8000,
190 0.8000, 0.8029, 0.8112, 0.8243, 0.8416, 0.8625, 0.8864, 0.9127, 0.9408, 0.9701,
219std::tuple<double, double, double, double>
223 auto aPos = a->GetPosition();
224 auto bPos = b->GetPosition();
227 double hBs = std::max(aPos.z, bPos.z);
228 double hUt = std::min(aPos.z, bPos.z);
229 return std::make_tuple(distance2D, distance3D, hBs, hUt);
240std::tuple<double, double>
243 double hBs = (heightA == 10) ? heightA : heightB;
244 double hUt = (heightA == 10) ? heightB : heightA;
245 return std::make_tuple(hBs, hUt);
266 return 32.45 + 20 * log10(freq / 1e9) + 20 * log10(dist3d);
282 if ((elevAngle < 10 && freq > 1e9) || freq >= 10e9)
284 int roundedFreq = round(freq / 10e8);
307 double elevAngleQuantized,
308 bool ionoScintLossEnabled,
309 bool tropoScintLossEnabled)
315 if (ionoScintLossEnabled)
317 loss = 6.22 / (pow(freq / 1e9, 1.5));
323 if (tropoScintLossEnabled)
344 const std::map<
int, std::vector<float>>* sfcl,
345 double elevAngleQuantized)
362constexpr double M_C = 299792458.0;
377 TypeId(
"ns3::ThreeGppPropagationLossModel")
379 .SetGroupName(
"Propagation")
380 .AddAttribute(
"Frequency",
381 "The centre frequency in Hz.",
386 .AddAttribute(
"ShadowingEnabled",
387 "Enable/disable shadowing.",
392 "ChannelConditionModel",
393 "Pointer to the channel condition model.",
398 .AddAttribute(
"EnforceParameterRanges",
399 "Whether to strictly enforce TR38.901 applicability ranges",
404 "BuildingPenetrationLossesEnabled",
405 "Enable/disable Building Penetration Losses.",
409 .AddAttribute(
"MeanVehicularLoss",
410 "9dB for standard cars, 20dB for cars with "
411 "metal coated glass panels.",
482 "Frequency should be between 0.5 and 100 GHz but is " << f);
513 double rxPow = txPowerDbm;
558 switch (cond->GetLosCondition())
589 const Vector termPos =
594 double o2iLossValue = 0;
597 double lossNormalVariate = 0;
602 bool notFound =
false;
603 bool newCondition =
false;
610 newCondition = (it->second.m_condition != cond);
617 it =
m_o2iLossMap.insert(it, std::make_pair(key, newItem));
620 if (notFound || newCondition)
630 lossIn = 0.5 * distance2dIn;
633 lossNormalVariate = 0;
635 o2iLossValue = lossTw + lossIn + lossNormalVariate;
638 it->second.m_o2iLoss = o2iLossValue;
639 it->second.m_condition = cond;
643 o2iLossValue = it->second.m_o2iLoss;
661 const Vector termPos =
666 kO2iPenetrationField.
Sample(DEVIATION,
668 kPenetrationDeviationCorrelationDistance);
671 double o2iLossValue = 0;
672 double lowLossTw = 0;
674 double lowlossNormalVariate = 0;
679 bool notFound =
false;
680 bool newCondition =
false;
687 newCondition = (it->second.m_condition != cond);
694 it =
m_o2iLossMap.insert(it, std::make_pair(key, newItem));
697 if (notFound || newCondition)
708 lossIn = 0.5 * distance2dIn;
713 o2iLossValue = lowLossTw + lossIn + lowlossNormalVariate;
716 it->second.m_o2iLoss = o2iLossValue;
717 it->second.m_condition = cond;
721 o2iLossValue = it->second.m_o2iLoss;
739 const Vector termPos =
744 kO2iPenetrationField.
Sample(DEVIATION,
746 kPenetrationDeviationCorrelationDistance);
749 double o2iLossValue = 0;
750 double highLossTw = 0;
752 double highlossNormalVariate = 0;
757 bool notFound =
false;
758 bool newCondition =
false;
765 newCondition = (it->second.m_condition != cond);
772 it =
m_o2iLossMap.insert(it, std::make_pair(key, newItem));
775 if (notFound || newCondition)
788 lossIn = 0.5 * distance2dIn;
793 o2iLossValue = highLossTw + lossIn + highlossNormalVariate;
796 it->second.m_o2iLoss = o2iLossValue;
797 it->second.m_condition = cond;
801 o2iLossValue = it->second.m_o2iLoss;
820 NS_ABORT_MSG(
"If we have set the O2I condition, we shouldn't be here");
848 const uint32_t siteNodeId = site->GetObject<
Node>()->GetId();
849 const Vector termPos = terminal->GetPosition();
855 const double corrDist =
861 double shadowingValue;
866 bool notFound =
false;
867 bool newCondition =
false;
875 newCondition = (it->second.m_condition != cond);
886 if (notFound || newCondition)
894 Vector2D displacement(newDistance.x - it->second.m_distance.x,
895 newDistance.y - it->second.m_distance.y);
897 shadowingValue = R * it->second.m_shadowing + sqrt(1 - R * R) *
903 it->second.m_shadowing = shadowingValue;
904 it->second.m_distance = newDistance;
906 it->second.m_condition = cond;
908 return shadowingValue;
923 const Vector& position,
924 double corrDist)
const
927 const uint64_t fieldKey =
928 (
static_cast<uint64_t
>(siteNodeId) << 2) |
static_cast<uint64_t
>(condSlot);
929 return kShadowFadingField.
Sample(fieldKey, position, corrDist);
949 double x = a.x - b.x;
950 double y = a.y - b.y;
951 double distance2D = sqrt(
x *
x + y * y);
965 uint32_t key = (((x1 + x2) * (x1 + x2 + 1)) / 2) + x2;
978 return b->GetPosition() - a->GetPosition();
982 return a->GetPosition() - b->GetPosition();
1018 double o2iVehicularLoss = 0.0;
1023 for (
const auto& mob : {a, b})
1025 auto velocityKmH = mob->GetVelocity().GetLength() * 3.6;
1026 auto idNode = mob->GetObject<
Node>()->GetId();
1028 if (velocityKmH < 30)
1034 else if (velocityKmH >= 30 && velocityKmH <= 120)
1046 "O2I loss for high-speed (>120 km/h) transit and satellites not implemented");
1056 return o2iVehicularLoss;
1066 static TypeId tid =
TypeId(
"ns3::ThreeGppRmaPropagationLossModel")
1068 .SetGroupName(
"Propagation")
1070 .AddAttribute(
"AvgBuildingHeight",
1071 "The average building height in meters.",
1075 .AddAttribute(
"AvgStreetWidth",
1076 "The average street width in meters.",
1114 [[maybe_unused]])
const
1126 "RMa scenario is valid for frequencies between 0.5 and 30 GHz.");
1128 auto [distance2D, distance3D, hBs, hUt] = GetBsUtDistancesAndHeights(a, b);
1131 if (hUt < 1.0 || hUt > 10.0)
1135 "The height of the UT should be between 1 and 10 m (see TR 38.901, Table 7.4.1-1)");
1138 if (hBs < 10.0 || hBs > 150.0)
1142 "The height of the BS should be between 10 and 150 m (see TR 38.901, Table 7.4.1-1)");
1156 "Breakpoint distance is zero (divide-by-zero below); are either hBs or hUt = 0?");
1159 if (distance2D < 10.0 || distance2D > 10.0e3)
1162 NS_LOG_WARN(
"The 2D distance is outside the validity range, the pathloss value may not be "
1168 if (distance2D <= distanceBp)
1189 "RMa scenario is valid for frequencies between 0.5 and 30 GHz.");
1191 auto [distance2D, distance3D, hBs, hUt] = GetBsUtDistancesAndHeights(a, b);
1194 if (hUt < 1.0 || hUt > 10.0)
1198 "The height of the UT should be between 1 and 10 m (see TR 38.901, Table 7.4.1-1)");
1201 if (hBs < 10.0 || hBs > 150.0)
1205 "The height of the BS should be between 10 and 150 m (see TR 38.901, Table 7.4.1-1)");
1216 if (distance2D < 10.0 || distance2D > 5.0e3)
1219 NS_LOG_WARN(
"The 2D distance is outside the validity range, the pathloss value may not be "
1224 double plNlos = 161.04 - 7.1 * log10(
m_w) + 7.5 * log10(
m_h) -
1225 (24.37 - 3.7 * pow((
m_h / hBs), 2)) * log10(hBs) +
1226 (43.42 - 3.1 * log10(hBs)) * (log10(distance3D) - 3.0) +
1227 20.0 * log10(
m_frequency / 1e9) - (3.2 * pow(log10(11.75 * hUt), 2) - 4.97);
1229 double loss = std::max(
GetLossLos(a, b), plNlos);
1242 double shadowingStd;
1252 if (distance2d <= distanceBp)
1270 return shadowingStd;
1286 double correlationDistance;
1291 correlationDistance = 37;
1295 correlationDistance = 120;
1302 return correlationDistance;
1308 double loss = 20.0 * log10(40.0 * M_PI * distance3D * frequency / 1e9 / 3.0) +
1309 std::min(0.03 * pow(h, 1.72), 10.0) * log10(distance3D) -
1310 std::min(0.044 * pow(h, 1.72), 14.77) + 0.002 * log10(h) * distance3D;
1317 double distanceBp = 2.0 * M_PI * hA * hB * frequency / M_C;
1328 static TypeId tid =
TypeId(
"ns3::ThreeGppUmaPropagationLossModel")
1330 .SetGroupName(
"Propagation")
1356 if (distance2D > 18.0)
1358 g = 5.0 / 4.0 * pow(distance2D / 100.0, 3) * exp(-distance2D / 150.0);
1365 c = pow((hUt - 13.0) / 10.0, 1.5) * g;
1369 double prob = 1.0 / (1.0 + c);
1377 int random =
m_uniformVar->GetInteger(12, std::max(12, (
int)(hUt - 1.5)));
1378 hE = (
double)floor(random / 3.0) * 3.0;
1382 double distanceBp = 4 * (hBs - hE) * (hUt - hE) *
m_frequency / M_C;
1392 auto [distance2D, distance3D, hBs, hUt] = GetBsUtDistancesAndHeights(a, b);
1395 if (hUt < 1.5 || hUt > 22.5)
1399 "The height of the UT should be between 1.5 and 22.5 m (see TR 38.901, Table 7.4.1-1)");
1405 NS_LOG_WARN(
"The height of the BS should be equal to 25 m (see TR 38.901, Table 7.4.1-1)");
1420 if (distance2D < 10.0 || distance2D > 5.0e3)
1423 NS_LOG_WARN(
"The 2D distance is outside the validity range, the pathloss value may not be "
1429 if (distance2D <= distanceBp)
1432 loss = 28.0 + 22.0 * log10(distance3D) + 20.0 * log10(
m_frequency / 1e9);
1437 loss = 28.0 + 40.0 * log10(distance3D) + 20.0 * log10(
m_frequency / 1e9) -
1438 9.0 * log10(pow(distanceBp, 2) + pow(hBs - hUt, 2));
1479 auto [distance2D, distance3D, hBs, hUt] = GetBsUtDistancesAndHeights(a, b);
1482 if (hUt < 1.5 || hUt > 22.5)
1486 "The height of the UT should be between 1.5 and 22.5 m (see TR 38.901, Table 7.4.1-1)");
1492 NS_LOG_WARN(
"The height of the BS should be equal to 25 m (see TR 38.901, Table 7.4.1-1)");
1503 if (distance2D < 10.0 || distance2D > 5.0e3)
1506 NS_LOG_WARN(
"The 2D distance is outside the validity range, the pathloss value may not be "
1512 13.54 + 39.08 * log10(distance3D) + 20.0 * log10(
m_frequency / 1e9) - 0.6 * (hUt - 1.5);
1513 double loss = std::max(
GetLossLos(a, b), plNlos);
1525 double shadowingStd;
1545 return shadowingStd;
1561 double correlationDistance;
1566 correlationDistance = 37;
1570 correlationDistance = 50;
1577 return correlationDistance;
1597 static TypeId tid =
TypeId(
"ns3::ThreeGppUmiStreetCanyonPropagationLossModel")
1599 .SetGroupName(
"Propagation")
1629 double distanceBp = 4 * (hBs - hE) * (hUt - hE) *
m_frequency / M_C;
1670 auto [hBs, hUt] = GetBsUtHeightsUmiStreetCanyon(a->GetPosition().z, b->GetPosition().z);
1673 if (hUt < 1.5 || hUt >= 10.0)
1677 "The height of the UT should be between 1.5 and 22.5 m (see TR 38.901, Table 7.4.1-1). "
1678 "We further assume hUT < hBS, then hUT is upper bounded by hBS, which should be 10 m");
1684 NS_LOG_WARN(
"The height of the BS should be equal to 10 m (see TR 38.901, Table 7.4.1-1)");
1699 if (distance2D < 10.0 || distance2D > 5.0e3)
1702 NS_LOG_WARN(
"The 2D distance is outside the validity range, the pathloss value may not be "
1708 if (distance2D <= distanceBp)
1711 loss = 32.4 + 21.0 * log10(distance3D) + 20.0 * log10(
m_frequency / 1e9);
1716 loss = 32.4 + 40.0 * log10(distance3D) + 20.0 * log10(
m_frequency / 1e9) -
1717 9.5 * log10(pow(distanceBp, 2) + pow(hBs - hUt, 2));
1733 auto [hBs, hUt] = GetBsUtHeightsUmiStreetCanyon(a->GetPosition().z, b->GetPosition().z);
1736 if (hUt < 1.5 || hUt >= 10.0)
1740 "The height of the UT should be between 1.5 and 22.5 m (see TR 38.901, Table 7.4.1-1). "
1741 "We further assume hUT < hBS, then hUT is upper bounded by hBS, which should be 10 m");
1747 NS_LOG_WARN(
"The height of the BS should be equal to 10 m (see TR 38.901, Table 7.4.1-1)");
1758 if (distance2D < 10.0 || distance2D > 5.0e3)
1761 NS_LOG_WARN(
"The 2D distance is outside the validity range, the pathloss value may not be "
1767 22.4 + 35.3 * log10(distance3D) + 21.3 * log10(
m_frequency / 1e9) - 0.3 * (hUt - 1.5);
1768 double loss = std::max(
GetLossLos(a, b), plNlos);
1781 double shadowingStd;
1795 shadowingStd = 7.82;
1802 return shadowingStd;
1818 double correlationDistance;
1823 correlationDistance = 10;
1827 correlationDistance = 13;
1834 return correlationDistance;
1844 static TypeId tid =
TypeId(
"ns3::ThreeGppIndoorOfficePropagationLossModel")
1846 .SetGroupName(
"Propagation")
1880 if (distance3D < 1.0 || distance3D > 150.0)
1883 NS_LOG_WARN(
"The 3D distance is outside the validity range, the pathloss value may not be "
1888 double loss = 32.4 + 17.3 * log10(distance3D) + 20.0 * log10(
m_frequency / 1e9);
1904 if (distance3D < 1.0 || distance3D > 150.0)
1907 NS_LOG_WARN(
"The 3D distance is outside the validity range, the pathloss value may not be "
1912 double plNlos = 17.3 + 38.3 * log10(distance3D) + 24.9 * log10(
m_frequency / 1e9);
1913 double loss = std::max(
GetLossLos(a, b), plNlos);
1927 double shadowingStd;
1935 shadowingStd = 8.03;
1942 return shadowingStd;
1952 double correlationDistance;
1956 correlationDistance = 10;
1960 correlationDistance = 6;
1967 return correlationDistance;
1976 TypeId(
"ns3::ThreeGppNTNPropagationLossModel")
1978 .SetGroupName(
"Propagation")
1980 "IonosphericScintillationLossEnabled",
1981 "Whether to apply the ionospheric scintillation loss "
1982 "(3GPP TR 38.811, Sec 6.6.6.1-4; applied below 6 GHz)",
1987 "TroposphericScintillationLossEnabled",
1988 "Whether to apply the tropospheric scintillation loss "
1989 "(3GPP TR 38.811, Sec 6.6.6.2; applied at 6 GHz and above)",
2007 "NTN communications are valid for frequencies between 0.5 and 100 GHz.");
2010 auto [elevAngle, elevAngleQuantized] =
2014 if (!std::isfinite(elevAngle) || elevAngle <= 0.0)
2016 NS_LOG_DEBUG(
"Elevation angle " << elevAngle <<
" deg is non-positive, returning "
2017 << OUT_OF_DOMAIN_LOSS_DB <<
" dB loss");
2018 return OUT_OF_DOMAIN_LOSS_DB;
2022 double loss = ComputeNtnPathloss(
m_frequency, distance3D);
2025 loss += ComputeAtmosphericAbsorptionLoss(
m_frequency, elevAngle);
2028 loss += ComputeIonosphericPlusTroposphericScintillationLoss(
m_frequency,
2042 "NTN communications are valid for frequencies between 0.5 and 100 GHz.");
2045 auto [elevAngle, elevAngleQuantized] =
2049 if (!std::isfinite(elevAngle) || elevAngle <= 0.0)
2051 NS_LOG_DEBUG(
"Elevation angle " << elevAngle <<
" deg is non-positive, returning "
2052 << OUT_OF_DOMAIN_LOSS_DB <<
" dB loss");
2053 return OUT_OF_DOMAIN_LOSS_DB;
2057 double loss = ComputeNtnPathloss(
m_frequency, distance3D);
2063 loss += ComputeAtmosphericAbsorptionLoss(
m_frequency, elevAngle);
2066 loss += ComputeIonosphericPlusTroposphericScintillationLoss(
m_frequency,
2081 double shadowingStd;
2083 std::string freqBand = (
m_frequency < 13.0e9) ?
"S" :
"Ka";
2084 auto [elevAngle, elevAngleQuantized] =
2109 return shadowingStd;
2117 double correlationDistance;
2132 return correlationDistance;
2140 static TypeId tid =
TypeId(
"ns3::ThreeGppNTNDenseUrbanPropagationLossModel")
2142 .SetGroupName(
"Propagation")
2152 m_SFCL = &SFCL_DenseUrban;
2170 static TypeId tid =
TypeId(
"ns3::ThreeGppNTNUrbanPropagationLossModel")
2172 .SetGroupName(
"Propagation")
2200 static TypeId tid =
TypeId(
"ns3::ThreeGppNTNSuburbanPropagationLossModel")
2202 .SetGroupName(
"Propagation")
2212 m_SFCL = &SFCL_SuburbanRural;
2230 static TypeId tid =
TypeId(
"ns3::ThreeGppNTNRuralPropagationLossModel")
2232 .SetGroupName(
"Propagation")
2242 m_SFCL = &SFCL_SuburbanRural;
cairo_uint64_t x
_cairo_uint_96by64_32x64_divrem:
O2iConditionValue
Possible values for Outdoor to Indoor condition.
@ LOW
Low Penetration Losses.
@ HIGH
High Penetration Losses.
LosConditionValue
Possible values for Line-of-Sight condition.
@ NLOSv
Non Line of Sight due to a vehicle.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
Stateless, position-keyed, spatially-correlated Gaussian random field.
double Sample(uint64_t fieldKey, const Vector &position, double corrDist) const
Sample the spatially-correlated field at a position; a non-positive correlation distance degrades to ...
@ SHADOW_FADING
Shadow fading, ThreeGppPropagationLossModel.
@ O2I_PENETRATION
Indoor distance and penetration loss, ThreeGppPropagationLossModel.
static double Calculate2dDistance(const Vector &a, const Vector &b)
Computes the 2D distance between two 3D vectors.
static std::tuple< double, double > GetQuantizedElevationAngle(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b)
Computes and quantizes the elevation angle to a two-digits integer in [10, 90].
Implements the pathloss model defined in 3GPP TR 38.901, Table 7.4.1-1 for the Indoor Office scenario...
static TypeId GetTypeId()
Get the type ID.
double GetShadowingCorrelationDistance(ChannelCondition::LosConditionValue cond) const override
Returns the shadow fading correlation distance.
double GetShadowingStd(Ptr< MobilityModel > a, Ptr< MobilityModel > b, ChannelCondition::LosConditionValue cond) const override
Returns the shadow fading standard deviation.
double GetO2iDistance2dIn() const override
Returns the minimum of the two independently generated distances according to the uniform distributio...
double GetLossNlos(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
Computes the pathloss between a and b considering that the line of sight is obstructed.
~ThreeGppIndoorOfficePropagationLossModel() override
Destructor.
ThreeGppIndoorOfficePropagationLossModel()
Constructor.
double GetLossLos(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
Computes the pathloss between a and b considering that the line of sight is not obstructed.
Implements the pathloss model defined in 3GPP TR 38.811, Sec.
~ThreeGppNTNDenseUrbanPropagationLossModel() override
Destructor.
static TypeId GetTypeId()
Get the type ID.
ThreeGppNTNDenseUrbanPropagationLossModel()
Constructor.
Base class for the NTN pathloss models defined in 3GPP TR 38.811.
static TypeId GetTypeId()
Get the type ID.
const std::map< int, std::vector< float > > * m_SFCL
The nested map containing the Shadow Fading and Clutter Loss values for the scenario,...
double GetO2iDistance2dIn() const override
Returns the minimum of the two independently generated distances according to the uniform distributio...
double GetShadowingStd(Ptr< MobilityModel > a, Ptr< MobilityModel > b, ChannelCondition::LosConditionValue cond) const override
Returns the shadow fading standard deviation.
double GetLossLos(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
Computes the pathloss between a and b considering that the line of sight is not obstructed.
double m_shadowingCorrDistanceLos
shadowing correlation distance for LOS, in meters
bool m_tropoScintLossEnabled
whether the tropospheric scintillation loss is applied
double GetShadowingCorrelationDistance(ChannelCondition::LosConditionValue cond) const override
Returns the shadow fading correlation distance.
bool m_ionoScintLossEnabled
whether the ionospheric scintillation loss is applied
double m_shadowingCorrDistanceNlos
shadowing correlation distance for NLOS, in meters
double GetLossNlos(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
Computes the pathloss between a and b considering that the line of sight is obstructed.
Implements the pathloss model defined in 3GPP TR 38.811, Sec.
static TypeId GetTypeId()
Get the type ID.
ThreeGppNTNRuralPropagationLossModel()
Constructor.
~ThreeGppNTNRuralPropagationLossModel() override
Destructor.
Implements the pathloss model defined in 3GPP TR 38.811, Sec.
ThreeGppNTNSuburbanPropagationLossModel()
Constructor.
static TypeId GetTypeId()
Get the type ID.
~ThreeGppNTNSuburbanPropagationLossModel() override
Destructor.
Implements the pathloss model defined in 3GPP TR 38.811, Sec.
ThreeGppNTNUrbanPropagationLossModel()
Constructor.
static TypeId GetTypeId()
Get the type ID.
~ThreeGppNTNUrbanPropagationLossModel() override
Destructor.
Ptr< ChannelConditionModel > GetChannelConditionModel() const
Returns the associated channel condition model.
virtual double GetO2iLowPenetrationLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b, ChannelCondition::LosConditionValue cond) const
Retrieves the o2i building penetration loss value by looking at m_o2iLossMap.
Ptr< UniformRandomVariable > m_randomO2iVar2
a uniform random variable for the calculation of the indoor loss, see TR38.901 Table 7....
double m_meanVehicleO2iLoss
normal cars (9dB), cars with metal coated glass panels (20dB)
double GetFrequency() const
Return the current central frequency.
virtual double GetO2iShadowingCorrelationDistance() const
Returns the shadow fading correlation distance of O2I links (3GPP TR 38.901 Table 7....
double GetLoss(Ptr< ChannelCondition > cond, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Computes the pathloss between a and b.
Ptr< UniformRandomVariable > m_randomO2iVar1
a uniform random variable for the calculation of the indoor loss, see TR38.901 Table 7....
double GetShadowing(Ptr< MobilityModel > a, Ptr< MobilityModel > b, ChannelCondition::LosConditionValue cond) const
Retrieves the shadowing value by looking at m_shadowingMap.
static double Calculate2dDistance(Vector a, Vector b)
Computes the 2D distance between two 3D vectors.
void SetChannelConditionModel(Ptr< ChannelConditionModel > model)
Set the channel condition model used to determine the channel state (e.g., the LOS/NLOS condition).
std::unordered_map< uint32_t, ShadowingMapItem > m_shadowingMap
map to store the shadowing values
virtual double GetLossNlos(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const =0
Computes the pathloss between a and b considering that the line of sight is obstructed.
virtual bool DoIsO2iLowPenetrationLoss(Ptr< const ChannelCondition > cond) const
Indicates the condition of the o2i building penetration loss (defined in 3GPP TR 38....
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
virtual double GetLossNlosv(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Computes the pathloss between a and b considering that the line of sight is obstructed by a vehicle.
Ptr< NormalRandomVariable > m_normalO2iVehicularLossVar
a normal random variable for the calculation of penetration loss for vehicles see TR38....
virtual double GetShadowingCorrelationDistance(ChannelCondition::LosConditionValue cond) const =0
Returns the shadow fading correlation distance.
ThreeGppPropagationLossModel()
Constructor.
Ptr< NormalRandomVariable > m_normRandomVariable
normal random variable
static TypeId GetTypeId()
Get the type ID.
Ptr< ChannelConditionModel > m_channelConditionModel
pointer to the channel condition model
~ThreeGppPropagationLossModel() override
Destructor.
void NotifyConstructionCompleted() override
Notifier called once the ObjectBase is fully constructed.
std::unordered_map< uint32_t, O2iLossMapItem > m_o2iLossMap
map to store the o2i Loss values
virtual double GetO2iDistance2dIn() const =0
Returns the minimum of the two independently generated distances according to the uniform distributio...
std::unordered_map< uint32_t, double > m_o2iVehicularUtLossMap
vehicular O2I loss for each individual UT with speed x, such that 30 < x <= 120 km/h.
virtual double GetO2iHighPenetrationLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b, ChannelCondition::LosConditionValue cond) const
Retrieves the o2i building penetration loss value by looking at m_o2iLossMap.
double SampleSpatiallyCorrelatedNormal(uint32_t siteNodeId, uint8_t condSlot, const Vector &position, double corrDist) const
Sample the SpatialGaussianField of shadow fading owned by a (site, condition slot) pair,...
bool IsO2iLowPenetrationLoss(Ptr< const ChannelCondition > cond) const
Return true if the O2I Building Penetration loss corresponds to a low loss condition.
virtual double GetO2iDistance2dInMax() const
Returns the upper bound of the uniform variables of the O2I 2D-in distance of GetO2iDistance2dIn(),...
virtual double GetO2iDistance2dInSub6Ghz() const
Returns a a single, link-specific, uniformly distributed variable value depending on the specific 3GP...
void SetFrequency(double f)
Set the central frequency of the model.
void ClearO2iLossCacheMap()
Clear cached O2I Building Penetration loss.
virtual double GetO2iDistance2dInSub6GhzMax() const
Returns the upper bound of the uniform variable of the O2I 2D-in distance of GetO2iDistance2dInSub6Gh...
void DoDispose() override
Destructor implementation.
static uint32_t GetKey(Ptr< MobilityModel > a, Ptr< MobilityModel > b)
Returns an unique key for the channel between a and b.
Ptr< NormalRandomVariable > m_normalO2iLowLossVar
a normal random variable for the calculation of 02i low loss, see TR38.901 Table 7....
double m_frequency
operating frequency in Hz
bool m_enforceRanges
strictly enforce TR 38.901 parameter ranges
virtual double GetShadowingStd(Ptr< MobilityModel > a, Ptr< MobilityModel > b, ChannelCondition::LosConditionValue cond) const =0
Returns the shadow fading standard deviation.
Ptr< NormalRandomVariable > m_normalO2iHighLossVar
a normal random variable for the calculation of 02i high loss, see TR38.901 Table 7....
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
Computes the received power by applying the pathloss model described in 3GPP TR 38....
bool m_shadowingEnabled
enable/disable shadowing
double GetO2iSub6GhzPenetrationLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b, ChannelCondition::LosConditionValue cond) const
Retrieves the o2i building penetration loss value by looking at m_o2iLossMap.
static Vector GetVectorDifference(Ptr< MobilityModel > a, Ptr< MobilityModel > b)
Get the difference between the node position.
bool m_buildingPenLossesEnabled
enable/disable building penetration losses
double GetO2iVehicularLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b, ChannelCondition::O2iConditionValue cond) const
Computes the o2i vehicular penetration loss by looking at m_o2iVehicularUtLossMap.
virtual double GetLossLos(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const =0
Computes the pathloss between a and b considering that the line of sight is not obstructed.
Implements the pathloss model defined in 3GPP TR 38.901, Table 7.4.1-1 for the RMa scenario.
double GetLossNlos(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
Computes the pathloss between a and b considering that the line of sight is obstructed.
double GetShadowingStd(Ptr< MobilityModel > a, Ptr< MobilityModel > b, ChannelCondition::LosConditionValue cond) const override
Returns the shadow fading standard deviation.
static double Pl1(double frequency, double distance3D, double h, double w)
Computes the PL1 formula for the RMa scenario.
double GetLossLos(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
Computes the pathloss between a and b considering that the line of sight is not obstructed.
double GetO2iDistance2dIn() const override
Returns the minimum of the two independently generated distances according to the uniform distributio...
ThreeGppRmaPropagationLossModel()
Constructor.
double GetO2iDistance2dInMax() const override
Returns the upper bound of the uniform variables of the O2I 2D-in distance of GetO2iDistance2dIn(),...
~ThreeGppRmaPropagationLossModel() override
Destructor.
double GetShadowingCorrelationDistance(ChannelCondition::LosConditionValue cond) const override
Returns the shadow fading correlation distance.
double m_h
average building height in meters
static TypeId GetTypeId()
Get the type ID.
static double GetBpDistance(double frequency, double hA, double hB)
Computes the breakpoint distance for the RMa scenario.
double m_w
average street width in meters
bool DoIsO2iLowPenetrationLoss(Ptr< const ChannelCondition > cond) const override
Indicates the condition of the o2i building penetration loss (defined in 3GPP TR 38....
double GetO2iShadowingCorrelationDistance() const override
Returns the shadow fading correlation distance of O2I links (3GPP TR 38.901 Table 7....
Implements the pathloss model defined in 3GPP TR 38.901, Table 7.4.1-1 for the UMa scenario.
static TypeId GetTypeId()
Get the type ID.
double GetLossNlos(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
Computes the pathloss between a and b considering that the line of sight is obstructed.
double GetBpDistance(double hUt, double hBs, double distance2D) const
Computes the breakpoint distance.
~ThreeGppUmaPropagationLossModel() override
Destructor.
ThreeGppUmaPropagationLossModel()
Constructor.
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
double GetLossLos(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
Computes the pathloss between a and b considering that the line of sight is not obstructed.
double GetO2iShadowingCorrelationDistance() const override
Returns the shadow fading correlation distance of O2I links (3GPP TR 38.901 Table 7....
double GetO2iDistance2dInMax() const override
Returns the upper bound of the uniform variables of the O2I 2D-in distance of GetO2iDistance2dIn(),...
double GetO2iDistance2dIn() const override
Returns the minimum of the two independently generated distances according to the uniform distributio...
double GetO2iDistance2dInSub6GhzMax() const override
Returns the upper bound of the uniform variable of the O2I 2D-in distance of GetO2iDistance2dInSub6Gh...
Ptr< UniformRandomVariable > m_uniformVar
a uniform random variable used for the computation of the breakpoint distance
double GetShadowingStd(Ptr< MobilityModel > a, Ptr< MobilityModel > b, ChannelCondition::LosConditionValue cond) const override
Returns the shadow fading standard deviation.
double GetO2iDistance2dInSub6Ghz() const override
Returns a a single, link-specific, uniformly distributed variable value depending on the specific 3GP...
double GetShadowingCorrelationDistance(ChannelCondition::LosConditionValue cond) const override
Returns the shadow fading correlation distance.
Implements the pathloss model defined in 3GPP TR 38.901, Table 7.4.1-1 for the UMi-Street Canyon scen...
double GetO2iShadowingCorrelationDistance() const override
Returns the shadow fading correlation distance of O2I links (3GPP TR 38.901 Table 7....
double GetO2iDistance2dInSub6Ghz() const override
Returns a a single, link-specific, uniformly distributed variable value depending on the specific 3GP...
~ThreeGppUmiStreetCanyonPropagationLossModel() override
Destructor.
double GetLossNlos(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
Computes the pathloss between a and b considering that the line of sight is obstructed.
double GetShadowingStd(Ptr< MobilityModel > a, Ptr< MobilityModel > b, ChannelCondition::LosConditionValue cond) const override
Returns the shadow fading standard deviation.
double GetBpDistance(double hUt, double hBs, double distance2D) const
Computes the breakpoint distance.
double GetO2iDistance2dIn() const override
Returns the minimum of the two independently generated distances according to the uniform distributio...
ThreeGppUmiStreetCanyonPropagationLossModel()
Constructor.
double GetLossLos(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
Computes the pathloss between a and b considering that the line of sight is not obstructed.
static TypeId GetTypeId()
Get the type ID.
double GetShadowingCorrelationDistance(ChannelCondition::LosConditionValue cond) const override
Returns the shadow fading correlation distance.
double GetO2iDistance2dInMax() const override
Returns the upper bound of the uniform variables of the O2I 2D-in distance of GetO2iDistance2dIn(),...
double GetO2iDistance2dInSub6GhzMax() const override
Returns the upper bound of the uniform variable of the O2I 2D-in distance of GetO2iDistance2dInSub6Gh...
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
double GetLength() const
Compute the length (magnitude) of the vector.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if a condition is false, with a message.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
const std::map< int, std::vector< float > > SFCL_SuburbanRural
The map containing the 3GPP value regarding Shadow Fading and Clutter Loss tables for the NTN Suburba...
const ns3::SpatialGaussianField kO2iPenetrationField
Indoor-distance and penetration-loss-deviation random fields, see SpatialGaussianField.
double SampleO2iDistance2dIn(const ns3::Vector &position, double maxDistance, bool minOfTwo)
Sample the spatially consistent O2I 2D-in distance at a terminal position (TR 38.901 Sec.
constexpr double kDistance2dInCorrelationDistance
Correlation distance of the uniform variables of the 2D-in distance, TR 38.901 Sec....
constexpr double kO2iHighLossStd
Standard deviation in dB of the high-loss penetration loss, TR 38.901 Table 7.4.3-2.
constexpr double M_C
speed of light in vacuum [m/s] (Issue 1092)
std::tuple< double, double, double, double > GetBsUtDistancesAndHeights(ns3::Ptr< const ns3::MobilityModel > a, ns3::Ptr< const ns3::MobilityModel > b)
Get the base station and user terminal relative distances and heights.
double ComputeAtmosphericAbsorptionLoss(double freq, double elevAngle)
Computes the atmospheric absorption loss using the formula described in 3GPP TR 38....
double O2iHighLossTw(double frequency)
High-loss O2I penetration loss through the external wall, TR 38.901 Table 7.4.3-2.
constexpr double kO2iLowLossStd
Standard deviation in dB of the low-loss penetration loss, TR 38.901 Table 7.4.3-2.
double ComputeIonosphericPlusTroposphericScintillationLoss(double freq, double elevAngleQuantized, bool ionoScintLossEnabled, bool tropoScintLossEnabled)
Computes the ionospheric plus tropospheric scintillation loss using the formulas described in 3GPP TR...
double ComputeNtnPathloss(double freq, double dist3d)
Computes the free-space path loss using the formula described in 3GPP TR 38.811, Table 6....
const ns3::SpatialGaussianField kShadowFadingField
Shadow-fading random fields, one per (site, condition), see SpatialGaussianField.
const double atmosphericAbsorption[101]
Array containing the attenuation given by atmospheric absorption.
const std::map< int, float > troposphericScintillationLoss
Map containing the Tropospheric attenuation in dB with 99% probability at 20 GHz in Toulouse used for...
const std::map< int, std::vector< float > > SFCL_Urban
The map containing the 3GPP value regarding Shadow Fading and Clutter Loss tables for the NTN Urban s...
O2iPenetrationFieldKey
Field keys of kO2iPenetrationField.
@ DISTANCE_2D_IN_2
second uniform variable of the 2D-in distance
@ DISTANCE_2D_IN_1
first uniform variable of the 2D-in distance
@ DEVIATION
penetration loss deviation
double ComputeClutterLoss(double freq, const std::map< int, std::vector< float > > *sfcl, double elevAngleQuantized)
Computes the clutter loss using the formula described in 3GPP TR 38.811, Sec 6.6.6....
SFCL_params
The enumerator used for code clarity when performing parameter assignment in the GetLoss Methods.
constexpr double OUT_OF_DOMAIN_LOSS_DB
Finite, large loss returned for links outside the domain of the TR 38.811 model (non-positive elevati...
std::tuple< double, double > GetBsUtHeightsUmiStreetCanyon(double heightA, double heightB)
Get the base station and user terminal heights for the UmiStreetCanyon scenario.
const std::map< int, std::vector< float > > SFCL_DenseUrban
The map containing the 3GPP value regarding Shadow Fading and Clutter Loss tables for the NTN Dense U...
constexpr double kPenetrationDeviationCorrelationDistance
Correlation distance of the penetration loss deviation, TR 38.901 Sec. 7.6.3.3.
double O2iLowLossTw(double frequency)
Low-loss O2I penetration loss through the external wall, TR 38.901 Table 7.4.3-2.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeChecker > MakeDoubleChecker()
double CalculateDistance(const Vector3D &a, const Vector3D &b)
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Define a struct for the m_o2iLossMap entries.
Define a struct for the m_shadowingMap entries.