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 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18 * Contributions: Timo Bingmann <timo.bingmann@student.kit.edu>
19 * Contributions: Tom Hewer <tomhewer@mac.com> for Two Ray Ground Model
20 * Pavel Boyko <boyko@iitp.ru> for matrix
21 */
22
24
25#include "ns3/boolean.h"
26#include "ns3/double.h"
27#include "ns3/log.h"
28#include "ns3/mobility-model.h"
29#include "ns3/pointer.h"
30#include "ns3/string.h"
31
32#include <cmath>
33
34namespace ns3
35{
36
37NS_LOG_COMPONENT_DEFINE("PropagationLossModel");
38
39// ------------------------------------------------------------------------- //
40
41NS_OBJECT_ENSURE_REGISTERED(PropagationLossModel);
42
43TypeId
45{
46 static TypeId tid =
47 TypeId("ns3::PropagationLossModel").SetParent<Object>().SetGroupName("Propagation");
48 return tid;
49}
50
52 : m_next(nullptr)
53{
54}
55
57{
58}
59
60void
62{
63 m_next = next;
64}
65
68{
69 return m_next;
70}
71
72double
75 Ptr<MobilityModel> b) const
76{
77 double self = DoCalcRxPower(txPowerDbm, a, b);
78 if (m_next)
79 {
80 self = m_next->CalcRxPower(self, a, b);
81 }
82 return self;
83}
84
85int64_t
87{
88 int64_t currentStream = stream;
89 currentStream += DoAssignStreams(stream);
90 if (m_next)
91 {
92 currentStream += m_next->AssignStreams(currentStream);
93 }
94 return (currentStream - stream);
95}
96
97// ------------------------------------------------------------------------- //
98
100
101TypeId
103{
104 static TypeId tid =
105 TypeId("ns3::RandomPropagationLossModel")
107 .SetGroupName("Propagation")
108 .AddConstructor<RandomPropagationLossModel>()
109 .AddAttribute(
110 "Variable",
111 "The random variable used to pick a loss every time CalcRxPower is invoked.",
112 StringValue("ns3::ConstantRandomVariable[Constant=1.0]"),
114 MakePointerChecker<RandomVariableStream>());
115 return tid;
116}
117
120{
121}
122
124{
125}
126
127double
130 Ptr<MobilityModel> b) const
131{
132 double rxc = -m_variable->GetValue();
133 NS_LOG_DEBUG("attenuation coefficient=" << rxc << "Db");
134 return txPowerDbm + rxc;
135}
136
137int64_t
139{
140 m_variable->SetStream(stream);
141 return 1;
142}
143
144// ------------------------------------------------------------------------- //
145
147
148TypeId
150{
151 static TypeId tid =
152 TypeId("ns3::FriisPropagationLossModel")
154 .SetGroupName("Propagation")
155 .AddConstructor<FriisPropagationLossModel>()
156 .AddAttribute(
157 "Frequency",
158 "The carrier frequency (in Hz) at which propagation occurs (default is 5.15 GHz).",
159 DoubleValue(5.150e9),
162 MakeDoubleChecker<double>())
163 .AddAttribute("SystemLoss",
164 "The system loss",
165 DoubleValue(1.0),
167 MakeDoubleChecker<double>())
168 .AddAttribute("MinLoss",
169 "The minimum value (dB) of the total loss, used at short ranges.",
170 DoubleValue(0.0),
173 MakeDoubleChecker<double>());
174 return tid;
175}
176
178{
179}
180
181void
183{
184 m_systemLoss = systemLoss;
185}
186
187double
189{
190 return m_systemLoss;
191}
192
193void
195{
196 m_minLoss = minLoss;
197}
198
199double
201{
202 return m_minLoss;
203}
204
205void
207{
208 m_frequency = frequency;
209 static const double C = 299792458.0; // speed of light in vacuum
210 m_lambda = C / frequency;
211}
212
213double
215{
216 return m_frequency;
217}
218
219double
221{
222 double mw = std::pow(10.0, dbm / 10.0);
223 return mw / 1000.0;
224}
225
226double
228{
229 double dbm = std::log10(w * 1000.0) * 10.0;
230 return dbm;
231}
232
233double
236 Ptr<MobilityModel> b) const
237{
238 /*
239 * Friis free space equation:
240 * where Pt, Gr, Gr and P are in Watt units
241 * L is in meter units.
242 *
243 * P Gt * Gr * (lambda^2)
244 * --- = ---------------------
245 * Pt (4 * pi * d)^2 * L
246 *
247 * Gt: tx gain (unit-less)
248 * Gr: rx gain (unit-less)
249 * Pt: tx power (W)
250 * d: distance (m)
251 * L: system loss
252 * lambda: wavelength (m)
253 *
254 * Here, we ignore tx and rx gain and the input and output values
255 * are in dB or dBm:
256 *
257 * lambda^2
258 * rx = tx + 10 log10 (-------------------)
259 * (4 * pi * d)^2 * L
260 *
261 * rx: rx power (dB)
262 * tx: tx power (dB)
263 * d: distance (m)
264 * L: system loss (unit-less)
265 * lambda: wavelength (m)
266 */
267 double distance = a->GetDistanceFrom(b);
268 if (distance < 3 * m_lambda)
269 {
271 "distance not within the far field region => inaccurate propagation loss value");
272 }
273 if (distance <= 0)
274 {
275 return txPowerDbm - m_minLoss;
276 }
277 double numerator = m_lambda * m_lambda;
278 double denominator = 16 * M_PI * M_PI * distance * distance * m_systemLoss;
279 double lossDb = -10 * log10(numerator / denominator);
280 NS_LOG_DEBUG("distance=" << distance << "m, loss=" << lossDb << "dB");
281 return txPowerDbm - std::max(lossDb, m_minLoss);
282}
283
284int64_t
286{
287 return 0;
288}
289
290// ------------------------------------------------------------------------- //
291// -- Two-Ray Ground Model ported from NS-2 -- tomhewer@mac.com -- Nov09 //
292
294
295TypeId
297{
298 static TypeId tid =
299 TypeId("ns3::TwoRayGroundPropagationLossModel")
301 .SetGroupName("Propagation")
302 .AddConstructor<TwoRayGroundPropagationLossModel>()
303 .AddAttribute(
304 "Frequency",
305 "The carrier frequency (in Hz) at which propagation occurs (default is 5.15 GHz).",
306 DoubleValue(5.150e9),
309 MakeDoubleChecker<double>())
310 .AddAttribute("SystemLoss",
311 "The system loss",
312 DoubleValue(1.0),
314 MakeDoubleChecker<double>())
315 .AddAttribute(
316 "MinDistance",
317 "The distance under which the propagation model refuses to give results (m)",
318 DoubleValue(0.5),
321 MakeDoubleChecker<double>())
322 .AddAttribute("HeightAboveZ",
323 "The height of the antenna (m) above the node's Z coordinate",
324 DoubleValue(0),
326 MakeDoubleChecker<double>());
327 return tid;
328}
329
331{
332}
333
334void
336{
337 m_systemLoss = systemLoss;
338}
339
340double
342{
343 return m_systemLoss;
344}
345
346void
348{
349 m_minDistance = minDistance;
350}
351
352double
354{
355 return m_minDistance;
356}
357
358void
360{
361 m_heightAboveZ = heightAboveZ;
362}
363
364void
366{
367 m_frequency = frequency;
368 static const double C = 299792458.0; // speed of light in vacuum
369 m_lambda = C / frequency;
370}
371
372double
374{
375 return m_frequency;
376}
377
378double
380{
381 double mw = std::pow(10.0, dbm / 10.0);
382 return mw / 1000.0;
383}
384
385double
387{
388 double dbm = std::log10(w * 1000.0) * 10.0;
389 return dbm;
390}
391
392double
395 Ptr<MobilityModel> b) const
396{
397 /*
398 * Two-Ray Ground equation:
399 *
400 * where Pt, Gt and Gr are in dBm units
401 * L, Ht and Hr are in meter units.
402 *
403 * Pr Gt * Gr * (Ht^2 * Hr^2)
404 * -- = (-------------------------)
405 * Pt d^4 * L
406 *
407 * Gt: tx gain (unit-less)
408 * Gr: rx gain (unit-less)
409 * Pt: tx power (dBm)
410 * d: distance (m)
411 * L: system loss
412 * Ht: Tx antenna height (m)
413 * Hr: Rx antenna height (m)
414 * lambda: wavelength (m)
415 *
416 * As with the Friis model we ignore tx and rx gain and output values
417 * are in dB or dBm
418 *
419 * (Ht * Ht) * (Hr * Hr)
420 * rx = tx + 10 log10 (-----------------------)
421 * (d * d * d * d) * L
422 */
423 double distance = a->GetDistanceFrom(b);
424 if (distance <= m_minDistance)
425 {
426 return txPowerDbm;
427 }
428
429 // Set the height of the Tx and Rx antennae
430 double txAntHeight = a->GetPosition().z + m_heightAboveZ;
431 double rxAntHeight = b->GetPosition().z + m_heightAboveZ;
432
433 // Calculate a crossover distance, under which we use Friis
434 /*
435 *
436 * dCross = (4 * pi * Ht * Hr) / lambda
437 *
438 */
439
440 double dCross = (4 * M_PI * txAntHeight * rxAntHeight) / m_lambda;
441 double tmp = 0;
442 if (distance <= dCross)
443 {
444 // We use Friis
445 double numerator = m_lambda * m_lambda;
446 tmp = M_PI * distance;
447 double denominator = 16 * tmp * tmp * m_systemLoss;
448 double pr = 10 * std::log10(numerator / denominator);
449 NS_LOG_DEBUG("Receiver within crossover (" << dCross << "m) for Two_ray path; using Friis");
450 NS_LOG_DEBUG("distance=" << distance << "m, attenuation coefficient=" << pr << "dB");
451 return txPowerDbm + pr;
452 }
453 else // Use Two-Ray Pathloss
454 {
455 tmp = txAntHeight * rxAntHeight;
456 double rayNumerator = tmp * tmp;
457 tmp = distance * distance;
458 double rayDenominator = tmp * tmp * m_systemLoss;
459 double rayPr = 10 * std::log10(rayNumerator / rayDenominator);
460 NS_LOG_DEBUG("distance=" << distance << "m, attenuation coefficient=" << rayPr << "dB");
461 return txPowerDbm + rayPr;
462 }
463}
464
465int64_t
467{
468 return 0;
469}
470
471// ------------------------------------------------------------------------- //
472
474
475TypeId
477{
478 static TypeId tid =
479 TypeId("ns3::LogDistancePropagationLossModel")
481 .SetGroupName("Propagation")
482 .AddConstructor<LogDistancePropagationLossModel>()
483 .AddAttribute("Exponent",
484 "The exponent of the Path Loss propagation model",
485 DoubleValue(3.0),
487 MakeDoubleChecker<double>())
488 .AddAttribute("ReferenceDistance",
489 "The distance at which the reference loss is calculated (m)",
490 DoubleValue(1.0),
492 MakeDoubleChecker<double>())
493 .AddAttribute("ReferenceLoss",
494 "The reference loss at reference distance (dB). (Default is Friis at 1m "
495 "with 5.15 GHz)",
496 DoubleValue(46.6777),
498 MakeDoubleChecker<double>());
499 return tid;
500}
501
503{
504}
505
506void
508{
509 m_exponent = n;
510}
511
512void
513LogDistancePropagationLossModel::SetReference(double referenceDistance, double referenceLoss)
514{
515 m_referenceDistance = referenceDistance;
516 m_referenceLoss = referenceLoss;
517}
518
519double
521{
522 return m_exponent;
523}
524
525double
528 Ptr<MobilityModel> b) const
529{
530 double distance = a->GetDistanceFrom(b);
531 if (distance <= m_referenceDistance)
532 {
533 NS_LOG_DEBUG("distance=" << distance << "m, reference-attenuation=" << -m_referenceLoss
534 << "dB, no further attenuation");
535 return txPowerDbm - m_referenceLoss;
536 }
551 double pathLossDb = 10 * m_exponent * std::log10(distance / m_referenceDistance);
552 double rxc = -m_referenceLoss - pathLossDb;
553 NS_LOG_DEBUG("distance=" << distance << "m, reference-attenuation=" << -m_referenceLoss
554 << "dB, "
555 << "attenuation coefficient=" << rxc << "db");
556 return txPowerDbm + rxc;
557}
558
559int64_t
561{
562 return 0;
563}
564
565// ------------------------------------------------------------------------- //
566
568
569TypeId
571{
572 static TypeId tid =
573 TypeId("ns3::ThreeLogDistancePropagationLossModel")
575 .SetGroupName("Propagation")
576 .AddConstructor<ThreeLogDistancePropagationLossModel>()
577 .AddAttribute("Distance0",
578 "Beginning of the first (near) distance field",
579 DoubleValue(1.0),
581 MakeDoubleChecker<double>())
582 .AddAttribute("Distance1",
583 "Beginning of the second (middle) distance field.",
584 DoubleValue(200.0),
586 MakeDoubleChecker<double>())
587 .AddAttribute("Distance2",
588 "Beginning of the third (far) distance field.",
589 DoubleValue(500.0),
591 MakeDoubleChecker<double>())
592 .AddAttribute("Exponent0",
593 "The exponent for the first field.",
594 DoubleValue(1.9),
596 MakeDoubleChecker<double>())
597 .AddAttribute("Exponent1",
598 "The exponent for the second field.",
599 DoubleValue(3.8),
601 MakeDoubleChecker<double>())
602 .AddAttribute("Exponent2",
603 "The exponent for the third field.",
604 DoubleValue(3.8),
606 MakeDoubleChecker<double>())
607 .AddAttribute(
608 "ReferenceLoss",
609 "The reference loss at distance d0 (dB). (Default is Friis at 1m with 5.15 GHz)",
610 DoubleValue(46.6777),
612 MakeDoubleChecker<double>());
613 return tid;
614}
615
617{
618}
619
620double
623 Ptr<MobilityModel> b) const
624{
625 double distance = a->GetDistanceFrom(b);
626 NS_ASSERT(distance >= 0);
627
628 // See doxygen comments for the formula and explanation
629
630 double pathLossDb;
631
632 if (distance < m_distance0)
633 {
634 pathLossDb = 0;
635 }
636 else if (distance < m_distance1)
637 {
638 pathLossDb = m_referenceLoss + 10 * m_exponent0 * std::log10(distance / m_distance0);
639 }
640 else if (distance < m_distance2)
641 {
642 pathLossDb = m_referenceLoss + 10 * m_exponent0 * std::log10(m_distance1 / m_distance0) +
643 10 * m_exponent1 * std::log10(distance / m_distance1);
644 }
645 else
646 {
647 pathLossDb = m_referenceLoss + 10 * m_exponent0 * std::log10(m_distance1 / m_distance0) +
648 10 * m_exponent1 * std::log10(m_distance2 / m_distance1) +
649 10 * m_exponent2 * std::log10(distance / m_distance2);
650 }
651
652 NS_LOG_DEBUG("ThreeLogDistance distance=" << distance << "m, "
653 << "attenuation=" << pathLossDb << "dB");
654
655 return txPowerDbm - pathLossDb;
656}
657
658int64_t
660{
661 return 0;
662}
663
664// ------------------------------------------------------------------------- //
665
667
668TypeId
670{
671 static TypeId tid =
672 TypeId("ns3::NakagamiPropagationLossModel")
674 .SetGroupName("Propagation")
675 .AddConstructor<NakagamiPropagationLossModel>()
676 .AddAttribute("Distance1",
677 "Beginning of the second distance field. Default is 80m.",
678 DoubleValue(80.0),
680 MakeDoubleChecker<double>())
681 .AddAttribute("Distance2",
682 "Beginning of the third distance field. Default is 200m.",
683 DoubleValue(200.0),
685 MakeDoubleChecker<double>())
686 .AddAttribute("m0",
687 "m0 for distances smaller than Distance1. Default is 1.5.",
688 DoubleValue(1.5),
690 MakeDoubleChecker<double>())
691 .AddAttribute("m1",
692 "m1 for distances smaller than Distance2. Default is 0.75.",
693 DoubleValue(0.75),
695 MakeDoubleChecker<double>())
696 .AddAttribute("m2",
697 "m2 for distances greater than Distance2. Default is 0.75.",
698 DoubleValue(0.75),
700 MakeDoubleChecker<double>())
701 .AddAttribute(
702 "ErlangRv",
703 "Access to the underlying ErlangRandomVariable",
704 StringValue("ns3::ErlangRandomVariable"),
706 MakePointerChecker<ErlangRandomVariable>())
707 .AddAttribute("GammaRv",
708 "Access to the underlying GammaRandomVariable",
709 StringValue("ns3::GammaRandomVariable"),
711 MakePointerChecker<GammaRandomVariable>());
712 ;
713 return tid;
714}
715
717{
718}
719
720double
723 Ptr<MobilityModel> b) const
724{
725 // select m parameter
726
727 double distance = a->GetDistanceFrom(b);
728 NS_ASSERT(distance >= 0);
729
730 double m;
731 if (distance < m_distance1)
732 {
733 m = m_m0;
734 }
735 else if (distance < m_distance2)
736 {
737 m = m_m1;
738 }
739 else
740 {
741 m = m_m2;
742 }
743
744 // the current power unit is dBm, but Watt is put into the Nakagami /
745 // Rayleigh distribution.
746 double powerW = std::pow(10, (txPowerDbm - 30) / 10);
747
748 double resultPowerW;
749
750 // switch between Erlang- and Gamma distributions: this is only for
751 // speed. (Gamma is equal to Erlang for any positive integer m.)
752 auto int_m = static_cast<unsigned int>(std::floor(m));
753
754 if (int_m == m)
755 {
756 resultPowerW = m_erlangRandomVariable->GetValue(int_m, powerW / m);
757 }
758 else
759 {
760 resultPowerW = m_gammaRandomVariable->GetValue(m, powerW / m);
761 }
762
763 double resultPowerDbm = 10 * std::log10(resultPowerW) + 30;
764
765 NS_LOG_DEBUG("Nakagami distance=" << distance << "m, "
766 << "power=" << powerW << "W, "
767 << "resultPower=" << resultPowerW << "W=" << resultPowerDbm
768 << "dBm");
769
770 return resultPowerDbm;
771}
772
773int64_t
775{
776 m_erlangRandomVariable->SetStream(stream);
777 m_gammaRandomVariable->SetStream(stream + 1);
778 return 2;
779}
780
781// ------------------------------------------------------------------------- //
782
784
785TypeId
787{
788 static TypeId tid = TypeId("ns3::FixedRssLossModel")
790 .SetGroupName("Propagation")
791 .AddConstructor<FixedRssLossModel>()
792 .AddAttribute("Rss",
793 "The fixed receiver Rss.",
794 DoubleValue(-150.0),
796 MakeDoubleChecker<double>());
797 return tid;
798}
799
802{
803}
804
806{
807}
808
809void
811{
812 m_rss = rss;
813}
814
815double
818 Ptr<MobilityModel> b) const
819{
820 return m_rss;
821}
822
823int64_t
825{
826 return 0;
827}
828
829// ------------------------------------------------------------------------- //
830
832
833TypeId
835{
836 static TypeId tid =
837 TypeId("ns3::MatrixPropagationLossModel")
839 .SetGroupName("Propagation")
840 .AddConstructor<MatrixPropagationLossModel>()
841 .AddAttribute("DefaultLoss",
842 "The default value for propagation loss, dB.",
843 DoubleValue(std::numeric_limits<double>::max()),
845 MakeDoubleChecker<double>());
846 return tid;
847}
848
851 m_default(std::numeric_limits<double>::max())
852{
853}
854
856{
857}
858
859void
861{
862 m_default = loss;
863}
864
865void
868 double loss,
869 bool symmetric)
870{
871 NS_ASSERT(ma && mb);
872
873 MobilityPair p = std::make_pair(ma, mb);
874 auto i = m_loss.find(p);
875
876 if (i == m_loss.end())
877 {
878 m_loss.insert(std::make_pair(p, loss));
879 }
880 else
881 {
882 i->second = loss;
883 }
884
885 if (symmetric)
886 {
887 SetLoss(mb, ma, loss, false);
888 }
889}
890
891double
894 Ptr<MobilityModel> b) const
895{
896 auto i = m_loss.find(std::make_pair(a, b));
897
898 if (i != m_loss.end())
899 {
900 return txPowerDbm - i->second;
901 }
902 else
903 {
904 return txPowerDbm - m_default;
905 }
906}
907
908int64_t
910{
911 return 0;
912}
913
914// ------------------------------------------------------------------------- //
915
917
918TypeId
920{
921 static TypeId tid = TypeId("ns3::RangePropagationLossModel")
923 .SetGroupName("Propagation")
924 .AddConstructor<RangePropagationLossModel>()
925 .AddAttribute("MaxRange",
926 "Maximum Transmission Range (meters)",
927 DoubleValue(250),
929 MakeDoubleChecker<double>());
930 return tid;
931}
932
934{
935}
936
937double
940 Ptr<MobilityModel> b) const
941{
942 double distance = a->GetDistanceFrom(b);
943 if (distance <= m_range)
944 {
945 return txPowerDbm;
946 }
947 else
948 {
949 return -1000;
950 }
951}
952
953int64_t
955{
956 return 0;
957}
958
959// ------------------------------------------------------------------------- //
960
961} // namespace ns3
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
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.
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:89
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:77
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:56
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 DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition: double.h:43
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Definition: pointer.h:259
#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_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:261
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Every class exported by the ns3 library is enclosed in the ns3 namespace.
STL namespace.