A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
propagation-loss-model.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005,2006,2007 INRIA
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  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  * Contributions: Timo Bingmann <timo.bingmann@student.kit.edu>
20  * Contributions: Tom Hewer <tomhewer@mac.com> for Two Ray Ground Model
21  * Pavel Boyko <boyko@iitp.ru> for matrix
22  */
23 
24 #include "propagation-loss-model.h"
25 #include "ns3/log.h"
26 #include "ns3/mobility-model.h"
27 #include "ns3/boolean.h"
28 #include "ns3/double.h"
29 #include "ns3/string.h"
30 #include "ns3/pointer.h"
31 #include <cmath>
32 
33 NS_LOG_COMPONENT_DEFINE ("PropagationLossModel");
34 
35 namespace ns3 {
36 
37 // ------------------------------------------------------------------------- //
38 
39 NS_OBJECT_ENSURE_REGISTERED (PropagationLossModel)
40  ;
41 
42 TypeId
44 {
45  static TypeId tid = TypeId ("ns3::PropagationLossModel")
46  .SetParent<Object> ()
47  ;
48  return tid;
49 }
50 
52  : m_next (0)
53 {
54 }
55 
57 {
58 }
59 
60 void
62 {
63  m_next = next;
64 }
65 
68 {
69  return m_next;
70 }
71 
72 double
75  Ptr<MobilityModel> b) const
76 {
77  double self = DoCalcRxPower (txPowerDbm, a, b);
78  if (m_next != 0)
79  {
80  self = m_next->CalcRxPower (self, a, b);
81  }
82  return self;
83 }
84 
85 int64_t
87 {
88  int64_t currentStream = stream;
89  currentStream += DoAssignStreams (stream);
90  if (m_next != 0)
91  {
92  currentStream += m_next->AssignStreams (currentStream);
93  }
94  return (currentStream - stream);
95 }
96 
97 // ------------------------------------------------------------------------- //
98 
100  ;
101 
102 TypeId
104 {
105  static TypeId tid = TypeId ("ns3::RandomPropagationLossModel")
107  .AddConstructor<RandomPropagationLossModel> ()
108  .AddAttribute ("Variable", "The random variable used to pick a loss everytime CalcRxPower is invoked.",
109  StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"),
110  MakePointerAccessor (&RandomPropagationLossModel::m_variable),
111  MakePointerChecker<RandomVariableStream> ())
112  ;
113  return tid;
114 }
117 {
118 }
119 
121 {
122 }
123 
124 double
127  Ptr<MobilityModel> b) const
128 {
129  double rxc = -m_variable->GetValue ();
130  NS_LOG_DEBUG ("attenuation coefficent="<<rxc<<"Db");
131  return txPowerDbm + rxc;
132 }
133 
134 int64_t
136 {
137  m_variable->SetStream (stream);
138  return 1;
139 }
140 
141 // ------------------------------------------------------------------------- //
142 
144  ;
145 
146 const double FriisPropagationLossModel::PI = 3.14159265358979323846;
147 
148 TypeId
150 {
151  static TypeId tid = TypeId ("ns3::FriisPropagationLossModel")
153  .AddConstructor<FriisPropagationLossModel> ()
154  .AddAttribute ("Frequency",
155  "The carrier frequency (in Hz) at which propagation occurs (default is 5.15 GHz).",
156  DoubleValue (5.150e9),
157  MakeDoubleAccessor (&FriisPropagationLossModel::SetFrequency,
159  MakeDoubleChecker<double> ())
160  .AddAttribute ("SystemLoss", "The system loss",
161  DoubleValue (1.0),
162  MakeDoubleAccessor (&FriisPropagationLossModel::m_systemLoss),
163  MakeDoubleChecker<double> ())
164  .AddAttribute ("MinDistance",
165  "The distance under which the propagation model refuses to give results (m)",
166  DoubleValue (0.5),
167  MakeDoubleAccessor (&FriisPropagationLossModel::SetMinDistance,
169  MakeDoubleChecker<double> ())
170  ;
171  return tid;
172 }
173 
175 {
176 }
177 void
179 {
180  m_systemLoss = systemLoss;
181 }
182 double
184 {
185  return m_systemLoss;
186 }
187 void
189 {
190  m_minDistance = minDistance;
191 }
192 double
194 {
195  return m_minDistance;
196 }
197 
198 void
200 {
201  m_frequency = frequency;
202  static const double C = 299792458.0; // speed of light in vacuum
203  m_lambda = C / frequency;
204 }
205 
206 double
208 {
209  return m_frequency;
210 }
211 
212 double
214 {
215  double mw = std::pow (10.0,dbm/10.0);
216  return mw / 1000.0;
217 }
218 
219 double
221 {
222  double dbm = std::log10 (w * 1000.0) * 10.0;
223  return dbm;
224 }
225 
226 double
229  Ptr<MobilityModel> b) const
230 {
231  /*
232  * Friis free space equation:
233  * where Pt, Gr, Gr and P are in Watt units
234  * L is in meter units.
235  *
236  * P Gt * Gr * (lambda^2)
237  * --- = ---------------------
238  * Pt (4 * pi * d)^2 * L
239  *
240  * Gt: tx gain (unit-less)
241  * Gr: rx gain (unit-less)
242  * Pt: tx power (W)
243  * d: distance (m)
244  * L: system loss
245  * lambda: wavelength (m)
246  *
247  * Here, we ignore tx and rx gain and the input and output values
248  * are in dB or dBm:
249  *
250  * lambda^2
251  * rx = tx + 10 log10 (-------------------)
252  * (4 * pi * d)^2 * L
253  *
254  * rx: rx power (dB)
255  * tx: tx power (dB)
256  * d: distance (m)
257  * L: system loss (unit-less)
258  * lambda: wavelength (m)
259  */
260  double distance = a->GetDistanceFrom (b);
261  if (distance <= m_minDistance)
262  {
263  return txPowerDbm;
264  }
265  double numerator = m_lambda * m_lambda;
266  double denominator = 16 * PI * PI * distance * distance * m_systemLoss;
267  double pr = 10 * std::log10 (numerator / denominator);
268  NS_LOG_DEBUG ("distance="<<distance<<"m, attenuation coefficient="<<pr<<"dB");
269  return txPowerDbm + pr;
270 }
271 
272 int64_t
274 {
275  return 0;
276 }
277 
278 // ------------------------------------------------------------------------- //
279 // -- Two-Ray Ground Model ported from NS-2 -- tomhewer@mac.com -- Nov09 //
280 
282  ;
283 
284 const double TwoRayGroundPropagationLossModel::PI = 3.14159265358979323846;
285 
286 TypeId
288 {
289  static TypeId tid = TypeId ("ns3::TwoRayGroundPropagationLossModel")
291  .AddConstructor<TwoRayGroundPropagationLossModel> ()
292  .AddAttribute ("Frequency",
293  "The carrier frequency (in Hz) at which propagation occurs (default is 5.15 GHz).",
294  DoubleValue (5.150e9),
297  MakeDoubleChecker<double> ())
298  .AddAttribute ("SystemLoss", "The system loss",
299  DoubleValue (1.0),
301  MakeDoubleChecker<double> ())
302  .AddAttribute ("MinDistance",
303  "The distance under which the propagation model refuses to give results (m)",
304  DoubleValue (0.5),
307  MakeDoubleChecker<double> ())
308  .AddAttribute ("HeightAboveZ",
309  "The height of the antenna (m) above the node's Z coordinate",
310  DoubleValue (0),
312  MakeDoubleChecker<double> ())
313  ;
314  return tid;
315 }
316 
318 {
319 }
320 void
322 {
323  m_systemLoss = systemLoss;
324 }
325 double
327 {
328  return m_systemLoss;
329 }
330 void
332 {
333  m_minDistance = minDistance;
334 }
335 double
337 {
338  return m_minDistance;
339 }
340 void
342 {
343  m_heightAboveZ = heightAboveZ;
344 }
345 
346 void
348 {
349  m_frequency = frequency;
350  static const double C = 299792458.0; // speed of light in vacuum
351  m_lambda = C / frequency;
352 }
353 
354 double
356 {
357  return m_frequency;
358 }
359 
360 double
362 {
363  double mw = std::pow (10.0,dbm / 10.0);
364  return mw / 1000.0;
365 }
366 
367 double
369 {
370  double dbm = std::log10 (w * 1000.0) * 10.0;
371  return dbm;
372 }
373 
374 double
377  Ptr<MobilityModel> b) const
378 {
379  /*
380  * Two-Ray Ground equation:
381  *
382  * where Pt, Gt and Gr are in dBm units
383  * L, Ht and Hr are in meter units.
384  *
385  * Pr Gt * Gr * (Ht^2 * Hr^2)
386  * -- = (-------------------------)
387  * Pt d^4 * L
388  *
389  * Gt: tx gain (unit-less)
390  * Gr: rx gain (unit-less)
391  * Pt: tx power (dBm)
392  * d: distance (m)
393  * L: system loss
394  * Ht: Tx antenna height (m)
395  * Hr: Rx antenna height (m)
396  * lambda: wavelength (m)
397  *
398  * As with the Friis model we ignore tx and rx gain and output values
399  * are in dB or dBm
400  *
401  * (Ht * Ht) * (Hr * Hr)
402  * rx = tx + 10 log10 (-----------------------)
403  * (d * d * d * d) * L
404  */
405  double distance = a->GetDistanceFrom (b);
406  if (distance <= m_minDistance)
407  {
408  return txPowerDbm;
409  }
410 
411  // Set the height of the Tx and Rx antennae
412  double txAntHeight = a->GetPosition ().z + m_heightAboveZ;
413  double rxAntHeight = b->GetPosition ().z + m_heightAboveZ;
414 
415  // Calculate a crossover distance, under which we use Friis
416  /*
417  *
418  * dCross = (4 * pi * Ht * Hr) / lambda
419  *
420  */
421 
422  double dCross = (4 * PI * txAntHeight * rxAntHeight) / m_lambda;
423  double tmp = 0;
424  if (distance <= dCross)
425  {
426  // We use Friis
427  double numerator = m_lambda * m_lambda;
428  tmp = PI * distance;
429  double denominator = 16 * tmp * tmp * m_systemLoss;
430  double pr = 10 * std::log10 (numerator / denominator);
431  NS_LOG_DEBUG ("Receiver within crossover (" << dCross << "m) for Two_ray path; using Friis");
432  NS_LOG_DEBUG ("distance=" << distance << "m, attenuation coefficient=" << pr << "dB");
433  return txPowerDbm + pr;
434  }
435  else // Use Two-Ray Pathloss
436  {
437  tmp = txAntHeight * rxAntHeight;
438  double rayNumerator = tmp * tmp;
439  tmp = distance * distance;
440  double rayDenominator = tmp * tmp * m_systemLoss;
441  double rayPr = 10 * std::log10 (rayNumerator / rayDenominator);
442  NS_LOG_DEBUG ("distance=" << distance << "m, attenuation coefficient=" << rayPr << "dB");
443  return txPowerDbm + rayPr;
444 
445  }
446 }
447 
448 int64_t
450 {
451  return 0;
452 }
453 
454 // ------------------------------------------------------------------------- //
455 
457  ;
458 
459 TypeId
461 {
462  static TypeId tid = TypeId ("ns3::LogDistancePropagationLossModel")
464  .AddConstructor<LogDistancePropagationLossModel> ()
465  .AddAttribute ("Exponent",
466  "The exponent of the Path Loss propagation model",
467  DoubleValue (3.0),
468  MakeDoubleAccessor (&LogDistancePropagationLossModel::m_exponent),
469  MakeDoubleChecker<double> ())
470  .AddAttribute ("ReferenceDistance",
471  "The distance at which the reference loss is calculated (m)",
472  DoubleValue (1.0),
474  MakeDoubleChecker<double> ())
475  .AddAttribute ("ReferenceLoss",
476  "The reference loss at reference distance (dB). (Default is Friis at 1m with 5.15 GHz)",
477  DoubleValue (46.6777),
479  MakeDoubleChecker<double> ())
480  ;
481  return tid;
482 
483 }
484 
486 {
487 }
488 
489 void
491 {
492  m_exponent = n;
493 }
494 void
495 LogDistancePropagationLossModel::SetReference (double referenceDistance, double referenceLoss)
496 {
497  m_referenceDistance = referenceDistance;
498  m_referenceLoss = referenceLoss;
499 }
500 double
502 {
503  return m_exponent;
504 }
505 
506 double
509  Ptr<MobilityModel> b) const
510 {
511  double distance = a->GetDistanceFrom (b);
512  if (distance <= m_referenceDistance)
513  {
514  return txPowerDbm;
515  }
530  double pathLossDb = 10 * m_exponent * std::log10 (distance / m_referenceDistance);
531  double rxc = -m_referenceLoss - pathLossDb;
532  NS_LOG_DEBUG ("distance="<<distance<<"m, reference-attenuation="<< -m_referenceLoss<<"dB, "<<
533  "attenuation coefficient="<<rxc<<"db");
534  return txPowerDbm + rxc;
535 }
536 
537 int64_t
539 {
540  return 0;
541 }
542 
543 // ------------------------------------------------------------------------- //
544 
546  ;
547 
548 TypeId
550 {
551  static TypeId tid = TypeId ("ns3::ThreeLogDistancePropagationLossModel")
553  .AddConstructor<ThreeLogDistancePropagationLossModel> ()
554  .AddAttribute ("Distance0",
555  "Beginning of the first (near) distance field",
556  DoubleValue (1.0),
558  MakeDoubleChecker<double> ())
559  .AddAttribute ("Distance1",
560  "Beginning of the second (middle) distance field.",
561  DoubleValue (200.0),
563  MakeDoubleChecker<double> ())
564  .AddAttribute ("Distance2",
565  "Beginning of the third (far) distance field.",
566  DoubleValue (500.0),
568  MakeDoubleChecker<double> ())
569  .AddAttribute ("Exponent0",
570  "The exponent for the first field.",
571  DoubleValue (1.9),
573  MakeDoubleChecker<double> ())
574  .AddAttribute ("Exponent1",
575  "The exponent for the second field.",
576  DoubleValue (3.8),
578  MakeDoubleChecker<double> ())
579  .AddAttribute ("Exponent2",
580  "The exponent for the third field.",
581  DoubleValue (3.8),
583  MakeDoubleChecker<double> ())
584  .AddAttribute ("ReferenceLoss",
585  "The reference loss at distance d0 (dB). (Default is Friis at 1m with 5.15 GHz)",
586  DoubleValue (46.6777),
588  MakeDoubleChecker<double> ())
589  ;
590  return tid;
591 
592 }
593 
595 {
596 }
597 
598 double
601  Ptr<MobilityModel> b) const
602 {
603  double distance = a->GetDistanceFrom (b);
604  NS_ASSERT (distance >= 0);
605 
606  // See doxygen comments for the formula and explanation
607 
608  double pathLossDb;
609 
610  if (distance < m_distance0)
611  {
612  pathLossDb = 0;
613  }
614  else if (distance < m_distance1)
615  {
616  pathLossDb = m_referenceLoss
617  + 10 * m_exponent0 * std::log10 (distance / m_distance0);
618  }
619  else if (distance < m_distance2)
620  {
621  pathLossDb = m_referenceLoss
622  + 10 * m_exponent0 * std::log10 (m_distance1 / m_distance0)
623  + 10 * m_exponent1 * std::log10 (distance / m_distance1);
624  }
625  else
626  {
627  pathLossDb = m_referenceLoss
628  + 10 * m_exponent0 * std::log10 (m_distance1 / m_distance0)
629  + 10 * m_exponent1 * std::log10 (m_distance2 / m_distance1)
630  + 10 * m_exponent2 * std::log10 (distance / m_distance2);
631  }
632 
633  NS_LOG_DEBUG ("ThreeLogDistance distance=" << distance << "m, " <<
634  "attenuation=" << pathLossDb << "dB");
635 
636  return txPowerDbm - pathLossDb;
637 }
638 
639 int64_t
641 {
642  return 0;
643 }
644 
645 // ------------------------------------------------------------------------- //
646 
648  ;
649 
650 TypeId
652 {
653  static TypeId tid = TypeId ("ns3::NakagamiPropagationLossModel")
655  .AddConstructor<NakagamiPropagationLossModel> ()
656  .AddAttribute ("Distance1",
657  "Beginning of the second distance field. Default is 80m.",
658  DoubleValue (80.0),
659  MakeDoubleAccessor (&NakagamiPropagationLossModel::m_distance1),
660  MakeDoubleChecker<double> ())
661  .AddAttribute ("Distance2",
662  "Beginning of the third distance field. Default is 200m.",
663  DoubleValue (200.0),
664  MakeDoubleAccessor (&NakagamiPropagationLossModel::m_distance2),
665  MakeDoubleChecker<double> ())
666  .AddAttribute ("m0",
667  "m0 for distances smaller than Distance1. Default is 1.5.",
668  DoubleValue (1.5),
669  MakeDoubleAccessor (&NakagamiPropagationLossModel::m_m0),
670  MakeDoubleChecker<double> ())
671  .AddAttribute ("m1",
672  "m1 for distances smaller than Distance2. Default is 0.75.",
673  DoubleValue (0.75),
674  MakeDoubleAccessor (&NakagamiPropagationLossModel::m_m1),
675  MakeDoubleChecker<double> ())
676  .AddAttribute ("m2",
677  "m2 for distances greater than Distance2. Default is 0.75.",
678  DoubleValue (0.75),
679  MakeDoubleAccessor (&NakagamiPropagationLossModel::m_m2),
680  MakeDoubleChecker<double> ())
681  .AddAttribute ("ErlangRv",
682  "Access to the underlying ErlangRandomVariable",
683  StringValue ("ns3::ErlangRandomVariable"),
685  MakePointerChecker<ErlangRandomVariable> ())
686  .AddAttribute ("GammaRv",
687  "Access to the underlying GammaRandomVariable",
688  StringValue ("ns3::GammaRandomVariable"),
690  MakePointerChecker<GammaRandomVariable> ());
691  ;
692  return tid;
693 
694 }
695 
697 {
698 }
699 
700 double
703  Ptr<MobilityModel> b) const
704 {
705  // select m parameter
706 
707  double distance = a->GetDistanceFrom (b);
708  NS_ASSERT (distance >= 0);
709 
710  double m;
711  if (distance < m_distance1)
712  {
713  m = m_m0;
714  }
715  else if (distance < m_distance2)
716  {
717  m = m_m1;
718  }
719  else
720  {
721  m = m_m2;
722  }
723 
724  // the current power unit is dBm, but Watt is put into the Nakagami /
725  // Rayleigh distribution.
726  double powerW = std::pow (10, (txPowerDbm - 30) / 10);
727 
728  double resultPowerW;
729 
730  // switch between Erlang- and Gamma distributions: this is only for
731  // speed. (Gamma is equal to Erlang for any positive integer m.)
732  unsigned int int_m = static_cast<unsigned int>(std::floor (m));
733 
734  if (int_m == m)
735  {
736  resultPowerW = m_erlangRandomVariable->GetValue (int_m, powerW / m);
737  }
738  else
739  {
740  resultPowerW = m_gammaRandomVariable->GetValue (m, powerW / m);
741  }
742 
743  double resultPowerDbm = 10 * std::log10 (resultPowerW) + 30;
744 
745  NS_LOG_DEBUG ("Nakagami distance=" << distance << "m, " <<
746  "power=" << powerW <<"W, " <<
747  "resultPower=" << resultPowerW << "W=" << resultPowerDbm << "dBm");
748 
749  return resultPowerDbm;
750 }
751 
752 int64_t
754 {
755  m_erlangRandomVariable->SetStream (stream);
756  m_gammaRandomVariable->SetStream (stream + 1);
757  return 2;
758 }
759 
760 // ------------------------------------------------------------------------- //
761 
763  ;
764 
765 TypeId
767 {
768  static TypeId tid = TypeId ("ns3::FixedRssLossModel")
770  .AddConstructor<FixedRssLossModel> ()
771  .AddAttribute ("Rss", "The fixed receiver Rss.",
772  DoubleValue (-150.0),
773  MakeDoubleAccessor (&FixedRssLossModel::m_rss),
774  MakeDoubleChecker<double> ())
775  ;
776  return tid;
777 }
780 {
781 }
782 
784 {
785 }
786 
787 void
789 {
790  m_rss = rss;
791 }
792 
793 double
796  Ptr<MobilityModel> b) const
797 {
798  return m_rss;
799 }
800 
801 int64_t
803 {
804  return 0;
805 }
806 
807 // ------------------------------------------------------------------------- //
808 
810  ;
811 
812 TypeId
814 {
815  static TypeId tid = TypeId ("ns3::MatrixPropagationLossModel")
817  .AddConstructor<MatrixPropagationLossModel> ()
818  .AddAttribute ("DefaultLoss", "The default value for propagation loss, dB.",
819  DoubleValue (std::numeric_limits<double>::max ()),
820  MakeDoubleAccessor (&MatrixPropagationLossModel::m_default),
821  MakeDoubleChecker<double> ())
822  ;
823  return tid;
824 }
825 
827  : PropagationLossModel (), m_default (std::numeric_limits<double>::max ())
828 {
829 }
830 
832 {
833 }
834 
835 void
837 {
838  m_default = loss;
839 }
840 
841 void
843 {
844  NS_ASSERT (ma != 0 && mb != 0);
845 
846  MobilityPair p = std::make_pair (ma, mb);
847  std::map<MobilityPair, double>::iterator i = m_loss.find (p);
848 
849  if (i == m_loss.end ())
850  {
851  m_loss.insert (std::make_pair (p, loss));
852  }
853  else
854  {
855  i->second = loss;
856  }
857 
858  if (symmetric)
859  {
860  SetLoss (mb, ma, loss, false);
861  }
862 }
863 
864 double
867  Ptr<MobilityModel> b) const
868 {
869  std::map<MobilityPair, double>::const_iterator i = m_loss.find (std::make_pair (a, b));
870 
871  if (i != m_loss.end ())
872  {
873  return txPowerDbm - i->second;
874  }
875  else
876  {
877  return txPowerDbm - m_default;
878  }
879 }
880 
881 int64_t
883 {
884  return 0;
885 }
886 
887 // ------------------------------------------------------------------------- //
888 
890  ;
891 
892 TypeId
894 {
895  static TypeId tid = TypeId ("ns3::RangePropagationLossModel")
897  .AddConstructor<RangePropagationLossModel> ()
898  .AddAttribute ("MaxRange",
899  "Maximum Transmission Range (meters)",
900  DoubleValue (250),
901  MakeDoubleAccessor (&RangePropagationLossModel::m_range),
902  MakeDoubleChecker<double> ())
903  ;
904  return tid;
905 }
906 
908 {
909 }
910 
911 double
914  Ptr<MobilityModel> b) const
915 {
916  double distance = a->GetDistanceFrom (b);
917  if (distance <= m_range)
918  {
919  return txPowerDbm;
920  }
921  else
922  {
923  return -1000;
924  }
925 }
926 
927 int64_t
929 {
930  return 0;
931 }
932 
933 // ------------------------------------------------------------------------- //
934 
935 } // namespace ns3
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
void SetDefaultLoss(double)
Set default loss (in dB, positive) to be used, infinity if not set.
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
double GetDistanceFrom(Ptr< const MobilityModel > position) const
void SetNext(Ptr< PropagationLossModel > next)
Enables a chain of loss models to act on the signal.
hold variables of type string
Definition: string.h:19
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
a Two-Ray Ground propagation loss model ported from NS2
#define NS_ASSERT(condition)
Definition: assert.h:64
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
Vector GetPosition(void) const
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
The propagation loss depends only on the distance (range) between transmitter and receiver...
Ptr< RandomVariableStream > m_variable
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
virtual int64_t DoAssignStreams(int64_t stream)
Subclasses must implement this; those not using random variables can return zero. ...
virtual double GetValue(void)=0
Returns a random double from the underlying distribution.
A log distance path loss propagation model with three distance fields.
void SetMinDistance(double minDistance)
virtual int64_t DoAssignStreams(int64_t stream)
Subclasses must implement this; those not using random variables can return zero. ...
Ptr< PropagationLossModel > GetNext()
Gets the next PropagationLossModel in the chain of loss models that act on the signal.
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const =0
double CalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
The propagation loss follows a random distribution.
Return a constant received power level independent of the transmit power.
virtual int64_t DoAssignStreams(int64_t stream)
Subclasses must implement this; those not using random variables can return zero. ...
virtual int64_t DoAssignStreams(int64_t stream)
Subclasses must implement this; those not using random variables can return zero. ...
a Friis propagation loss model
Ptr< GammaRandomVariable > m_gammaRandomVariable
Ptr< PropagationLossModel > m_next
virtual int64_t DoAssignStreams(int64_t stream)
Subclasses must implement this; those not using random variables can return zero. ...
NS_LOG_COMPONENT_DEFINE("PropagationLossModel")
Nakagami-m fast fading propagation loss model.
Ptr< ErlangRandomVariable > m_erlangRandomVariable
Modelize the propagation loss through a transmission medium.
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
#define NS_LOG_DEBUG(msg)
Definition: log.h:289
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).
virtual int64_t DoAssignStreams(int64_t stream)
Subclasses must implement this; those not using random variables can return zero. ...
virtual int64_t DoAssignStreams(int64_t stream)
Subclasses must implement this; those not using random variables can return zero. ...
virtual int64_t DoAssignStreams(int64_t stream)
Subclasses must implement this; those not using random variables can return zero. ...
void SetReference(double referenceDistance, double referenceLoss)
a base class which provides memory management and object aggregation
Definition: object.h:63
std::pair< Ptr< MobilityModel >, Ptr< MobilityModel > > MobilityPair
a log distance propagation model.
Hold a floating point type.
Definition: double.h:41
a unique identifier for an interface.
Definition: type-id.h:49
TypeId SetParent(TypeId tid)
Definition: type-id.cc:611
The propagation loss is fixed for each pair of nodes and doesn't depend on their actual positions...
int64_t AssignStreams(int64_t stream)
If this loss model uses objects of type RandomVariableStream, set the stream numbers to the integers ...
virtual int64_t DoAssignStreams(int64_t stream)
Subclasses must implement this; those not using random variables can return zero. ...
std::map< MobilityPair, double > m_loss
Fixed loss between pair of nodes.
double z
z coordinate of vector
Definition: vector.h:57
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
virtual int64_t DoAssignStreams(int64_t stream)=0
Subclasses must implement this; those not using random variables can return zero. ...