A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
propagation-loss-model.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005,2006,2007 INRIA
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18 * Contributions: Timo Bingmann <timo.bingmann@student.kit.edu>
19 * Contributions: Gary Pei <guangyu.pei@boeing.com> for fixed RSS
20 * Contributions: Tom Hewer <tomhewer@mac.com> for two ray ground model
21 * Pavel Boyko <boyko@iitp.ru> for matrix
22 */
23
24#ifndef PROPAGATION_LOSS_MODEL_H
25#define PROPAGATION_LOSS_MODEL_H
26
27#include "ns3/object.h"
28#include "ns3/random-variable-stream.h"
29
30#include <unordered_map>
31
32namespace ns3
33{
34
35/**
36 * \defgroup propagation Propagation Models
37 */
38
39/**
40 * \ingroup propagation
41 * \ingroup tests
42 * \defgroup propagation-tests Propagation module tests
43 */
44
45class MobilityModel;
46
47/**
48 * \ingroup propagation
49 *
50 * \brief Models the propagation loss through a transmission medium
51 *
52 * Calculate the receive power (dbm) from a transmit power (dbm)
53 * and a mobility model for the source and destination positions.
54 */
56{
57 public:
58 /**
59 * Get the type ID.
60 * \brief Get the type ID.
61 * \return the object TypeId
62 */
63 static TypeId GetTypeId();
64
66 ~PropagationLossModel() override;
67
68 // Delete copy constructor and assignment operator to avoid misuse
71
72 /**
73 * \brief Enables a chain of loss models to act on the signal
74 * \param next The next PropagationLossModel to add to the chain
75 *
76 * This method of chaining propagation loss models only works commutatively
77 * if the propagation loss of all models in the chain are independent
78 * of transmit power.
79 */
81
82 /**
83 * \brief Gets the next PropagationLossModel in the chain of loss models
84 * that act on the signal.
85 * \returns The next PropagationLossModel in the chain
86 *
87 * This method of chaining propagation loss models only works commutatively
88 * if the propagation loss of all models in the chain are independent
89 * of transmit power.
90 */
92
93 /**
94 * Returns the Rx Power taking into account all the PropagationLossModel(s)
95 * chained to the current one.
96 *
97 * \param txPowerDbm current transmission power (in dBm)
98 * \param a the mobility model of the source
99 * \param b the mobility model of the destination
100 * \returns the reception power after adding/multiplying propagation loss (in dBm)
101 */
102 double CalcRxPower(double txPowerDbm, Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
103
104 /**
105 * If this loss model uses objects of type RandomVariableStream,
106 * set the stream numbers to the integers starting with the offset
107 * 'stream'. Return the number of streams (possibly zero) that
108 * have been assigned. If there are PropagationLossModels chained
109 * together, this method will also assign streams to the
110 * downstream models.
111 *
112 * \param stream the stream index offset start
113 * \return the number of stream indices assigned by this model
114 */
115 int64_t AssignStreams(int64_t stream);
116
117 protected:
118 /**
119 * Assign a fixed random variable stream number to the random variables used by this model.
120 *
121 * Subclasses must implement this; those not using random variables
122 * can return zero.
123 *
124 * \param stream first stream index to use
125 * \return the number of stream indices assigned by this model
126 */
127 virtual int64_t DoAssignStreams(int64_t stream) = 0;
128
129 private:
130 /**
131 * PropagationLossModel.
132 *
133 * \param txPowerDbm current transmission power (in dBm)
134 * \param a the mobility model of the source
135 * \param b the mobility model of the destination
136 * \returns the reception power after adding/multiplying propagation loss (in dBm)
137 */
138 virtual double DoCalcRxPower(double txPowerDbm,
140 Ptr<MobilityModel> b) const = 0;
141
142 Ptr<PropagationLossModel> m_next; //!< Next propagation loss model in the list
143};
144
145/**
146 * \ingroup propagation
147 *
148 * \brief The propagation loss follows a random distribution.
149 */
151{
152 public:
153 /**
154 * \brief Get the type ID.
155 * \return the object TypeId
156 */
157 static TypeId GetTypeId();
158
161
162 // Delete copy constructor and assignment operator to avoid misuse
165
166 private:
167 double DoCalcRxPower(double txPowerDbm,
169 Ptr<MobilityModel> b) const override;
170 int64_t DoAssignStreams(int64_t stream) override;
171
173};
174
175/**
176 * \ingroup propagation
177 *
178 * \brief a Friis propagation loss model
179 *
180 * The Friis propagation loss model was first described in
181 * "A Note on a Simple Transmission Formula", by
182 * "Harald T. Friis".
183 *
184 * The original equation was described as:
185 * \f$ \frac{P_r}{P_t} = \frac{A_r A_t}{d^2\lambda^2} \f$
186 * with the following equation for the case of an
187 * isotropic antenna with no heat loss:
188 * \f$ A_{isotr.} = \frac{\lambda^2}{4\pi} \f$
189 *
190 * The final equation becomes:
191 * \f$ \frac{P_r}{P_t} = \frac{\lambda^2}{(4 \pi d)^2} \f$
192 *
193 * Modern extensions to this original equation are:
194 * \f$ P_r = \frac{P_t G_t G_r \lambda^2}{(4 \pi d)^2 L}\f$
195 *
196 * With:
197 * - \f$ P_r \f$ : reception power (W)
198 * - \f$ P_t \f$ : transmission power (W)
199 * - \f$ G_t \f$ : transmission gain (unit-less)
200 * - \f$ G_r \f$ : reception gain (unit-less)
201 * - \f$ \lambda \f$ : wavelength (m)
202 * - \f$ d \f$ : distance (m)
203 * - \f$ L \f$ : system loss (unit-less)
204 *
205 * In the implementation, \f$ \lambda \f$ is calculated as
206 * \f$ \frac{C}{f} \f$, where \f$ C = 299792458\f$ m/s is the speed of light in
207 * vacuum, and \f$ f \f$ is the frequency in Hz which can be configured by
208 * the user via the Frequency attribute.
209 *
210 * The Friis model is valid only for propagation in free space within
211 * the so-called far field region, which can be considered
212 * approximately as the region for \f$ d > 3 \lambda \f$.
213 * The model will still return a value for \f$ d < 3 \lambda \f$, as
214 * doing so (rather than triggering a fatal error) is practical for
215 * many simulation scenarios. However, we stress that the values
216 * obtained in such conditions shall not be considered realistic.
217 *
218 * Related with this issue, we note that the Friis formula is
219 * undefined for \f$ d = 0 \f$, and results in
220 * \f$ P_r > P_t \f$ for \f$ d < \lambda / 2 \sqrt{\pi} \f$.
221 * Both these conditions occur outside of the far field region, so in
222 * principle the Friis model shall not be used in these conditions.
223 * In practice, however, Friis is often used in scenarios where accurate
224 * propagation modeling is not deemed important, and values of \f$ d =
225 * 0 \f$ can occur. To allow practical use of the model in such
226 * scenarios, we have to 1) return some value for \f$ d = 0 \f$, and
227 * 2) avoid large discontinuities in propagation loss values (which
228 * could lead to artifacts such as bogus capture effects which are
229 * much worse than inaccurate propagation loss values). The two issues
230 * are conflicting, as, according to the Friis formula,
231 * \f$\lim_{d \to 0 } P_r = +\infty \f$;
232 * so if, for \f$ d = 0 \f$, we use a fixed loss value, we end up with an infinitely large
233 * discontinuity, which as we discussed can cause undesirable
234 * simulation artifacts.
235 *
236 * To avoid these artifact, this implementation of the Friis model
237 * provides an attribute called MinLoss which allows to specify the
238 * minimum total loss (in dB) returned by the model. This is used in
239 * such a way that
240 * \f$ P_r \f$ continuously increases for \f$ d \to 0 \f$, until
241 * MinLoss is reached, and then stay constant; this allow to
242 * return a value for \f$ d = 0 \f$ and at the same time avoid
243 * discontinuities. The model won't be much realistic, but at least
244 * the simulation artifacts discussed before are avoided. The default value of
245 * MinLoss is 0 dB, which means that by default the model will return
246 * \f$ P_r = P_t \f$ for \f$ d <= \lambda / 2 \sqrt{\pi} \f$. We note
247 * that this value of \f$ d \f$ is outside of the far field
248 * region, hence the validity of the model in the far field region is
249 * not affected.
250 *
251 */
253{
254 public:
255 /**
256 * \brief Get the type ID.
257 * \return the object TypeId
258 */
259 static TypeId GetTypeId();
261
262 // Delete copy constructor and assignment operator to avoid misuse
265
266 /**
267 * \param frequency (Hz)
268 *
269 * Set the carrier frequency used in the Friis model
270 * calculation.
271 */
272 void SetFrequency(double frequency);
273 /**
274 * \param systemLoss (dimension-less)
275 *
276 * Set the system loss used by the Friis propagation model.
277 */
278 void SetSystemLoss(double systemLoss);
279
280 /**
281 * \param minLoss the minimum loss (dB)
282 *
283 * no matter how short the distance, the total propagation loss (in
284 * dB) will always be greater or equal than this value
285 */
286 void SetMinLoss(double minLoss);
287
288 /**
289 * \return the minimum loss.
290 */
291 double GetMinLoss() const;
292
293 /**
294 * \returns the current frequency (Hz)
295 */
296 double GetFrequency() const;
297 /**
298 * \returns the current system loss (dimension-less)
299 */
300 double GetSystemLoss() const;
301
302 private:
303 double DoCalcRxPower(double txPowerDbm,
305 Ptr<MobilityModel> b) const override;
306 int64_t DoAssignStreams(int64_t stream) override;
307
308 /**
309 * Transforms a Dbm value to Watt
310 * \param dbm the Dbm value
311 * \return the Watts
312 */
313 double DbmToW(double dbm) const;
314
315 /**
316 * Transforms a Watt value to Dbm
317 * \param w the Watt value
318 * \return the Dbm
319 */
320 double DbmFromW(double w) const;
321
322 double m_lambda; //!< the carrier wavelength
323 double m_frequency; //!< the carrier frequency
324 double m_systemLoss; //!< the system loss
325 double m_minLoss; //!< the minimum loss
326};
327
328/**
329 * \ingroup propagation
330 *
331 * \brief a Two-Ray Ground propagation loss model ported from NS2
332 *
333 * Two-ray ground reflection model.
334 *
335 * \f$ Pr = \frac{P_t * G_t * G_r * (H_t^2 * H_r^2)}{d^4 * L} \f$
336 *
337 * The original equation in Rappaport's book assumes L = 1.
338 * To be consistent with the free space equation, L is added here.
339 *
340 * Ht and Hr are set at the respective nodes z coordinate plus a model parameter
341 * set via SetHeightAboveZ.
342 *
343 * The two-ray model does not give a good result for short distances, due to the
344 * oscillation caused by constructive and destructive combination of the two
345 * rays. Instead the Friis free-space model is used for small distances.
346 *
347 * The crossover distance, below which Friis is used, is calculated as follows:
348 *
349 * \f$ dCross = \frac{(4 * \pi * H_t * H_r)}{\lambda} \f$
350 *
351 * In the implementation, \f$ \lambda \f$ is calculated as
352 * \f$ \frac{C}{f} \f$, where \f$ C = 299792458\f$ m/s is the speed of light in
353 * vacuum, and \f$ f \f$ is the frequency in Hz which can be configured by
354 * the user via the Frequency attribute.
355 */
357{
358 public:
359 /**
360 * \brief Get the type ID.
361 * \return the object TypeId
362 */
363 static TypeId GetTypeId();
365
366 // Delete copy constructor and assignment operator to avoid misuse
369
370 /**
371 * \param frequency (Hz)
372 *
373 * Set the carrier frequency used in the TwoRayGround model
374 * calculation.
375 */
376 void SetFrequency(double frequency);
377
378 /**
379 * \param systemLoss (dimension-less)
380 *
381 * Set the system loss used by the TwoRayGround propagation model.
382 */
383 void SetSystemLoss(double systemLoss);
384 /**
385 * \param minDistance the minimum distance
386 *
387 * Below this distance, the txpower is returned
388 * unmodified as the rxpower.
389 */
390 void SetMinDistance(double minDistance);
391 /**
392 * \returns the minimum distance.
393 */
394 double GetMinDistance() const;
395
396 /**
397 * \returns the current frequency (Hz)
398 */
399 double GetFrequency() const;
400
401 /**
402 * \returns the current system loss (dimension-less)
403 */
404 double GetSystemLoss() const;
405 /**
406 * \param heightAboveZ the model antenna height above the node's Z coordinate
407 *
408 * Set the model antenna height above the node's Z coordinate
409 */
410 void SetHeightAboveZ(double heightAboveZ);
411
412 private:
413 double DoCalcRxPower(double txPowerDbm,
415 Ptr<MobilityModel> b) const override;
416 int64_t DoAssignStreams(int64_t stream) override;
417
418 /**
419 * Transforms a Dbm value to Watt
420 * \param dbm the Dbm value
421 * \return the Watts
422 */
423 double DbmToW(double dbm) const;
424
425 /**
426 * Transforms a Watt value to Dbm
427 * \param w the Watt value
428 * \return the Dbm
429 */
430 double DbmFromW(double w) const;
431
432 double m_lambda; //!< the carrier wavelength
433 double m_frequency; //!< the carrier frequency
434 double m_systemLoss; //!< the system loss
435 double m_minDistance; //!< minimum distance for the model
436 double m_heightAboveZ; //!< antenna height above the node's Z coordinate
437};
438
439/**
440 * \ingroup propagation
441 *
442 * \brief a log distance propagation model.
443 *
444 * This model calculates the reception power with a so-called
445 * log-distance propagation model:
446 * \f$ L = L_0 + 10 n log_{10}(\frac{d}{d_0})\f$
447 *
448 * where:
449 * - \f$ n \f$ : the path loss distance exponent
450 * - \f$ d_0 \f$ : reference distance (m)
451 * - \f$ L_0 \f$ : path loss at reference distance (dB)
452 * - \f$ d \f$ : distance (m)
453 * - \f$ L \f$ : path loss (dB)
454 *
455 * When the path loss is requested at a distance smaller than
456 * the reference distance, the tx power is returned.
457 *
458 */
460{
461 public:
462 /**
463 * \brief Get the type ID.
464 * \return the object TypeId
465 */
466 static TypeId GetTypeId();
468
469 // Delete copy constructor and assignment operator to avoid misuse
472
473 /**
474 * \param n the path loss exponent.
475 * Set the path loss exponent.
476 */
477 void SetPathLossExponent(double n);
478 /**
479 * \returns the current path loss exponent.
480 */
481 double GetPathLossExponent() const;
482
483 /**
484 * Set the reference path loss at a given distance
485 * \param referenceDistance reference distance
486 * \param referenceLoss reference path loss
487 */
488 void SetReference(double referenceDistance, double referenceLoss);
489
490 private:
491 double DoCalcRxPower(double txPowerDbm,
493 Ptr<MobilityModel> b) const override;
494
495 int64_t DoAssignStreams(int64_t stream) override;
496
497 /**
498 * Creates a default reference loss model
499 * \return a default reference loss model
500 */
502
503 double m_exponent; //!< model exponent
504 double m_referenceDistance; //!< reference distance
505 double m_referenceLoss; //!< reference loss
506};
507
508/**
509 * \ingroup propagation
510 *
511 * \brief A log distance path loss propagation model with three distance
512 * fields. This model is the same as ns3::LogDistancePropagationLossModel
513 * except that it has three distance fields: near, middle and far with
514 * different exponents.
515 *
516 * Within each field the reception power is calculated using the log-distance
517 * propagation equation:
518 * \f[ L = L_0 + 10 \cdot n_0 log_{10}(\frac{d}{d_0})\f]
519 * Each field begins where the previous ends and all together form a continuous function.
520 *
521 * There are three valid distance fields: near, middle, far. Actually four: the
522 * first from 0 to the reference distance is invalid and returns txPowerDbm.
523 *
524 * \f[ \underbrace{0 \cdots\cdots}_{=0} \underbrace{d_0 \cdots\cdots}_{n_0} \underbrace{d_1
525\cdots\cdots}_{n_1} \underbrace{d_2 \cdots\cdots}_{n_2} \infty \f]
526 *
527 * Complete formula for the path loss in dB:
528 *
529 * \f[\displaystyle L =
530\begin{cases}
5310 & d < d_0 \\
532L_0 + 10 \cdot n_0 \log_{10}(\frac{d}{d_0}) & d_0 \leq d < d_1 \\
533L_0 + 10 \cdot n_0 \log_{10}(\frac{d_1}{d_0}) + 10 \cdot n_1 \log_{10}(\frac{d}{d_1}) & d_1 \leq d <
534d_2 \\ L_0 + 10 \cdot n_0 \log_{10}(\frac{d_1}{d_0}) + 10 \cdot n_1 \log_{10}(\frac{d_2}{d_1}) + 10
535\cdot n_2 \log_{10}(\frac{d}{d_2})& d_2 \leq d \end{cases}\f]
536 *
537 * where:
538 * - \f$ L \f$ : resulting path loss (dB)
539 * - \f$ d \f$ : distance (m)
540 * - \f$ d_0, d_1, d_2 \f$ : three distance fields (m)
541 * - \f$ n_0, n_1, n_2 \f$ : path loss distance exponent for each field (unitless)
542 * - \f$ L_0 \f$ : path loss at reference distance (dB)
543 *
544 * When the path loss is requested at a distance smaller than the reference
545 * distance \f$ d_0 \f$, the tx power (with no path loss) is returned. The
546 * reference distance defaults to 1m and reference loss defaults to
547 * ns3::FriisPropagationLossModel with 5.15 GHz and is thus \f$ L_0 \f$ = 46.67 dB.
548 */
550{
551 public:
552 /**
553 * \brief Get the type ID.
554 * \return the object TypeId
555 */
556 static TypeId GetTypeId();
558
559 // Delete copy constructor and assignment operator to avoid misuse
562 delete;
563
564 // Parameters are all accessible via attributes.
565
566 private:
567 double DoCalcRxPower(double txPowerDbm,
569 Ptr<MobilityModel> b) const override;
570
571 int64_t DoAssignStreams(int64_t stream) override;
572
573 double m_distance0; //!< Beginning of the first (near) distance field
574 double m_distance1; //!< Beginning of the second (middle) distance field.
575 double m_distance2; //!< Beginning of the third (far) distance field.
576
577 double m_exponent0; //!< The exponent for the first field.
578 double m_exponent1; //!< The exponent for the second field.
579 double m_exponent2; //!< The exponent for the third field.
580
581 double m_referenceLoss; //!< The reference loss at distance d0 (dB).
582};
583
584/**
585 * \ingroup propagation
586 *
587 * \brief Nakagami-m fast fading propagation loss model.
588 *
589 * This propagation loss model implements the Nakagami-m fast fading
590 * model, which accounts for the variations in signal strength due to multipath
591 * fading. The model does not account for the path loss due to the
592 * distance traveled by the signal, hence for typical simulation usage it
593 * is recommended to consider using it in combination with other models
594 * that take into account this aspect.
595 *
596 * The Nakagami-m distribution is applied to the power level. The probability
597 * density function is defined as
598 * \f[ p(x; m, \omega) = \frac{2 m^m}{\Gamma(m) \omega^m} x^{2m - 1} e^{-\frac{m}{\omega} x^2} \f]
599 * with \f$ m \f$ the fading depth parameter and \f$ \omega \f$ the average received power.
600 *
601 * It is implemented by either a ns3::GammaRandomVariable or a
602 * ns3::ErlangRandomVariable random variable.
603 *
604 * The implementation of the model allows to specify different values of the m parameter (and hence
605 * different fading profiles) for three different distance ranges: \f[ \underbrace{0
606 * \cdots\cdots}_{m_0} \underbrace{d_1 \cdots\cdots}_{m_1} \underbrace{d_2 \cdots\cdots}_{m_2}
607 * \infty \f]
608 *
609 * For m = 1 the Nakagami-m distribution equals the Rayleigh distribution. Thus
610 * this model also implements Rayleigh distribution based fast fading.
611 */
613{
614 public:
615 /**
616 * \brief Get the type ID.
617 * \return the object TypeId
618 */
619 static TypeId GetTypeId();
620
622
623 // Delete copy constructor and assignment operator to avoid misuse
626
627 // Parameters are all accessible via attributes.
628
629 private:
630 double DoCalcRxPower(double txPowerDbm,
632 Ptr<MobilityModel> b) const override;
633
634 int64_t DoAssignStreams(int64_t stream) override;
635
636 double m_distance1; //!< Distance1
637 double m_distance2; //!< Distance2
638
639 double m_m0; //!< m for distances smaller than Distance1
640 double m_m1; //!< m for distances smaller than Distance2
641 double m_m2; //!< m for distances greater than Distance2
642
645};
646
647/**
648 * \ingroup propagation
649 *
650 * \brief Return a constant received power level independent of the transmit
651 * power
652 *
653 * The received power is constant independent of the transmit power. The user
654 * must set received power level through the Rss attribute or public
655 * SetRss() method. Note that if this loss model is chained to other loss
656 * models via SetNext() method, it can only be the first loss model in such
657 * a chain, or else it will disregard the losses computed by loss models
658 * that precede it in the chain.
659 */
661{
662 public:
663 /**
664 * \brief Get the type ID.
665 * \return the object TypeId
666 */
667 static TypeId GetTypeId();
668
670 ~FixedRssLossModel() override;
671
672 // Delete copy constructor and assignment operator to avoid misuse
675
676 /**
677 * \param rss (dBm) the received signal strength
678 *
679 * Set the received signal strength (RSS) in dBm.
680 */
681 void SetRss(double rss);
682
683 private:
684 double DoCalcRxPower(double txPowerDbm,
686 Ptr<MobilityModel> b) const override;
687
688 int64_t DoAssignStreams(int64_t stream) override;
689
690 double m_rss; //!< the received signal strength
691};
692
693/**
694 * \ingroup propagation
695 *
696 * \brief The propagation loss is fixed for each pair of nodes and doesn't depend on their actual
697 * positions.
698 *
699 * This is supposed to be used by synthetic tests. Note that by default propagation loss is assumed
700 * to be symmetric.
701 */
703{
704 public:
705 /**
706 * \brief Get the type ID.
707 * \return the object TypeId
708 */
709 static TypeId GetTypeId();
710
713
714 // Delete copy constructor and assignment operator to avoid misuse
717
718 /**
719 * \brief Set loss (in dB, positive) between pair of ns-3 objects
720 * (typically, nodes).
721 *
722 * \param a ma Source mobility model
723 * \param b mb Destination mobility model
724 * \param loss a -> b path loss, positive in dB
725 * \param symmetric If true (default), both a->b and b->a paths will be affected
726 */
727 void SetLoss(Ptr<MobilityModel> a, Ptr<MobilityModel> b, double loss, bool symmetric = true);
728
729 /**
730 * Set the default propagation loss (in dB, positive) to be used, infinity if not set
731 * \param defaultLoss the default proagation loss
732 */
733 void SetDefaultLoss(double defaultLoss);
734
735 private:
736 double DoCalcRxPower(double txPowerDbm,
738 Ptr<MobilityModel> b) const override;
739
740 int64_t DoAssignStreams(int64_t stream) override;
741
742 double m_default; //!< default loss
743
744 /// Typedef: Mobility models pair
745 typedef std::pair<const Ptr<MobilityModel>, const Ptr<MobilityModel>> MobilityPair;
746
747 /**
748 * \ingroup propagation
749 *
750 * \brief Hasher for a pair of mobility models.
751 */
753 {
754 public:
755 /**
756 * \brief Get the hash for a MobilityPair.
757 * \param key MobilityPair reference to hash
758 * \return the MobilityPair hash
759 */
760 size_t operator()(const MobilityPair& key) const
761 {
762 return uint64_t(key.first.operator->()) ^ uint64_t(key.second.operator->());
763 }
764 };
765
766 std::unordered_map<MobilityPair, double, MobilityPairHasher>
767 m_loss; //!< Propagation loss between pair of nodes
768};
769
770/**
771 * \ingroup propagation
772 *
773 * \brief The propagation loss depends only on the distance (range) between transmitter and
774 * receiver.
775 *
776 * The single MaxRange attribute (units of meters) determines path loss.
777 * Receivers at or within MaxRange meters receive the transmission at the
778 * transmit power level. Receivers beyond MaxRange receive at power
779 * -1000 dBm (effectively zero).
780 */
782{
783 public:
784 /**
785 * \brief Get the type ID.
786 * \return the object TypeId
787 */
788 static TypeId GetTypeId();
790
791 // Delete copy constructor and assignment operator to avoid misuse
794
795 private:
796 double DoCalcRxPower(double txPowerDbm,
798 Ptr<MobilityModel> b) const override;
799
800 int64_t DoAssignStreams(int64_t stream) override;
801
802 double m_range; //!< Maximum Transmission Range (meters)
803};
804
805} // namespace ns3
806
807#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
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
static TypeId GetTypeId()
Get the type ID.
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()
Get the type ID.
FriisPropagationLossModel & operator=(const FriisPropagationLossModel &)=delete
a log distance propagation model.
LogDistancePropagationLossModel & operator=(const LogDistancePropagationLossModel &)=delete
LogDistancePropagationLossModel(const LogDistancePropagationLossModel &)=delete
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()
Get the type ID.
static Ptr< PropagationLossModel > CreateDefaultReference()
Creates a default reference loss model.
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
size_t operator()(const MobilityPair &key) const
Get the hash for a MobilityPair.
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.
std::unordered_map< MobilityPair, double, MobilityPairHasher > m_loss
Propagation loss between pair of nodes.
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< const Ptr< MobilityModel >, const Ptr< MobilityModel > > MobilityPair
Typedef: Mobility models pair.
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
PropagationLossModel.
static TypeId GetTypeId()
Get the type ID.
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.
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.
static TypeId GetTypeId()
Get the type ID.
A base class which provides memory management and object aggregation.
Definition: object.h:89
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.
static TypeId GetTypeId()
Get the type ID.
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
Ptr< PropagationLossModel > GetNext()
Gets the next PropagationLossModel in the chain of loss models that act on the signal.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
The propagation loss follows a random distribution.
RandomPropagationLossModel & operator=(const RandomPropagationLossModel &)=delete
static TypeId GetTypeId()
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
static TypeId GetTypeId()
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.
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
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
static TypeId GetTypeId()
Get the type ID.
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.
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.