A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
propagation-loss-model.h
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: 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:
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);
138 };
139 
218 {
219 public:
220  static TypeId GetTypeId (void);
228  void SetFrequency (double frequency);
234  void SetSystemLoss (double systemLoss);
235 
242  void SetMinLoss (double minLoss);
243 
247  double GetMinLoss (void) const;
248 
252  double GetFrequency (void) const;
256  double GetSystemLoss (void) const;
257 
258 private:
261  virtual double DoCalcRxPower (double txPowerDbm,
263  Ptr<MobilityModel> b) const;
264  virtual int64_t DoAssignStreams (int64_t stream);
265  double DbmToW (double dbm) const;
266  double DbmFromW (double w) const;
267 
268  static const double PI;
269  double m_lambda;
270  double m_frequency;
271  double m_systemLoss;
272  double m_minLoss;
273 };
274 
304 {
305 public:
306  static TypeId GetTypeId (void);
308 
315  void SetFrequency (double frequency);
316 
322  void SetSystemLoss (double systemLoss);
329  void SetMinDistance (double minDistance);
333  double GetMinDistance (void) const;
334 
338  double GetFrequency (void) const;
339 
343  double GetSystemLoss (void) const;
349  void SetHeightAboveZ (double heightAboveZ);
350 
351 private:
354  virtual double DoCalcRxPower (double txPowerDbm,
356  Ptr<MobilityModel> b) const;
357  virtual int64_t DoAssignStreams (int64_t stream);
358  double DbmToW (double dbm) const;
359  double DbmFromW (double w) const;
360 
361  static const double PI;
362  double m_lambda;
363  double m_frequency;
364  double m_systemLoss;
367 };
368 
390 {
391 public:
392  static TypeId GetTypeId (void);
394 
399  void SetPathLossExponent (double n);
403  double GetPathLossExponent (void) const;
404 
405  void SetReference (double referenceDistance, double referenceLoss);
406 
407 private:
410  virtual double DoCalcRxPower (double txPowerDbm,
412  Ptr<MobilityModel> b) const;
413  virtual int64_t DoAssignStreams (int64_t stream);
415 
416  double m_exponent;
419 };
420 
462 {
463 public:
464  static TypeId GetTypeId (void);
466 
467  // Parameters are all accessible via attributes.
468 
469 private:
472 
473  virtual double DoCalcRxPower (double txPowerDbm,
475  Ptr<MobilityModel> b) const;
476  virtual int64_t DoAssignStreams (int64_t stream);
477 
478  double m_distance0;
479  double m_distance1;
480  double m_distance2;
481 
482  double m_exponent0;
483  double m_exponent1;
484  double m_exponent2;
485 
487 };
488 
510 {
511 public:
512  static TypeId GetTypeId (void);
513 
515 
516  // Parameters are all accessible via attributes.
517 
518 private:
521 
522  virtual double DoCalcRxPower (double txPowerDbm,
524  Ptr<MobilityModel> b) const;
525  virtual int64_t DoAssignStreams (int64_t stream);
526 
527  double m_distance1;
528  double m_distance2;
529 
530  double m_m0;
531  double m_m1;
532  double m_m2;
533 
536 };
537 
552 {
553 public:
554  static TypeId GetTypeId (void);
555 
557  virtual ~FixedRssLossModel ();
563  void SetRss (double rss);
564 
565 private:
568  virtual double DoCalcRxPower (double txPowerDbm,
570  Ptr<MobilityModel> b) const;
571  virtual int64_t DoAssignStreams (int64_t stream);
572  double m_rss;
573 };
574 
583 {
584 public:
585  static TypeId GetTypeId (void);
586 
588  virtual ~MatrixPropagationLossModel ();
589 
599  void SetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b, double loss, bool symmetric = true);
601  void SetDefaultLoss (double);
602 
603 private:
604  virtual double DoCalcRxPower (double txPowerDbm,
606  Ptr<MobilityModel> b) const;
607  virtual int64_t DoAssignStreams (int64_t stream);
608 private:
610  double m_default;
611 
612  typedef std::pair< Ptr<MobilityModel>, Ptr<MobilityModel> > MobilityPair;
614  std::map<MobilityPair, double> m_loss;
615 };
616 
628 {
629 public:
630  static TypeId GetTypeId (void);
632 private:
635  virtual double DoCalcRxPower (double txPowerDbm,
637  Ptr<MobilityModel> b) const;
638  virtual int64_t DoAssignStreams (int64_t stream);
639 private:
640  double m_range;
641 };
642 
643 } // namespace ns3
644 
645 #endif /* PROPAGATION_LOSS_MODEL_H */
static Ptr< PropagationLossModel > CreateDefaultReference(void)
PropagationLossModel & operator=(const PropagationLossModel &o)
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
void SetNext(Ptr< PropagationLossModel > next)
Enables a chain of loss models to act on the signal.
FriisPropagationLossModel & operator=(const FriisPropagationLossModel &o)
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
a Two-Ray Ground propagation loss model ported from NS2
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. ...
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. ...
TwoRayGroundPropagationLossModel & operator=(const TwoRayGroundPropagationLossModel &o)
Ptr< PropagationLossModel > GetNext()
Gets the next PropagationLossModel in the chain of loss models that act on the signal.
RandomPropagationLossModel & operator=(const RandomPropagationLossModel &o)
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
ThreeLogDistancePropagationLossModel & operator=(const ThreeLogDistancePropagationLossModel &o)
double CalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
The propagation loss follows a random distribution.
FixedRssLossModel & operator=(const FixedRssLossModel &o)
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
RangePropagationLossModel & operator=(const RangePropagationLossModel &o)
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
LogDistancePropagationLossModel & operator=(const LogDistancePropagationLossModel &o)
NakagamiPropagationLossModel & operator=(const NakagamiPropagationLossModel &o)
Modelize the propagation loss through a transmission medium.
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
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.
a unique identifier for an interface.
Definition: type-id.h:49
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.
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. ...