A Discrete-Event Network Simulator
API
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
32namespace ns3 {
33
44class MobilityModel;
45
55{
56public:
62 static TypeId GetTypeId (void);
63
65 virtual ~PropagationLossModel ();
66
67 // Delete copy constructor and assignment operator to avoid misuse
70
80
91
101 double CalcRxPower (double txPowerDbm,
103 Ptr<MobilityModel> b) const;
104
116 int64_t AssignStreams (int64_t stream);
117
118protected:
128 virtual int64_t DoAssignStreams (int64_t stream) = 0;
129
130private:
139 virtual double DoCalcRxPower (double txPowerDbm,
141 Ptr<MobilityModel> b) const = 0;
142
144};
145
152{
153public:
158 static TypeId GetTypeId (void);
159
162
163 // Delete copy constructor and assignment operator to avoid misuse
166
167private:
168 double DoCalcRxPower (double txPowerDbm,
170 Ptr<MobilityModel> b) const override;
171 int64_t DoAssignStreams (int64_t stream) override;
172
174};
175
254{
255public:
260 static TypeId GetTypeId (void);
262
263 // Delete copy constructor and assignment operator to avoid misuse
266
273 void SetFrequency (double frequency);
279 void SetSystemLoss (double systemLoss);
280
287 void SetMinLoss (double minLoss);
288
292 double GetMinLoss (void) const;
293
297 double GetFrequency (void) const;
301 double GetSystemLoss (void) const;
302
303private:
304 double DoCalcRxPower (double txPowerDbm,
306 Ptr<MobilityModel> b) const override;
307 int64_t DoAssignStreams (int64_t stream) override;
308
314 double DbmToW (double dbm) const;
315
321 double DbmFromW (double w) const;
322
323 double m_lambda;
324 double m_frequency;
326 double m_minLoss;
327};
328
358{
359public:
364 static TypeId GetTypeId (void);
366
367 // Delete copy constructor and assignment operator to avoid misuse
370
377 void SetFrequency (double frequency);
378
384 void SetSystemLoss (double systemLoss);
391 void SetMinDistance (double minDistance);
395 double GetMinDistance (void) const;
396
400 double GetFrequency (void) const;
401
405 double GetSystemLoss (void) const;
411 void SetHeightAboveZ (double heightAboveZ);
412
413private:
414 double DoCalcRxPower (double txPowerDbm,
416 Ptr<MobilityModel> b) const override;
417 int64_t DoAssignStreams (int64_t stream) override;
418
424 double DbmToW (double dbm) const;
425
431 double DbmFromW (double w) const;
432
433 double m_lambda;
434 double m_frequency;
438};
439
461{
462public:
467 static TypeId GetTypeId (void);
469
470 // Delete copy constructor and assignment operator to avoid misuse
473
478 void SetPathLossExponent (double n);
482 double GetPathLossExponent (void) const;
483
489 void SetReference (double referenceDistance, double referenceLoss);
490
491private:
492 double DoCalcRxPower (double txPowerDbm,
494 Ptr<MobilityModel> b) const override;
495
496 int64_t DoAssignStreams (int64_t stream) override;
497
503
504 double m_exponent;
507};
508
550{
551public:
556 static TypeId GetTypeId (void);
558
559 // Delete copy constructor and assignment operator to avoid misuse
562
563 // Parameters are all accessible via attributes.
564
565private:
566 double DoCalcRxPower (double txPowerDbm,
568 Ptr<MobilityModel> b) const override;
569
570 int64_t DoAssignStreams (int64_t stream) override;
571
572 double m_distance0;
573 double m_distance1;
574 double m_distance2;
575
576 double m_exponent0;
577 double m_exponent1;
578 double m_exponent2;
579
581};
582
611{
612public:
617 static TypeId GetTypeId (void);
618
620
621 // Delete copy constructor and assignment operator to avoid misuse
624
625 // Parameters are all accessible via attributes.
626
627private:
628 double DoCalcRxPower (double txPowerDbm,
630 Ptr<MobilityModel> b) const override;
631
632 int64_t DoAssignStreams (int64_t stream) override;
633
634 double m_distance1;
635 double m_distance2;
636
637 double m_m0;
638 double m_m1;
639 double m_m2;
640
643};
644
659{
660public:
665 static TypeId GetTypeId (void);
666
668 virtual ~FixedRssLossModel ();
669
670 // Delete copy constructor and assignment operator to avoid misuse
673
679 void SetRss (double rss);
680
681private:
682 double DoCalcRxPower (double txPowerDbm,
684 Ptr<MobilityModel> b) const override;
685
686 int64_t DoAssignStreams (int64_t stream) override;
687
688 double m_rss;
689};
690
699{
700public:
705 static TypeId GetTypeId (void);
706
709
710 // Delete copy constructor and assignment operator to avoid misuse
713
723 void SetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b, double loss, bool symmetric = true);
724
729 void SetDefaultLoss (double defaultLoss);
730
731private:
732 double DoCalcRxPower (double txPowerDbm,
734 Ptr<MobilityModel> b) const override;
735
736 int64_t DoAssignStreams (int64_t stream) override;
737
738 double m_default;
739
741 typedef std::pair< Ptr<MobilityModel>, Ptr<MobilityModel> > MobilityPair;
742
743 std::map<MobilityPair, double> m_loss;
744};
745
757{
758public:
763 static TypeId GetTypeId (void);
765
766 // Delete copy constructor and assignment operator to avoid misuse
769
770private:
771 double DoCalcRxPower (double txPowerDbm,
773 Ptr<MobilityModel> b) const override;
774
775 int64_t DoAssignStreams (int64_t stream) override;
776
777 double m_range;
778};
779
780} // namespace ns3
781
782#endif /* PROPAGATION_LOSS_MODEL_H */
Return a constant received power level independent of the transmit power.
double m_rss
the received signal strength
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
FixedRssLossModel & operator=(const FixedRssLossModel &)=delete
static TypeId GetTypeId(void)
Get the type ID.
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
FixedRssLossModel(const FixedRssLossModel &)=delete
a Friis propagation loss model
double m_lambda
the carrier wavelength
double DbmFromW(double w) const
Transforms a Watt value to Dbm.
double m_frequency
the carrier frequency
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
FriisPropagationLossModel(const FriisPropagationLossModel &)=delete
double DbmToW(double dbm) const
Transforms a Dbm value to Watt.
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
static TypeId GetTypeId(void)
Get the type ID.
FriisPropagationLossModel & operator=(const FriisPropagationLossModel &)=delete
a log distance propagation model.
LogDistancePropagationLossModel & operator=(const LogDistancePropagationLossModel &)=delete
LogDistancePropagationLossModel(const LogDistancePropagationLossModel &)=delete
static Ptr< PropagationLossModel > CreateDefaultReference(void)
Creates a default reference loss model.
void SetReference(double referenceDistance, double referenceLoss)
Set the reference path loss at a given distance.
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
static TypeId GetTypeId(void)
Get the type ID.
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
The propagation loss is fixed for each pair of nodes and doesn't depend on their actual positions.
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).
void SetDefaultLoss(double defaultLoss)
Set the default propagation loss (in dB, positive) to be used, infinity if not set.
static TypeId GetTypeId(void)
Get the type ID.
MatrixPropagationLossModel(const MatrixPropagationLossModel &)=delete
MatrixPropagationLossModel & operator=(const MatrixPropagationLossModel &)=delete
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
std::pair< Ptr< MobilityModel >, Ptr< MobilityModel > > MobilityPair
Typedef: Mobility models pair.
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
std::map< MobilityPair, double > m_loss
Propagation loss between pair of nodes.
Nakagami-m fast fading propagation loss model.
Ptr< ErlangRandomVariable > m_erlangRandomVariable
Erlang random variable.
double m_m0
m for distances smaller than Distance1
NakagamiPropagationLossModel(const NakagamiPropagationLossModel &)=delete
Ptr< GammaRandomVariable > m_gammaRandomVariable
Gamma random variable.
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
static TypeId GetTypeId(void)
Get the type ID.
NakagamiPropagationLossModel & operator=(const NakagamiPropagationLossModel &)=delete
double m_m1
m for distances smaller than Distance2
double m_m2
m for distances greater than Distance2
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
A base class which provides memory management and object aggregation.
Definition: object.h:88
Models the propagation loss through a transmission medium.
PropagationLossModel & operator=(const PropagationLossModel &)=delete
virtual int64_t DoAssignStreams(int64_t stream)=0
Assign a fixed random variable stream number to the random variables used by this model.
Ptr< PropagationLossModel > m_next
Next propagation loss model in the list.
double CalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Returns the Rx Power taking into account all the PropagationLossModel(s) chained to the current one.
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const =0
PropagationLossModel.
int64_t AssignStreams(int64_t stream)
If this loss model uses objects of type RandomVariableStream, set the stream numbers to the integers ...
void SetNext(Ptr< PropagationLossModel > next)
Enables a chain of loss models to act on the signal.
PropagationLossModel(const PropagationLossModel &)=delete
static TypeId GetTypeId(void)
Get the type ID.
Ptr< PropagationLossModel > GetNext()
Gets the next PropagationLossModel in the chain of loss models that act on the signal.
The propagation loss follows a random distribution.
RandomPropagationLossModel & operator=(const RandomPropagationLossModel &)=delete
static TypeId GetTypeId(void)
Get the type ID.
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
Ptr< RandomVariableStream > m_variable
random generator
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
RandomPropagationLossModel(const RandomPropagationLossModel &)=delete
The propagation loss depends only on the distance (range) between transmitter and receiver.
RangePropagationLossModel & operator=(const RangePropagationLossModel &)=delete
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
static TypeId GetTypeId(void)
Get the type ID.
RangePropagationLossModel(const RangePropagationLossModel &)=delete
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
double m_range
Maximum Transmission Range (meters)
A log distance path loss propagation model with three distance fields.
double m_referenceLoss
The reference loss at distance d0 (dB).
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
double m_distance0
Beginning of the first (near) distance field.
double m_distance2
Beginning of the third (far) distance field.
ThreeLogDistancePropagationLossModel(const ThreeLogDistancePropagationLossModel &)=delete
double m_exponent2
The exponent for the third field.
double m_distance1
Beginning of the second (middle) distance field.
ThreeLogDistancePropagationLossModel & operator=(const ThreeLogDistancePropagationLossModel &)=delete
static TypeId GetTypeId(void)
Get the type ID.
double m_exponent0
The exponent for the first field.
double m_exponent1
The exponent for the second field.
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
a Two-Ray Ground propagation loss model ported from NS2
double DbmToW(double dbm) const
Transforms a Dbm value to Watt.
double m_minDistance
minimum distance for the model
double m_heightAboveZ
antenna height above the node's Z coordinate
double DbmFromW(double w) const
Transforms a Watt value to Dbm.
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
static TypeId GetTypeId(void)
Get the type ID.
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
TwoRayGroundPropagationLossModel(const TwoRayGroundPropagationLossModel &)=delete
TwoRayGroundPropagationLossModel & operator=(const TwoRayGroundPropagationLossModel &)=delete
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.