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