A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
propagation-loss-model.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005,2006,2007 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 * Contributions: Timo Bingmann <timo.bingmann@student.kit.edu>
8 * Contributions: Tom Hewer <tomhewer@mac.com> for Two Ray Ground Model
9 * Pavel Boyko <boyko@iitp.ru> for matrix
10 */
11
13
14#include "ns3/boolean.h"
15#include "ns3/double.h"
16#include "ns3/log.h"
17#include "ns3/mobility-model.h"
18#include "ns3/node.h"
19#include "ns3/pointer.h"
20#include "ns3/string.h"
21
22#include <cmath>
23
24namespace ns3
25{
26
27NS_LOG_COMPONENT_DEFINE("PropagationLossModel");
28
29// ------------------------------------------------------------------------- //
30
32
35{
36 static TypeId tid =
37 TypeId("ns3::PropagationLossModel").SetParent<Object>().SetGroupName("Propagation");
38 return tid;
39}
40
45
49
50void
55
61
62double
65 Ptr<MobilityModel> b) const
66{
67 double self = DoCalcRxPower(txPowerDbm, a, b);
68 if (m_next)
69 {
70 self = m_next->CalcRxPower(self, a, b);
71 }
72 return self;
73}
74
75int64_t
77{
78 int64_t currentStream = stream;
79 currentStream += DoAssignStreams(stream);
80 if (m_next)
81 {
82 currentStream += m_next->AssignStreams(currentStream);
83 }
84 return (currentStream - stream);
85}
86
87// ------------------------------------------------------------------------- //
88
90
93{
94 static TypeId tid =
95 TypeId("ns3::RandomPropagationLossModel")
97 .SetGroupName("Propagation")
98 .AddConstructor<RandomPropagationLossModel>()
99 .AddAttribute(
100 "Variable",
101 "The random variable used to pick a loss every time CalcRxPower is invoked.",
102 StringValue("ns3::ConstantRandomVariable[Constant=1.0]"),
105 return tid;
106}
107
112
116
117double
120 Ptr<MobilityModel> b) const
121{
122 double rxc = -m_variable->GetValue();
123 NS_LOG_DEBUG("attenuation coefficient=" << rxc << "Db");
124 return txPowerDbm + rxc;
125}
126
127int64_t
129{
130 m_variable->SetStream(stream);
131 return 1;
132}
133
134// ------------------------------------------------------------------------- //
135
137
138TypeId
140{
141 static TypeId tid =
142 TypeId("ns3::FriisPropagationLossModel")
144 .SetGroupName("Propagation")
145 .AddConstructor<FriisPropagationLossModel>()
146 .AddAttribute(
147 "Frequency",
148 "The carrier frequency (in Hz) at which propagation occurs (default is 5.15 GHz).",
149 DoubleValue(5.150e9),
153 .AddAttribute("SystemLoss",
154 "The system loss (linear factor >= 1, not in dB)",
155 DoubleValue(1.0),
159 .AddAttribute("MinLoss",
160 "The minimum value (dB) of the total loss, used at short ranges.",
161 DoubleValue(0.0),
165 return tid;
166}
167
171
172void
174{
175 NS_ABORT_MSG_UNLESS(systemLoss >= 1, "System loss less than 1 corresponds to gain");
176 m_systemLoss = systemLoss;
177}
178
179double
184
185void
187{
188 m_minLoss = minLoss;
189}
190
191double
196
197void
199{
200 m_frequency = frequency;
201 static const double C = 299792458.0; // speed of light in vacuum
202 m_lambda = C / frequency;
203}
204
205double
210
211double
213{
214 double mw = std::pow(10.0, dbm / 10.0);
215 return mw / 1000.0;
216}
217
218double
220{
221 double dbm = std::log10(w * 1000.0) * 10.0;
222 return dbm;
223}
224
225double
228 Ptr<MobilityModel> b) const
229{
230 /*
231 * Friis free space equation:
232 * where Pt, Gr, Gr and P are in Watt units
233 * L is in meter units.
234 *
235 * P Gt * Gr * (lambda^2)
236 * --- = ---------------------
237 * Pt (4 * pi * d)^2 * L
238 *
239 * Gt: tx gain (unit-less)
240 * Gr: rx gain (unit-less)
241 * Pt: tx power (W)
242 * d: distance (m)
243 * L: system loss
244 * lambda: wavelength (m)
245 *
246 * Here, we ignore tx and rx gain and the input and output values
247 * are in dB or dBm:
248 *
249 * lambda^2
250 * rx = tx + 10 log10 (-------------------)
251 * (4 * pi * d)^2 * L
252 *
253 * rx: rx power (dB)
254 * tx: tx power (dB)
255 * d: distance (m)
256 * L: system loss (unit-less)
257 * lambda: wavelength (m)
258 */
259 double distance = a->GetDistanceFrom(b);
260 if (distance < 3 * m_lambda)
261 {
263 "distance not within the far field region => inaccurate propagation loss value");
264 }
265 if (distance <= 0)
266 {
267 return txPowerDbm - m_minLoss;
268 }
269 double numerator = m_lambda * m_lambda;
270 double denominator = 16 * M_PI * M_PI * distance * distance * m_systemLoss;
271 double lossDb = -10 * log10(numerator / denominator);
272 NS_LOG_DEBUG("distance=" << distance << "m, loss=" << lossDb << "dB");
273 return txPowerDbm - std::max(lossDb, m_minLoss);
274}
275
276int64_t
278{
279 return 0;
280}
281
282// ------------------------------------------------------------------------- //
283// -- Two-Ray Ground Model ported from NS-2 -- tomhewer@mac.com -- Nov09 //
284
286
287TypeId
289{
290 static TypeId tid =
291 TypeId("ns3::TwoRayGroundPropagationLossModel")
293 .SetGroupName("Propagation")
294 .AddConstructor<TwoRayGroundPropagationLossModel>()
295 .AddAttribute(
296 "Frequency",
297 "The carrier frequency (in Hz) at which propagation occurs (default is 5.15 GHz).",
298 DoubleValue(5.150e9),
302 .AddAttribute("SystemLoss",
303 "The system loss (linear factor >= 1, not in dB)",
304 DoubleValue(1.0),
308 .AddAttribute(
309 "MinDistance",
310 "The distance under which the propagation model refuses to give results (m)",
311 DoubleValue(0.5),
315 .AddAttribute("HeightAboveZ",
316 "The height of the antenna (m) above the node's Z coordinate",
317 DoubleValue(0),
320 return tid;
321}
322
326
327void
329{
330 NS_ABORT_MSG_UNLESS(systemLoss >= 1, "System loss less than 1 corresponds to gain");
331 m_systemLoss = systemLoss;
332}
333
334double
339
340void
342{
343 m_minDistance = minDistance;
344}
345
346double
351
352void
354{
355 m_heightAboveZ = heightAboveZ;
356}
357
358void
360{
361 m_frequency = frequency;
362 static const double C = 299792458.0; // speed of light in vacuum
363 m_lambda = C / frequency;
364}
365
366double
371
372double
374{
375 double mw = std::pow(10.0, dbm / 10.0);
376 return mw / 1000.0;
377}
378
379double
381{
382 double dbm = std::log10(w * 1000.0) * 10.0;
383 return dbm;
384}
385
386double
389 Ptr<MobilityModel> b) const
390{
391 /*
392 * Two-Ray Ground equation:
393 *
394 * where Pt, Gt and Gr are in dBm units
395 * L, Ht and Hr are in meter units.
396 *
397 * Pr Gt * Gr * (Ht^2 * Hr^2)
398 * -- = (-------------------------)
399 * Pt d^4 * L
400 *
401 * Gt: tx gain (unit-less)
402 * Gr: rx gain (unit-less)
403 * Pt: tx power (dBm)
404 * d: distance (m)
405 * L: system loss
406 * Ht: Tx antenna height (m)
407 * Hr: Rx antenna height (m)
408 * lambda: wavelength (m)
409 *
410 * As with the Friis model we ignore tx and rx gain and output values
411 * are in dB or dBm
412 *
413 * (Ht * Ht) * (Hr * Hr)
414 * rx = tx + 10 log10 (-----------------------)
415 * (d * d * d * d) * L
416 */
417 double distance = a->GetDistanceFrom(b);
418 if (distance <= m_minDistance)
419 {
420 return txPowerDbm;
421 }
422
423 // Set the height of the Tx and Rx antennae
424 double txAntHeight = a->GetPosition().z + m_heightAboveZ;
425 double rxAntHeight = b->GetPosition().z + m_heightAboveZ;
426
427 // Calculate a crossover distance, under which we use Friis
428 /*
429 *
430 * dCross = (4 * pi * Ht * Hr) / lambda
431 *
432 */
433
434 double dCross = (4 * M_PI * txAntHeight * rxAntHeight) / m_lambda;
435 double tmp = 0;
436 if (distance <= dCross)
437 {
438 // We use Friis
439 double numerator = m_lambda * m_lambda;
440 tmp = M_PI * distance;
441 double denominator = 16 * tmp * tmp * m_systemLoss;
442 double pr = 10 * std::log10(numerator / denominator);
443 NS_LOG_DEBUG("Receiver within crossover (" << dCross << "m) for Two_ray path; using Friis");
444 NS_LOG_DEBUG("distance=" << distance << "m, attenuation coefficient=" << pr << "dB");
445 return txPowerDbm + pr;
446 }
447 else // Use Two-Ray Pathloss
448 {
449 tmp = txAntHeight * rxAntHeight;
450 double rayNumerator = tmp * tmp;
451 tmp = distance * distance;
452 double rayDenominator = tmp * tmp * m_systemLoss;
453 double rayPr = 10 * std::log10(rayNumerator / rayDenominator);
454 NS_LOG_DEBUG("distance=" << distance << "m, attenuation coefficient=" << rayPr << "dB");
455 return txPowerDbm + rayPr;
456 }
457}
458
459int64_t
461{
462 return 0;
463}
464
465// ------------------------------------------------------------------------- //
466
468
469TypeId
471{
472 static TypeId tid =
473 TypeId("ns3::LogDistancePropagationLossModel")
475 .SetGroupName("Propagation")
476 .AddConstructor<LogDistancePropagationLossModel>()
477 .AddAttribute("Exponent",
478 "The exponent of the Path Loss propagation model",
479 DoubleValue(3.0),
482 .AddAttribute("ReferenceDistance",
483 "The distance at which the reference loss is calculated (m)",
484 DoubleValue(1.0),
487 .AddAttribute("ReferenceLoss",
488 "The reference loss at reference distance (dB). (Default is Friis at 1m "
489 "with 5.15 GHz)",
490 DoubleValue(46.6777),
493 return tid;
494}
495
499
500void
505
506void
507LogDistancePropagationLossModel::SetReference(double referenceDistance, double referenceLoss)
508{
509 m_referenceDistance = referenceDistance;
510 m_referenceLoss = referenceLoss;
511}
512
513double
518
519double
522 Ptr<MobilityModel> b) const
523{
524 double distance = a->GetDistanceFrom(b);
525 if (distance <= m_referenceDistance)
526 {
527 NS_LOG_DEBUG("distance=" << distance << "m, reference-attenuation=" << -m_referenceLoss
528 << "dB, no further attenuation");
529 return txPowerDbm - m_referenceLoss;
530 }
531 /**
532 * The formula is:
533 * rx = 10 * log (Pr0(tx)) - n * 10 * log (d/d0)
534 *
535 * Pr0: rx power at reference distance d0 (W)
536 * d0: reference distance: 1.0 (m)
537 * d: distance (m)
538 * tx: tx power (dB)
539 * rx: dB
540 *
541 * Which, in our case is:
542 *
543 * rx = rx0(tx) - 10 * n * log (d/d0)
544 */
545 double pathLossDb = 10 * m_exponent * std::log10(distance / m_referenceDistance);
546 double rxc = -m_referenceLoss - pathLossDb;
547 NS_LOG_DEBUG("distance=" << distance << "m, reference-attenuation=" << -m_referenceLoss
548 << "dB, "
549 << "attenuation coefficient=" << rxc << "db");
550 return txPowerDbm + rxc;
551}
552
553int64_t
555{
556 return 0;
557}
558
559// ------------------------------------------------------------------------- //
560
562
563TypeId
565{
566 static TypeId tid =
567 TypeId("ns3::ThreeLogDistancePropagationLossModel")
569 .SetGroupName("Propagation")
570 .AddConstructor<ThreeLogDistancePropagationLossModel>()
571 .AddAttribute("Distance0",
572 "Beginning of the first (near) distance field",
573 DoubleValue(1.0),
576 .AddAttribute("Distance1",
577 "Beginning of the second (middle) distance field.",
578 DoubleValue(200.0),
581 .AddAttribute("Distance2",
582 "Beginning of the third (far) distance field.",
583 DoubleValue(500.0),
586 .AddAttribute("Exponent0",
587 "The exponent for the first field.",
588 DoubleValue(1.9),
591 .AddAttribute("Exponent1",
592 "The exponent for the second field.",
593 DoubleValue(3.8),
596 .AddAttribute("Exponent2",
597 "The exponent for the third field.",
598 DoubleValue(3.8),
601 .AddAttribute(
602 "ReferenceLoss",
603 "The reference loss at distance d0 (dB). (Default is Friis at 1m with 5.15 GHz)",
604 DoubleValue(46.6777),
607 return tid;
608}
609
613
614double
617 Ptr<MobilityModel> b) const
618{
619 double distance = a->GetDistanceFrom(b);
620 NS_ASSERT(distance >= 0);
621
622 // See doxygen comments for the formula and explanation
623
624 double pathLossDb;
625
626 if (distance < m_distance0)
627 {
628 pathLossDb = 0;
629 }
630 else if (distance < m_distance1)
631 {
632 pathLossDb = m_referenceLoss + 10 * m_exponent0 * std::log10(distance / m_distance0);
633 }
634 else if (distance < m_distance2)
635 {
636 pathLossDb = m_referenceLoss + 10 * m_exponent0 * std::log10(m_distance1 / m_distance0) +
637 10 * m_exponent1 * std::log10(distance / m_distance1);
638 }
639 else
640 {
641 pathLossDb = m_referenceLoss + 10 * m_exponent0 * std::log10(m_distance1 / m_distance0) +
642 10 * m_exponent1 * std::log10(m_distance2 / m_distance1) +
643 10 * m_exponent2 * std::log10(distance / m_distance2);
644 }
645
646 NS_LOG_DEBUG("ThreeLogDistance distance=" << distance << "m, "
647 << "attenuation=" << pathLossDb << "dB");
648
649 return txPowerDbm - pathLossDb;
650}
651
652int64_t
654{
655 return 0;
656}
657
658// ------------------------------------------------------------------------- //
659
661
662TypeId
664{
665 static TypeId tid =
666 TypeId("ns3::NakagamiPropagationLossModel")
668 .SetGroupName("Propagation")
669 .AddConstructor<NakagamiPropagationLossModel>()
670 .AddAttribute("Distance1",
671 "Beginning of the second distance field. Default is 80m.",
672 DoubleValue(80.0),
675 .AddAttribute("Distance2",
676 "Beginning of the third distance field. Default is 200m.",
677 DoubleValue(200.0),
680 .AddAttribute("m0",
681 "m0 for distances smaller than Distance1. Default is 1.5.",
682 DoubleValue(1.5),
685 .AddAttribute("m1",
686 "m1 for distances smaller than Distance2. Default is 0.75.",
687 DoubleValue(0.75),
690 .AddAttribute("m2",
691 "m2 for distances greater than Distance2. Default is 0.75.",
692 DoubleValue(0.75),
695 .AddAttribute(
696 "ErlangRv",
697 "Access to the underlying ErlangRandomVariable",
698 StringValue("ns3::ErlangRandomVariable"),
701 .AddAttribute("GammaRv",
702 "Access to the underlying GammaRandomVariable",
703 StringValue("ns3::GammaRandomVariable"),
706 ;
707 return tid;
708}
709
713
714double
717 Ptr<MobilityModel> b) const
718{
719 // select m parameter
720
721 double distance = a->GetDistanceFrom(b);
722 NS_ASSERT(distance >= 0);
723
724 double m;
725 if (distance < m_distance1)
726 {
727 m = m_m0;
728 }
729 else if (distance < m_distance2)
730 {
731 m = m_m1;
732 }
733 else
734 {
735 m = m_m2;
736 }
737
738 // the current power unit is dBm, but Watt is put into the Nakagami /
739 // Rayleigh distribution.
740 double powerW = std::pow(10, (txPowerDbm - 30) / 10);
741
742 double resultPowerW;
743
744 // switch between Erlang- and Gamma distributions: this is only for
745 // speed. (Gamma is equal to Erlang for any positive integer m.)
746 auto int_m = static_cast<unsigned int>(std::floor(m));
747
748 if (int_m == m)
749 {
750 resultPowerW = m_erlangRandomVariable->GetValue(int_m, powerW / m);
751 }
752 else
753 {
754 resultPowerW = m_gammaRandomVariable->GetValue(m, powerW / m);
755 }
756
757 double resultPowerDbm = 10 * std::log10(resultPowerW) + 30;
758
759 NS_LOG_DEBUG("Nakagami distance=" << distance << "m, "
760 << "power=" << powerW << "W, "
761 << "resultPower=" << resultPowerW << "W=" << resultPowerDbm
762 << "dBm");
763
764 return resultPowerDbm;
765}
766
767int64_t
769{
770 m_erlangRandomVariable->SetStream(stream);
771 m_gammaRandomVariable->SetStream(stream + 1);
772 return 2;
773}
774
775// ------------------------------------------------------------------------- //
776
778
779TypeId
781{
782 static TypeId tid = TypeId("ns3::FixedRssLossModel")
784 .SetGroupName("Propagation")
785 .AddConstructor<FixedRssLossModel>()
786 .AddAttribute("Rss",
787 "The fixed receiver Rss.",
788 DoubleValue(-150.0),
791 return tid;
792}
793
798
802
803void
805{
806 m_rss = rss;
807}
808
809double
812 Ptr<MobilityModel> b) const
813{
814 return m_rss;
815}
816
817int64_t
819{
820 return 0;
821}
822
823// ------------------------------------------------------------------------- //
824
826
827TypeId
829{
830 static TypeId tid =
831 TypeId("ns3::MatrixPropagationLossModel")
833 .SetGroupName("Propagation")
834 .AddConstructor<MatrixPropagationLossModel>()
835 .AddAttribute("DefaultLoss",
836 "The default value for propagation loss, dB.",
837 DoubleValue(std::numeric_limits<double>::max()),
840 return tid;
841}
842
848
852
853void
855{
856 m_default = loss;
857}
858
859void
862 double loss,
863 bool symmetric)
864{
865 NS_ASSERT(ma && mb);
866
867 uint64_t p = ((uint64_t)ma->GetObject<Node>()->GetId()) << 32 |
868 ((uint64_t)mb->GetObject<Node>()->GetId());
869 auto i = m_loss.find(p);
870
871 if (i == m_loss.end())
872 {
873 m_loss.insert(std::make_pair(p, loss));
874 }
875 else
876 {
877 i->second = loss;
878 }
879
880 if (symmetric)
881 {
882 SetLoss(mb, ma, loss, false);
883 }
884}
885
886double
889 Ptr<MobilityModel> b) const
890{
891 uint64_t p =
892 ((uint64_t)a->GetObject<Node>()->GetId()) << 32 | ((uint64_t)b->GetObject<Node>()->GetId());
893 auto i = m_loss.find(p);
894
895 if (i != m_loss.end())
896 {
897 return txPowerDbm - i->second;
898 }
899 else
900 {
901 return txPowerDbm - m_default;
902 }
903}
904
905int64_t
907{
908 return 0;
909}
910
911// ------------------------------------------------------------------------- //
912
914
915TypeId
917{
918 static TypeId tid = TypeId("ns3::RangePropagationLossModel")
920 .SetGroupName("Propagation")
921 .AddConstructor<RangePropagationLossModel>()
922 .AddAttribute("MaxRange",
923 "Maximum Transmission Range (meters)",
924 DoubleValue(250),
927 return tid;
928}
929
933
934double
937 Ptr<MobilityModel> b) const
938{
939 double distance = a->GetDistanceFrom(b);
940 if (distance <= m_range)
941 {
942 return txPowerDbm;
943 }
944 else
945 {
946 return -1000;
947 }
948}
949
950int64_t
952{
953 return 0;
954}
955
956// ------------------------------------------------------------------------- //
957
958} // namespace ns3
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition double.h:31
Return a constant received power level independent of the transmit power.
double m_rss
the received signal strength
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
static TypeId GetTypeId()
Get the type ID.
a Friis propagation loss model
double m_lambda
the carrier wavelength
double DbmFromW(double w) const
Transforms a Watt value to Dbm.
double m_frequency
the carrier frequency
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
double DbmToW(double dbm) const
Transforms a Dbm value to Watt.
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
static TypeId GetTypeId()
Get the type ID.
double m_systemLoss
the system loss (linear factor)
a log distance propagation model.
void SetReference(double referenceDistance, double referenceLoss)
Set the reference path loss at a given distance.
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
static TypeId GetTypeId()
Get the type ID.
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
The propagation loss is fixed for each pair of nodes and doesn't depend on their actual positions.
void SetLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b, double loss, bool symmetric=true)
Set loss (in dB, positive) between pair of ns-3 objects (typically, nodes).
void SetDefaultLoss(double defaultLoss)
Set the default propagation loss (in dB, positive) to be used, infinity if not set.
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
std::unordered_map< uint64_t, double > m_loss
Propagation loss between pair of nodes.
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
static TypeId GetTypeId()
Get the type ID.
Nakagami-m fast fading propagation loss model.
Ptr< ErlangRandomVariable > m_erlangRandomVariable
Erlang random variable.
double m_m0
m for distances smaller than Distance1
Ptr< GammaRandomVariable > m_gammaRandomVariable
Gamma random variable.
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
double m_m1
m for distances smaller than Distance2
double m_m2
m for distances greater than Distance2
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
static TypeId GetTypeId()
Get the type ID.
A network Node.
Definition node.h:46
uint32_t GetId() const
Definition node.cc:106
Object()
Constructor.
Definition object.cc:96
Models the propagation loss through a transmission medium.
virtual int64_t DoAssignStreams(int64_t stream)=0
Assign a fixed random variable stream number to the random variables used by this model.
Ptr< PropagationLossModel > m_next
Next propagation loss model in the list.
double CalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Returns the Rx Power taking into account all the PropagationLossModel(s) chained to the current one.
static TypeId GetTypeId()
Get the type ID.
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const =0
PropagationLossModel.
int64_t AssignStreams(int64_t stream)
If this loss model uses objects of type RandomVariableStream, set the stream numbers to the integers ...
void SetNext(Ptr< PropagationLossModel > next)
Enables a chain of loss models to act on the signal.
Ptr< PropagationLossModel > GetNext()
Gets the next PropagationLossModel in the chain of loss models that act on the signal.
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:67
The propagation loss follows a random distribution.
static TypeId GetTypeId()
Get the type ID.
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
Ptr< RandomVariableStream > m_variable
random generator
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
The propagation loss depends only on the distance (range) between transmitter and receiver.
static TypeId GetTypeId()
Get the type ID.
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
double m_range
Maximum Transmission Range (meters)
Hold variables of type string.
Definition string.h:45
A log distance path loss propagation model with three distance fields.
double m_referenceLoss
The reference loss at distance d0 (dB).
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
double m_distance0
Beginning of the first (near) distance field.
double m_distance2
Beginning of the third (far) distance field.
double m_exponent2
The exponent for the third field.
double m_distance1
Beginning of the second (middle) distance field.
double m_exponent0
The exponent for the first field.
double m_exponent1
The exponent for the second field.
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
a Two-Ray Ground propagation loss model ported from NS2
double DbmToW(double dbm) const
Transforms a Dbm value to Watt.
double m_minDistance
minimum distance for the model
double m_heightAboveZ
antenna height above the node's Z coordinate
static TypeId GetTypeId()
Get the type ID.
double DbmFromW(double w) const
Transforms a Watt value to Dbm.
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
double m_systemLoss
the system loss (linear factor)
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
a unique identifier for an interface.
Definition type-id.h:49
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition assert.h:55
Ptr< const AttributeChecker > MakeDoubleChecker()
Definition double.h:82
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:32
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition pointer.h:249
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
Definition pointer.h:270
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if a condition is false, with a message.
Definition abort.h:133
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition log.h:250
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.
STL namespace.