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 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]"),
108  MakePointerAccessor (&RandomPropagationLossModel::m_variable),
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 coefficent="<<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 const double FriisPropagationLossModel::PI = 3.14159265358979323846;
144 
145 TypeId
147 {
148  static TypeId tid = TypeId ("ns3::FriisPropagationLossModel")
150  .AddConstructor<FriisPropagationLossModel> ()
151  .AddAttribute ("Frequency",
152  "The carrier frequency (in Hz) at which propagation occurs (default is 5.15 GHz).",
153  DoubleValue (5.150e9),
154  MakeDoubleAccessor (&FriisPropagationLossModel::SetFrequency,
156  MakeDoubleChecker<double> ())
157  .AddAttribute ("SystemLoss", "The system loss",
158  DoubleValue (1.0),
159  MakeDoubleAccessor (&FriisPropagationLossModel::m_systemLoss),
160  MakeDoubleChecker<double> ())
161  .AddAttribute ("MinLoss",
162  "The minimum value (dB) of the total loss, used at short ranges. Note: ",
163  DoubleValue (0.0),
164  MakeDoubleAccessor (&FriisPropagationLossModel::SetMinLoss,
166  MakeDoubleChecker<double> ())
167  ;
168  return tid;
169 }
170 
172 {
173 }
174 void
176 {
177  m_systemLoss = systemLoss;
178 }
179 double
181 {
182  return m_systemLoss;
183 }
184 void
186 {
187  m_minLoss = minLoss;
188 }
189 double
191 {
192  return m_minLoss;
193 }
194 
195 void
197 {
198  m_frequency = frequency;
199  static const double C = 299792458.0; // speed of light in vacuum
200  m_lambda = C / frequency;
201 }
202 
203 double
205 {
206  return m_frequency;
207 }
208 
209 double
211 {
212  double mw = std::pow (10.0,dbm/10.0);
213  return mw / 1000.0;
214 }
215 
216 double
218 {
219  double dbm = std::log10 (w * 1000.0) * 10.0;
220  return dbm;
221 }
222 
223 double
226  Ptr<MobilityModel> b) const
227 {
228  /*
229  * Friis free space equation:
230  * where Pt, Gr, Gr and P are in Watt units
231  * L is in meter units.
232  *
233  * P Gt * Gr * (lambda^2)
234  * --- = ---------------------
235  * Pt (4 * pi * d)^2 * L
236  *
237  * Gt: tx gain (unit-less)
238  * Gr: rx gain (unit-less)
239  * Pt: tx power (W)
240  * d: distance (m)
241  * L: system loss
242  * lambda: wavelength (m)
243  *
244  * Here, we ignore tx and rx gain and the input and output values
245  * are in dB or dBm:
246  *
247  * lambda^2
248  * rx = tx + 10 log10 (-------------------)
249  * (4 * pi * d)^2 * L
250  *
251  * rx: rx power (dB)
252  * tx: tx power (dB)
253  * d: distance (m)
254  * L: system loss (unit-less)
255  * lambda: wavelength (m)
256  */
257  double distance = a->GetDistanceFrom (b);
258  if (distance < 3*m_lambda)
259  {
260  NS_LOG_WARN ("distance not within the far field region => inaccurate propagation loss value");
261  }
262  if (distance <= 0)
263  {
264  return txPowerDbm - m_minLoss;
265  }
266  double numerator = m_lambda * m_lambda;
267  double denominator = 16 * PI * PI * distance * distance * m_systemLoss;
268  double lossDb = -10 * log10 (numerator / denominator);
269  NS_LOG_DEBUG ("distance=" << distance<< "m, loss=" << lossDb <<"dB");
270  return txPowerDbm - std::max (lossDb, m_minLoss);
271 }
272 
273 int64_t
275 {
276  return 0;
277 }
278 
279 // ------------------------------------------------------------------------- //
280 // -- Two-Ray Ground Model ported from NS-2 -- tomhewer@mac.com -- Nov09 //
281 
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 TypeId
460 {
461  static TypeId tid = TypeId ("ns3::LogDistancePropagationLossModel")
463  .AddConstructor<LogDistancePropagationLossModel> ()
464  .AddAttribute ("Exponent",
465  "The exponent of the Path Loss propagation model",
466  DoubleValue (3.0),
467  MakeDoubleAccessor (&LogDistancePropagationLossModel::m_exponent),
468  MakeDoubleChecker<double> ())
469  .AddAttribute ("ReferenceDistance",
470  "The distance at which the reference loss is calculated (m)",
471  DoubleValue (1.0),
473  MakeDoubleChecker<double> ())
474  .AddAttribute ("ReferenceLoss",
475  "The reference loss at reference distance (dB). (Default is Friis at 1m with 5.15 GHz)",
476  DoubleValue (46.6777),
478  MakeDoubleChecker<double> ())
479  ;
480  return tid;
481 
482 }
483 
485 {
486 }
487 
488 void
490 {
491  m_exponent = n;
492 }
493 void
494 LogDistancePropagationLossModel::SetReference (double referenceDistance, double referenceLoss)
495 {
496  m_referenceDistance = referenceDistance;
497  m_referenceLoss = referenceLoss;
498 }
499 double
501 {
502  return m_exponent;
503 }
504 
505 double
508  Ptr<MobilityModel> b) const
509 {
510  double distance = a->GetDistanceFrom (b);
511  if (distance <= m_referenceDistance)
512  {
513  return txPowerDbm;
514  }
529  double pathLossDb = 10 * m_exponent * std::log10 (distance / m_referenceDistance);
530  double rxc = -m_referenceLoss - pathLossDb;
531  NS_LOG_DEBUG ("distance="<<distance<<"m, reference-attenuation="<< -m_referenceLoss<<"dB, "<<
532  "attenuation coefficient="<<rxc<<"db");
533  return txPowerDbm + rxc;
534 }
535 
536 int64_t
538 {
539  return 0;
540 }
541 
542 // ------------------------------------------------------------------------- //
543 
545 
546 TypeId
548 {
549  static TypeId tid = TypeId ("ns3::ThreeLogDistancePropagationLossModel")
551  .AddConstructor<ThreeLogDistancePropagationLossModel> ()
552  .AddAttribute ("Distance0",
553  "Beginning of the first (near) distance field",
554  DoubleValue (1.0),
556  MakeDoubleChecker<double> ())
557  .AddAttribute ("Distance1",
558  "Beginning of the second (middle) distance field.",
559  DoubleValue (200.0),
561  MakeDoubleChecker<double> ())
562  .AddAttribute ("Distance2",
563  "Beginning of the third (far) distance field.",
564  DoubleValue (500.0),
566  MakeDoubleChecker<double> ())
567  .AddAttribute ("Exponent0",
568  "The exponent for the first field.",
569  DoubleValue (1.9),
571  MakeDoubleChecker<double> ())
572  .AddAttribute ("Exponent1",
573  "The exponent for the second field.",
574  DoubleValue (3.8),
576  MakeDoubleChecker<double> ())
577  .AddAttribute ("Exponent2",
578  "The exponent for the third field.",
579  DoubleValue (3.8),
581  MakeDoubleChecker<double> ())
582  .AddAttribute ("ReferenceLoss",
583  "The reference loss at distance d0 (dB). (Default is Friis at 1m with 5.15 GHz)",
584  DoubleValue (46.6777),
586  MakeDoubleChecker<double> ())
587  ;
588  return tid;
589 
590 }
591 
593 {
594 }
595 
596 double
599  Ptr<MobilityModel> b) const
600 {
601  double distance = a->GetDistanceFrom (b);
602  NS_ASSERT (distance >= 0);
603 
604  // See doxygen comments for the formula and explanation
605 
606  double pathLossDb;
607 
608  if (distance < m_distance0)
609  {
610  pathLossDb = 0;
611  }
612  else if (distance < m_distance1)
613  {
614  pathLossDb = m_referenceLoss
615  + 10 * m_exponent0 * std::log10 (distance / m_distance0);
616  }
617  else if (distance < m_distance2)
618  {
619  pathLossDb = m_referenceLoss
620  + 10 * m_exponent0 * std::log10 (m_distance1 / m_distance0)
621  + 10 * m_exponent1 * std::log10 (distance / m_distance1);
622  }
623  else
624  {
625  pathLossDb = m_referenceLoss
626  + 10 * m_exponent0 * std::log10 (m_distance1 / m_distance0)
627  + 10 * m_exponent1 * std::log10 (m_distance2 / m_distance1)
628  + 10 * m_exponent2 * std::log10 (distance / m_distance2);
629  }
630 
631  NS_LOG_DEBUG ("ThreeLogDistance distance=" << distance << "m, " <<
632  "attenuation=" << pathLossDb << "dB");
633 
634  return txPowerDbm - pathLossDb;
635 }
636 
637 int64_t
639 {
640  return 0;
641 }
642 
643 // ------------------------------------------------------------------------- //
644 
646 
647 TypeId
649 {
650  static TypeId tid = TypeId ("ns3::NakagamiPropagationLossModel")
652  .AddConstructor<NakagamiPropagationLossModel> ()
653  .AddAttribute ("Distance1",
654  "Beginning of the second distance field. Default is 80m.",
655  DoubleValue (80.0),
656  MakeDoubleAccessor (&NakagamiPropagationLossModel::m_distance1),
657  MakeDoubleChecker<double> ())
658  .AddAttribute ("Distance2",
659  "Beginning of the third distance field. Default is 200m.",
660  DoubleValue (200.0),
661  MakeDoubleAccessor (&NakagamiPropagationLossModel::m_distance2),
662  MakeDoubleChecker<double> ())
663  .AddAttribute ("m0",
664  "m0 for distances smaller than Distance1. Default is 1.5.",
665  DoubleValue (1.5),
666  MakeDoubleAccessor (&NakagamiPropagationLossModel::m_m0),
667  MakeDoubleChecker<double> ())
668  .AddAttribute ("m1",
669  "m1 for distances smaller than Distance2. Default is 0.75.",
670  DoubleValue (0.75),
671  MakeDoubleAccessor (&NakagamiPropagationLossModel::m_m1),
672  MakeDoubleChecker<double> ())
673  .AddAttribute ("m2",
674  "m2 for distances greater than Distance2. Default is 0.75.",
675  DoubleValue (0.75),
676  MakeDoubleAccessor (&NakagamiPropagationLossModel::m_m2),
677  MakeDoubleChecker<double> ())
678  .AddAttribute ("ErlangRv",
679  "Access to the underlying ErlangRandomVariable",
680  StringValue ("ns3::ErlangRandomVariable"),
682  MakePointerChecker<ErlangRandomVariable> ())
683  .AddAttribute ("GammaRv",
684  "Access to the underlying GammaRandomVariable",
685  StringValue ("ns3::GammaRandomVariable"),
687  MakePointerChecker<GammaRandomVariable> ());
688  ;
689  return tid;
690 
691 }
692 
694 {
695 }
696 
697 double
700  Ptr<MobilityModel> b) const
701 {
702  // select m parameter
703 
704  double distance = a->GetDistanceFrom (b);
705  NS_ASSERT (distance >= 0);
706 
707  double m;
708  if (distance < m_distance1)
709  {
710  m = m_m0;
711  }
712  else if (distance < m_distance2)
713  {
714  m = m_m1;
715  }
716  else
717  {
718  m = m_m2;
719  }
720 
721  // the current power unit is dBm, but Watt is put into the Nakagami /
722  // Rayleigh distribution.
723  double powerW = std::pow (10, (txPowerDbm - 30) / 10);
724 
725  double resultPowerW;
726 
727  // switch between Erlang- and Gamma distributions: this is only for
728  // speed. (Gamma is equal to Erlang for any positive integer m.)
729  unsigned int int_m = static_cast<unsigned int>(std::floor (m));
730 
731  if (int_m == m)
732  {
733  resultPowerW = m_erlangRandomVariable->GetValue (int_m, powerW / m);
734  }
735  else
736  {
737  resultPowerW = m_gammaRandomVariable->GetValue (m, powerW / m);
738  }
739 
740  double resultPowerDbm = 10 * std::log10 (resultPowerW) + 30;
741 
742  NS_LOG_DEBUG ("Nakagami distance=" << distance << "m, " <<
743  "power=" << powerW <<"W, " <<
744  "resultPower=" << resultPowerW << "W=" << resultPowerDbm << "dBm");
745 
746  return resultPowerDbm;
747 }
748 
749 int64_t
751 {
752  m_erlangRandomVariable->SetStream (stream);
753  m_gammaRandomVariable->SetStream (stream + 1);
754  return 2;
755 }
756 
757 // ------------------------------------------------------------------------- //
758 
760 
761 TypeId
763 {
764  static TypeId tid = TypeId ("ns3::FixedRssLossModel")
766  .AddConstructor<FixedRssLossModel> ()
767  .AddAttribute ("Rss", "The fixed receiver Rss.",
768  DoubleValue (-150.0),
769  MakeDoubleAccessor (&FixedRssLossModel::m_rss),
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  .AddConstructor<MatrixPropagationLossModel> ()
813  .AddAttribute ("DefaultLoss", "The default value for propagation loss, dB.",
814  DoubleValue (std::numeric_limits<double>::max ()),
815  MakeDoubleAccessor (&MatrixPropagationLossModel::m_default),
816  MakeDoubleChecker<double> ())
817  ;
818  return tid;
819 }
820 
822  : PropagationLossModel (), m_default (std::numeric_limits<double>::max ())
823 {
824 }
825 
827 {
828 }
829 
830 void
832 {
833  m_default = loss;
834 }
835 
836 void
838 {
839  NS_ASSERT (ma != 0 && mb != 0);
840 
841  MobilityPair p = std::make_pair (ma, mb);
842  std::map<MobilityPair, double>::iterator i = m_loss.find (p);
843 
844  if (i == m_loss.end ())
845  {
846  m_loss.insert (std::make_pair (p, loss));
847  }
848  else
849  {
850  i->second = loss;
851  }
852 
853  if (symmetric)
854  {
855  SetLoss (mb, ma, loss, false);
856  }
857 }
858 
859 double
862  Ptr<MobilityModel> b) const
863 {
864  std::map<MobilityPair, double>::const_iterator i = m_loss.find (std::make_pair (a, b));
865 
866  if (i != m_loss.end ())
867  {
868  return txPowerDbm - i->second;
869  }
870  else
871  {
872  return txPowerDbm - m_default;
873  }
874 }
875 
876 int64_t
878 {
879  return 0;
880 }
881 
882 // ------------------------------------------------------------------------- //
883 
885 
886 TypeId
888 {
889  static TypeId tid = TypeId ("ns3::RangePropagationLossModel")
891  .AddConstructor<RangePropagationLossModel> ()
892  .AddAttribute ("MaxRange",
893  "Maximum Transmission Range (meters)",
894  DoubleValue (250),
895  MakeDoubleAccessor (&RangePropagationLossModel::m_range),
896  MakeDoubleChecker<double> ())
897  ;
898  return tid;
899 }
900 
902 {
903 }
904 
905 double
908  Ptr<MobilityModel> b) const
909 {
910  double distance = a->GetDistanceFrom (b);
911  if (distance <= m_range)
912  {
913  return txPowerDbm;
914  }
915  else
916  {
917  return -1000;
918  }
919 }
920 
921 int64_t
923 {
924  return 0;
925 }
926 
927 // ------------------------------------------------------------------------- //
928 
929 } // 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
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register the class in the ns-3 factory.
Definition: object-base.h:38
void SetNext(Ptr< PropagationLossModel > next)
Enables a chain of loss models to act on the signal.
hold variables of type string
Definition: string.h:18
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)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:61
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:170
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.
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. ...
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_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:203
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:213
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:64
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:610
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. ...