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/pointer.h"
19#include "ns3/string.h"
20
21#include <cmath>
22
23namespace ns3
24{
25
26NS_LOG_COMPONENT_DEFINE("PropagationLossModel");
27
28// ------------------------------------------------------------------------- //
29
30NS_OBJECT_ENSURE_REGISTERED(PropagationLossModel);
31
32TypeId
34{
35 static TypeId tid =
36 TypeId("ns3::PropagationLossModel").SetParent<Object>().SetGroupName("Propagation");
37 return tid;
38}
39
41 : m_next(nullptr)
42{
43}
44
48
49void
54
60
61double
64 Ptr<MobilityModel> b) const
65{
66 double self = DoCalcRxPower(txPowerDbm, a, b);
67 if (m_next)
68 {
69 self = m_next->CalcRxPower(self, a, b);
70 }
71 return self;
72}
73
74int64_t
76{
77 int64_t currentStream = stream;
78 currentStream += DoAssignStreams(stream);
79 if (m_next)
80 {
81 currentStream += m_next->AssignStreams(currentStream);
82 }
83 return (currentStream - stream);
84}
85
86// ------------------------------------------------------------------------- //
87
89
92{
93 static TypeId tid =
94 TypeId("ns3::RandomPropagationLossModel")
96 .SetGroupName("Propagation")
97 .AddConstructor<RandomPropagationLossModel>()
98 .AddAttribute(
99 "Variable",
100 "The random variable used to pick a loss every time CalcRxPower is invoked.",
101 StringValue("ns3::ConstantRandomVariable[Constant=1.0]"),
104 return tid;
105}
106
111
115
116double
119 Ptr<MobilityModel> b) const
120{
121 double rxc = -m_variable->GetValue();
122 NS_LOG_DEBUG("attenuation coefficient=" << rxc << "Db");
123 return txPowerDbm + rxc;
124}
125
126int64_t
128{
129 m_variable->SetStream(stream);
130 return 1;
131}
132
133// ------------------------------------------------------------------------- //
134
136
137TypeId
139{
140 static TypeId tid =
141 TypeId("ns3::FriisPropagationLossModel")
143 .SetGroupName("Propagation")
144 .AddConstructor<FriisPropagationLossModel>()
145 .AddAttribute(
146 "Frequency",
147 "The carrier frequency (in Hz) at which propagation occurs (default is 5.15 GHz).",
148 DoubleValue(5.150e9),
152 .AddAttribute("SystemLoss",
153 "The system loss (linear factor >= 1, not in dB)",
154 DoubleValue(1.0),
158 .AddAttribute("MinLoss",
159 "The minimum value (dB) of the total loss, used at short ranges.",
160 DoubleValue(0.0),
164 return tid;
165}
166
170
171void
173{
174 NS_ABORT_MSG_UNLESS(systemLoss >= 1, "System loss less than 1 corresponds to gain");
175 m_systemLoss = systemLoss;
176}
177
178double
183
184void
186{
187 m_minLoss = minLoss;
188}
189
190double
195
196void
198{
199 m_frequency = frequency;
200 static const double C = 299792458.0; // speed of light in vacuum
201 m_lambda = C / frequency;
202}
203
204double
209
210double
212{
213 double mw = std::pow(10.0, dbm / 10.0);
214 return mw / 1000.0;
215}
216
217double
219{
220 double dbm = std::log10(w * 1000.0) * 10.0;
221 return dbm;
222}
223
224double
227 Ptr<MobilityModel> b) const
228{
229 /*
230 * Friis free space equation:
231 * where Pt, Gr, Gr and P are in Watt units
232 * L is in meter units.
233 *
234 * P Gt * Gr * (lambda^2)
235 * --- = ---------------------
236 * Pt (4 * pi * d)^2 * L
237 *
238 * Gt: tx gain (unit-less)
239 * Gr: rx gain (unit-less)
240 * Pt: tx power (W)
241 * d: distance (m)
242 * L: system loss
243 * lambda: wavelength (m)
244 *
245 * Here, we ignore tx and rx gain and the input and output values
246 * are in dB or dBm:
247 *
248 * lambda^2
249 * rx = tx + 10 log10 (-------------------)
250 * (4 * pi * d)^2 * L
251 *
252 * rx: rx power (dB)
253 * tx: tx power (dB)
254 * d: distance (m)
255 * L: system loss (unit-less)
256 * lambda: wavelength (m)
257 */
258 double distance = a->GetDistanceFrom(b);
259 if (distance < 3 * m_lambda)
260 {
262 "distance not within the far field region => inaccurate propagation loss value");
263 }
264 if (distance <= 0)
265 {
266 return txPowerDbm - m_minLoss;
267 }
268 double numerator = m_lambda * m_lambda;
269 double denominator = 16 * M_PI * M_PI * distance * distance * m_systemLoss;
270 double lossDb = -10 * log10(numerator / denominator);
271 NS_LOG_DEBUG("distance=" << distance << "m, loss=" << lossDb << "dB");
272 return txPowerDbm - std::max(lossDb, m_minLoss);
273}
274
275int64_t
277{
278 return 0;
279}
280
281// ------------------------------------------------------------------------- //
282// -- Two-Ray Ground Model ported from NS-2 -- tomhewer@mac.com -- Nov09 //
283
285
286TypeId
288{
289 static TypeId tid =
290 TypeId("ns3::TwoRayGroundPropagationLossModel")
292 .SetGroupName("Propagation")
293 .AddConstructor<TwoRayGroundPropagationLossModel>()
294 .AddAttribute(
295 "Frequency",
296 "The carrier frequency (in Hz) at which propagation occurs (default is 5.15 GHz).",
297 DoubleValue(5.150e9),
301 .AddAttribute("SystemLoss",
302 "The system loss (linear factor >= 1, not in dB)",
303 DoubleValue(1.0),
307 .AddAttribute(
308 "MinDistance",
309 "The distance under which the propagation model refuses to give results (m)",
310 DoubleValue(0.5),
314 .AddAttribute("HeightAboveZ",
315 "The height of the antenna (m) above the node's Z coordinate",
316 DoubleValue(0),
319 return tid;
320}
321
325
326void
328{
329 NS_ABORT_MSG_UNLESS(systemLoss >= 1, "System loss less than 1 corresponds to gain");
330 m_systemLoss = systemLoss;
331}
332
333double
338
339void
341{
342 m_minDistance = minDistance;
343}
344
345double
350
351void
353{
354 m_heightAboveZ = heightAboveZ;
355}
356
357void
359{
360 m_frequency = frequency;
361 static const double C = 299792458.0; // speed of light in vacuum
362 m_lambda = C / frequency;
363}
364
365double
370
371double
373{
374 double mw = std::pow(10.0, dbm / 10.0);
375 return mw / 1000.0;
376}
377
378double
380{
381 double dbm = std::log10(w * 1000.0) * 10.0;
382 return dbm;
383}
384
385double
388 Ptr<MobilityModel> b) const
389{
390 /*
391 * Two-Ray Ground equation:
392 *
393 * where Pt, Gt and Gr are in dBm units
394 * L, Ht and Hr are in meter units.
395 *
396 * Pr Gt * Gr * (Ht^2 * Hr^2)
397 * -- = (-------------------------)
398 * Pt d^4 * L
399 *
400 * Gt: tx gain (unit-less)
401 * Gr: rx gain (unit-less)
402 * Pt: tx power (dBm)
403 * d: distance (m)
404 * L: system loss
405 * Ht: Tx antenna height (m)
406 * Hr: Rx antenna height (m)
407 * lambda: wavelength (m)
408 *
409 * As with the Friis model we ignore tx and rx gain and output values
410 * are in dB or dBm
411 *
412 * (Ht * Ht) * (Hr * Hr)
413 * rx = tx + 10 log10 (-----------------------)
414 * (d * d * d * d) * L
415 */
416 double distance = a->GetDistanceFrom(b);
417 if (distance <= m_minDistance)
418 {
419 return txPowerDbm;
420 }
421
422 // Set the height of the Tx and Rx antennae
423 double txAntHeight = a->GetPosition().z + m_heightAboveZ;
424 double rxAntHeight = b->GetPosition().z + m_heightAboveZ;
425
426 // Calculate a crossover distance, under which we use Friis
427 /*
428 *
429 * dCross = (4 * pi * Ht * Hr) / lambda
430 *
431 */
432
433 double dCross = (4 * M_PI * txAntHeight * rxAntHeight) / m_lambda;
434 double tmp = 0;
435 if (distance <= dCross)
436 {
437 // We use Friis
438 double numerator = m_lambda * m_lambda;
439 tmp = M_PI * distance;
440 double denominator = 16 * tmp * tmp * m_systemLoss;
441 double pr = 10 * std::log10(numerator / denominator);
442 NS_LOG_DEBUG("Receiver within crossover (" << dCross << "m) for Two_ray path; using Friis");
443 NS_LOG_DEBUG("distance=" << distance << "m, attenuation coefficient=" << pr << "dB");
444 return txPowerDbm + pr;
445 }
446 else // Use Two-Ray Pathloss
447 {
448 tmp = txAntHeight * rxAntHeight;
449 double rayNumerator = tmp * tmp;
450 tmp = distance * distance;
451 double rayDenominator = tmp * tmp * m_systemLoss;
452 double rayPr = 10 * std::log10(rayNumerator / rayDenominator);
453 NS_LOG_DEBUG("distance=" << distance << "m, attenuation coefficient=" << rayPr << "dB");
454 return txPowerDbm + rayPr;
455 }
456}
457
458int64_t
460{
461 return 0;
462}
463
464// ------------------------------------------------------------------------- //
465
467
468TypeId
470{
471 static TypeId tid =
472 TypeId("ns3::LogDistancePropagationLossModel")
474 .SetGroupName("Propagation")
475 .AddConstructor<LogDistancePropagationLossModel>()
476 .AddAttribute("Exponent",
477 "The exponent of the Path Loss propagation model",
478 DoubleValue(3.0),
481 .AddAttribute("ReferenceDistance",
482 "The distance at which the reference loss is calculated (m)",
483 DoubleValue(1.0),
486 .AddAttribute("ReferenceLoss",
487 "The reference loss at reference distance (dB). (Default is Friis at 1m "
488 "with 5.15 GHz)",
489 DoubleValue(46.6777),
492 return tid;
493}
494
498
499void
504
505void
506LogDistancePropagationLossModel::SetReference(double referenceDistance, double referenceLoss)
507{
508 m_referenceDistance = referenceDistance;
509 m_referenceLoss = referenceLoss;
510}
511
512double
517
518double
521 Ptr<MobilityModel> b) const
522{
523 double distance = a->GetDistanceFrom(b);
524 if (distance <= m_referenceDistance)
525 {
526 NS_LOG_DEBUG("distance=" << distance << "m, reference-attenuation=" << -m_referenceLoss
527 << "dB, no further attenuation");
528 return txPowerDbm - m_referenceLoss;
529 }
530 /**
531 * The formula is:
532 * rx = 10 * log (Pr0(tx)) - n * 10 * log (d/d0)
533 *
534 * Pr0: rx power at reference distance d0 (W)
535 * d0: reference distance: 1.0 (m)
536 * d: distance (m)
537 * tx: tx power (dB)
538 * rx: dB
539 *
540 * Which, in our case is:
541 *
542 * rx = rx0(tx) - 10 * n * log (d/d0)
543 */
544 double pathLossDb = 10 * m_exponent * std::log10(distance / m_referenceDistance);
545 double rxc = -m_referenceLoss - pathLossDb;
546 NS_LOG_DEBUG("distance=" << distance << "m, reference-attenuation=" << -m_referenceLoss
547 << "dB, "
548 << "attenuation coefficient=" << rxc << "db");
549 return txPowerDbm + rxc;
550}
551
552int64_t
554{
555 return 0;
556}
557
558// ------------------------------------------------------------------------- //
559
561
562TypeId
564{
565 static TypeId tid =
566 TypeId("ns3::ThreeLogDistancePropagationLossModel")
568 .SetGroupName("Propagation")
569 .AddConstructor<ThreeLogDistancePropagationLossModel>()
570 .AddAttribute("Distance0",
571 "Beginning of the first (near) distance field",
572 DoubleValue(1.0),
575 .AddAttribute("Distance1",
576 "Beginning of the second (middle) distance field.",
577 DoubleValue(200.0),
580 .AddAttribute("Distance2",
581 "Beginning of the third (far) distance field.",
582 DoubleValue(500.0),
585 .AddAttribute("Exponent0",
586 "The exponent for the first field.",
587 DoubleValue(1.9),
590 .AddAttribute("Exponent1",
591 "The exponent for the second field.",
592 DoubleValue(3.8),
595 .AddAttribute("Exponent2",
596 "The exponent for the third field.",
597 DoubleValue(3.8),
600 .AddAttribute(
601 "ReferenceLoss",
602 "The reference loss at distance d0 (dB). (Default is Friis at 1m with 5.15 GHz)",
603 DoubleValue(46.6777),
606 return tid;
607}
608
612
613double
616 Ptr<MobilityModel> b) const
617{
618 double distance = a->GetDistanceFrom(b);
619 NS_ASSERT(distance >= 0);
620
621 // See doxygen comments for the formula and explanation
622
623 double pathLossDb;
624
625 if (distance < m_distance0)
626 {
627 pathLossDb = 0;
628 }
629 else if (distance < m_distance1)
630 {
631 pathLossDb = m_referenceLoss + 10 * m_exponent0 * std::log10(distance / m_distance0);
632 }
633 else if (distance < m_distance2)
634 {
635 pathLossDb = m_referenceLoss + 10 * m_exponent0 * std::log10(m_distance1 / m_distance0) +
636 10 * m_exponent1 * std::log10(distance / m_distance1);
637 }
638 else
639 {
640 pathLossDb = m_referenceLoss + 10 * m_exponent0 * std::log10(m_distance1 / m_distance0) +
641 10 * m_exponent1 * std::log10(m_distance2 / m_distance1) +
642 10 * m_exponent2 * std::log10(distance / m_distance2);
643 }
644
645 NS_LOG_DEBUG("ThreeLogDistance distance=" << distance << "m, "
646 << "attenuation=" << pathLossDb << "dB");
647
648 return txPowerDbm - pathLossDb;
649}
650
651int64_t
653{
654 return 0;
655}
656
657// ------------------------------------------------------------------------- //
658
660
661TypeId
663{
664 static TypeId tid =
665 TypeId("ns3::NakagamiPropagationLossModel")
667 .SetGroupName("Propagation")
668 .AddConstructor<NakagamiPropagationLossModel>()
669 .AddAttribute("Distance1",
670 "Beginning of the second distance field. Default is 80m.",
671 DoubleValue(80.0),
674 .AddAttribute("Distance2",
675 "Beginning of the third distance field. Default is 200m.",
676 DoubleValue(200.0),
679 .AddAttribute("m0",
680 "m0 for distances smaller than Distance1. Default is 1.5.",
681 DoubleValue(1.5),
684 .AddAttribute("m1",
685 "m1 for distances smaller than Distance2. Default is 0.75.",
686 DoubleValue(0.75),
689 .AddAttribute("m2",
690 "m2 for distances greater than Distance2. Default is 0.75.",
691 DoubleValue(0.75),
694 .AddAttribute(
695 "ErlangRv",
696 "Access to the underlying ErlangRandomVariable",
697 StringValue("ns3::ErlangRandomVariable"),
700 .AddAttribute("GammaRv",
701 "Access to the underlying GammaRandomVariable",
702 StringValue("ns3::GammaRandomVariable"),
705 ;
706 return tid;
707}
708
712
713double
716 Ptr<MobilityModel> b) const
717{
718 // select m parameter
719
720 double distance = a->GetDistanceFrom(b);
721 NS_ASSERT(distance >= 0);
722
723 double m;
724 if (distance < m_distance1)
725 {
726 m = m_m0;
727 }
728 else if (distance < m_distance2)
729 {
730 m = m_m1;
731 }
732 else
733 {
734 m = m_m2;
735 }
736
737 // the current power unit is dBm, but Watt is put into the Nakagami /
738 // Rayleigh distribution.
739 double powerW = std::pow(10, (txPowerDbm - 30) / 10);
740
741 double resultPowerW;
742
743 // switch between Erlang- and Gamma distributions: this is only for
744 // speed. (Gamma is equal to Erlang for any positive integer m.)
745 auto int_m = static_cast<unsigned int>(std::floor(m));
746
747 if (int_m == m)
748 {
749 resultPowerW = m_erlangRandomVariable->GetValue(int_m, powerW / m);
750 }
751 else
752 {
753 resultPowerW = m_gammaRandomVariable->GetValue(m, powerW / m);
754 }
755
756 double resultPowerDbm = 10 * std::log10(resultPowerW) + 30;
757
758 NS_LOG_DEBUG("Nakagami distance=" << distance << "m, "
759 << "power=" << powerW << "W, "
760 << "resultPower=" << resultPowerW << "W=" << resultPowerDbm
761 << "dBm");
762
763 return resultPowerDbm;
764}
765
766int64_t
768{
769 m_erlangRandomVariable->SetStream(stream);
770 m_gammaRandomVariable->SetStream(stream + 1);
771 return 2;
772}
773
774// ------------------------------------------------------------------------- //
775
777
778TypeId
780{
781 static TypeId tid = TypeId("ns3::FixedRssLossModel")
783 .SetGroupName("Propagation")
784 .AddConstructor<FixedRssLossModel>()
785 .AddAttribute("Rss",
786 "The fixed receiver Rss.",
787 DoubleValue(-150.0),
790 return tid;
791}
792
797
801
802void
804{
805 m_rss = rss;
806}
807
808double
811 Ptr<MobilityModel> b) const
812{
813 return m_rss;
814}
815
816int64_t
818{
819 return 0;
820}
821
822// ------------------------------------------------------------------------- //
823
825
826TypeId
828{
829 static TypeId tid =
830 TypeId("ns3::MatrixPropagationLossModel")
832 .SetGroupName("Propagation")
833 .AddConstructor<MatrixPropagationLossModel>()
834 .AddAttribute("DefaultLoss",
835 "The default value for propagation loss, dB.",
836 DoubleValue(std::numeric_limits<double>::max()),
839 return tid;
840}
841
844 m_default(std::numeric_limits<double>::max())
845{
846}
847
851
852void
854{
855 m_default = loss;
856}
857
858void
861 double loss,
862 bool symmetric)
863{
864 NS_ASSERT(ma && mb);
865
866 MobilityPair p = std::make_pair(ma, mb);
867 auto i = m_loss.find(p);
868
869 if (i == m_loss.end())
870 {
871 m_loss.insert(std::make_pair(p, loss));
872 }
873 else
874 {
875 i->second = loss;
876 }
877
878 if (symmetric)
879 {
880 SetLoss(mb, ma, loss, false);
881 }
882}
883
884double
887 Ptr<MobilityModel> b) const
888{
889 auto i = m_loss.find(std::make_pair(a, b));
890
891 if (i != m_loss.end())
892 {
893 return txPowerDbm - i->second;
894 }
895 else
896 {
897 return txPowerDbm - m_default;
898 }
899}
900
901int64_t
903{
904 return 0;
905}
906
907// ------------------------------------------------------------------------- //
908
910
911TypeId
913{
914 static TypeId tid = TypeId("ns3::RangePropagationLossModel")
916 .SetGroupName("Propagation")
917 .AddConstructor<RangePropagationLossModel>()
918 .AddAttribute("MaxRange",
919 "Maximum Transmission Range (meters)",
920 DoubleValue(250),
923 return tid;
924}
925
929
930double
933 Ptr<MobilityModel> b) const
934{
935 double distance = a->GetDistanceFrom(b);
936 if (distance <= m_range)
937 {
938 return txPowerDbm;
939 }
940 else
941 {
942 return -1000;
943 }
944}
945
946int64_t
948{
949 return 0;
950}
951
952// ------------------------------------------------------------------------- //
953
954} // 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.
std::unordered_map< MobilityPair, double, MobilityPairHasher > m_loss
Propagation loss between pair of nodes.
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
std::pair< const Ptr< MobilityModel >, const Ptr< MobilityModel > > MobilityPair
Typedef: Mobility models pair.
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 base class which provides memory management and object aggregation.
Definition object.h:78
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.
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.
virtual double GetValue()=0
Get the next random value drawn from the distribution.
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
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:48
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 AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition pointer.h:248
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
Definition pointer.h:269
#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.
Ptr< const AttributeChecker > MakeDoubleChecker()
Definition double.h:82
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition double.h:32
STL namespace.