A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
propagation-loss-model.h
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: Gary Pei <guangyu.pei@boeing.com> for fixed RSS
21  * Contributions: Tom Hewer <tomhewer@mac.com> for two ray ground model
22  * Pavel Boyko <boyko@iitp.ru> for matrix
23  */
24 
25 #ifndef PROPAGATION_LOSS_MODEL_H
26 #define PROPAGATION_LOSS_MODEL_H
27 
28 #include "ns3/object.h"
29 #include "ns3/random-variable-stream.h"
30 #include <map>
31 
32 namespace ns3 {
33 
39 class MobilityModel;
40 
50 {
51 public:
52  static TypeId GetTypeId (void);
53 
55  virtual ~PropagationLossModel ();
56 
66 
77 
84  double CalcRxPower (double txPowerDbm,
86  Ptr<MobilityModel> b) const;
87 
99  int64_t AssignStreams (int64_t stream);
100 
101 private:
103  PropagationLossModel &operator = (const PropagationLossModel &o);
104  virtual double DoCalcRxPower (double txPowerDbm,
106  Ptr<MobilityModel> b) const = 0;
107 
112  virtual int64_t DoAssignStreams (int64_t stream) = 0;
113 
115 };
116 
123 {
124 public:
125  static TypeId GetTypeId (void);
126 
128  virtual ~RandomPropagationLossModel ();
129 
130 private:
133  virtual double DoCalcRxPower (double txPowerDbm,
135  Ptr<MobilityModel> b) const;
136  virtual int64_t DoAssignStreams (int64_t stream);
137  Ptr<RandomVariableStream> m_variable;
138 };
139 
181 {
182 public:
183  static TypeId GetTypeId (void);
191  void SetFrequency (double frequency);
197  void SetSystemLoss (double systemLoss);
198 
205  void SetMinDistance (double minDistance);
206 
210  double GetMinDistance (void) const;
211 
215  double GetFrequency (void) const;
219  double GetSystemLoss (void) const;
220 
221 private:
224  virtual double DoCalcRxPower (double txPowerDbm,
226  Ptr<MobilityModel> b) const;
227  virtual int64_t DoAssignStreams (int64_t stream);
228  double DbmToW (double dbm) const;
229  double DbmFromW (double w) const;
230 
231  static const double PI;
232  double m_lambda;
233  double m_frequency;
234  double m_systemLoss;
235  double m_minDistance;
236 };
237 
267 {
268 public:
269  static TypeId GetTypeId (void);
271 
278  void SetFrequency (double frequency);
279 
285  void SetSystemLoss (double systemLoss);
292  void SetMinDistance (double minDistance);
296  double GetMinDistance (void) const;
297 
301  double GetFrequency (void) const;
302 
306  double GetSystemLoss (void) const;
312  void SetHeightAboveZ (double heightAboveZ);
313 
314 private:
317  virtual double DoCalcRxPower (double txPowerDbm,
319  Ptr<MobilityModel> b) const;
320  virtual int64_t DoAssignStreams (int64_t stream);
321  double DbmToW (double dbm) const;
322  double DbmFromW (double w) const;
323 
324  static const double PI;
325  double m_lambda;
326  double m_frequency;
327  double m_systemLoss;
328  double m_minDistance;
329  double m_heightAboveZ;
330 };
331 
353 {
354 public:
355  static TypeId GetTypeId (void);
357 
362  void SetPathLossExponent (double n);
366  double GetPathLossExponent (void) const;
367 
368  void SetReference (double referenceDistance, double referenceLoss);
369 
370 private:
373  virtual double DoCalcRxPower (double txPowerDbm,
375  Ptr<MobilityModel> b) const;
376  virtual int64_t DoAssignStreams (int64_t stream);
377  static Ptr<PropagationLossModel> CreateDefaultReference (void);
378 
379  double m_exponent;
380  double m_referenceDistance;
381  double m_referenceLoss;
382 };
383 
425 {
426 public:
427  static TypeId GetTypeId (void);
429 
430  // Parameters are all accessible via attributes.
431 
432 private:
435 
436  virtual double DoCalcRxPower (double txPowerDbm,
438  Ptr<MobilityModel> b) const;
439  virtual int64_t DoAssignStreams (int64_t stream);
440 
441  double m_distance0;
442  double m_distance1;
443  double m_distance2;
444 
445  double m_exponent0;
446  double m_exponent1;
447  double m_exponent2;
448 
449  double m_referenceLoss;
450 };
451 
473 {
474 public:
475  static TypeId GetTypeId (void);
476 
478 
479  // Parameters are all accessible via attributes.
480 
481 private:
484 
485  virtual double DoCalcRxPower (double txPowerDbm,
487  Ptr<MobilityModel> b) const;
488  virtual int64_t DoAssignStreams (int64_t stream);
489 
490  double m_distance1;
491  double m_distance2;
492 
493  double m_m0;
494  double m_m1;
495  double m_m2;
496 
497  Ptr<ErlangRandomVariable> m_erlangRandomVariable;
498  Ptr<GammaRandomVariable> m_gammaRandomVariable;
499 };
500 
515 {
516 public:
517  static TypeId GetTypeId (void);
518 
520  virtual ~FixedRssLossModel ();
526  void SetRss (double rss);
527 
528 private:
530  FixedRssLossModel & operator = (const FixedRssLossModel &o);
531  virtual double DoCalcRxPower (double txPowerDbm,
533  Ptr<MobilityModel> b) const;
534  virtual int64_t DoAssignStreams (int64_t stream);
535  double m_rss;
536 };
537 
546 {
547 public:
548  static TypeId GetTypeId (void);
549 
551  virtual ~MatrixPropagationLossModel ();
552 
562  void SetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b, double loss, bool symmetric = true);
564  void SetDefaultLoss (double);
565 
566 private:
567  virtual double DoCalcRxPower (double txPowerDbm,
569  Ptr<MobilityModel> b) const;
570  virtual int64_t DoAssignStreams (int64_t stream);
571 private:
573  double m_default;
574 
575  typedef std::pair< Ptr<MobilityModel>, Ptr<MobilityModel> > MobilityPair;
577  std::map<MobilityPair, double> m_loss;
578 };
579 
591 {
592 public:
593  static TypeId GetTypeId (void);
595 private:
598  virtual double DoCalcRxPower (double txPowerDbm,
600  Ptr<MobilityModel> b) const;
601  virtual int64_t DoAssignStreams (int64_t stream);
602 private:
603  double m_range;
604 };
605 
606 } // namespace ns3
607 
608 #endif /* PROPAGATION_LOSS_MODEL_H */
void SetDefaultLoss(double)
Set default loss (in dB, positive) to be used, infinity if not set.
void SetNext(Ptr< PropagationLossModel > next)
Enables a chain of loss models to act on the signal.
a Two-Ray Ground propagation loss model ported from NS2
The propagation loss depends only on the distance (range) between transmitter and receiver...
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
virtual int64_t DoAssignStreams(int64_t stream)
A log distance path loss propagation model with three distance fields. This model is the same as ns3:...
void SetMinDistance(double minDistance)
virtual int64_t DoAssignStreams(int64_t stream)
Ptr< PropagationLossModel > GetNext()
Gets the next PropagationLossModel in the chain of loss models that act on the signal.
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)
virtual int64_t DoAssignStreams(int64_t stream)
a Friis propagation loss model
virtual int64_t DoAssignStreams(int64_t stream)
Nakagami-m fast fading propagation loss model.
Modelize the propagation loss through a transmission medium.
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)
virtual int64_t DoAssignStreams(int64_t stream)
virtual int64_t DoAssignStreams(int64_t stream)
a base class which provides memory management and object aggregation
Definition: object.h:63
a log distance propagation model.
a unique identifier for an interface.
Definition: type-id.h:44
The propagation loss is fixed for each pair of nodes and doesn't depend on their actual positions...
int64_t AssignStreams(int64_t stream)
virtual int64_t DoAssignStreams(int64_t stream)
std::map< MobilityPair, double > m_loss
Fixed loss between pair of nodes.
virtual int64_t DoAssignStreams(int64_t stream)=0