A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
channel-condition-model.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 SIGNET Lab, Department of Information Engineering,
3 * University of Padova
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
20
21#include "ns3/boolean.h"
22#include "ns3/double.h"
23#include "ns3/geocentric-constant-position-mobility-model.h"
24#include "ns3/log.h"
25#include "ns3/mobility-model.h"
26#include "ns3/node.h"
27#include "ns3/pointer.h"
28#include "ns3/simulator.h"
29#include "ns3/string.h"
30
31#include <cmath>
32
33namespace
34{
35
36/// NTN Dense Urban LOS probabilities from table 6.6.1-1 of 3GPP 38.811
37const std::map<int, double> DenseUrbanLOSProb{
38 {10, {28.2}},
39 {20, {33.1}},
40 {30, {39.8}},
41 {40, {46.8}},
42 {50, {53.7}},
43 {60, {61.2}},
44 {70, {73.8}},
45 {80, {82.0}},
46 {90, {98.1}},
47};
48
49/// NTN Urban LOS probabilities from table 6.6.1-1 of 3GPP 38.811
50const std::map<int, double> UrbanLOSProb{
51 {10, {24.6}},
52 {20, {38.6}},
53 {30, {49.3}},
54 {40, {61.3}},
55 {50, {72.6}},
56 {60, {80.5}},
57 {70, {91.9}},
58 {80, {96.8}},
59 {90, {99.2}},
60};
61
62/// NTN Suburban LOS probabilities from table 6.6.1-1 of 3GPP 38.811
63const std::map<int, double> SuburbanRuralLOSProb{
64 {10, {78.2}},
65 {20, {86.9}},
66 {30, {91.9}},
67 {40, {92.9}},
68 {50, {93.5}},
69 {60, {94.0}},
70 {70, {94.9}},
71 {80, {95.2}},
72 {90, {99.8}},
73};
74
75} // namespace
76
77namespace ns3
78{
79
80NS_LOG_COMPONENT_DEFINE("ChannelConditionModel");
81
82NS_OBJECT_ENSURE_REGISTERED(ChannelCondition);
83
84TypeId
86{
87 static TypeId tid =
88 TypeId("ns3::ChannelCondition").SetParent<Object>().SetGroupName("Propagation");
89 return tid;
90}
91
93 : m_losCondition(LosConditionValue::LC_ND),
94 m_o2iCondition(O2iConditionValue::O2I_ND),
95 m_o2iLowHighCondition(O2iLowHighConditionValue::LH_O2I_ND)
96{
97}
98
102{
103 m_losCondition = losCondition;
104 m_o2iCondition = o2iCondition;
105 m_o2iLowHighCondition = o2iLowHighCondition;
106}
107
109{
110}
111
114{
115 return m_losCondition;
116}
117
118void
120{
121 m_losCondition = cond;
122}
123
126{
127 return m_o2iCondition;
128}
129
130void
132{
133 m_o2iCondition = o2iCondition;
134}
135
138{
140}
141
142void
144{
145 m_o2iLowHighCondition = o2iLowHighCondition;
146}
147
148bool
150{
152}
153
154bool
156{
158}
159
160bool
162{
164}
165
166bool
168{
170}
171
172bool
174{
176}
177
178bool
180{
182}
183
184bool
186{
187 return m_losCondition == losCondition && m_o2iCondition == o2iCondition;
188}
189
190std::ostream&
192{
194 {
195 os << "LOS";
196 }
198 {
199 os << "NLOS";
200 }
202 {
203 os << "NLOSv";
204 }
205
206 return os;
207}
208
209// ------------------------------------------------------------------------- //
210
212
213TypeId
215{
216 static TypeId tid =
217 TypeId("ns3::ChannelConditionModel").SetParent<Object>().SetGroupName("Propagation");
218 return tid;
219}
220
222{
223}
224
226{
227}
228
229// ------------------------------------------------------------------------- //
230
232
233TypeId
235{
236 static TypeId tid = TypeId("ns3::AlwaysLosChannelConditionModel")
237 .SetParent<Object>()
238 .SetGroupName("Propagation")
239 .AddConstructor<AlwaysLosChannelConditionModel>();
240 return tid;
241}
242
244{
245}
246
248{
249}
250
253 Ptr<const MobilityModel> /* b */) const
254{
255 Ptr<ChannelCondition> c = CreateObject<ChannelCondition>(ChannelCondition::LOS);
256
257 return c;
258}
259
260int64_t
262{
263 return 0;
264}
265
266// ------------------------------------------------------------------------- //
267
269
270TypeId
272{
273 static TypeId tid = TypeId("ns3::NeverLosChannelConditionModel")
274 .SetParent<Object>()
275 .SetGroupName("Propagation")
276 .AddConstructor<NeverLosChannelConditionModel>();
277 return tid;
278}
279
281{
282}
283
285{
286}
287
290 Ptr<const MobilityModel> /* b */) const
291{
292 Ptr<ChannelCondition> c = CreateObject<ChannelCondition>(ChannelCondition::NLOS);
293
294 return c;
295}
296
297int64_t
299{
300 return 0;
301}
302
303// ------------------------------------------------------------------------- //
304
306
307TypeId
309{
310 static TypeId tid = TypeId("ns3::NeverLosVehicleChannelConditionModel")
312 .SetGroupName("Propagation")
313 .AddConstructor<NeverLosVehicleChannelConditionModel>();
314 return tid;
315}
316
318{
319}
320
322{
323}
324
327 Ptr<const MobilityModel> /* b */) const
328{
329 Ptr<ChannelCondition> c = CreateObject<ChannelCondition>(ChannelCondition::NLOSv);
330
331 return c;
332}
333
334int64_t
336{
337 return 0;
338}
339
340// ------------------------------------------------------------------------- //
341
343
344TypeId
346{
347 static TypeId tid =
348 TypeId("ns3::ThreeGppChannelConditionModel")
350 .SetGroupName("Propagation")
351 .AddAttribute(
352 "UpdatePeriod",
353 "Specifies the time period after which the channel "
354 "condition is recomputed. If set to 0, the channel condition is never updated.",
358 .AddAttribute("O2iThreshold",
359 "Specifies what will be the ratio of O2I channel "
360 "conditions. Default value is 0 that corresponds to 0 O2I losses.",
361 DoubleValue(0.0),
363 MakeDoubleChecker<double>(0, 1))
364 .AddAttribute("O2iLowLossThreshold",
365 "Specifies what will be the ratio of O2I "
366 "low - high penetration losses. Default value is 1.0 meaning that"
367 "all losses will be low",
368 DoubleValue(1.0),
370 MakeDoubleChecker<double>(0, 1))
371 .AddAttribute("LinkO2iConditionToAntennaHeight",
372 "Specifies whether the O2I condition will "
373 "be determined based on the UE height, i.e. if the UE height is 1.5 then "
374 "it is O2O, "
375 "otherwise it is O2I.",
376 BooleanValue(false),
380 return tid;
381}
382
385{
386 m_uniformVar = CreateObject<UniformRandomVariable>();
389
390 m_uniformVarO2i = CreateObject<UniformRandomVariable>();
391 m_uniformO2iLowHighLossVar = CreateObject<UniformRandomVariable>();
392}
393
395{
396}
397
398void
400{
401 m_channelConditionMap.clear();
402 m_updatePeriod = Seconds(0.0);
403}
404
408{
410
411 // get the key for this channel
412 uint32_t key = GetKey(a, b);
413
414 bool notFound = false; // indicates if the channel condition is not present in the map
415 bool update = false; // indicates if the channel condition has to be updated
416
417 // look for the channel condition in m_channelConditionMap
418 auto mapItem = m_channelConditionMap.find(key);
419 if (mapItem != m_channelConditionMap.end())
420 {
421 NS_LOG_DEBUG("found the channel condition in the map");
422 cond = mapItem->second.m_condition;
423
424 // check if it has to be updated
425 if (!m_updatePeriod.IsZero() &&
426 Simulator::Now() - mapItem->second.m_generatedTime > m_updatePeriod)
427 {
428 NS_LOG_DEBUG("it has to be updated");
429 update = true;
430 }
431 }
432 else
433 {
434 NS_LOG_DEBUG("channel condition not found");
435 notFound = true;
436 }
437
438 // if the channel condition was not found or if it has to be updated
439 // generate a new channel condition
440 if (notFound || update)
441 {
442 cond = ComputeChannelCondition(a, b);
443 // store the channel condition in m_channelConditionMap, used as cache.
444 // For this reason you see a const_cast.
445 Item mapItem;
446 mapItem.m_condition = cond;
448 const_cast<ThreeGppChannelConditionModel*>(this)->m_channelConditionMap[key] = mapItem;
449 }
450
451 return cond;
452}
453
457{
458 double o2iProb = m_uniformVarO2i->GetValue(0, 1);
459
461 {
462 if (std::min(a->GetPosition().z, b->GetPosition().z) == 1.5)
463 {
465 }
466 else
467 {
469 }
470 }
471 else
472 {
473 if (o2iProb < m_o2iThreshold)
474 {
475 NS_LOG_INFO("Return O2i condition ....");
477 }
478 else
479 {
480 NS_LOG_INFO("Return O2o condition ....");
482 }
483 }
484}
485
489{
490 NS_LOG_FUNCTION(this << a << b);
491 Ptr<ChannelCondition> cond = CreateObject<ChannelCondition>();
492
493 // compute the LOS probability
494 double pLos = ComputePlos(a, b);
495 double pNlos = ComputePnlos(a, b);
496
497 // draw a random value
498 double pRef = m_uniformVar->GetValue();
499
500 NS_LOG_DEBUG("pRef " << pRef << " pLos " << pLos << " pNlos " << pNlos);
501
502 // get the channel condition
503 if (pRef <= pLos)
504 {
505 // LOS
506 cond->SetLosCondition(ChannelCondition::LosConditionValue::LOS);
507 }
508 else if (pRef <= pLos + pNlos)
509 {
510 // NLOS
511 cond->SetLosCondition(ChannelCondition::LosConditionValue::NLOS);
512 }
513 else
514 {
515 // NLOSv (added to support vehicular scenarios)
516 cond->SetLosCondition(ChannelCondition::LosConditionValue::NLOSv);
517 }
518
519 cond->SetO2iCondition(ComputeO2i(a, b));
520
521 if (cond->GetO2iCondition() == ChannelCondition::O2iConditionValue::O2I)
522 {
523 // Since we have O2I penetration losses, we should choose based on the
524 // threshold if it will be low or high penetration losses
525 // (see TR38.901 Table 7.4.3)
526 double o2iLowHighLossProb = m_uniformO2iLowHighLossVar->GetValue(0, 1);
528
529 if (o2iLowHighLossProb < m_o2iLowLossThreshold)
530 {
532 }
533 else
534 {
536 }
537 cond->SetO2iLowHighCondition(lowHighLossCondition);
538 }
539
540 return cond;
541}
542
543double
546{
547 NS_LOG_FUNCTION(this << a << b);
548 // by default returns 1 - PLOS
549 return (1 - ComputePlos(a, b));
550}
551
552int64_t
554{
555 m_uniformVar->SetStream(stream);
556 m_uniformVarO2i->SetStream(stream + 1);
558
559 return 3;
560}
561
562double
564{
565 double x = a.x - b.x;
566 double y = a.y - b.y;
567 double distance2D = sqrt(x * x + y * y);
568
569 return distance2D;
570}
571
574{
575 // use the nodes ids to obtain a unique key for the channel between a and b
576 // sort the nodes ids so that the key is reciprocal
577 uint32_t x1 = std::min(a->GetObject<Node>()->GetId(), b->GetObject<Node>()->GetId());
578 uint32_t x2 = std::max(a->GetObject<Node>()->GetId(), b->GetObject<Node>()->GetId());
579
580 // use the cantor function to obtain the key
581 uint32_t key = (((x1 + x2) * (x1 + x2 + 1)) / 2) + x2;
582
583 return key;
584}
585
586std::tuple<double, double>
589{
590 Ptr<MobilityModel> aMobNonConst = ConstCast<MobilityModel>(a);
591 Ptr<MobilityModel> bMobNonConst = ConstCast<MobilityModel>(b);
592
593 // check if aMob and bMob are of type GeocentricConstantPositionMobilityModel
594 auto aNTNMob = DynamicCast<GeocentricConstantPositionMobilityModel>(aMobNonConst);
595 auto bNTNMob = DynamicCast<GeocentricConstantPositionMobilityModel>(bMobNonConst);
596 NS_ASSERT_MSG(aNTNMob && bNTNMob,
597 "Mobility Models need to be of type Geocentric for NTN scenarios");
598
599 double elevAngle = aNTNMob->GetElevationAngle(bNTNMob);
600 // Round the elevation angle into a two-digits integer between 10 and 90, as specified in
601 // Sec. 6.6.1, 3GPP TR 38.811 v15.4.0
602 int elevAngleQuantized = (elevAngle < 10) ? 10 : round(elevAngle / 10) * 10;
603 NS_ASSERT_MSG((elevAngleQuantized >= 10) && (elevAngleQuantized <= 90),
604 "Invalid elevation angle!");
605
606 return std::make_tuple(elevAngle, elevAngleQuantized);
607};
608
609// ------------------------------------------------------------------------- //
610
612
613TypeId
615{
616 static TypeId tid = TypeId("ns3::ThreeGppRmaChannelConditionModel")
618 .SetGroupName("Propagation")
619 .AddConstructor<ThreeGppRmaChannelConditionModel>();
620 return tid;
621}
622
625{
626}
627
629{
630}
631
632double
635{
636 // compute the 2D distance between a and b
637 double distance2D = Calculate2dDistance(a->GetPosition(), b->GetPosition());
638
639 // NOTE: no indication is given about the heights of the BS and the UT used
640 // to derive the LOS probability
641
642 // compute the LOS probability (see 3GPP TR 38.901, Sec. 7.4.2)
643 double pLos = 0.0;
644 if (distance2D <= 10.0)
645 {
646 pLos = 1.0;
647 }
648 else
649 {
650 pLos = exp(-(distance2D - 10.0) / 1000.0);
651 }
652
653 return pLos;
654}
655
656// ------------------------------------------------------------------------- //
657
659
660TypeId
662{
663 static TypeId tid = TypeId("ns3::ThreeGppUmaChannelConditionModel")
665 .SetGroupName("Propagation")
666 .AddConstructor<ThreeGppUmaChannelConditionModel>();
667 return tid;
668}
669
672{
673}
674
676{
677}
678
679double
682{
683 // compute the 2D distance between a and b
684 double distance2D = Calculate2dDistance(a->GetPosition(), b->GetPosition());
685
686 // retrieve h_UT, it should be smaller than 23 m
687 double h_UT = std::min(a->GetPosition().z, b->GetPosition().z);
688 if (h_UT > 23.0)
689 {
691 "The height of the UT should be smaller than 23 m (see TR 38.901, Table 7.4.2-1)");
692 }
693
694 // retrieve h_BS, it should be equal to 25 m
695 double h_BS = std::max(a->GetPosition().z, b->GetPosition().z);
696 if (h_BS != 25.0)
697 {
698 NS_LOG_WARN("The LOS probability was derived assuming BS antenna heights of 25 m (see TR "
699 "38.901, Table 7.4.2-1)");
700 }
701
702 // compute the LOS probability (see 3GPP TR 38.901, Sec. 7.4.2)
703 double pLos = 0.0;
704 if (distance2D <= 18.0)
705 {
706 pLos = 1.0;
707 }
708 else
709 {
710 // compute C'(h_UT)
711 double c = 0.0;
712 if (h_UT <= 13.0)
713 {
714 c = 0;
715 }
716 else
717 {
718 c = pow((h_UT - 13.0) / 10.0, 1.5);
719 }
720
721 pLos = (18.0 / distance2D + exp(-distance2D / 63.0) * (1.0 - 18.0 / distance2D)) *
722 (1.0 + c * 5.0 / 4.0 * pow(distance2D / 100.0, 3.0) * exp(-distance2D / 150.0));
723 }
724
725 return pLos;
726}
727
728// ------------------------------------------------------------------------- //
729
731
732TypeId
734{
735 static TypeId tid = TypeId("ns3::ThreeGppUmiStreetCanyonChannelConditionModel")
737 .SetGroupName("Propagation")
739 return tid;
740}
741
744{
745}
746
748{
749}
750
751double
754{
755 // compute the 2D distance between a and b
756 double distance2D = Calculate2dDistance(a->GetPosition(), b->GetPosition());
757
758 // NOTE: no indication is given about the UT height used to derive the
759 // LOS probability
760
761 // h_BS should be equal to 10 m. We check if at least one of the two
762 // nodes has height equal to 10 m
763 if (a->GetPosition().z != 10.0 && b->GetPosition().z != 10.0)
764 {
765 NS_LOG_WARN("The LOS probability was derived assuming BS antenna heights of 10 m (see TR "
766 "38.901, Table 7.4.2-1)");
767 }
768
769 // compute the LOS probability (see 3GPP TR 38.901, Sec. 7.4.2)
770 double pLos = 0.0;
771 if (distance2D <= 18.0)
772 {
773 pLos = 1.0;
774 }
775 else
776 {
777 pLos = 18.0 / distance2D + exp(-distance2D / 36.0) * (1.0 - 18.0 / distance2D);
778 }
779
780 return pLos;
781}
782
783// ------------------------------------------------------------------------- //
784
786
787TypeId
789{
790 static TypeId tid = TypeId("ns3::ThreeGppIndoorMixedOfficeChannelConditionModel")
792 .SetGroupName("Propagation")
794 return tid;
795}
796
799{
800}
801
803{
804}
805
806double
809{
810 // compute the 2D distance between a and b
811 double distance2D = Calculate2dDistance(a->GetPosition(), b->GetPosition());
812
813 // NOTE: no indication is given about the UT height used to derive the
814 // LOS probability
815
816 // retrieve h_BS, it should be equal to 3 m
817 double h_BS = std::max(a->GetPosition().z, b->GetPosition().z);
818 if (h_BS != 3.0)
819 {
820 NS_LOG_WARN("The LOS probability was derived assuming BS antenna heights of 3 m (see TR "
821 "38.901, Table 7.4.2-1)");
822 }
823
824 // compute the LOS probability (see 3GPP TR 38.901, Sec. 7.4.2)
825 double pLos = 0.0;
826 if (distance2D <= 1.2)
827 {
828 pLos = 1.0;
829 }
830 else if (distance2D > 1.2 && distance2D < 6.5)
831 {
832 pLos = exp(-(distance2D - 1.2) / 4.7);
833 }
834 else
835 {
836 pLos = exp(-(distance2D - 6.5) / 32.6) * 0.32;
837 }
838
839 return pLos;
840}
841
842// ------------------------------------------------------------------------- //
843
845
846TypeId
848{
849 static TypeId tid = TypeId("ns3::ThreeGppIndoorOpenOfficeChannelConditionModel")
851 .SetGroupName("Propagation")
853 return tid;
854}
855
858{
859}
860
862{
863}
864
865double
868{
869 // compute the 2D distance between a and b
870 double distance2D = Calculate2dDistance(a->GetPosition(), b->GetPosition());
871
872 // NOTE: no indication is given about the UT height used to derive the
873 // LOS probability
874
875 // retrieve h_BS, it should be equal to 3 m
876 double h_BS = std::max(a->GetPosition().z, b->GetPosition().z);
877 if (h_BS != 3.0)
878 {
879 NS_LOG_WARN("The LOS probability was derived assuming BS antenna heights of 3 m (see TR "
880 "38.901, Table 7.4.2-1)");
881 }
882
883 // compute the LOS probability (see 3GPP TR 38.901, Sec. 7.4.2)
884 double pLos = 0.0;
885 if (distance2D <= 5.0)
886 {
887 pLos = 1.0;
888 }
889 else if (distance2D > 5.0 && distance2D <= 49.0)
890 {
891 pLos = exp(-(distance2D - 5.0) / 70.8);
892 }
893 else
894 {
895 pLos = exp(-(distance2D - 49.0) / 211.7) * 0.54;
896 }
897
898 return pLos;
899}
900
901// ------------------------------------------------------------------------- //
902
904
905TypeId
907{
908 static TypeId tid = TypeId("ns3::ThreeGppNTNDenseUrbanChannelConditionModel")
910 .SetGroupName("Propagation")
912 return tid;
913}
914
915double
918{
919 // Compute the LOS probability (see 3GPP TR 38.811, Table 6.6.1-1).
920 // The elevation angle is first quantized to one of the reference angles.
921 auto [elevAngle, quantizedElevAngle] = GetQuantizedElevationAngle(a, b);
922 return DenseUrbanLOSProb.at(quantizedElevAngle);
923}
924
925// ------------------------------------------------------------------------- //
926
928
929TypeId
931{
932 static TypeId tid = TypeId("ns3::ThreeGppNTNUrbanChannelConditionModel")
934 .SetGroupName("Propagation")
935 .AddConstructor<ThreeGppNTNUrbanChannelConditionModel>();
936 return tid;
937}
938
939double
942{
943 // Compute the LOS probability (see 3GPP TR 38.811, Table 6.6.1-1).
944 // The elevation angle is first quantized to one of the reference angles.
945 auto [elevAngle, quantizedElevAngle] = GetQuantizedElevationAngle(a, b);
946 return UrbanLOSProb.at(quantizedElevAngle);
947}
948
949// ------------------------------------------------------------------------- //
950
952
953TypeId
955{
956 static TypeId tid = TypeId("ns3::ThreeGppNTNSuburbanChannelConditionModel")
958 .SetGroupName("Propagation")
960 return tid;
961}
962
963double
966{
967 // Compute the LOS probability (see 3GPP TR 38.811, Table 6.6.1-1).
968 // The elevation angle is first quantized to one of the reference angles.
969 auto [elevAngle, quantizedElevAngle] = GetQuantizedElevationAngle(a, b);
970 return SuburbanRuralLOSProb.at(quantizedElevAngle);
971}
972
973// ------------------------------------------------------------------------- //
974
976
977TypeId
979{
980 static TypeId tid = TypeId("ns3::ThreeGppNTNRuralChannelConditionModel")
982 .SetGroupName("Propagation")
983 .AddConstructor<ThreeGppNTNRuralChannelConditionModel>();
984 return tid;
985}
986
987double
990{
991 // Compute the LOS probability (see 3GPP TR 38.811, Table 6.6.1-1).
992 // The elevation angle is first quantized to one of the reference angles.
993 auto [elevAngle, quantizedElevAngle] = GetQuantizedElevationAngle(a, b);
994 return SuburbanRuralLOSProb.at(quantizedElevAngle);
995}
996
997} // end namespace ns3
Models an always in-LoS condition model.
int64_t AssignStreams(int64_t stream) override
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
static TypeId GetTypeId()
Get the type ID.
Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Computes the condition of the channel between a and b, that will be always LoS.
LosConditionValue m_losCondition
contains the information about the LOS state of the channel
O2iLowHighConditionValue m_o2iLowHighCondition
contains the information about the O2I low-high building penetration losses
bool IsO2i() const
Return true if the channel is outdoor-to-indoor.
ChannelCondition()
Constructor for the ChannelCondition class.
void SetLosCondition(LosConditionValue losCondition)
Set the LosConditionValue with the information about the LOS/NLOS state of the channel.
LosConditionValue GetLosCondition() const
Get the LosConditionValue containing the information about the LOS/NLOS state of the channel.
bool IsNlos() const
Return true if the channel condition is NLOS.
bool IsEqual(LosConditionValue losCondition, O2iConditionValue o2iCondition) const
Return true if this instance is equivalent to the one passed as argument.
O2iConditionValue m_o2iCondition
contains the information about the O2I state of the channel
bool IsNlosv() const
Return true if the channel condition is NLOSv.
bool IsLos() const
Return true if the channel condition is LOS.
void SetO2iCondition(O2iConditionValue o2iCondition)
Set the O2iConditionValue containing the information about the O2I state of the channel.
~ChannelCondition() override
Destructor for the ChannelCondition class.
O2iLowHighConditionValue GetO2iLowHighCondition() const
Get the O2iLowHighConditionValue containing the information about the O2I building penetration losses...
bool IsO2o() const
Return true if the channel is outdoor-to-outdoor.
bool IsI2i() const
Return true if the channel is indoor-to-indoor.
static TypeId GetTypeId()
Get the type ID.
O2iConditionValue
Possible values for Outdoor to Indoor condition.
@ O2O
Outdoor to Outdoor.
O2iLowHighConditionValue
Possible values for Low-High Penetration Loss condition.
@ LOW
Low Penetration Losses.
@ HIGH
High Penetration Losses.
void SetO2iLowHighCondition(O2iLowHighConditionValue o2iLowHighCondition)
Set the O2iLowHighConditionValue containing the information about the O2I building penetration losses...
O2iConditionValue GetO2iCondition() const
Get the O2iConditionValue containing the information about the O2I state of the channel.
LosConditionValue
Possible values for Line-of-Sight condition.
@ NLOSv
Non Line of Sight due to a vehicle.
Models the channel condition.
static TypeId GetTypeId()
Get the type ID.
ChannelConditionModel()
Constructor for the ChannelConditionModel class.
~ChannelConditionModel() override
Destructor for the ChannelConditionModel class.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
Models a never in-LoS condition model.
static TypeId GetTypeId()
Get the type ID.
~NeverLosChannelConditionModel() override
Destructor.
Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Computes the condition of the channel between a and b, that will be always non-LoS.
int64_t AssignStreams(int64_t stream) override
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
Models a never in-LoS condition model caused by a blocking vehicle.
int64_t AssignStreams(int64_t stream) override
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Computes the condition of the channel between a and b, that will be always NLOSv.
A network Node.
Definition: node.h:57
uint32_t GetId() const
Definition: node.cc:117
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:211
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:208
Base class for the 3GPP channel condition models.
int64_t AssignStreams(int64_t stream) override
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
void DoDispose() override
Destructor implementation.
Ptr< UniformRandomVariable > m_uniformVarO2i
uniform random variable that is used for the generation of the O2i conditions
virtual ChannelCondition::O2iConditionValue ComputeO2i(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const
Determines whether the channel condition is O2I or O2O.
static uint32_t GetKey(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b)
Returns a unique and reciprocal key for the channel between a and b.
Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Retrieve the condition of the channel between a and b.
~ThreeGppChannelConditionModel() override
Destructor for the ThreeGppRmaChannelConditionModel class.
Ptr< UniformRandomVariable > m_uniformO2iLowHighLossVar
a uniform random variable for the calculation of the low/high losses, see TR38.901 Table 7....
double m_o2iLowLossThreshold
the threshold for determining what is the ratio of low - high O2I building penetration losses
static double Calculate2dDistance(const Vector &a, const Vector &b)
Computes the 2D distance between two 3D vectors.
virtual double ComputePnlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const
Compute the NLOS probability.
double m_o2iThreshold
the threshold for determining what is the ratio of channels with O2I
virtual double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const =0
Compute the LOS probability.
std::unordered_map< uint32_t, Item > m_channelConditionMap
map to store the channel conditions
Ptr< UniformRandomVariable > m_uniformVar
uniform random variable
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].
ThreeGppChannelConditionModel()
Constructor for the ThreeGppRmaChannelConditionModel class.
Ptr< ChannelCondition > ComputeChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const
This method computes the channel condition based on a probabilistic model that is specific for the sc...
bool m_linkO2iConditionToAntennaHeight
the indicator that determines whether the O2I/O2O condition is determined based on the UE height
Time m_updatePeriod
the update period for the channel condition
static TypeId GetTypeId()
Get the type ID.
Computes the channel condition for the Indoor Mixed Office scenario.
ThreeGppIndoorMixedOfficeChannelConditionModel()
Constructor for the ThreeGppIndoorMixedOfficeChannelConditionModel class.
~ThreeGppIndoorMixedOfficeChannelConditionModel() override
Destructor for the ThreeGppIndoorMixedOfficeChannelConditionModel class.
double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability as specified in Table 7.4.2-1 of 3GPP TR 38.901 for the Indoor Mixed Offi...
Computes the channel condition for the Indoor Open Office scenario.
ThreeGppIndoorOpenOfficeChannelConditionModel()
Constructor for the ThreeGppIndoorOpenOfficeChannelConditionModel class.
double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability as specified in Table 7.4.2-1 of 3GPP TR 38.901 for the Indoor Open Offic...
~ThreeGppIndoorOpenOfficeChannelConditionModel() override
Destructor for the ThreeGppIndoorOpenOfficeChannelConditionModel class.
Computes the channel condition for the NTN Dense Urban Scenario.
double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability.
Computes the channel condition for the NTN Rural Scenario.
double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability.
static TypeId GetTypeId()
Register this type.
Computes the channel condition for the NTN Suburban Scenario.
double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability.
Computes the channel condition for the NTN Urban Scenario.
static TypeId GetTypeId()
Register this type.
double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability.
Computes the channel condition for the RMa scenario.
~ThreeGppRmaChannelConditionModel() override
Destructor for the ThreeGppRmaChannelConditionModel class.
double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability as specified in Table 7.4.2-1 of 3GPP TR 38.901 for the RMa scenario.
ThreeGppRmaChannelConditionModel()
Constructor for the ThreeGppRmaChannelConditionModel class.
static TypeId GetTypeId()
Get the type ID.
Computes the channel condition for the UMa scenario.
static TypeId GetTypeId()
Get the type ID.
ThreeGppUmaChannelConditionModel()
Constructor for the ThreeGppUmaChannelConditionModel class.
double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability as specified in Table 7.4.2-1 of 3GPP TR 38.901 for the UMa scenario.
~ThreeGppUmaChannelConditionModel() override
Destructor for the ThreeGppUmaChannelConditionModel class.
Computes the channel condition for the UMi-Street canyon scenario.
ThreeGppUmiStreetCanyonChannelConditionModel()
Constructor for the ThreeGppUmiStreetCanyonChannelConditionModel class.
~ThreeGppUmiStreetCanyonChannelConditionModel() override
Destructor for the ThreeGppUmiStreetCanyonChannelConditionModel class.
double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability as specified in Table 7.4.2-1 of 3GPP TR 38.901 for the UMi-Street Canyon...
bool IsZero() const
Exactly equivalent to t == 0.
Definition: nstime.h:315
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
double GetValue(double min, double max)
Get the next random value drawn from the distribution.
#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
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#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.
Definition: log.h:261
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:275
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1319
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1331
const std::map< int, double > SuburbanRuralLOSProb
NTN Suburban LOS probabilities from table 6.6.1-1 of 3GPP 38.811.
const std::map< int, double > UrbanLOSProb
NTN Urban LOS probabilities from table 6.6.1-1 of 3GPP 38.811.
const std::map< int, double > DenseUrbanLOSProb
NTN Dense Urban LOS probabilities from table 6.6.1-1 of 3GPP 38.811.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition: boolean.cc:124
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition: nstime.h:1407
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:159
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition: boolean.h:81
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition: double.h:43
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Definition: nstime.h:1427
Struct to store the channel condition in the m_channelConditionMap.
Ptr< ChannelCondition > m_condition
the channel condition
Time m_generatedTime
the time when the condition was generated