A Discrete-Event Network Simulator
API
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 namespace ns3 {
34 
35 NS_LOG_COMPONENT_DEFINE ("PropagationLossModel");
36 
37 // ------------------------------------------------------------------------- //
38 
39 NS_OBJECT_ENSURE_REGISTERED (PropagationLossModel);
40 
41 TypeId
43 {
44  static TypeId tid = TypeId ("ns3::PropagationLossModel")
45  .SetParent<Object> ()
46  ;
47  return tid;
48 }
49 
51  : m_next (0)
52 {
53 }
54 
56 {
57 }
58 
59 void
61 {
62  m_next = next;
63 }
64 
67 {
68  return m_next;
69 }
70 
71 double
74  Ptr<MobilityModel> b) const
75 {
76  double self = DoCalcRxPower (txPowerDbm, a, b);
77  if (m_next != 0)
78  {
79  self = m_next->CalcRxPower (self, a, b);
80  }
81  return self;
82 }
83 
84 int64_t
86 {
87  int64_t currentStream = stream;
88  currentStream += DoAssignStreams (stream);
89  if (m_next != 0)
90  {
91  currentStream += m_next->AssignStreams (currentStream);
92  }
93  return (currentStream - stream);
94 }
95 
96 // ------------------------------------------------------------------------- //
97 
99 
100 TypeId
102 {
103  static TypeId tid = TypeId ("ns3::RandomPropagationLossModel")
105  .AddConstructor<RandomPropagationLossModel> ()
106  .AddAttribute ("Variable", "The random variable used to pick a loss everytime CalcRxPower is invoked.",
107  StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"),
109  MakePointerChecker<RandomVariableStream> ())
110  ;
111  return tid;
112 }
115 {
116 }
117 
119 {
120 }
121 
122 double
125  Ptr<MobilityModel> b) const
126 {
127  double rxc = -m_variable->GetValue ();
128  NS_LOG_DEBUG ("attenuation coefficient="<<rxc<<"Db");
129  return txPowerDbm + rxc;
130 }
131 
132 int64_t
134 {
135  m_variable->SetStream (stream);
136  return 1;
137 }
138 
139 // ------------------------------------------------------------------------- //
140 
142 
143 TypeId
145 {
146  static TypeId tid = TypeId ("ns3::FriisPropagationLossModel")
148  .SetGroupName ("Propagation")
149  .AddConstructor<FriisPropagationLossModel> ()
150  .AddAttribute ("Frequency",
151  "The carrier frequency (in Hz) at which propagation occurs (default is 5.15 GHz).",
152  DoubleValue (5.150e9),
155  MakeDoubleChecker<double> ())
156  .AddAttribute ("SystemLoss", "The system loss",
157  DoubleValue (1.0),
159  MakeDoubleChecker<double> ())
160  .AddAttribute ("MinLoss",
161  "The minimum value (dB) of the total loss, used at short ranges. Note: ",
162  DoubleValue (0.0),
165  MakeDoubleChecker<double> ())
166  ;
167  return tid;
168 }
169 
171 {
172 }
173 void
175 {
176  m_systemLoss = systemLoss;
177 }
178 double
180 {
181  return m_systemLoss;
182 }
183 void
185 {
186  m_minLoss = minLoss;
187 }
188 double
190 {
191  return m_minLoss;
192 }
193 
194 void
196 {
197  m_frequency = frequency;
198  static const double C = 299792458.0; // speed of light in vacuum
199  m_lambda = C / frequency;
200 }
201 
202 double
204 {
205  return m_frequency;
206 }
207 
208 double
210 {
211  double mw = std::pow (10.0,dbm/10.0);
212  return mw / 1000.0;
213 }
214 
215 double
217 {
218  double dbm = std::log10 (w * 1000.0) * 10.0;
219  return dbm;
220 }
221 
222 double
225  Ptr<MobilityModel> b) const
226 {
227  /*
228  * Friis free space equation:
229  * where Pt, Gr, Gr and P are in Watt units
230  * L is in meter units.
231  *
232  * P Gt * Gr * (lambda^2)
233  * --- = ---------------------
234  * Pt (4 * pi * d)^2 * L
235  *
236  * Gt: tx gain (unit-less)
237  * Gr: rx gain (unit-less)
238  * Pt: tx power (W)
239  * d: distance (m)
240  * L: system loss
241  * lambda: wavelength (m)
242  *
243  * Here, we ignore tx and rx gain and the input and output values
244  * are in dB or dBm:
245  *
246  * lambda^2
247  * rx = tx + 10 log10 (-------------------)
248  * (4 * pi * d)^2 * L
249  *
250  * rx: rx power (dB)
251  * tx: tx power (dB)
252  * d: distance (m)
253  * L: system loss (unit-less)
254  * lambda: wavelength (m)
255  */
256  double distance = a->GetDistanceFrom (b);
257  if (distance < 3*m_lambda)
258  {
259  NS_LOG_WARN ("distance not within the far field region => inaccurate propagation loss value");
260  }
261  if (distance <= 0)
262  {
263  return txPowerDbm - m_minLoss;
264  }
265  double numerator = m_lambda * m_lambda;
266  double denominator = 16 * M_PI * M_PI * distance * distance * m_systemLoss;
267  double lossDb = -10 * log10 (numerator / denominator);
268  NS_LOG_DEBUG ("distance=" << distance<< "m, loss=" << lossDb <<"dB");
269  return txPowerDbm - std::max (lossDb, m_minLoss);
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 TypeId
285 {
286  static TypeId tid = TypeId ("ns3::TwoRayGroundPropagationLossModel")
288  .AddConstructor<TwoRayGroundPropagationLossModel> ()
289  .AddAttribute ("Frequency",
290  "The carrier frequency (in Hz) at which propagation occurs (default is 5.15 GHz).",
291  DoubleValue (5.150e9),
294  MakeDoubleChecker<double> ())
295  .AddAttribute ("SystemLoss", "The system loss",
296  DoubleValue (1.0),
298  MakeDoubleChecker<double> ())
299  .AddAttribute ("MinDistance",
300  "The distance under which the propagation model refuses to give results (m)",
301  DoubleValue (0.5),
304  MakeDoubleChecker<double> ())
305  .AddAttribute ("HeightAboveZ",
306  "The height of the antenna (m) above the node's Z coordinate",
307  DoubleValue (0),
309  MakeDoubleChecker<double> ())
310  ;
311  return tid;
312 }
313 
315 {
316 }
317 void
319 {
320  m_systemLoss = systemLoss;
321 }
322 double
324 {
325  return m_systemLoss;
326 }
327 void
329 {
330  m_minDistance = minDistance;
331 }
332 double
334 {
335  return m_minDistance;
336 }
337 void
339 {
340  m_heightAboveZ = heightAboveZ;
341 }
342 
343 void
345 {
346  m_frequency = frequency;
347  static const double C = 299792458.0; // speed of light in vacuum
348  m_lambda = C / frequency;
349 }
350 
351 double
353 {
354  return m_frequency;
355 }
356 
357 double
359 {
360  double mw = std::pow (10.0,dbm / 10.0);
361  return mw / 1000.0;
362 }
363 
364 double
366 {
367  double dbm = std::log10 (w * 1000.0) * 10.0;
368  return dbm;
369 }
370 
371 double
374  Ptr<MobilityModel> b) const
375 {
376  /*
377  * Two-Ray Ground equation:
378  *
379  * where Pt, Gt and Gr are in dBm units
380  * L, Ht and Hr are in meter units.
381  *
382  * Pr Gt * Gr * (Ht^2 * Hr^2)
383  * -- = (-------------------------)
384  * Pt d^4 * L
385  *
386  * Gt: tx gain (unit-less)
387  * Gr: rx gain (unit-less)
388  * Pt: tx power (dBm)
389  * d: distance (m)
390  * L: system loss
391  * Ht: Tx antenna height (m)
392  * Hr: Rx antenna height (m)
393  * lambda: wavelength (m)
394  *
395  * As with the Friis model we ignore tx and rx gain and output values
396  * are in dB or dBm
397  *
398  * (Ht * Ht) * (Hr * Hr)
399  * rx = tx + 10 log10 (-----------------------)
400  * (d * d * d * d) * L
401  */
402  double distance = a->GetDistanceFrom (b);
403  if (distance <= m_minDistance)
404  {
405  return txPowerDbm;
406  }
407 
408  // Set the height of the Tx and Rx antennae
409  double txAntHeight = a->GetPosition ().z + m_heightAboveZ;
410  double rxAntHeight = b->GetPosition ().z + m_heightAboveZ;
411 
412  // Calculate a crossover distance, under which we use Friis
413  /*
414  *
415  * dCross = (4 * pi * Ht * Hr) / lambda
416  *
417  */
418 
419  double dCross = (4 * M_PI * txAntHeight * rxAntHeight) / m_lambda;
420  double tmp = 0;
421  if (distance <= dCross)
422  {
423  // We use Friis
424  double numerator = m_lambda * m_lambda;
425  tmp = M_PI * distance;
426  double denominator = 16 * tmp * tmp * m_systemLoss;
427  double pr = 10 * std::log10 (numerator / denominator);
428  NS_LOG_DEBUG ("Receiver within crossover (" << dCross << "m) for Two_ray path; using Friis");
429  NS_LOG_DEBUG ("distance=" << distance << "m, attenuation coefficient=" << pr << "dB");
430  return txPowerDbm + pr;
431  }
432  else // Use Two-Ray Pathloss
433  {
434  tmp = txAntHeight * rxAntHeight;
435  double rayNumerator = tmp * tmp;
436  tmp = distance * distance;
437  double rayDenominator = tmp * tmp * m_systemLoss;
438  double rayPr = 10 * std::log10 (rayNumerator / rayDenominator);
439  NS_LOG_DEBUG ("distance=" << distance << "m, attenuation coefficient=" << rayPr << "dB");
440  return txPowerDbm + rayPr;
441 
442  }
443 }
444 
445 int64_t
447 {
448  return 0;
449 }
450 
451 // ------------------------------------------------------------------------- //
452 
454 
455 TypeId
457 {
458  static TypeId tid = TypeId ("ns3::LogDistancePropagationLossModel")
460  .SetGroupName ("Propagation")
461  .AddConstructor<LogDistancePropagationLossModel> ()
462  .AddAttribute ("Exponent",
463  "The exponent of the Path Loss propagation model",
464  DoubleValue (3.0),
466  MakeDoubleChecker<double> ())
467  .AddAttribute ("ReferenceDistance",
468  "The distance at which the reference loss is calculated (m)",
469  DoubleValue (1.0),
471  MakeDoubleChecker<double> ())
472  .AddAttribute ("ReferenceLoss",
473  "The reference loss at reference distance (dB). (Default is Friis at 1m with 5.15 GHz)",
474  DoubleValue (46.6777),
476  MakeDoubleChecker<double> ())
477  ;
478  return tid;
479 
480 }
481 
483 {
484 }
485 
486 void
488 {
489  m_exponent = n;
490 }
491 void
492 LogDistancePropagationLossModel::SetReference (double referenceDistance, double referenceLoss)
493 {
494  m_referenceDistance = referenceDistance;
495  m_referenceLoss = referenceLoss;
496 }
497 double
499 {
500  return m_exponent;
501 }
502 
503 double
506  Ptr<MobilityModel> b) const
507 {
508  double distance = a->GetDistanceFrom (b);
509  if (distance <= m_referenceDistance)
510  {
511  return txPowerDbm;
512  }
527  double pathLossDb = 10 * m_exponent * std::log10 (distance / m_referenceDistance);
528  double rxc = -m_referenceLoss - pathLossDb;
529  NS_LOG_DEBUG ("distance="<<distance<<"m, reference-attenuation="<< -m_referenceLoss<<"dB, "<<
530  "attenuation coefficient="<<rxc<<"db");
531  return txPowerDbm + rxc;
532 }
533 
534 int64_t
536 {
537  return 0;
538 }
539 
540 // ------------------------------------------------------------------------- //
541 
543 
544 TypeId
546 {
547  static TypeId tid = TypeId ("ns3::ThreeLogDistancePropagationLossModel")
549  .AddConstructor<ThreeLogDistancePropagationLossModel> ()
550  .AddAttribute ("Distance0",
551  "Beginning of the first (near) distance field",
552  DoubleValue (1.0),
554  MakeDoubleChecker<double> ())
555  .AddAttribute ("Distance1",
556  "Beginning of the second (middle) distance field.",
557  DoubleValue (200.0),
559  MakeDoubleChecker<double> ())
560  .AddAttribute ("Distance2",
561  "Beginning of the third (far) distance field.",
562  DoubleValue (500.0),
564  MakeDoubleChecker<double> ())
565  .AddAttribute ("Exponent0",
566  "The exponent for the first field.",
567  DoubleValue (1.9),
569  MakeDoubleChecker<double> ())
570  .AddAttribute ("Exponent1",
571  "The exponent for the second field.",
572  DoubleValue (3.8),
574  MakeDoubleChecker<double> ())
575  .AddAttribute ("Exponent2",
576  "The exponent for the third field.",
577  DoubleValue (3.8),
579  MakeDoubleChecker<double> ())
580  .AddAttribute ("ReferenceLoss",
581  "The reference loss at distance d0 (dB). (Default is Friis at 1m with 5.15 GHz)",
582  DoubleValue (46.6777),
584  MakeDoubleChecker<double> ())
585  ;
586  return tid;
587 
588 }
589 
591 {
592 }
593 
594 double
597  Ptr<MobilityModel> b) const
598 {
599  double distance = a->GetDistanceFrom (b);
600  NS_ASSERT (distance >= 0);
601 
602  // See doxygen comments for the formula and explanation
603 
604  double pathLossDb;
605 
606  if (distance < m_distance0)
607  {
608  pathLossDb = 0;
609  }
610  else if (distance < m_distance1)
611  {
612  pathLossDb = m_referenceLoss
613  + 10 * m_exponent0 * std::log10 (distance / m_distance0);
614  }
615  else if (distance < m_distance2)
616  {
617  pathLossDb = m_referenceLoss
618  + 10 * m_exponent0 * std::log10 (m_distance1 / m_distance0)
619  + 10 * m_exponent1 * std::log10 (distance / m_distance1);
620  }
621  else
622  {
623  pathLossDb = m_referenceLoss
624  + 10 * m_exponent0 * std::log10 (m_distance1 / m_distance0)
625  + 10 * m_exponent1 * std::log10 (m_distance2 / m_distance1)
626  + 10 * m_exponent2 * std::log10 (distance / m_distance2);
627  }
628 
629  NS_LOG_DEBUG ("ThreeLogDistance distance=" << distance << "m, " <<
630  "attenuation=" << pathLossDb << "dB");
631 
632  return txPowerDbm - pathLossDb;
633 }
634 
635 int64_t
637 {
638  return 0;
639 }
640 
641 // ------------------------------------------------------------------------- //
642 
644 
645 TypeId
647 {
648  static TypeId tid = TypeId ("ns3::NakagamiPropagationLossModel")
650  .SetGroupName ("Propagation")
651  .AddConstructor<NakagamiPropagationLossModel> ()
652  .AddAttribute ("Distance1",
653  "Beginning of the second distance field. Default is 80m.",
654  DoubleValue (80.0),
656  MakeDoubleChecker<double> ())
657  .AddAttribute ("Distance2",
658  "Beginning of the third distance field. Default is 200m.",
659  DoubleValue (200.0),
661  MakeDoubleChecker<double> ())
662  .AddAttribute ("m0",
663  "m0 for distances smaller than Distance1. Default is 1.5.",
664  DoubleValue (1.5),
666  MakeDoubleChecker<double> ())
667  .AddAttribute ("m1",
668  "m1 for distances smaller than Distance2. Default is 0.75.",
669  DoubleValue (0.75),
671  MakeDoubleChecker<double> ())
672  .AddAttribute ("m2",
673  "m2 for distances greater than Distance2. Default is 0.75.",
674  DoubleValue (0.75),
676  MakeDoubleChecker<double> ())
677  .AddAttribute ("ErlangRv",
678  "Access to the underlying ErlangRandomVariable",
679  StringValue ("ns3::ErlangRandomVariable"),
681  MakePointerChecker<ErlangRandomVariable> ())
682  .AddAttribute ("GammaRv",
683  "Access to the underlying GammaRandomVariable",
684  StringValue ("ns3::GammaRandomVariable"),
686  MakePointerChecker<GammaRandomVariable> ());
687  ;
688  return tid;
689 
690 }
691 
693 {
694 }
695 
696 double
699  Ptr<MobilityModel> b) const
700 {
701  // select m parameter
702 
703  double distance = a->GetDistanceFrom (b);
704  NS_ASSERT (distance >= 0);
705 
706  double m;
707  if (distance < m_distance1)
708  {
709  m = m_m0;
710  }
711  else if (distance < m_distance2)
712  {
713  m = m_m1;
714  }
715  else
716  {
717  m = m_m2;
718  }
719 
720  // the current power unit is dBm, but Watt is put into the Nakagami /
721  // Rayleigh distribution.
722  double powerW = std::pow (10, (txPowerDbm - 30) / 10);
723 
724  double resultPowerW;
725 
726  // switch between Erlang- and Gamma distributions: this is only for
727  // speed. (Gamma is equal to Erlang for any positive integer m.)
728  unsigned int int_m = static_cast<unsigned int>(std::floor (m));
729 
730  if (int_m == m)
731  {
732  resultPowerW = m_erlangRandomVariable->GetValue (int_m, powerW / m);
733  }
734  else
735  {
736  resultPowerW = m_gammaRandomVariable->GetValue (m, powerW / m);
737  }
738 
739  double resultPowerDbm = 10 * std::log10 (resultPowerW) + 30;
740 
741  NS_LOG_DEBUG ("Nakagami distance=" << distance << "m, " <<
742  "power=" << powerW <<"W, " <<
743  "resultPower=" << resultPowerW << "W=" << resultPowerDbm << "dBm");
744 
745  return resultPowerDbm;
746 }
747 
748 int64_t
750 {
751  m_erlangRandomVariable->SetStream (stream);
752  m_gammaRandomVariable->SetStream (stream + 1);
753  return 2;
754 }
755 
756 // ------------------------------------------------------------------------- //
757 
759 
760 TypeId
762 {
763  static TypeId tid = TypeId ("ns3::FixedRssLossModel")
765  .SetGroupName ("Propagation")
766  .AddConstructor<FixedRssLossModel> ()
767  .AddAttribute ("Rss", "The fixed receiver Rss.",
768  DoubleValue (-150.0),
770  MakeDoubleChecker<double> ())
771  ;
772  return tid;
773 }
776 {
777 }
778 
780 {
781 }
782 
783 void
785 {
786  m_rss = rss;
787 }
788 
789 double
792  Ptr<MobilityModel> b) const
793 {
794  return m_rss;
795 }
796 
797 int64_t
799 {
800  return 0;
801 }
802 
803 // ------------------------------------------------------------------------- //
804 
806 
807 TypeId
809 {
810  static TypeId tid = TypeId ("ns3::MatrixPropagationLossModel")
812  .SetGroupName ("Propagation")
813  .AddConstructor<MatrixPropagationLossModel> ()
814  .AddAttribute ("DefaultLoss", "The default value for propagation loss, dB.",
815  DoubleValue (std::numeric_limits<double>::max ()),
817  MakeDoubleChecker<double> ())
818  ;
819  return tid;
820 }
821 
823  : PropagationLossModel (), m_default (std::numeric_limits<double>::max ())
824 {
825 }
826 
828 {
829 }
830 
831 void
833 {
834  m_default = loss;
835 }
836 
837 void
839 {
840  NS_ASSERT (ma != 0 && mb != 0);
841 
842  MobilityPair p = std::make_pair (ma, mb);
843  std::map<MobilityPair, double>::iterator i = m_loss.find (p);
844 
845  if (i == m_loss.end ())
846  {
847  m_loss.insert (std::make_pair (p, loss));
848  }
849  else
850  {
851  i->second = loss;
852  }
853 
854  if (symmetric)
855  {
856  SetLoss (mb, ma, loss, false);
857  }
858 }
859 
860 double
863  Ptr<MobilityModel> b) const
864 {
865  std::map<MobilityPair, double>::const_iterator i = m_loss.find (std::make_pair (a, b));
866 
867  if (i != m_loss.end ())
868  {
869  return txPowerDbm - i->second;
870  }
871  else
872  {
873  return txPowerDbm - m_default;
874  }
875 }
876 
877 int64_t
879 {
880  return 0;
881 }
882 
883 // ------------------------------------------------------------------------- //
884 
886 
887 TypeId
889 {
890  static TypeId tid = TypeId ("ns3::RangePropagationLossModel")
892  .AddConstructor<RangePropagationLossModel> ()
893  .AddAttribute ("MaxRange",
894  "Maximum Transmission Range (meters)",
895  DoubleValue (250),
897  MakeDoubleChecker<double> ())
898  ;
899  return tid;
900 }
901 
903 {
904 }
905 
906 double
909  Ptr<MobilityModel> b) const
910 {
911  double distance = a->GetDistanceFrom (b);
912  if (distance <= m_range)
913  {
914  return txPowerDbm;
915  }
916  else
917  {
918  return -1000;
919  }
920 }
921 
922 int64_t
924 {
925  return 0;
926 }
927 
928 // ------------------------------------------------------------------------- //
929 
930 } // namespace ns3
double m_m0
m for distances smaller than Distance1
double m_distance2
Beginning of the third (far) distance field.
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
Returns the Rx Power taking into account only the particular PropagatinLossModel. ...
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Returns the Rx Power taking into account only the particular PropagatinLossModel. ...
void SetDefaultLoss(double defaultLoss)
Set the default propagation loss (in dB, positive) to be used, infinity if not set.
double GetDistanceFrom(Ptr< const MobilityModel > position) const
double m_m2
m for distances greater than Distance2
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:44
void SetNext(Ptr< PropagationLossModel > next)
Enables a chain of loss models to act on the signal.
Hold variables of type string.
Definition: string.h:41
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Returns the Rx Power taking into account only the particular PropagatinLossModel. ...
double m_frequency
the carrier frequency
double m_range
Maximum Transmission Range (meters)
a Two-Ray Ground propagation loss model ported from NS2
double m_heightAboveZ
antenna height above the node's Z coordinate
double m_lambda
the carrier wavelength
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:67
double m_frequency
the carrier frequency
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
double m_referenceLoss
The reference loss at distance d0 (dB).
Vector GetPosition(void) const
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Returns the Rx Power taking into account only the particular PropagatinLossModel. ...
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Returns the Rx Power taking into account only the particular PropagatinLossModel. ...
double m_exponent1
The exponent for the second field.
The propagation loss depends only on the distance (range) between transmitter and receiver...
double m_minDistance
minimum distance for the model
Ptr< RandomVariableStream > m_variable
random generator
static TypeId GetTypeId(void)
Get the type ID.
static TypeId GetTypeId(void)
Get the type ID.
STL namespace.
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Returns the Rx Power taking into account only the particular PropagatinLossModel. ...
double m_rss
the received signal strength
virtual int64_t DoAssignStreams(int64_t stream)
Subclasses must implement this; those not using random variables can return zero. ...
virtual double GetValue(void)=0
Get the next random value as a double drawn from the distribution.
A log distance path loss propagation model with three distance fields.
static TypeId GetTypeId(void)
Get the type ID.
virtual int64_t DoAssignStreams(int64_t stream)
Subclasses must implement this; those not using random variables can return zero. ...
double m_exponent0
The exponent for the first field.
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:220
Ptr< PropagationLossModel > GetNext()
Gets the next PropagationLossModel in the chain of loss models that act on the signal.
double m_lambda
the carrier wavelength
double DbmToW(double dbm) const
Transforms a Dbm value to Watt.
static TypeId GetTypeId(void)
Get the type ID.
static TypeId GetTypeId(void)
Get the type ID.
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Returns the Rx Power taking into account only the particular PropagatinLossModel. ...
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const =0
Returns the Rx Power taking into account only the particular PropagatinLossModel. ...
static TypeId GetTypeId(void)
Get the type ID.
double CalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Returns the Rx Power taking into account all the PropagatinLossModel(s) chained to the current one...
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
Gamma random variable.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double m_distance0
Beginning of the first (near) distance field.
Ptr< PropagationLossModel > m_next
Next propagation loss model in the list.
virtual int64_t DoAssignStreams(int64_t stream)
Subclasses must implement this; those not using random variables can return zero. ...
Nakagami-m fast fading propagation loss model.
Ptr< ErlangRandomVariable > m_erlangRandomVariable
Erlang random variable.
double m_distance1
Beginning of the second (middle) distance field.
double m_referenceDistance
reference distance
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:42
double m_exponent2
The exponent for the third field.
Models the propagation loss through a transmission medium.
static TypeId GetTypeId(void)
Get the type ID.
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Returns the Rx Power taking into account only the particular PropagatinLossModel. ...
static TypeId GetTypeId(void)
Get the type ID.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:228
double m_m1
m for distances smaller than Distance2
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:236
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. ...
double DbmToW(double dbm) const
Transforms a Dbm value to Watt.
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)
Set the reference path loss at a given distance.
A base class which provides memory management and object aggregation.
Definition: object.h:87
std::pair< Ptr< MobilityModel >, Ptr< MobilityModel > > MobilityPair
Typedef: Mobility models pair.
static TypeId GetTypeId(void)
Get the type ID.
a log distance propagation model.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
Definition: double.h:41
static TypeId GetTypeId(void)
Get the type ID.
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:826
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. ...
double DbmFromW(double w) const
Transforms a Watt value to Dbm.
double DbmFromW(double w) const
Transforms a Watt value to Dbm.
std::map< MobilityPair, double > m_loss
Propagation loss between pair of nodes.
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Returns the Rx Power taking into account only the particular PropagatinLossModel. ...
virtual int64_t DoAssignStreams(int64_t stream)=0
Subclasses must implement this; those not using random variables can return zero. ...