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 
176 {
177 public:
178  static TypeId GetTypeId (void);
187  void SetLambda (double frequency, double speed);
194  void SetLambda (double lambda);
200  void SetSystemLoss (double systemLoss);
201 
208  void SetMinDistance (double minDistance);
209 
213  double GetMinDistance (void) const;
214 
218  double GetLambda (void) const;
222  double GetSystemLoss (void) const;
223 
224 private:
227  virtual double DoCalcRxPower (double txPowerDbm,
229  Ptr<MobilityModel> b) const;
230  virtual int64_t DoAssignStreams (int64_t stream);
231  double DbmToW (double dbm) const;
232  double DbmFromW (double w) const;
233 
234  static const double PI;
235  double m_lambda;
236  double m_systemLoss;
238 };
239 
264 {
265 public:
266  static TypeId GetTypeId (void);
275  void SetLambda (double frequency, double speed);
282  void SetLambda (double lambda);
288  void SetSystemLoss (double systemLoss);
295  void SetMinDistance (double minDistance);
299  double GetMinDistance (void) const;
303  double GetLambda (void) const;
307  double GetSystemLoss (void) const;
313  void SetHeightAboveZ (double heightAboveZ);
314 
315 private:
318  virtual double DoCalcRxPower (double txPowerDbm,
320  Ptr<MobilityModel> b) const;
321  virtual int64_t DoAssignStreams (int64_t stream);
322  double DbmToW (double dbm) const;
323  double DbmFromW (double w) const;
324 
325  static const double PI;
326  double m_lambda;
327  double m_systemLoss;
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);
378 
379  double m_exponent;
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 
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 
499 };
500 
515 {
516 public:
517  static TypeId GetTypeId (void);
518 
520  virtual ~FixedRssLossModel ();
526  void SetRss (double rss);
527 
528 private:
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 */