From 6848f41fd1fe3f30241769e5353dc458e5856230 Mon Sep 17 00:00:00 2001 From: Nicola Baldo Date: Mon, 30 Apr 2012 13:02:35 +0200 Subject: [PATCH] decouple most propagation models from buildings module --- doc/models/Makefile | 1 + src/buildings/doc/source/buildings-design.rst | 278 ++---------- .../doc/source/buildings-references.rst | 9 +- .../model/buildings-propagation-loss-model.cc | 400 +----------------- .../model/buildings-propagation-loss-model.h | 77 +--- ...hybrid-buildings-propagation-loss-model.cc | 122 +++++- .../hybrid-buildings-propagation-loss-model.h | 57 ++- .../itu-r-1238-propagation-loss-model.cc | 116 +++++ .../model/itu-r-1238-propagation-loss-model.h | 77 ++++ .../oh-buildings-propagation-loss-model.cc | 21 +- .../oh-buildings-propagation-loss-model.h | 27 +- src/buildings/test/buildings-pathloss-test.cc | 31 +- src/buildings/test/buildings-pathloss-test.h | 6 +- src/buildings/wscript | 2 + src/lte/doc/source/lte-references.rst | 14 - src/lte/helper/lte-helper.cc | 23 +- src/propagation/doc/propagation.rst | 323 +++++++++++++- .../itu-r-1411-los-propagation-loss-model.cc | 95 +++++ .../itu-r-1411-los-propagation-loss-model.h | 70 +++ ...los-over-rooftop-propagation-loss-model.cc | 225 ++++++++++ ...nlos-over-rooftop-propagation-loss-model.h | 80 ++++ .../okumura-hata-propagation-loss-model.cc | 155 +++++++ .../okumura-hata-propagation-loss-model.h | 66 +++ .../model/propagation-environment.h | 54 +++ src/propagation/wscript | 7 + 25 files changed, 1515 insertions(+), 821 deletions(-) create mode 100644 src/buildings/model/itu-r-1238-propagation-loss-model.cc create mode 100644 src/buildings/model/itu-r-1238-propagation-loss-model.h create mode 100644 src/propagation/model/itu-r-1411-los-propagation-loss-model.cc create mode 100644 src/propagation/model/itu-r-1411-los-propagation-loss-model.h create mode 100644 src/propagation/model/itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc create mode 100644 src/propagation/model/itu-r-1411-nlos-over-rooftop-propagation-loss-model.h create mode 100644 src/propagation/model/okumura-hata-propagation-loss-model.cc create mode 100644 src/propagation/model/okumura-hata-propagation-loss-model.h create mode 100644 src/propagation/model/propagation-environment.h diff --git a/doc/models/Makefile b/doc/models/Makefile index 7ad51bab8..dee4e4ccb 100644 --- a/doc/models/Makefile +++ b/doc/models/Makefile @@ -28,6 +28,7 @@ SOURCES = \ $(SRC)/buildings/doc/source/buildings-design.rst \ $(SRC)/buildings/doc/source/buildings-user.rst \ $(SRC)/buildings/doc/source/buildings-testing.rst \ + $(SRC)/buildings/doc/source/buildings-references.rst \ $(SRC)/click/doc/click.rst \ $(SRC)/csma/doc/csma.rst \ $(SRC)/dsdv/doc/dsdv.rst \ diff --git a/src/buildings/doc/source/buildings-design.rst b/src/buildings/doc/source/buildings-design.rst index d4760ecb8..0ebdf4892 100644 --- a/src/buildings/doc/source/buildings-design.rst +++ b/src/buildings/doc/source/buildings-design.rst @@ -17,9 +17,9 @@ The Buildings module provides: #. a new propagation model (``HybridBuildingsPropagationLossModel``) working with the mobility model just introduced, that allows to model the phenomenon of indoor/outdoor propagation in the presence of buildings. #. a simplified model working only with Okumura Hata (``OhBuildingsPropagationLossModel``) considering the phenomenon of indoor/outdoor propagation in the presence of buildings. -The models have been designed with LTE in mind, though their implementation is in fact independent from any LTE-specific code, and can be used with other ns-3 wireless technologies as well (e.g., wifi). +The models have been designed with LTE in mind, though their implementation is in fact independent from any LTE-specific code, and can be used with other ns-3 wireless technologies as well (e.g., wifi, wimax). -The ``HybridBuildingsPropagationLossModel`` pathloss model included is obtained through a combination of several well known pathloss models in order to mimic different environmental scenarios such as urban, suburban and open areas. Moreover, the model considers both outdoor and indoor indoor and outdoor communication has to be included since HeNB might be installed either within building and either outside. In case of indoor communication, the model has to consider also the type of building in outdoor <-> indoor communication according to some general criteria such as the wall penetration losses of the common materials; moreover it includes some general configuration for the internal walls in indoor communications. Finally, the frequency also represent an important parameter since it spans from 600 MHz up to 2600 MHz according to [TS36.101]_. +The ``HybridBuildingsPropagationLossModel`` pathloss model included is obtained through a combination of several well known pathloss models in order to mimic different environmental scenarios such as urban, suburban and open areas. Moreover, the model considers both outdoor and indoor indoor and outdoor communication has to be included since HeNB might be installed either within building and either outside. In case of indoor communication, the model has to consider also the type of building in outdoor <-> indoor communication according to some general criteria such as the wall penetration losses of the common materials; moreover it includes some general configuration for the internal walls in indoor communications. The ``OhBuildingsPropagationLossModel`` pathloss model has been created for simplifying the previous one removing the thresholds for switching from one model to other. For doing this it has been used only one propagation model from the one available (i.e., the Okumura Hata). The presence of building is still considered in the model; therefore all the considerations of above regarding the building type are still valid. The same consideration can be done for what concern the environmental scenario and frequency since both of them are parameters of the model considered. @@ -52,247 +52,13 @@ The ``Building`` class is included in ``BuildingsMobilityModel`` class, which in The class ``BuildingsMobilityModel`` is used by ``BuildingsPropagationLossModel`` class, which inherits from the ns3 class ``PropagationLossModel`` and manages the pathloss computation of the single components and their composition according to the nodes' positions. Moreover, it implements also the shadowing, that is the loss due to obstacles in the main path (i.e., vegetation, buildings, etc.). -Pathloss model elements -+++++++++++++++++++++++ -In the following we describe the pathloss model elements that are included in the BuildingsPropagationLossModel and available to implement different pathloss logics. -Okumura Hata (OH) ------------------ -This model is used to model open area pathloss for long distance (i.e., > 1 Km). In order to include all the possible frequencies usable by LTE we need to consider several variant of the well known Okumura Hata model. In fact, the standard one is designed for frequencies ranging from 150 MHz to 1500 MHz, the COST231 [cost231]_ one for the 1500 MHz up to 2000 MHz and [pl26ghz]_ for the one at 2.6G Hz. Another important aspect is the scenarios considered by the models, in fact the all models are originally designed for urban scenario and then only the standard one and the COST231 are extended to suburban, while only the standard one has been extended to open areas. Therefore, the model cannot cover all scenarios at all frequencies. In the following we detail the models adopted. +ItuR1238PropagationLossModel +++++++++++++++++++++++++++++ - - -The pathloss expression of the COST231 OH is: - -.. math:: - - L = 46.3 + 33.9\log{f} - 13.82 \log{h_\mathrm{b}} + (44.9 - 6.55\log{h_\mathrm{b}})\log{d} - F(h_\mathrm{M}) + C - -where - -.. math:: - - F(h_\mathrm{M}) = \left\{\begin{array}{ll} (1.1\log(f))-0.7 \times h_\mathrm{M} - (1.56\times \log(f)-0.8) & \mbox{for medium and small size cities} \\ 3.2\times (\log{(11.75\times h_\mathrm{M}}))^2 & \mbox{for large cities}\end{array} \right. - - -.. math:: - - C = \left\{\begin{array}{ll} 0dB & \mbox{for medium-size cities and suburban areas} \\ 3dB & \mbox{for large cities}\end{array} \right. - -and - - :math:`f` : frequency [MHz] - - :math:`h_\mathrm{b}` : eNB height above the ground [m] - - :math:`h_\mathrm{M}` : UE height above the ground [m] - - :math:`d` : distance [km] - - :math:`log` : is a logarithm in base 10 (this for the whole document) - - -This model is only for urban scenarios. - -The pathloss expression of the standard OH in urban area is: - -.. math:: - - L = 69.55 + 26.16\log{f} - 13.82 \log{h_\mathrm{b}} + (44.9 - 6.55\log{h_\mathrm{b}})\log{d} - C_\mathrm{H} - -where for small or medium sized city - -.. math:: - - C_\mathrm{H} = 0.8 + (1.1\log{f} - 0.7)h_\mathrm{M} -1.56\log{f} - -and for large cities - -.. math:: - C_\mathrm{H} = \left\{\begin{array}{ll} 8.29 (\log{(1.54h_M)})^2 -1.1 & \mbox{if } 150\leq f\leq 200 \\ 3.2(\log{(11.75h_M)})^2 -4.97 & \mbox{if } 200 R_\mathrm{bp}$}\end{array} \right. - -.. math:: - - L_\mathrm{LoS,u} = L_\mathrm{bp} + 20 + \left\{\begin{array}{ll} 25\log{\frac{d}{R_\mathrm{bp}}} & \mbox{for $d \le R_\mathrm{bp}$} \\ 40\log{\frac{d}{R_\mathrm{bp}}} & \mbox{for $d > R_\mathrm{bp}$}\end{array} \right. - -where the breakpoint distance is given by - -.. math:: - - R_\mathrm{bp} \approx \frac{4h_\mathrm{b}h_\mathrm{m}}{\lambda} - -and the above parameters are - - :math:`\lambda` : wavelength [m] - - :math:`h_\mathrm{b}` : eNB height above the ground [m] - - :math:`h_\mathrm{m}` : UE height above the ground [m] - - :math:`d` : distance [m] - -and :math:`L_{bp}` is the value for the basic transmission loss at the break point, defined as: - -.. math:: - - L_{bp} = \left|20\log \left(\frac{\lambda^2}{8\pi h_\mathrm{b}h\mathrm{m}}\right)\right| - -The value used by the simulator is the average one for modeling the median pathloss. - - -NLoS over the rooftops -~~~~~~~~~~~~~~~~~~~~~~ - -In this case the model is based on [walfisch]_ and [ikegami]_, where the loss is expressed as the sum of free-space loss (:math:`L_{bf}`), the diffraction loss from rooftop to street (:math:`L_{rts}`) and the reduction due to multiple screen diffraction past rows of building (:math:`L_{msd}`). The formula is: - -.. math:: - - L_{NLOS1} = \left\{ \begin{array}{ll} L_{bf} + L_{rts} + L_{msd} & \mbox{for } L_{rts} + L_{msd} > 0 \\ L_{bf} & \mbox{for } L_{rts} + L_{msd} \le 0\end{array}\right. - -The free-space loss is given by: - -.. math:: - - L_{bf} = 32.4 + 20 \log {(d/1000)} + 20\log{(f)} - -where: - - :math:`f` : frequency [MHz] - - :math:`d` : distance (where :math:`d > 1`) [m] - -The term :math:`L_{rts}` takes into account the width of the street and its orientation, according to the formulas - -.. math:: - - L_{rts} = -8.2 - 10\log {(w)} + 10\log{(f)} + 20\log{(\Delta h_m)} + L_{ori} - - L_{ori} = \left\{ \begin{array}{lll} -10 + 0.354\varphi & \mbox{for } 0^{\circ} \le \varphi < 35^{\circ} \\ 2.5 + 0.075(\varphi-35) & \mbox{for } 35^{\circ} \le \varphi < 55^{\circ} \\ 4.0 -0.114(\varphi-55) & \mbox{for } 55^{\circ} \varphi \le 90^{\circ}\end{array}\right. - - \Delta h_m = h_r - h_m - -where: - - :math:`h_r` : is the height of the rooftop [m] - - :math:`h_m` : is the height of the mobile [m] - - :math:`\varphi` : is the street orientation with respect to the direct path (degrees) - - -The multiple screen diffraction loss depends on the BS antenna height relative to the building height and on the incidence angle. The former is selected as the higher antenna in the communication link. Regarding the latter, the "settled field distance" is used for select the proper model; its value is given by - -.. math:: - - d_{s} = \frac{\lambda d^2}{\Delta h_{b}^2} - -with - - :math:`\Delta h_b = h_b - h_m` - -Therefore, in case of :math:`l > d_s` (where `l` is the distance over which the building extend), it can be evaluated according to - -.. math:: - - L_{msd} = L_{bsh} + k_{a} + k_{d}\log{(d/1000)} + k_{f}\log{(f)} - 9\log{(b)} - - L_{bsh} = \left\{ \begin{array}{ll} -18\log{(1+\Delta h_{b})} & \mbox{for } h_{b} > h_{r} \\ 0 & \mbox{for } h_{b} \le h_{hr} \end{array}\right. - - k_a = \left\{ \begin{array}{lll} - 71.4 & \mbox{for } h_{b} > h_{r} \mbox{ and } f>2000 \mbox{ MHz} \\ - 54 & \mbox{for } h_{b} > h_{r} \mbox{ and } f\le2000 \mbox{ MHz} \\ - 54-0.8\Delta h_b & \mbox{for } h_{b} \le h_{r} \mbox{ and } d \ge 500 \mbox{ m} \\ - 54-1.6\Delta h_b & \mbox{for } h_{b} \le h_{r} \mbox{ and } d < 500 \mbox{ m} \\ - \end{array} \right. - - k_d = \left\{ \begin{array}{ll} - 18 & \mbox{for } h_{b} > h_{r} \\ - 18 -15\frac{\Delta h_b}{h_r} & \mbox{for } h_{b} \le h_{r} - \end{array} \right. - - k_f = \left\{ \begin{array}{ll} - -8 & \mbox{for } f>2000 \mbox{ MHz} \\ - -4 + 0.7(f/925 -1) & \mbox{for medium city and suburban centres and} f\le2000 \mbox{ MHz} \\ - -4 + 1.5(f/925 -1) & \mbox{for metropolitan centres and } f\le2000 \mbox{ MHz} - \end{array}\right. - - -Alternatively, in case of :math:`l < d_s`, the formula is: - -.. math:: - - L_{msd} = -10\log{\left(Q_M^2\right)} - -where - -.. math:: - - Q_M = \left\{ \begin{array}{lll} - 2.35\left(\frac{\Delta h_b}{d}\sqrt{\frac{b}{\lambda}}\right)^{0.9} & \mbox{for } h_{b} > h_{r} \\ - \frac{b}{d} & \mbox{for } h_{b} \approx h_{r} \\ - \frac{b}{2\pi d}\sqrt{\frac{\lambda}{\rho}}\left(\frac{1}{\theta}-\frac{1}{2\pi + \theta}\right) & \mbox{for } h_{b} < h_{r} - \end{array}\right. - - -where: - -.. math:: - - \theta = arc tan \left(\frac{\Delta h_b}{b}\right) - - \rho = \sqrt{\Delta h_b^2 + b^2} - - -Indoor Communications (I1238) ------------------------------ - -In this case the model considers the ITU P.1238, which includes losses due to type of building (i.e., residential, office and commercial). +This class implements a building-dependent indoor propagation loss model based on the ITU P.1238 model, which includes losses due to type of building (i.e., residential, office and commercial). The analytical expression is given in the following. .. math:: @@ -313,6 +79,14 @@ where: + +BuildingsPropagationLossModel ++++++++++++++++++++++++++++++ + +The BuildingsPropagationLossModel provides an additional set of building-dependent pathloss model elements that are used to implement different pathloss logics. These pathloss model elements are described in the following subsections. + + + External Wall Loss (EWL) ------------------------- @@ -340,7 +114,7 @@ This component models the penetration loss occurring in indoor-to-indoor communi Height Gain Model (HG) ----------------------- -This component model the gain due to the fact that the transmitting device is on a floor above the ground. In literature [turkmani]_ this gain has been evaluated as about 2 dB per floor. This gain can be applied to all the indoor to outdoor communications and vice-versa. +This component model the gain due to the fact that the transmitting device is on a floor above the ground. In the literature [turkmani]_ this gain has been evaluated as about 2 dB per floor. This gain can be applied to all the indoor to outdoor communications and vice-versa. Shadowing Model @@ -375,7 +149,14 @@ In the following we describe the different pathloss logic that are implemented b HybridBuildingsPropagationLossModel ----------------------------------- -The following pseudo-code illustrates how the different pathloss model elements described above are integrated in the ``HybridBuildingsPropagationLossModel``:: +The ``HybridBuildingsPropagationLossModel`` pathloss model included is obtained through a combination of several well known pathloss models in order to mimic different outdoor and indoor scenarios, as well as indoor-to-outdoor and outdoor-to-indoor scenarios. In detail, the class ``HybridBuildingsPropagationLossModel`` integrates the following pathloss models: + + * OkumuraHataPropagationLossModel (OH) + * ItuR1411LosPropagationLossModel and ItuR1411NlosOverRooftopPropagationLossModel (I1411) + * ItuR1238PropagationLossModel (I1238) + * the pathloss elements of the BuildingsPropagationLossModel (EWL, HG, IWL) + +The following pseudo-code illustrates how the different pathloss model elements described above are integrated in ``HybridBuildingsPropagationLossModel``:: if (txNode is outdoor) then @@ -419,7 +200,11 @@ The following pseudo-code illustrates how the different pathloss model elements L = I1411 + EWL -We note that, for the case of communication between two nodes below rooftop level with distance is greater then 1 km, we still consider the I1411 model, since OH is specifically designed for macro cells and therefore for antennas above the roof-top level. Finally, we introduced a threshold called ``m_itu1411DistanceThreshold``) for pruning the communications between nodes below rooftop when the distance is too large (the default values is 2 km). + + +We note that, for the case of communication between two nodes below rooftop level with distance is greater then 1 km, we still consider the I1411 model, since OH is specifically designed for macro cells and therefore for antennas above the roof-top level. + +For the ITU-R P.1411 model we consider both the LOS and NLoS versions. In particular, we considers the LoS propagation for distances that are shorted than a tunable threshold (``m_itu1411NlosThreshold``). In case on NLoS propagation, the over the roof-top model is taken in consideration for modeling both macro BS and SC. In case on NLoS several parameters scenario dependent have been included, such as average street width, orientation, etc. The values of such parameters have to be properly set according to the scenario implemented, the model does not calculate natively their values. In case any values is provided, the standard ones are used, apart for the height of the mobile and BS, which instead their integrity is tested directly in the code (i.e., they have to be greater then zero). In the following we give the expressions of the components of the model. We also note that the use of different propagation models (OH, I1411, I1238 with their variants) in HybridBuildingsPropagationLossModel can result in discontinuities of the pathloss with respect to distance. A proper tuning of the attributes (especially the distance threshold attributes) can avoid these discontinuities. However, since the behavior of each model depends on several other parameters (frequency, node heigth, etc), there is no default value of these thresholds that can avoid the discontinuities in all possible configurations. Hence, an appropriate tuning of these parameters is left to the user. @@ -427,7 +212,14 @@ We also note that the use of different propagation models (OH, I1411, I1238 with OhBuildingsPropagationLossModel ------------------------------- -The following pseudo-code illustrates how the different pathloss model elements described above are integrated in the ``OhBuildingsPropagationLossModel``:: +The ``OhBuildingsPropagationLossModel`` class has been created as a simple means to solve the discontinuity problems of ``HybridBuildingsPropagationLossModel`` without doing scenario-specific parameter tuning. The solution is to use only one propagation loss model (i.e., Okumura Hata), while retaining the structure of the pathloss logic for the calculation of other path loss components (such as wall penetration losses). The result is a model that is free of discontinuities (except those due to walls), but that is less realistic overall for a generic scenario with buildings and outdoor/indoor users, e.g., because Okumura Hata is not suitable neither for indoor communications nor for outdoor communications below rooftop level. + +In detail, the class ``OhBuildingsPropagationLossModel`` integrates the following pathloss models: + + * OkumuraHataPropagationLossModel (OH) + * the pathloss elements of the BuildingsPropagationLossModel (EWL, HG, IWL) + +The following pseudo-code illustrates how the different pathloss model elements described above are integrated in ``OhBuildingsPropagationLossModel``:: if (txNode is outdoor) then diff --git a/src/buildings/doc/source/buildings-references.rst b/src/buildings/doc/source/buildings-references.rst index 7fc8e2b7d..e7905d79e 100644 --- a/src/buildings/doc/source/buildings-references.rst +++ b/src/buildings/doc/source/buildings-references.rst @@ -1,11 +1,6 @@ -.. [pl26ghz] Sun Kun; Wang Ping; Li Yingze, "Path loss models for suburban scenario at 2.3GHz, 2.6GHz and 3.5GHz", - in Proc. of ISAPE 2008, Kunming, China, Nov 2008. +.. include:: replace.txt + .. [turkmani] Turkmani A.M.D., J.D. Parson and D.G. Lewis, "Radio propagation into buildings at 441, 900 and 1400 MHz", in Proc. of 4th Int. Conference on Land Mobile Radio, 1987. -.. [walfisch] J.Walfisch and H.L. Bertoni, "A Theoretical model of UHF propagation in urban environments," in IEEE Trans. Antennas Propagat., vol.36, 1988, pp.1788- 1796 - -.. [ikegami] F.Ikegami, T.Takeuchi, and S.Yoshida, "Theoretical prediction of mean field strength for Urban Mobile Radio", in IEEE Trans. Antennas Propagat., Vol.39, No.3, 1991 - -.. [cost231] “Digital Mobile Radio: COST 231 View on the Evolution Towards 3rd Generation Systems”, Commission of the European Communities, L-2920, Luxembourg, 1989 diff --git a/src/buildings/model/buildings-propagation-loss-model.cc b/src/buildings/model/buildings-propagation-loss-model.cc index 04932ebce..2c3b4f17d 100644 --- a/src/buildings/model/buildings-propagation-loss-model.cc +++ b/src/buildings/model/buildings-propagation-loss-model.cc @@ -25,7 +25,7 @@ #include "ns3/mobility-model.h" #include "ns3/double.h" #include "ns3/pointer.h" -#include +#include #include "buildings-propagation-loss-model.h" #include "ns3/buildings-mobility-model.h" #include "ns3/enum.h" @@ -70,17 +70,6 @@ BuildingsPropagationLossModel::GetTypeId (void) .SetParent () - .AddAttribute ("Lambda", - "The wavelength (default is 2.106 GHz at 300 000 km/s).", - DoubleValue (300000000.0 / 2160e6), - MakeDoubleAccessor (&BuildingsPropagationLossModel::SetLambda, &BuildingsPropagationLossModel::GetLambda), - MakeDoubleChecker ()) - - .AddAttribute ("Frequency", - "The Frequency (default is 2.106 GHz).", - DoubleValue (2160e6), - MakeDoubleAccessor (&BuildingsPropagationLossModel::SetFrequency), - MakeDoubleChecker ()) .AddAttribute ("ShadowSigmaOutdoor", "Standard deviation of the normal distribution used for calculate the shadowing for outdoor nodes", @@ -99,40 +88,6 @@ BuildingsPropagationLossModel::GetTypeId (void) MakeDoubleAccessor (&BuildingsPropagationLossModel::m_shadowingSigmaExtWalls), MakeDoubleChecker ()) - .AddAttribute ("RooftopLevel", - " The height of the rooftop [m].", - DoubleValue (20.0), - MakeDoubleAccessor (&BuildingsPropagationLossModel::m_rooftopHeight), - MakeDoubleChecker ()) - - .AddAttribute ("Los2NlosThr", - " Threshold from LoS to NLoS in ITU 1411 [m].", - DoubleValue (200.0), - MakeDoubleAccessor (&BuildingsPropagationLossModel::m_itu1411NlosThreshold), - MakeDoubleChecker ()) - - .AddAttribute ("MinDistance", - "The distance under which the propagation model refuses to give results (m) ", - DoubleValue (0.5), - MakeDoubleAccessor (&BuildingsPropagationLossModel::SetMinDistance, &BuildingsPropagationLossModel::GetMinDistance), - MakeDoubleChecker ()) - - .AddAttribute ("Environment", - "Environment Scenario", - EnumValue (BuildingsPropagationLossModel::Urban), - MakeEnumAccessor (&BuildingsPropagationLossModel::SetEnvironment, - &BuildingsPropagationLossModel::GetEnvironment), - MakeEnumChecker (BuildingsPropagationLossModel::Urban, "Urban", - BuildingsPropagationLossModel::SubUrban, "SubUrban", - BuildingsPropagationLossModel::OpenAreas, "OpenAreas")) - - .AddAttribute ("CitySize", - "Dimension of the city", - EnumValue (BuildingsPropagationLossModel::Large), - MakeEnumAccessor (&BuildingsPropagationLossModel::SetCitySize), - MakeEnumChecker (BuildingsPropagationLossModel::Small, "Small", - BuildingsPropagationLossModel::Medium, "Medium", - BuildingsPropagationLossModel::Large, "Large")) .AddAttribute ("InternalWallLoss", "Additional loss for each internal wall [dB]", DoubleValue (5.0), @@ -143,359 +98,6 @@ BuildingsPropagationLossModel::GetTypeId (void) return tid; } -BuildingsPropagationLossModel::BuildingsPropagationLossModel () - : C (0), - m_environment (Urban), - m_citySize (Large), - m_streetsOrientation (45.0), - m_streetsWidth (20.0), - m_buildingsExtend (80.0), - m_buildingSeparation (50.0) -{ -} - -BuildingsPropagationLossModel::~BuildingsPropagationLossModel () -{ -} - -void -BuildingsPropagationLossModel::SetLambda (double lambda) -{ - m_lambda = lambda; - m_frequency = 300000000 / lambda; -} - -void -BuildingsPropagationLossModel::SetFrequency (double freq) -{ - m_frequency = freq; - m_lambda = 300000000 / m_frequency; -} - -double -BuildingsPropagationLossModel::GetLambda (void) const -{ - return m_lambda; -} - -double -BuildingsPropagationLossModel::GetFrequency (void) const -{ - return m_frequency; -} - -void -BuildingsPropagationLossModel::SetMinDistance (double minDistance) -{ - m_minDistance = minDistance; -} -double -BuildingsPropagationLossModel::GetMinDistance (void) const -{ - return m_minDistance; -} - -void -BuildingsPropagationLossModel::SetEnvironment (Environment env) -{ - m_environment = env; -} - -BuildingsPropagationLossModel::Environment -BuildingsPropagationLossModel::GetEnvironment (void) const -{ - return m_environment; -} - -void -BuildingsPropagationLossModel::SetCitySize (CitySize size) -{ - m_citySize = size; -} - -BuildingsPropagationLossModel::CitySize -BuildingsPropagationLossModel::GetCitySize (void) const -{ - return m_citySize; -} - - - -double -BuildingsPropagationLossModel::OkumuraHata (Ptr a, Ptr b) const -{ - // Hp: a is the rooftop antenna (from GetLoss logic) - double loss = 0.0; - double fmhz = m_frequency / 1e6; - double dist = a->GetDistanceFrom (b) / 1000.0; - if (m_frequency <= 1.500e9) - { - // standard Okumura Hata (from wikipedia) - double log_f = log10 (fmhz); - double hb = (a->GetPosition ().z > b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); - double hm = (a->GetPosition ().z < b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); - NS_ASSERT_MSG (hb > 0 && hm > 0, "nodes' height must be greater then 0"); - double log_aHeight = 13.82 * log10 (hb); - double log_bHeight = 0.0; - if (m_citySize == Large) - { - if (m_frequency < 200) - { - log_bHeight = 8.29 * pow (log10 (1.54 * hm), 2) - 1.1; - } - else - { - log_bHeight = 3.2 * pow (log10 (11.75 * hm), 2) - 4.97; - } - } - else - { - log_bHeight = 0.8 + (1.1 * log_f - 0.7) * hm - 1.56 * log_f; - } - -// NS_LOG_INFO (this << " logf " << 26.16 * log_f << " loga " << log_aHeight << " X " << (((44.9 - (6.55 * log10(hb)) ))*log10 (a->GetDistanceFrom (b))) << " logb " << log_bHeight); - loss = 69.55 + (26.16 * log_f) - log_aHeight + (((44.9 - (6.55 * log10 (hb)) )) * log10 (dist)) - log_bHeight; - if (m_environment == SubUrban) - { - loss += -2 * (pow (log10 (fmhz / 28), 2)) - 5.4; - } - else if (m_environment == OpenAreas) - { - loss += -4.70 * pow (log10 (fmhz),2) + 18.33 * log10 (fmhz) - 40.94; - } - - } - else if (m_frequency <= 2.170e9) // max 3GPP freq EUTRA band #1 - { - // COST 231 Okumura model - double log_f = log10 (fmhz); - double hb = (a->GetPosition ().z > b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); - double hm = (a->GetPosition ().z < b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); - NS_ASSERT_MSG (hb > 0 && hm > 0, "nodes' height must be greater then 0"); - double log_aHeight = 13.82 * log10 (hb); - double log_bHeight = 0.0; - double C = 0.0; - - if (m_citySize == Large) - { - log_bHeight = 3.2 * pow ((log10 (11.75 * hm)),2); - C = 3; - } - else - { - log_bHeight = 1.1 * log_f - 0.7 * hm - (1.56 * log_f - 0.8); - } - - loss = 46.3 + (33.9 * log_f) - log_aHeight + (((44.9 - (6.55 * log10 (hb)) )) * log10 (dist)) - log_bHeight + C; - } - else if (m_frequency <= 2.690e9) // max 3GPP freq EUTRA band #1 - { - // Empirical model from - // "Path Loss Models for Suburban Scenario at 2.3GHz, 2.6GHz and 3.5GHz" - // Sun Kun, Wang Ping, Li Yingze - // Antennas, Propagation and EM Theory, 2008. ISAPE 2008. 8th International Symposium on - loss = 36 + 26 * log10 (dist * 1000); - } - - return (loss); -} - - - -double -BuildingsPropagationLossModel::ItuR1411 (Ptr a, Ptr b) const -{ - if (a->GetDistanceFrom (b) < m_itu1411NlosThreshold) - { - return (ItuR1411Los (a,b)); - } - else - { - return (ItuR1411NlosOverRooftop (a,b)); - } -} - - -double -BuildingsPropagationLossModel::ItuR1411Los (Ptr a, Ptr b) const -{ - NS_LOG_INFO (this); - double dist = a->GetDistanceFrom (b); - double lossLow = 0.0; - double lossUp = 0.0; - double pi = 3.141592653589793; - NS_ASSERT_MSG (a->GetPosition ().z > 0 && b->GetPosition ().z > 0, "nodes' height must be greater then 0"); - double Lbp = fabs (20 * log10 ((m_lambda * m_lambda) / (8 * pi * a->GetPosition ().z * b->GetPosition ().z))); - double Rbp = (4 * a->GetPosition ().z * b->GetPosition ().z) / m_lambda; -// NS_LOG_INFO (this << " Lbp " << Lbp << " Rbp " << Rbp << " lambda " << m_lambda); - if (dist <= Rbp) - { - lossLow = Lbp + 20 * log10 (dist / Rbp); - lossUp = Lbp + 20 + 25 * log10 (dist / Rbp); - } - else - { - lossLow = Lbp + 40 * log10 (dist / Rbp); - lossUp = Lbp + 20 + 40 * log10 (dist / Rbp); - } - - double loss = (lossUp + lossLow) / 2; - - return (loss); -} - - -double -BuildingsPropagationLossModel::ItuR1411NlosOverRooftop (Ptr a, Ptr b) const -{ - NS_LOG_INFO (this); - double Lori = 0.0; - double fmhz = m_frequency / 1e6; - if ((m_streetsOrientation >= 0)&&(m_streetsOrientation < 35)) - { - Lori = -10.0 + 0.354 * m_streetsOrientation; - } - else if ((m_streetsOrientation >= 35)&&(m_streetsOrientation < 55)) - { - Lori = 2.5 + 0.075 * (m_streetsOrientation - 35); - } - else if ((m_streetsOrientation >= 55)&&(m_streetsOrientation < 90)) - { - Lori = 2.5 + 0.075 * (m_streetsOrientation - 55); - } - else - { - NS_LOG_ERROR (this << " Street Orientation must be in [0,90]"); - } - double distance = a->GetDistanceFrom (b); - double hb = (a->GetPosition ().z > b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); - double hm = (a->GetPosition ().z < b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); - NS_ASSERT_MSG (hm > 0 && hb > 0, "nodes' height must be greater then 0"); - double Dhb = hb - m_rooftopHeight; - double ds = (m_lambda * distance * distance) / (Dhb * Dhb); - double Lmsd = 0.0; - double pi = 3.141592653589793; -// NS_LOG_INFO (this << " build " << m_buildingsExtend << " ds " << ds << " roof " << m_rooftopHeight << " hb " << hb << " lambda " << m_lambda); - if (ds < m_buildingsExtend) - { - double Lbsh = 0.0; - double ka = 0.0; - double kd = 0.0; - double kf = 0.0; - if (hb > m_rooftopHeight) - { - Lbsh = -18 * log10 (1 + Dhb); - ka = (fmhz > 2000 ? 71.4 : 54.0); - kd = 18.0; - } - else - { - Lbsh = 0; - kd = 18.0 - 15 * Dhb / a->GetPosition ().z; - if (distance < 500) - { - ka = 54.0 - 1.6 * Dhb * distance / 1000; - } - else - { - ka = 54.0 - 0.8 * Dhb; - } - } - if (fmhz > 2000) - { - kf = -8; - } - else if ((m_environment == Urban)&&(m_citySize == Large)) - { - kf = -4 + 0.7 * (fmhz / 925.0 - 1); - } - else - { - kf = -4 + 1.5 * (fmhz / 925.0 - 1); - } - - Lmsd = Lbsh + ka + kd*log10 (distance / 1000.0) + kf*log10 (fmhz) - 9.0 * log10 (m_buildingSeparation); - } - else - { - double theta = atan (Dhb / m_buildingSeparation); - double rho = sqrt (Dhb * Dhb + m_buildingSeparation * m_buildingSeparation); - double Qm = 0.0; - if ((hb > m_rooftopHeight - 1.0) && (hb < m_rooftopHeight + 1.0)) - { - Qm = m_buildingSeparation / distance; - } - else if (hb > m_rooftopHeight) - { - Qm = 2.35 * pow (Dhb / distance * sqrt (m_buildingSeparation / m_lambda), 0.9); - } - else - { - Qm = m_buildingSeparation / (2 * pi * distance) * sqrt (m_lambda / rho) * (1 / theta - (1 / (2 * pi + theta))); - } - Lmsd = -10 * log10 (Qm * Qm); - } - double Lbf = 32.4 + 20 * log10 (distance / 1000) + 20 * log10 (fmhz); - double Dhm = m_rooftopHeight - hm; - double Lrts = -8.2 - 10 * log10 (m_streetsWidth) + 10 * log10 (fmhz) + 20 * log10 (Dhm) + Lori; -// NS_LOG_INFO (this << " Lbf " << Lbf << " Lrts " << Lrts << " Dhm" << Dhm << " Lmsd " << Lmsd); - double loss = 0.0; - if (Lrts + Lmsd > 0) - { - loss = Lbf + Lrts + Lmsd; - } - else - { - loss = Lbf; - } - return (loss); -} - - -double -BuildingsPropagationLossModel::ItuR1238 (Ptr a, Ptr b) const -{ - double N = 0.0; - int n = abs (a->GetFloorNumber () - b->GetFloorNumber ()); - NS_LOG_LOGIC (this << " A floor " << (uint16_t)a->GetFloorNumber () << " B floor " << (uint16_t)b->GetFloorNumber () << " n " << n); - double Lf = 0.0; - Ptr aBuilding = a->GetBuilding (); - if (aBuilding->GetBuildingType () == Building::Residential) - { - N = 28; - if (n >= 1) - { - Lf = 4 * n; - } - NS_LOG_LOGIC (this << " Residential "); - } - else if (aBuilding->GetBuildingType () == Building::Office) - { - N = 30; - if (n >= 1) - { - Lf = 15 + (4 * (n - 1)); - } - NS_LOG_LOGIC (this << " Office "); - } - else if (aBuilding->GetBuildingType () == Building::Commercial) - { - N = 22; - if (n >= 1) - { - Lf = 6 + (3 * (n - 1)); - } - NS_LOG_LOGIC (this << " Commercial "); - } - else - { - NS_LOG_ERROR (this << " Unkwnon Wall Type"); - } - double loss = 20 * log10 (m_frequency / 1e6 /*MHz*/) + N*log10 (a->GetDistanceFrom (b)) + Lf - 28.0; - NS_LOG_INFO (this << " Node " << a->GetPosition () << " <-> " << b->GetPosition () << " loss = " << loss << " dB"); - return (loss); -} - double BuildingsPropagationLossModel::ExternalWallLoss (Ptr a) const diff --git a/src/buildings/model/buildings-propagation-loss-model.h b/src/buildings/model/buildings-propagation-loss-model.h index f6ca189e0..cc7cecea3 100644 --- a/src/buildings/model/buildings-propagation-loss-model.h +++ b/src/buildings/model/buildings-propagation-loss-model.h @@ -1,6 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) + * Copyright (c) 2011, 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -16,6 +16,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Marco Miozzo + * Nicola Baldo * */ @@ -36,23 +37,17 @@ class JakesFadingLossModel; /** * \ingroup propagation * - * \brief The Building-Propagation-Model is a compound of different models able to evaluate the pathloss from 200 to 2600 MHz, in different environments and with buildings (i.e., indoor and outdoor communications). + * This model provides means for simulating the following propagation + * phenomena in the presence of buildings: * - * This model includes Hata model, COST231, ITU-R P.1411 (short range - * communications), ITU-R P.1238 (indoor communications). - * Building-Propagation-Model properly combines the models above in order - * to be able to evaluate the pathloss under different scenarios, in detail: - * - Environments: urban, suburban, open-areas; - * - frequency: from 200 uo to 2600 MHz - * - short range communications vs long range communications - * - Node position respect to buildings: indoor, outdoor and hybrid (indoor <-> outdoor) - * - Building penetretation loss - * - floors, etc... - * - * Frequency: 200 MHz to 2000 MHz - * Link Distance:up to 20 km - * Short/long distance commutation: 1 Km - * \warning This model works with BuildingsMobilityModel + * - shadowing (indoor, outdoor) + * - external wall penetration loss + * - internal wall penetration loss + * + * The distance-dependent component of propagation loss is deferred + * to derived classes which are expected to implement the GetLoss method. + * + * \warning This model works only with BuildingsMobilityModel * */ @@ -61,17 +56,6 @@ class BuildingsPropagationLossModel : public PropagationLossModel public: static TypeId GetTypeId (void); - BuildingsPropagationLossModel (); - ~BuildingsPropagationLossModel (); - enum Environment - { - Urban, SubUrban, OpenAreas - }; - - enum CitySize - { - Small, Medium, Large - }; /** * \param a the mobility model of the source @@ -79,49 +63,18 @@ public: * \returns the propagation loss (in dBm) */ virtual double GetLoss (Ptr a, Ptr b) const = 0; - void SetEnvironment (Environment env); - void SetCitySize (CitySize size); - void SetLambda (double lambda); - void SetFrequency (double freq); - void SetMinDistance (double minDistance); - Environment GetEnvironment (void) const; - CitySize GetCitySize (void) const; - double GetMinDistance (void) const; - double GetLambda (void) const; - double GetFrequency (void) const; -// void SetLambda (double frequency, double speed); - + // inherited from PropagationLossModel virtual double DoCalcRxPower (double txPowerDbm, Ptr a, Ptr b) const; + protected: - virtual double OkumuraHata (Ptr a, Ptr b) const; - virtual double ItuR1411 (Ptr a, Ptr b) const; - virtual double ItuR1411Los (Ptr a, Ptr b) const; - virtual double ItuR1411NlosOverRooftop (Ptr a, Ptr b) const; -// double ItuR1411NlosStreetCanyons (Ptr a, Ptr b) const; - double ItuR1238 (Ptr a, Ptr b) const; double ExternalWallLoss (Ptr a) const; double HeightLoss (Ptr n) const; double InternalWallsLoss (Ptr a, Ptr b) const; - double GetShadowing (Ptr a, Ptr b) - const; + double GetShadowing (Ptr a, Ptr b) const; - double C; // OH loss coefficient for the environment - double N; // ITU-R P.1238: power loss coefficient - double m_lambda; - Environment m_environment; - CitySize m_citySize; - double m_minDistance; // in meter - double m_frequency; // frequency in MHz - double m_rooftopHeight; // in meter (used to discriminate OH and short range canyoning) - double m_itu1411NlosThreshold; // in meters (switch Los -> NLoS) - double m_itu1411DistanceThreshold; // in meters (above infinite loss) - double m_streetsOrientation; // in degrees [0,90] - double m_streetsWidth; // in meters - double m_buildingsExtend; // in meters - double m_buildingSeparation; // in meters double m_lossInternalWall; // in meters diff --git a/src/buildings/model/hybrid-buildings-propagation-loss-model.cc b/src/buildings/model/hybrid-buildings-propagation-loss-model.cc index 27e923279..fdbf9dd39 100644 --- a/src/buildings/model/hybrid-buildings-propagation-loss-model.cc +++ b/src/buildings/model/hybrid-buildings-propagation-loss-model.cc @@ -20,16 +20,21 @@ * */ -#include "ns3/propagation-loss-model.h" +#include + #include "ns3/log.h" #include "ns3/mobility-model.h" #include "ns3/double.h" #include "ns3/pointer.h" -#include -#include "hybrid-buildings-propagation-loss-model.h" +#include "ns3/okumura-hata-propagation-loss-model.h" +#include "ns3/itu-r-1411-los-propagation-loss-model.h" +#include "ns3/itu-r-1411-nlos-over-rooftop-propagation-loss-model.h" +#include "ns3/itu-r-1238-propagation-loss-model.h" #include "ns3/buildings-mobility-model.h" #include "ns3/enum.h" +#include "hybrid-buildings-propagation-loss-model.h" + NS_LOG_COMPONENT_DEFINE ("HybridBuildingsPropagationLossModel"); @@ -40,8 +45,11 @@ NS_OBJECT_ENSURE_REGISTERED (HybridBuildingsPropagationLossModel); HybridBuildingsPropagationLossModel::HybridBuildingsPropagationLossModel () - : BuildingsPropagationLossModel () { + m_okumuraHata = CreateObject (); + m_ituR1411Los = CreateObject (); + m_ituR1411NlosOverRooftop = CreateObject (); + m_ituR1238 = CreateObject (); } HybridBuildingsPropagationLossModel::~HybridBuildingsPropagationLossModel () @@ -52,14 +60,80 @@ TypeId HybridBuildingsPropagationLossModel::GetTypeId (void) { static TypeId tid = TypeId ("ns3::HybridBuildingsPropagationLossModel") - - .SetParent () - - .AddConstructor (); + + .SetParent () + + .AddConstructor () + + .AddAttribute ("Frequency", + "The Frequency (default is 2.106 GHz).", + DoubleValue (2160e6), + MakeDoubleAccessor (&HybridBuildingsPropagationLossModel::SetFrequency), + MakeDoubleChecker ()) + + .AddAttribute ("Los2NlosThr", + " Threshold from LoS to NLoS in ITU 1411 [m].", + DoubleValue (200.0), + MakeDoubleAccessor (&HybridBuildingsPropagationLossModel::m_itu1411NlosThreshold), + MakeDoubleChecker ()) + + .AddAttribute ("Environment", + "Environment Scenario", + EnumValue (UrbanEnvironment), + MakeEnumAccessor (&HybridBuildingsPropagationLossModel::SetEnvironment), + MakeEnumChecker (UrbanEnvironment, "Urban", + SubUrbanEnvironment, "SubUrban", + OpenAreasEnvironment, "OpenAreas")) + + .AddAttribute ("CitySize", + "Dimension of the city", + EnumValue (LargeCity), + MakeEnumAccessor (&HybridBuildingsPropagationLossModel::SetCitySize), + MakeEnumChecker (SmallCity, "Small", + MediumCity, "Medium", + LargeCity, "Large")) + + .AddAttribute ("RooftopLevel", + "The height of the rooftop level in meters", + DoubleValue (20.0), + MakeDoubleAccessor (&HybridBuildingsPropagationLossModel::SetRooftopHeight), + MakeDoubleChecker (0.0, 90.0)) + + ; return tid; } +void +HybridBuildingsPropagationLossModel::SetEnvironment (EnvironmentType env) +{ + m_okumuraHata->SetAttribute ("Environment", EnumValue (env)); + m_ituR1411NlosOverRooftop->SetAttribute ("Environment", EnumValue (env)); +} + +void +HybridBuildingsPropagationLossModel::SetCitySize (CitySize size) +{ + m_okumuraHata->SetAttribute ("CitySize", EnumValue (size)); + m_ituR1411NlosOverRooftop->SetAttribute ("CitySize", EnumValue (size)); +} + +void +HybridBuildingsPropagationLossModel::SetFrequency (double freq) +{ + m_okumuraHata->SetAttribute ("Frequency", DoubleValue (freq)); + m_ituR1411Los->SetAttribute ("Frequency", DoubleValue (freq)); + m_ituR1411NlosOverRooftop->SetAttribute ("Frequency", DoubleValue (freq)); + m_ituR1238->SetAttribute ("Frequency", DoubleValue (freq)); +} + +void +HybridBuildingsPropagationLossModel::SetRooftopHeight (double rooftopHeight) +{ + m_rooftopHeight = rooftopHeight; + m_ituR1411NlosOverRooftop->SetAttribute ("RooftopLevel", DoubleValue (rooftopHeight)); +} + double HybridBuildingsPropagationLossModel::GetLoss (Ptr a, Ptr b) const @@ -68,10 +142,6 @@ HybridBuildingsPropagationLossModel::GetLoss (Ptr a, PtrGetDistanceFrom (b); - if (distance <= m_minDistance) - { - return 0.0; - } // get the BuildingsMobilityModel pointers Ptr a1 = DynamicCast (a); @@ -176,8 +246,36 @@ HybridBuildingsPropagationLossModel::GetLoss (Ptr a, PtrIsIndoor () } // end a1->IsOutdoor () + loss = std::max (loss, 0.0); + return loss; } +double +HybridBuildingsPropagationLossModel::OkumuraHata (Ptr a, Ptr b) const +{ + return m_okumuraHata->GetLoss (a, b); +} + +double +HybridBuildingsPropagationLossModel::ItuR1411 (Ptr a, Ptr b) const +{ + if (a->GetDistanceFrom (b) < m_itu1411NlosThreshold) + { + return (m_ituR1411Los->GetLoss (a, b)); + } + else + { + return (m_ituR1411NlosOverRooftop->GetLoss (a, b)); + } +} + +double +HybridBuildingsPropagationLossModel::ItuR1238 (Ptr a, Ptr b) const +{ + return m_ituR1238->GetLoss (a,b); +} + + } // namespace ns3 diff --git a/src/buildings/model/hybrid-buildings-propagation-loss-model.h b/src/buildings/model/hybrid-buildings-propagation-loss-model.h index fb60c5a52..687483489 100644 --- a/src/buildings/model/hybrid-buildings-propagation-loss-model.h +++ b/src/buildings/model/hybrid-buildings-propagation-loss-model.h @@ -16,6 +16,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Marco Miozzo + * Nicola Baldo * */ @@ -23,18 +24,22 @@ #define HYBRID_BUILDINGS_PROPAGATION_LOSS_MODEL_H_ #include +#include namespace ns3 { +class OkumuraHataPropagationLossModel; +class ItuR1411LosPropagationLossModel; +class ItuR1411NlosOverRooftopPropagationLossModel; +class ItuR1238PropagationLossModel; /** * \ingroup propagation * - * \brief The Hybrid-Building-Propagation-Model is a compound of different models able to evaluate the pathloss from 200 to 2600 MHz, in different environments and with buildings (i.e., indoor and outdoor communications). + * \brief The HybridBuildingsPropagationModel is a compound of different models able to evaluate the pathloss from 200 to 2600 MHz, in different environments and with buildings (i.e., indoor and outdoor communications). * * This model includes Hata model, COST231, ITU-R P.1411 (short range - * communications), ITU-R P.1238 (indoor communications). - * Building-Propagation-Model properly combines the models above in order + * communications), ITU-R P.1238 (indoor communications), which are combined in order * to be able to evaluate the pathloss under different scenarios, in detail: * - Environments: urban, suburban, open-areas; * - frequency: from 200 uo to 2600 MHz @@ -46,7 +51,8 @@ namespace ns3 { * Frequency: 200 MHz to 2000 MHz * Link Distance:up to 20 km * Short/long distance commutation: 1 Km - * \warning This model works with BuildingsMobilityModel + * + * \warning This model works only with BuildingsMobilityModel * */ @@ -58,13 +64,56 @@ public: HybridBuildingsPropagationLossModel (); ~HybridBuildingsPropagationLossModel (); + + /** + * set the environment type + * + * \param env + */ + void SetEnvironment (EnvironmentType env); + + /** + * set the size of the city + * + * \param size + */ + void SetCitySize (CitySize size); + + /** + * set the propagation frequency + * + * \param freq + */ + void SetFrequency (double freq); + + /** + * set the rooftop height + * + * \param rooftopHeight + */ + void SetRooftopHeight (double rooftopHeight); + /** * \param a the mobility model of the source * \param b the mobility model of the destination * \returns the propagation loss (in dBm) */ virtual double GetLoss (Ptr a, Ptr b) const; + +private: + + double OkumuraHata (Ptr a, Ptr b) const; + double ItuR1411 (Ptr a, Ptr b) const; + double ItuR1238 (Ptr a, Ptr b) const; + + Ptr m_okumuraHata; + Ptr m_ituR1411Los; + Ptr m_ituR1411NlosOverRooftop; + Ptr m_ituR1238; + + double m_itu1411NlosThreshold; ///< in meters (switch Los -> NLoS) + double m_rooftopHeight; }; diff --git a/src/buildings/model/itu-r-1238-propagation-loss-model.cc b/src/buildings/model/itu-r-1238-propagation-loss-model.cc new file mode 100644 index 000000000..9aa4510cd --- /dev/null +++ b/src/buildings/model/itu-r-1238-propagation-loss-model.cc @@ -0,0 +1,116 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011, 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Marco Miozzo , + * Nicola Baldo + * + */ +#include "ns3/log.h" +#include "ns3/double.h" +#include "ns3/enum.h" +#include "ns3/mobility-model.h" +#include + +#include "itu-r-1238-propagation-loss-model.h" +#include "buildings-mobility-model.h" + +NS_LOG_COMPONENT_DEFINE ("ItuR1238PropagationLossModel"); + +namespace ns3 { + +NS_OBJECT_ENSURE_REGISTERED (ItuR1238PropagationLossModel); + + +TypeId +ItuR1238PropagationLossModel::GetTypeId (void) +{ + static TypeId tid = TypeId ("ns3::ItuR1238PropagationLossModel") + + .SetParent () + + .AddAttribute ("Frequency", + "The Frequency (default is 2.106 GHz).", + DoubleValue (2160e6), + MakeDoubleAccessor (&ItuR1238PropagationLossModel::m_frequency), + MakeDoubleChecker ()); + + return tid; +} + +double +ItuR1238PropagationLossModel::GetLoss (Ptr a1, Ptr b1) const +{ + NS_LOG_FUNCTION (this << a1 << b1); + Ptr a = DynamicCast (a1); + Ptr b = DynamicCast (b1); + NS_ASSERT_MSG ((a != 0) && (b != 0), "ItuR1238PropagationLossModel only works with BuildingsMobilityModel"); + NS_ASSERT_MSG (a->GetBuilding ()->GetId () == b->GetBuilding ()->GetId (), "ITU-R 1238 applies only to nodes that are in the same building"); + double N = 0.0; + int n = abs (a->GetFloorNumber () - b->GetFloorNumber ()); + NS_LOG_LOGIC (this << " A floor " << (uint16_t)a->GetFloorNumber () << " B floor " << (uint16_t)b->GetFloorNumber () << " n " << n); + double Lf = 0.0; + Ptr aBuilding = a->GetBuilding (); + if (aBuilding->GetBuildingType () == Building::Residential) + { + N = 28; + if (n >= 1) + { + Lf = 4 * n; + } + NS_LOG_LOGIC (this << " Residential "); + } + else if (aBuilding->GetBuildingType () == Building::Office) + { + N = 30; + if (n >= 1) + { + Lf = 15 + (4 * (n - 1)); + } + NS_LOG_LOGIC (this << " Office "); + } + else if (aBuilding->GetBuildingType () == Building::Commercial) + { + N = 22; + if (n >= 1) + { + Lf = 6 + (3 * (n - 1)); + } + NS_LOG_LOGIC (this << " Commercial "); + } + else + { + NS_LOG_ERROR (this << " Unkwnon Wall Type"); + } + double loss = 20 * log10 (m_frequency / 1e6 /*MHz*/) + N*log10 (a->GetDistanceFrom (b)) + Lf - 28.0; + NS_LOG_INFO (this << " Node " << a->GetPosition () << " <-> " << b->GetPosition () << " loss = " << loss << " dB"); + + return loss; +} + + +double +ItuR1238PropagationLossModel::DoCalcRxPower (double txPowerDbm, + Ptr a, + Ptr b) const +{ + return (txPowerDbm - GetLoss (a, b)); +} + + + + +} // namespace ns3 diff --git a/src/buildings/model/itu-r-1238-propagation-loss-model.h b/src/buildings/model/itu-r-1238-propagation-loss-model.h new file mode 100644 index 000000000..0db416dbe --- /dev/null +++ b/src/buildings/model/itu-r-1238-propagation-loss-model.h @@ -0,0 +1,77 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011, 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Marco Miozzo + * Nicola Baldo + * + */ + +#ifndef ITU_R_1238_PROPAGATION_LOSS_MODEL_H +#define ITU_R_1238_PROPAGATION_LOSS_MODEL_H + +#include +#include + +namespace ns3 { + +/** + * This class implements the ITU-R 1238 propagation loss model. + * + */ +class ItuR1238PropagationLossModel : public PropagationLossModel +{ + +public: + + // inherited from Object + static TypeId GetTypeId (void); + + /** + * + * + * \param a the first mobility model + * \param b the second mobility model + * + * \return the loss in dBm for the propagation between + * the two given mobility models + */ + double GetLoss (Ptr a, Ptr b) const; + +private: + + // inherited from PropagationLossModel + virtual double DoCalcRxPower (double txPowerDbm, + Ptr a, + Ptr b) const; + + double m_frequency; ///< frequency in MHz + double m_lambda; ///< wavelength + EnvironmentType m_environment; + CitySize m_citySize; + double m_rooftopHeight; ///< in meters + double m_streetsOrientation; ///< in degrees [0,90] + double m_streetsWidth; ///< in meters + double m_buildingsExtend; ///< in meters + double m_buildingSeparation; ///< in meters + +}; + +} // namespace ns3 + + +#endif // ITU_R_1238_PROPAGATION_LOSS_MODEL_H + diff --git a/src/buildings/model/oh-buildings-propagation-loss-model.cc b/src/buildings/model/oh-buildings-propagation-loss-model.cc index 1b6fd574b..741da488c 100644 --- a/src/buildings/model/oh-buildings-propagation-loss-model.cc +++ b/src/buildings/model/oh-buildings-propagation-loss-model.cc @@ -27,6 +27,7 @@ #include #include "oh-buildings-propagation-loss-model.h" #include "ns3/buildings-mobility-model.h" +#include "ns3/okumura-hata-propagation-loss-model.h" #include "ns3/enum.h" @@ -39,8 +40,8 @@ NS_OBJECT_ENSURE_REGISTERED (OhBuildingsPropagationLossModel); OhBuildingsPropagationLossModel::OhBuildingsPropagationLossModel () - : BuildingsPropagationLossModel () { + m_okumuraHata = CreateObject (); } OhBuildingsPropagationLossModel::~OhBuildingsPropagationLossModel () @@ -63,12 +64,7 @@ OhBuildingsPropagationLossModel::GetTypeId (void) double OhBuildingsPropagationLossModel::GetLoss (Ptr a, Ptr b) const { - - double distance = a->GetDistanceFrom (b); - if (distance <= m_minDistance) - { - return 0.0; - } + NS_LOG_FUNCTION (this << a << b); // get the BuildingsMobilityModel pointers Ptr a1 = DynamicCast (a); @@ -81,13 +77,13 @@ OhBuildingsPropagationLossModel::GetLoss (Ptr a, PtrIsOutdoor ()) { - loss = OkumuraHata (a1, b1); + loss = m_okumuraHata->GetLoss (a1, b1); NS_LOG_INFO (this << " O-O : " << loss); } else { // b indoor - loss = OkumuraHata (a1, b1) + ExternalWallLoss (b1); + loss = m_okumuraHata->GetLoss (a1, b1) + ExternalWallLoss (b1); NS_LOG_INFO (this << " O-I : " << loss); } // end b1->isIndoor () } @@ -99,24 +95,25 @@ OhBuildingsPropagationLossModel::GetLoss (Ptr a, PtrGetBuilding () == b1->GetBuilding ()) { // nodes are in same building -> indoor communication ITU-R P.1238 - loss = OkumuraHata (a1, b1) + InternalWallsLoss (a1, b1);; + loss = m_okumuraHata->GetLoss (a1, b1) + InternalWallsLoss (a1, b1);; NS_LOG_INFO (this << " I-I (same building)" << loss); } else { // nodes are in different buildings - loss = OkumuraHata (a1, b1) + ExternalWallLoss (a1) + ExternalWallLoss (b1); + loss = m_okumuraHata->GetLoss (a1, b1) + ExternalWallLoss (a1) + ExternalWallLoss (b1); NS_LOG_INFO (this << " I-O-I (different buildings): " << loss); } } else { - loss = OkumuraHata (a1, b1) + ExternalWallLoss (a1); + loss = m_okumuraHata->GetLoss (a1, b1) + ExternalWallLoss (a1); NS_LOG_INFO (this << " I-O : " << loss); } // end b1->IsIndoor () } // end a1->IsOutdoor () + loss = std::max (0.0, loss); return loss; } diff --git a/src/buildings/model/oh-buildings-propagation-loss-model.h b/src/buildings/model/oh-buildings-propagation-loss-model.h index bf65b0f19..38159fcb3 100644 --- a/src/buildings/model/oh-buildings-propagation-loss-model.h +++ b/src/buildings/model/oh-buildings-propagation-loss-model.h @@ -26,32 +26,16 @@ namespace ns3 { +class OkumuraHataPropagationLossModel; /** * \ingroup propagation * - * \brief The Okumura Hata (OH)-Building-Propagation-Model is propagation module - * using only the Okumura Hata model from the one provided by - * BuildingsPropagationLossModel, in different environments and with - * buildings (i.e., indoor and outdoor communications). - * - * This model includes Hata model, COST231, ITU-R P.1411 (short range - * communications), ITU-R P.1238 (indoor communications). - * Building-Propagation-Model properly combines the models above in order - * to be able to evaluate the pathloss under different scenarios, in detail: - * - Environments: urban, suburban, open-areas; - * - frequency: from 200 uo to 2600 MHz - * - short range communications vs long range communications - * - Node position respect to buildings: indoor, outdoor and hybrid (indoor <-> outdoor) - * - Building penetretation loss - * - floors, etc... - * - * Frequency: 200 MHz to 2000 MHz - * Link Distance:up to 20 km - * \warning This model works with BuildingsMobilityModel + * this model combines the OkumuraHata model with the BuildingsPropagationLossModel + * + * \warning This model works with BuildingsMobilityModel only * */ - class OhBuildingsPropagationLossModel : public BuildingsPropagationLossModel { @@ -67,6 +51,9 @@ public: */ virtual double GetLoss (Ptr a, Ptr b) const; +private: + + Ptr m_okumuraHata; }; diff --git a/src/buildings/test/buildings-pathloss-test.cc b/src/buildings/test/buildings-pathloss-test.cc index b3ea757b7..3f9e7f454 100644 --- a/src/buildings/test/buildings-pathloss-test.cc +++ b/src/buildings/test/buildings-pathloss-test.cc @@ -52,56 +52,56 @@ BuildingsPathlossTestSuite::BuildingsPathlossTestSuite () double freq = 869e6; // E_UTRA BAND #5 see table 5.5-1 of 36.101 - AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 137.93, "OH Urban Large city")); + AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, UrbanEnvironment, LargeCity, 137.93, "OH Urban Large city")); - AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 137.88, "OH Urban small city")); + AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, UrbanEnvironment, SmallCity, 137.88, "OH Urban small city")); - AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, BuildingsPropagationLossModel::SubUrban, BuildingsPropagationLossModel::Large, 128.03, "loss OH SubUrban")); + AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, SubUrbanEnvironment, LargeCity, 128.03, "loss OH SubUrban")); - AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, BuildingsPropagationLossModel::OpenAreas, BuildingsPropagationLossModel::Large, 110.21, "loss OH OpenAreas")); + AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, OpenAreasEnvironment, LargeCity, 110.21, "loss OH OpenAreas")); // Test #2 COST231 Model (1500 < freq < 2000~2170 MHz) (Macro<->UE) freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 - AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 148.55, "COST231 Urban Large city")); + AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, UrbanEnvironment, LargeCity, 148.55, "COST231 Urban Large city")); - AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 150.64, "COST231 Urban small city and suburban")); + AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, UrbanEnvironment, SmallCity, 150.64, "COST231 Urban small city and suburban")); // Test #3 2.6 GHz model (Macro<->UE) freq = 2.620e9; // E_UTRA BAND #7 see table 5.5-1 of 36.101 - AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 121.83, "2.6GHz model")); + AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, UrbanEnvironment, SmallCity, 121.83, "2.6GHz model")); // Test #4 ITU1411 LOS model (Macro<->UE) freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 - AddTestCase (new BuildingsPathlossTestCase (freq, 1, 3, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 81.00, "ITU1411 LOS")); + AddTestCase (new BuildingsPathlossTestCase (freq, 1, 3, UrbanEnvironment, LargeCity, 81.00, "ITU1411 LOS")); // Test #5 ITU1411 NLOS model (Macro<->UE) freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 - AddTestCase (new BuildingsPathlossTestCase (freq, 1, 4, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 143.69, "ITU1411 NLOS")); + AddTestCase (new BuildingsPathlossTestCase (freq, 1, 4, UrbanEnvironment, LargeCity, 143.69, "ITU1411 NLOS")); // Test #6 ITUP1238 (HeNB <-> UE) freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 - AddTestCase (new BuildingsPathlossTestCase (freq, 5, 6, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 88.3855, "ITUP1238")); + AddTestCase (new BuildingsPathlossTestCase (freq, 5, 6, UrbanEnvironment, LargeCity, 88.3855, "ITUP1238")); // Test #7 Outdoor -> Indoor OkumuraHata (Macro<->UE) freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 // The loss is as in test #2 (large city) plus the building penetration loss // which for ConcreteWithWindows is equal to 7 dB -> 148.55 + 7 = 155.55 - AddTestCase (new BuildingsPathlossTestCase (freq, 1, 7, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 155.55, "Okumura Hata Outdoor -> Indoor")); + AddTestCase (new BuildingsPathlossTestCase (freq, 1, 7, UrbanEnvironment, LargeCity, 155.55, "Okumura Hata Outdoor -> Indoor")); // Test #8 Outdoor -> Indoor ITU1411 (Macro<->UE) freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 // The loss is as in test #4 plus the building penetration loss // which for ConcreteWithWindows is equal to 7 dB -> 81.000 + 7 = 88.000 - AddTestCase (new BuildingsPathlossTestCase (freq, 1, 8, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 88.000, "ITU1411 LOS Outdoor -> Indoor")); + AddTestCase (new BuildingsPathlossTestCase (freq, 1, 8, UrbanEnvironment, LargeCity, 88.000, "ITU1411 LOS Outdoor -> Indoor")); // Test #9 Indoor -> Outdoor LOS (HeNB <-> UE) @@ -109,7 +109,7 @@ BuildingsPathlossTestSuite::BuildingsPathlossTestSuite () // The loss is similar of test #4 plus the building penetration loss // which for ConcreteWithWindows is equal to 7 dB and the height gain // (2 floors x 2 dB/floor = 4) -> 81.838 + 7 - 4 = 84.838 - AddTestCase (new BuildingsPathlossTestCase (freq, 9, 10, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 84.838, "ITU1411 LOS Indoor -> Outdoor")); + AddTestCase (new BuildingsPathlossTestCase (freq, 9, 10, UrbanEnvironment, LargeCity, 84.838, "ITU1411 LOS Indoor -> Outdoor")); // Test #10 Indoor -> Outdoor NLOS (HeNB <-> UE) @@ -117,7 +117,7 @@ BuildingsPathlossTestSuite::BuildingsPathlossTestSuite () // The loss is similar as in test #4 plus the building penetration loss // which for ConcreteWithWindows is equal to 7 dB and the height gain // (2 floors x 2 dB/floor = 4) -> 180.90 + 7 - 4 = 183.90 - AddTestCase (new BuildingsPathlossTestCase (freq, 9, 11, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 183.90, "ITU1411 NLOS Indoor -> Outdoor")); + AddTestCase (new BuildingsPathlossTestCase (freq, 9, 11, UrbanEnvironment, LargeCity, 183.90, "ITU1411 NLOS Indoor -> Outdoor")); } @@ -131,7 +131,7 @@ static BuildingsPathlossTestSuite buildingsPathlossTestSuite; * TestCase */ -BuildingsPathlossTestCase::BuildingsPathlossTestCase (double freq, uint16_t m1, uint16_t m2, BuildingsPropagationLossModel::Environment env, BuildingsPropagationLossModel::CitySize city, double refValue, std::string name) +BuildingsPathlossTestCase::BuildingsPathlossTestCase (double freq, uint16_t m1, uint16_t m2, EnvironmentType env, CitySize city, double refValue, std::string name) : TestCase ("LOSS calculation: " + name), m_freq (freq), m_mobilityModelIndex1 (m1), @@ -190,7 +190,6 @@ BuildingsPathlossTestCase::DoRun (void) Ptr propagationLossModel = CreateObject (); propagationLossModel->SetAttribute ("Frequency", DoubleValue (m_freq)); - propagationLossModel->SetAttribute ("Lambda", DoubleValue (300000000.0 / m_freq)); propagationLossModel->SetAttribute ("Environment", EnumValue (m_env)); propagationLossModel->SetAttribute ("CitySize", EnumValue (m_city)); // cancel shadowing effect diff --git a/src/buildings/test/buildings-pathloss-test.h b/src/buildings/test/buildings-pathloss-test.h index 3dfc9c1c0..ef4eaba99 100644 --- a/src/buildings/test/buildings-pathloss-test.h +++ b/src/buildings/test/buildings-pathloss-test.h @@ -41,7 +41,7 @@ public: class BuildingsPathlossTestCase : public TestCase { public: - BuildingsPathlossTestCase (double freq, uint16_t m1, uint16_t m2, BuildingsPropagationLossModel::Environment env, BuildingsPropagationLossModel::CitySize city, double refValue, std::string name); + BuildingsPathlossTestCase (double freq, uint16_t m1, uint16_t m2, EnvironmentType env, CitySize city, double refValue, std::string name); virtual ~BuildingsPathlossTestCase (); private: @@ -51,8 +51,8 @@ private: double m_freq; uint16_t m_mobilityModelIndex1; uint16_t m_mobilityModelIndex2; - BuildingsPropagationLossModel::Environment m_env; - BuildingsPropagationLossModel::CitySize m_city; + EnvironmentType m_env; + CitySize m_city; double m_lossRef; }; diff --git a/src/buildings/wscript b/src/buildings/wscript index 1ab4afef1..7ee54a3d9 100644 --- a/src/buildings/wscript +++ b/src/buildings/wscript @@ -7,6 +7,7 @@ def build(bld): 'model/building.cc', 'model/building-list.cc', 'model/buildings-mobility-model.cc', + 'model/itu-r-1238-propagation-loss-model.cc', 'model/buildings-propagation-loss-model.cc', 'model/hybrid-buildings-propagation-loss-model.cc', 'model/oh-buildings-propagation-loss-model.cc', @@ -29,6 +30,7 @@ def build(bld): 'model/building.h', 'model/building-list.h', 'model/buildings-mobility-model.h', + 'model/itu-r-1238-propagation-loss-model.h', 'model/buildings-propagation-loss-model.h', 'model/hybrid-buildings-propagation-loss-model.h', 'model/oh-buildings-propagation-loss-model.h', diff --git a/src/lte/doc/source/lte-references.rst b/src/lte/doc/source/lte-references.rst index d3a1b64ab..652d5ee0c 100644 --- a/src/lte/doc/source/lte-references.rst +++ b/src/lte/doc/source/lte-references.rst @@ -46,10 +46,6 @@ .. [ns3manual] `The ns-3 Manual `_ -.. [pl26ghz] Sun Kun; Wang Ping; Li Yingze, "Path loss models for suburban scenario at 2.3GHz, 2.6GHz and 3.5GHz", - in Proc. of ISAPE 2008, Kunming, China, Nov 2008. - - .. [PaduaPEM] http://mailman.isi.edu/pipermail/ns-developers/2011-November/009559.html .. [Vienna] The Vienna LTE Simulators http://www.nt.tuwien.ac.at/about-us/staff/josep-colom-ikuno/lte-simulators/ @@ -60,16 +56,6 @@ .. [TS36.212] 3GPP TS 36.212 "E-UTRA Multiplexing and channel coding" - -.. [turkmani] Turkmani A.M.D., J.D. Parson and D.G. Lewis, "Radio propagation into buildings at 441, 900 and 1400 MHz", - in Proc. of 4th Int. Conference on Land Mobile Radio, 1987. - -.. [walfisch] J.Walfisch and H.L. Bertoni, "A Theoretical model of UHF propagation in urban environments," in IEEE Trans. Antennas Propagat., vol.36, 1988, pp.1788- 1796 - -.. [ikegami] F.Ikegami, T.Takeuchi, and S.Yoshida, "Theoretical prediction of mean field strength for Urban Mobile Radio", in IEEE Trans. Antennas Propagat., Vol.39, No.3, 1991 - -.. [cost231] "Digital Mobile Radio: COST 231 View on the Evolution Towards 3rd Generation Systems", Commission of the European Communities, L-2920, Luxembourg, 1989 - .. [mathworks] Matlab R2011b Documentation Communications System Toolbox, `Methodology for Simulating Multipath Fading Channels `_ .. [PaduaPEM] http://mailman.isi.edu/pipermail/ns-developers/2011-November/009559.html diff --git a/src/lte/helper/lte-helper.cc b/src/lte/helper/lte-helper.cc index aa3b48602..de58a43a7 100644 --- a/src/lte/helper/lte-helper.cc +++ b/src/lte/helper/lte-helper.cc @@ -371,22 +371,21 @@ LteHelper::InstallSingleEnbDevice (Ptr n) rrc->SetForwardUpCallback (MakeCallback (&LteEnbNetDevice::Receive, dev)); NS_LOG_LOGIC ("set the propagation model frequencies"); - if (m_downlinkPathlossModel->GetObject () != 0) + double dlFreq = LteSpectrumValueHelper::GetCarrierFrequency (dev->GetDlEarfcn ()); + NS_LOG_LOGIC ("DL freq: " << dlFreq); + bool dlFreqOk = m_downlinkPathlossModel->SetAttributeFailSafe ("Frequency", DoubleValue (dlFreq)); + if (!dlFreqOk) { - double dlFreq = LteSpectrumValueHelper::GetCarrierFrequency (dev->GetDlEarfcn ()); - NS_LOG_LOGIC ("DL freq: " << dlFreq); - m_downlinkPathlossModel->SetAttribute ("Frequency", DoubleValue (dlFreq)); + NS_LOG_WARN ("DL propagation model does not have a Frequency attribute"); } - else + double ulFreq = LteSpectrumValueHelper::GetCarrierFrequency (dev->GetUlEarfcn ()); + NS_LOG_LOGIC ("UL freq: " << ulFreq); + bool ulFreqOk = m_uplinkPathlossModel->SetAttributeFailSafe ("Frequency", DoubleValue (ulFreq)); + if (!ulFreqOk) { - NS_LOG_LOGIC ("DL propagation model: " << m_downlinkPathlossModel->GetTypeId ()); - } - if (m_uplinkPathlossModel->GetObject () != 0) - { - double ulFreq = LteSpectrumValueHelper::GetCarrierFrequency (dev->GetUlEarfcn ()); - NS_LOG_LOGIC ("UL freq: " << ulFreq); - m_uplinkPathlossModel->SetAttribute ("Frequency", DoubleValue (ulFreq)); + NS_LOG_WARN ("UL propagation model does not have a Frequency attribute"); } + dev->Start (); diff --git a/src/propagation/doc/propagation.rst b/src/propagation/doc/propagation.rst index 4b40f2242..a7246f7a9 100644 --- a/src/propagation/doc/propagation.rst +++ b/src/propagation/doc/propagation.rst @@ -2,33 +2,322 @@ .. _Propagation: +########### Propagation ------------ +########### The |ns3| propagation module defines two generic interfaces, namely ``PropagationLossModel`` and ``PropagationDelayModel``, for the modeling of respectively propagation loss and propagation delay. -The following propagation loss models are implemented: -* ``JakesPropagationLossModel`` -* ``PropagationLossModel`` -* ``RandomPropagationLossModel`` -* ``FriisPropagationLossModel`` -* ``TwoRayGroundPropagationLossModel`` -* ``LogDistancePropagationLossModel`` -* ``ThreeLogDistancePropagationLossModel`` -* ``NakagamiPropagationLossModel`` -* ``FixedRssLossModel`` -* ``MatrixPropagationLossModel`` -* ``RangePropagationLossModel`` +++++++++++++++++++++ +PropagationLossModel +++++++++++++++++++++ + + +Each of the available propagation loss models of ns-3 is explained in +one of the following subsections. + + + +FriisPropagationLossModel +++++++++++++++++++++++++++++++++++++ + + +TwoRayGroundPropagationLossModel +++++++++++++++++++++++++++++++++ + + +LogDistancePropagationLossModel ++++++++++++++++++++++++++++++++ + +ThreeLogDistancePropagationLossModel +++++++++++++++++++++++++++++++++++++ + +JakesPropagationLossModel ++++++++++++++++++++++++++ + +PropagationLossModel +++++++++++++++++++++ + +RandomPropagationLossModel +++++++++++++++++++++++++++ + +NakagamiPropagationLossModel +++++++++++++++++++++++++++++ + +FixedRssLossModel ++++++++++++++++++ + +MatrixPropagationLossModel +++++++++++++++++++++++++++ + +RangePropagationLossModel ++++++++++++++++++++++++++ + + + + +OkumuraHataPropagationLossModel ++++++++++++++++++++++++++++++++ + +This model is used to model open area pathloss for long distance (i.e., > 1 Km). In order to include all the possible frequencies usable by LTE we need to consider several variants of the well known Okumura Hata model. In fact, the original Okumura Hata model [hata]_ is designed for frequencies ranging from 150 MHz to 1500 MHz, the COST231 [cost231]_ extends it for the frequency range from 1500 MHz to 2000 MHz, and [pl26ghz]_ further extends it up to 2.6G Hz. Another important aspect is the scenarios considered by the models, in fact the all models are originally designed for urban scenario and then only the standard one and the COST231 are extended to suburban, while only the standard one has been extended to open areas. Therefore, the model cannot cover all scenarios at all frequencies. In the following we detail the models adopted. + + + +The pathloss expression of the COST231 OH is: + +.. math:: + + L = 46.3 + 33.9\log{f} - 13.82 \log{h_\mathrm{b}} + (44.9 - 6.55\log{h_\mathrm{b}})\log{d} - F(h_\mathrm{M}) + C + +where + +.. math:: + + F(h_\mathrm{M}) = \left\{\begin{array}{ll} (1.1\log(f))-0.7 \times h_\mathrm{M} - (1.56\times \log(f)-0.8) & \mbox{for medium and small size cities} \\ 3.2\times (\log{(11.75\times h_\mathrm{M}}))^2 & \mbox{for large cities}\end{array} \right. + + +.. math:: + + C = \left\{\begin{array}{ll} 0dB & \mbox{for medium-size cities and suburban areas} \\ 3dB & \mbox{for large cities}\end{array} \right. + +and + + :math:`f` : frequency [MHz] + + :math:`h_\mathrm{b}` : eNB height above the ground [m] + + :math:`h_\mathrm{M}` : UE height above the ground [m] + + :math:`d` : distance [km] + + :math:`log` : is a logarithm in base 10 (this for the whole document) + + +This model is only for urban scenarios. + +The pathloss expression of the standard OH in urban area is: + +.. math:: + + L = 69.55 + 26.16\log{f} - 13.82 \log{h_\mathrm{b}} + (44.9 - 6.55\log{h_\mathrm{b}})\log{d} - C_\mathrm{H} + +where for small or medium sized city + +.. math:: + + C_\mathrm{H} = 0.8 + (1.1\log{f} - 0.7)h_\mathrm{M} -1.56\log{f} + +and for large cities + +.. math:: + C_\mathrm{H} = \left\{\begin{array}{ll} 8.29 (\log{(1.54h_M)})^2 -1.1 & \mbox{if } 150\leq f\leq 200 \\ 3.2(\log{(11.75h_M)})^2 -4.97 & \mbox{if } 200 R_\mathrm{bp}$}\end{array} \right. + +.. math:: + + L_\mathrm{LoS,u} = L_\mathrm{bp} + 20 + \left\{\begin{array}{ll} 25\log{\frac{d}{R_\mathrm{bp}}} & \mbox{for $d \le R_\mathrm{bp}$} \\ 40\log{\frac{d}{R_\mathrm{bp}}} & \mbox{for $d > R_\mathrm{bp}$}\end{array} \right. + +where the breakpoint distance is given by + +.. math:: + + R_\mathrm{bp} \approx \frac{4h_\mathrm{b}h_\mathrm{m}}{\lambda} + +and the above parameters are + + :math:`\lambda` : wavelength [m] + + :math:`h_\mathrm{b}` : eNB height above the ground [m] + + :math:`h_\mathrm{m}` : UE height above the ground [m] + + :math:`d` : distance [m] + +and :math:`L_{bp}` is the value for the basic transmission loss at the break point, defined as: + +.. math:: + + L_{bp} = \left|20\log \left(\frac{\lambda^2}{8\pi h_\mathrm{b}h\mathrm{m}}\right)\right| + +The value used by the simulator is the average one for modeling the median pathloss. + + +ItuR1411NlosOverRooftopPropagationLossModel ++++++++++++++++++++++++++++++++++++++++++++ + +This model is designed for Non-Line-of-Sight (LoS) short range outdoor communication over rooftops in the frequency range 300 MHz to 100 GHz. This model includes several scenario-dependent parameters, such as average street width, orientation, etc. It is advised to set the values of these parameters manually (using the ns-3 attribute system) according to the desired scenario. + +In detail, the model is based on [walfisch]_ and [ikegami]_, where the loss is expressed as the sum of free-space loss (:math:`L_{bf}`), the diffraction loss from rooftop to street (:math:`L_{rts}`) and the reduction due to multiple screen diffraction past rows of building (:math:`L_{msd}`). The formula is: + +.. math:: + + L_{NLOS1} = \left\{ \begin{array}{ll} L_{bf} + L_{rts} + L_{msd} & \mbox{for } L_{rts} + L_{msd} > 0 \\ L_{bf} & \mbox{for } L_{rts} + L_{msd} \le 0\end{array}\right. + +The free-space loss is given by: + +.. math:: + + L_{bf} = 32.4 + 20 \log {(d/1000)} + 20\log{(f)} + +where: + + :math:`f` : frequency [MHz] + + :math:`d` : distance (where :math:`d > 1`) [m] + +The term :math:`L_{rts}` takes into account the width of the street and its orientation, according to the formulas + +.. math:: + + L_{rts} = -8.2 - 10\log {(w)} + 10\log{(f)} + 20\log{(\Delta h_m)} + L_{ori} + + L_{ori} = \left\{ \begin{array}{lll} -10 + 0.354\varphi & \mbox{for } 0^{\circ} \le \varphi < 35^{\circ} \\ 2.5 + 0.075(\varphi-35) & \mbox{for } 35^{\circ} \le \varphi < 55^{\circ} \\ 4.0 -0.114(\varphi-55) & \mbox{for } 55^{\circ} \varphi \le 90^{\circ}\end{array}\right. + + \Delta h_m = h_r - h_m + +where: + + :math:`h_r` : is the height of the rooftop [m] + + :math:`h_m` : is the height of the mobile [m] + + :math:`\varphi` : is the street orientation with respect to the direct path (degrees) + + +The multiple screen diffraction loss depends on the BS antenna height relative to the building height and on the incidence angle. The former is selected as the higher antenna in the communication link. Regarding the latter, the "settled field distance" is used for select the proper model; its value is given by + +.. math:: + + d_{s} = \frac{\lambda d^2}{\Delta h_{b}^2} + +with + + :math:`\Delta h_b = h_b - h_m` + +Therefore, in case of :math:`l > d_s` (where `l` is the distance over which the building extend), it can be evaluated according to + +.. math:: + + L_{msd} = L_{bsh} + k_{a} + k_{d}\log{(d/1000)} + k_{f}\log{(f)} - 9\log{(b)} + + L_{bsh} = \left\{ \begin{array}{ll} -18\log{(1+\Delta h_{b})} & \mbox{for } h_{b} > h_{r} \\ 0 & \mbox{for } h_{b} \le h_{hr} \end{array}\right. + + k_a = \left\{ \begin{array}{lll} + 71.4 & \mbox{for } h_{b} > h_{r} \mbox{ and } f>2000 \mbox{ MHz} \\ + 54 & \mbox{for } h_{b} > h_{r} \mbox{ and } f\le2000 \mbox{ MHz} \\ + 54-0.8\Delta h_b & \mbox{for } h_{b} \le h_{r} \mbox{ and } d \ge 500 \mbox{ m} \\ + 54-1.6\Delta h_b & \mbox{for } h_{b} \le h_{r} \mbox{ and } d < 500 \mbox{ m} \\ + \end{array} \right. + + k_d = \left\{ \begin{array}{ll} + 18 & \mbox{for } h_{b} > h_{r} \\ + 18 -15\frac{\Delta h_b}{h_r} & \mbox{for } h_{b} \le h_{r} + \end{array} \right. + + k_f = \left\{ \begin{array}{ll} + -8 & \mbox{for } f>2000 \mbox{ MHz} \\ + -4 + 0.7(f/925 -1) & \mbox{for medium city and suburban centres and} f\le2000 \mbox{ MHz} \\ + -4 + 1.5(f/925 -1) & \mbox{for metropolitan centres and } f\le2000 \mbox{ MHz} + \end{array}\right. + + +Alternatively, in case of :math:`l < d_s`, the formula is: + +.. math:: + + L_{msd} = -10\log{\left(Q_M^2\right)} + +where + +.. math:: + + Q_M = \left\{ \begin{array}{lll} + 2.35\left(\frac{\Delta h_b}{d}\sqrt{\frac{b}{\lambda}}\right)^{0.9} & \mbox{for } h_{b} > h_{r} \\ + \frac{b}{d} & \mbox{for } h_{b} \approx h_{r} \\ + \frac{b}{2\pi d}\sqrt{\frac{\lambda}{\rho}}\left(\frac{1}{\theta}-\frac{1}{2\pi + \theta}\right) & \mbox{for } h_{b} < h_{r} + \end{array}\right. + + +where: + +.. math:: + + \theta = arc tan \left(\frac{\Delta h_b}{b}\right) + + \rho = \sqrt{\Delta h_b^2 + b^2} + + + + ++++++++++++++++++++++ +PropagationDelayModel ++++++++++++++++++++++ The following propagation delay models are implemented: -* ``PropagationDelayModel`` -* ``RandomPropagationDelayModel`` -* ``ConstantSpeedPropagationDelayModel`` +PropagationDelayModel ++++++++++++++++++++++ -All the above models can be used within any model using the ``PropagationLossModel`` and ``PropagationDelayModel`` interfaces, such as Wifi and Wimax. +RandomPropagationDelayModel ++++++++++++++++++++++++++++ + +ConstantSpeedPropagationDelayModel +++++++++++++++++++++++++++++++++++ + + +.. [hata] M.Hata, "Empirical formula for propagation loss in land mobile radio + services", IEEE Trans. on Vehicular Technology, vol. 29, pp. 317-325, 1980 + +.. [cost231] “Digital Mobile Radio: COST 231 View on the Evolution Towards 3rd Generation Systems”, Commission of the European Communities, L-2920, Luxembourg, 1989 + +.. [pl26ghz] Sun Kun, Wang Ping, Li Yingze, "Path loss models for suburban scenario at 2.3GHz, 2.6GHz and 3.5GHz", + in Proc. of ISAPE 2008, Kunming, China, Nov 2008. + +.. [walfisch] J.Walfisch and H.L. Bertoni, "A Theoretical model of UHF propagation in urban environments," in IEEE Trans. Antennas Propagat., vol.36, 1988, pp.1788- 1796 + +.. [ikegami] F.Ikegami, T.Takeuchi, and S.Yoshida, "Theoretical prediction of mean field strength for Urban Mobile Radio", in IEEE Trans. Antennas Propagat., Vol.39, No.3, 1991 + diff --git a/src/propagation/model/itu-r-1411-los-propagation-loss-model.cc b/src/propagation/model/itu-r-1411-los-propagation-loss-model.cc new file mode 100644 index 000000000..1d154f648 --- /dev/null +++ b/src/propagation/model/itu-r-1411-los-propagation-loss-model.cc @@ -0,0 +1,95 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011, 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Marco Miozzo , + * Nicola Baldo + * + */ +#include "ns3/log.h" +#include "ns3/double.h" +#include "ns3/enum.h" +#include "ns3/mobility-model.h" +#include + +#include "itu-r-1411-los-propagation-loss-model.h" + +NS_LOG_COMPONENT_DEFINE ("ItuR1411LosPropagationLossModel"); + +namespace ns3 { + +NS_OBJECT_ENSURE_REGISTERED (ItuR1411LosPropagationLossModel); + +TypeId +ItuR1411LosPropagationLossModel::GetTypeId (void) +{ + static TypeId tid = TypeId ("ns3::ItuR1411LosPropagationLossModel") + + .SetParent () + + .AddAttribute ("Frequency", + "The propagation frequency in Hz", + DoubleValue (2160e6), + MakeDoubleAccessor (&ItuR1411LosPropagationLossModel::SetFrequency), + MakeDoubleChecker ()); + + return tid; +} + +double +ItuR1411LosPropagationLossModel::GetLoss (Ptr a, Ptr b) const +{ + NS_LOG_FUNCTION (this); + double dist = a->GetDistanceFrom (b); + double lossLow = 0.0; + double lossUp = 0.0; + NS_ASSERT_MSG (a->GetPosition ().z > 0 && b->GetPosition ().z > 0, "nodes' height must be greater than 0"); + double Lbp = fabs (20 * log10 ((m_lambda * m_lambda) / (8 * M_PI * a->GetPosition ().z * b->GetPosition ().z))); + double Rbp = (4 * a->GetPosition ().z * b->GetPosition ().z) / m_lambda; + NS_LOG_LOGIC (this << " Lbp " << Lbp << " Rbp " << Rbp << " lambda " << m_lambda); + if (dist <= Rbp) + { + lossLow = Lbp + 20 * log10 (dist / Rbp); + lossUp = Lbp + 20 + 25 * log10 (dist / Rbp); + } + else + { + lossLow = Lbp + 40 * log10 (dist / Rbp); + lossUp = Lbp + 20 + 40 * log10 (dist / Rbp); + } + + double loss = (lossUp + lossLow) / 2; + + return loss; +} + + +void +ItuR1411LosPropagationLossModel::SetFrequency (double freq) +{ + m_lambda = 300000000 / freq; +} + + +double +ItuR1411LosPropagationLossModel::DoCalcRxPower (double txPowerDbm, + Ptr a, + Ptr b) const +{ + return (txPowerDbm - GetLoss (a, b)); +} + +} // namespace ns3 diff --git a/src/propagation/model/itu-r-1411-los-propagation-loss-model.h b/src/propagation/model/itu-r-1411-los-propagation-loss-model.h new file mode 100644 index 000000000..f4aa66ba4 --- /dev/null +++ b/src/propagation/model/itu-r-1411-los-propagation-loss-model.h @@ -0,0 +1,70 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011, 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Marco Miozzo + * Nicola Baldo + * + */ + +#ifndef ITU_R_1411_LOS_PROPAGATION_LOSS_MODEL_H +#define ITU_R_1411_LOS_PROPAGATION_LOSS_MODEL_H + +#include "ns3/propagation-loss-model.h" + +namespace ns3 { + +class ItuR1411LosPropagationLossModel : public PropagationLossModel +{ + +public: + + // inherited from Object + static TypeId GetTypeId (void); + + /** + * Set the operating frequency + * + * \param freq the frequency in Hz + */ + void SetFrequency (double freq); + + /** + * + * + * \param a the first mobility model + * \param b the second mobility model + * + * \return the loss in dBm for the propagation between + * the two given mobility models + */ + double GetLoss (Ptr a, Ptr b) const; + +private: + + // inherited from PropagationLossModel + virtual double DoCalcRxPower (double txPowerDbm, + Ptr a, + Ptr b) const; + + double m_lambda; // wavelength +}; + +} // namespace ns3 + + +#endif // ITU_R_1411_LOS_PROPAGATION_LOSS_MODEL_H + diff --git a/src/propagation/model/itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc b/src/propagation/model/itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc new file mode 100644 index 000000000..186350583 --- /dev/null +++ b/src/propagation/model/itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc @@ -0,0 +1,225 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011, 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Marco Miozzo , + * Nicola Baldo + * + */ +#include "ns3/log.h" +#include "ns3/double.h" +#include "ns3/enum.h" +#include "ns3/mobility-model.h" +#include + +#include "itu-r-1411-nlos-over-rooftop-propagation-loss-model.h" + +NS_LOG_COMPONENT_DEFINE ("ItuR1411NlosOverRooftopPropagationLossModel"); + +namespace ns3 { + +NS_OBJECT_ENSURE_REGISTERED (ItuR1411NlosOverRooftopPropagationLossModel); + + +TypeId +ItuR1411NlosOverRooftopPropagationLossModel::GetTypeId (void) +{ + static TypeId tid = TypeId ("ns3::ItuR1411NlosOverRooftopPropagationLossModel") + + .SetParent () + + .AddAttribute ("Frequency", + "The Frequency (default is 2.106 GHz).", + DoubleValue (2160e6), + MakeDoubleAccessor (&ItuR1411NlosOverRooftopPropagationLossModel::SetFrequency), + MakeDoubleChecker ()) + + + .AddAttribute ("Environment", + "Environment Scenario", + EnumValue (UrbanEnvironment), + MakeEnumAccessor (&ItuR1411NlosOverRooftopPropagationLossModel::m_environment), + MakeEnumChecker (UrbanEnvironment, "Urban", + SubUrbanEnvironment, "SubUrban", + OpenAreasEnvironment, "OpenAreas")) + + .AddAttribute ("CitySize", + "Dimension of the city", + EnumValue (LargeCity), + MakeEnumAccessor (&ItuR1411NlosOverRooftopPropagationLossModel::m_citySize), + MakeEnumChecker (SmallCity, "Small", + MediumCity, "Medium", + LargeCity, "Large")) + + .AddAttribute ("RooftopLevel", + "The height of the rooftop level in meters", + DoubleValue (20.0), + MakeDoubleAccessor (&ItuR1411NlosOverRooftopPropagationLossModel::m_rooftopHeight), + MakeDoubleChecker (0.0, 90.0)) + + .AddAttribute ("StreetsOrientation", + "The orientation of streets in degrees [0,90] with respect to the direction of propagation", + DoubleValue (45.0), + MakeDoubleAccessor (&ItuR1411NlosOverRooftopPropagationLossModel::m_streetsOrientation), + MakeDoubleChecker (0.0, 90.0)) + + .AddAttribute ("StreetsWidth", + "The width of streets", + DoubleValue (20.0), + MakeDoubleAccessor (&ItuR1411NlosOverRooftopPropagationLossModel::m_streetsWidth), + MakeDoubleChecker (0.0, 1000.0)) + + .AddAttribute ("BuildingsExtend", + "The distance over which the buildings extend", + DoubleValue (80.0), + MakeDoubleAccessor (&ItuR1411NlosOverRooftopPropagationLossModel::m_buildingsExtend), + MakeDoubleChecker ()) + + .AddAttribute ("BuildingSeparation", + "The separation between buildings", + DoubleValue (50.0), + MakeDoubleAccessor (&ItuR1411NlosOverRooftopPropagationLossModel::m_buildingSeparation), + MakeDoubleChecker ()); + + return tid; +} + + +double +ItuR1411NlosOverRooftopPropagationLossModel::GetLoss (Ptr a, Ptr b) const +{ + NS_LOG_FUNCTION (this << a << b); + double Lori = 0.0; + double fmhz = m_frequency / 1e6; + if ((m_streetsOrientation >= 0)&&(m_streetsOrientation < 35)) + { + Lori = -10.0 + 0.354 * m_streetsOrientation; + } + else if ((m_streetsOrientation >= 35)&&(m_streetsOrientation < 55)) + { + Lori = 2.5 + 0.075 * (m_streetsOrientation - 35); + } + else if ((m_streetsOrientation >= 55)&&(m_streetsOrientation < 90)) + { + Lori = 2.5 + 0.075 * (m_streetsOrientation - 55); + } + else + { + NS_FATAL_ERROR (this << " Street Orientation must be in [0,90]"); + } + double distance = a->GetDistanceFrom (b); + double hb = (a->GetPosition ().z > b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); + double hm = (a->GetPosition ().z < b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); + NS_ASSERT_MSG (hm > 0 && hb > 0, "nodes' height must be greater then 0"); + double Dhb = hb - m_rooftopHeight; + double ds = (m_lambda * distance * distance) / (Dhb * Dhb); + double Lmsd = 0.0; + double pi = 3.141592653589793; + NS_LOG_LOGIC (this << " build " << m_buildingsExtend << " ds " << ds << " roof " << m_rooftopHeight << " hb " << hb << " lambda " << m_lambda); + if (ds < m_buildingsExtend) + { + double Lbsh = 0.0; + double ka = 0.0; + double kd = 0.0; + double kf = 0.0; + if (hb > m_rooftopHeight) + { + Lbsh = -18 * log10 (1 + Dhb); + ka = (fmhz > 2000 ? 71.4 : 54.0); + kd = 18.0; + } + else + { + Lbsh = 0; + kd = 18.0 - 15 * Dhb / a->GetPosition ().z; + if (distance < 500) + { + ka = 54.0 - 1.6 * Dhb * distance / 1000; + } + else + { + ka = 54.0 - 0.8 * Dhb; + } + } + if (fmhz > 2000) + { + kf = -8; + } + else if ((m_environment == UrbanEnvironment)&&(m_citySize == LargeCity)) + { + kf = -4 + 0.7 * (fmhz / 925.0 - 1); + } + else + { + kf = -4 + 1.5 * (fmhz / 925.0 - 1); + } + + Lmsd = Lbsh + ka + kd*log10 (distance / 1000.0) + kf*log10 (fmhz) - 9.0 * log10 (m_buildingSeparation); + } + else + { + double theta = atan (Dhb / m_buildingSeparation); + double rho = sqrt (Dhb * Dhb + m_buildingSeparation * m_buildingSeparation); + double Qm = 0.0; + if ((hb > m_rooftopHeight - 1.0) && (hb < m_rooftopHeight + 1.0)) + { + Qm = m_buildingSeparation / distance; + } + else if (hb > m_rooftopHeight) + { + Qm = 2.35 * pow (Dhb / distance * sqrt (m_buildingSeparation / m_lambda), 0.9); + } + else + { + Qm = m_buildingSeparation / (2 * pi * distance) * sqrt (m_lambda / rho) * (1 / theta - (1 / (2 * pi + theta))); + } + Lmsd = -10 * log10 (Qm * Qm); + } + double Lbf = 32.4 + 20 * log10 (distance / 1000) + 20 * log10 (fmhz); + double Dhm = m_rooftopHeight - hm; + double Lrts = -8.2 - 10 * log10 (m_streetsWidth) + 10 * log10 (fmhz) + 20 * log10 (Dhm) + Lori; + NS_LOG_LOGIC (this << " Lbf " << Lbf << " Lrts " << Lrts << " Dhm" << Dhm << " Lmsd " << Lmsd); + double loss = 0.0; + if (Lrts + Lmsd > 0) + { + loss = Lbf + Lrts + Lmsd; + } + else + { + loss = Lbf; + } + return loss; +} + + +void +ItuR1411NlosOverRooftopPropagationLossModel::SetFrequency (double freq) +{ + m_frequency = freq; + m_lambda = 300000000 / freq; +} + + +double +ItuR1411NlosOverRooftopPropagationLossModel::DoCalcRxPower (double txPowerDbm, + Ptr a, + Ptr b) const +{ + return (txPowerDbm - GetLoss (a, b)); +} + + +} // namespace ns3 diff --git a/src/propagation/model/itu-r-1411-nlos-over-rooftop-propagation-loss-model.h b/src/propagation/model/itu-r-1411-nlos-over-rooftop-propagation-loss-model.h new file mode 100644 index 000000000..314650220 --- /dev/null +++ b/src/propagation/model/itu-r-1411-nlos-over-rooftop-propagation-loss-model.h @@ -0,0 +1,80 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011, 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Marco Miozzo + * Nicola Baldo + * + */ + +#ifndef ITU_R_1411_NLOS_OVER_ROOFTOP_PROPAGATION_LOSS_MODEL_H +#define ITU_R_1411_NLOS_OVER_ROOFTOP_PROPAGATION_LOSS_MODEL_H + +#include +#include + +namespace ns3 { + +class ItuR1411NlosOverRooftopPropagationLossModel : public PropagationLossModel +{ + +public: + + // inherited from Object + static TypeId GetTypeId (void); + + /** + * Set the operating frequency + * + * \param freq the frequency in Hz + */ + void SetFrequency (double freq); + + /** + * + * + * \param a the first mobility model + * \param b the second mobility model + * + * \return the loss in dBm for the propagation between + * the two given mobility models + */ + double GetLoss (Ptr a, Ptr b) const; + +private: + + // inherited from PropagationLossModel + virtual double DoCalcRxPower (double txPowerDbm, + Ptr a, + Ptr b) const; + + double m_frequency; ///< frequency in MHz + double m_lambda; ///< wavelength + EnvironmentType m_environment; + CitySize m_citySize; + double m_rooftopHeight; ///< in meters + double m_streetsOrientation; ///< in degrees [0,90] + double m_streetsWidth; ///< in meters + double m_buildingsExtend; ///< in meters + double m_buildingSeparation; ///< in meters + +}; + +} // namespace ns3 + + +#endif // ITU_R_1411_NLOS_OVER_ROOFTOP_PROPAGATION_LOSS_MODEL_H + diff --git a/src/propagation/model/okumura-hata-propagation-loss-model.cc b/src/propagation/model/okumura-hata-propagation-loss-model.cc new file mode 100644 index 000000000..92522ee5f --- /dev/null +++ b/src/propagation/model/okumura-hata-propagation-loss-model.cc @@ -0,0 +1,155 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011, 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Marco Miozzo , + * Nicola Baldo + * + */ +#include "ns3/log.h" +#include "ns3/double.h" +#include "ns3/enum.h" +#include "ns3/mobility-model.h" +#include + +#include "okumura-hata-propagation-loss-model.h" + +NS_LOG_COMPONENT_DEFINE ("OkumuraHataPropagationLossModel"); + +namespace ns3 { + +NS_OBJECT_ENSURE_REGISTERED (OkumuraHataPropagationLossModel); + + +TypeId +OkumuraHataPropagationLossModel::GetTypeId (void) +{ + static TypeId tid = TypeId ("ns3::OkumuraHataPropagationLossModel") + + .SetParent () + + .AddAttribute ("Frequency", + "The propagation frequency in Hz", + DoubleValue (2160e6), + MakeDoubleAccessor (&OkumuraHataPropagationLossModel::m_frequency), + MakeDoubleChecker ()) + + .AddAttribute ("Environment", + "Environment Scenario", + EnumValue (UrbanEnvironment), + MakeEnumAccessor (&OkumuraHataPropagationLossModel::m_environment), + MakeEnumChecker (UrbanEnvironment, "Urban", + SubUrbanEnvironment, "SubUrban", + OpenAreasEnvironment, "OpenAreas")) + + .AddAttribute ("CitySize", + "Dimension of the city", + EnumValue (LargeCity), + MakeEnumAccessor (&OkumuraHataPropagationLossModel::m_citySize), + MakeEnumChecker (SmallCity, "Small", + MediumCity, "Medium", + LargeCity, "Large")); + + return tid; +} + +double +OkumuraHataPropagationLossModel::GetLoss (Ptr a, Ptr b) const +{ + double loss = 0.0; + double fmhz = m_frequency / 1e6; + double dist = a->GetDistanceFrom (b) / 1000.0; + if (m_frequency <= 1.500e9) + { + // standard Okumura Hata (from wikipedia) + double log_f = log10 (fmhz); + double hb = (a->GetPosition ().z > b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); + double hm = (a->GetPosition ().z < b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); + NS_ASSERT_MSG (hb > 0 && hm > 0, "nodes' height must be greater then 0"); + double log_aHeight = 13.82 * log10 (hb); + double log_bHeight = 0.0; + if (m_citySize == LargeCity) + { + if (m_frequency < 200) + { + log_bHeight = 8.29 * pow (log10 (1.54 * hm), 2) - 1.1; + } + else + { + log_bHeight = 3.2 * pow (log10 (11.75 * hm), 2) - 4.97; + } + } + else + { + log_bHeight = 0.8 + (1.1 * log_f - 0.7) * hm - 1.56 * log_f; + } + + // NS_LOG_INFO (this << " logf " << 26.16 * log_f << " loga " << log_aHeight << " X " << (((44.9 - (6.55 * log10(hb)) ))*log10 (a->GetDistanceFrom (b))) << " logb " << log_bHeight); + loss = 69.55 + (26.16 * log_f) - log_aHeight + (((44.9 - (6.55 * log10 (hb)) )) * log10 (dist)) - log_bHeight; + if (m_environment == SubUrbanEnvironment) + { + loss += -2 * (pow (log10 (fmhz / 28), 2)) - 5.4; + } + else if (m_environment == OpenAreasEnvironment) + { + loss += -4.70 * pow (log10 (fmhz),2) + 18.33 * log10 (fmhz) - 40.94; + } + + } + else if (m_frequency <= 2.170e9) // max 3GPP freq EUTRA band #1 + { + // COST 231 Okumura model + double log_f = log10 (fmhz); + double hb = (a->GetPosition ().z > b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); + double hm = (a->GetPosition ().z < b->GetPosition ().z ? a->GetPosition ().z : b->GetPosition ().z); + NS_ASSERT_MSG (hb > 0 && hm > 0, "nodes' height must be greater then 0"); + double log_aHeight = 13.82 * log10 (hb); + double log_bHeight = 0.0; + double C = 0.0; + + if (m_citySize == LargeCity) + { + log_bHeight = 3.2 * pow ((log10 (11.75 * hm)),2); + C = 3; + } + else + { + log_bHeight = 1.1 * log_f - 0.7 * hm - (1.56 * log_f - 0.8); + } + + loss = 46.3 + (33.9 * log_f) - log_aHeight + (((44.9 - (6.55 * log10 (hb)) )) * log10 (dist)) - log_bHeight + C; + } + else if (m_frequency <= 2.690e9) // max 3GPP freq EUTRA band #1 + { + // Empirical model from + // "Path Loss Models for Suburban Scenario at 2.3GHz, 2.6GHz and 3.5GHz" + // Sun Kun, Wang Ping, Li Yingze + // Antennas, Propagation and EM Theory, 2008. ISAPE 2008. 8th International Symposium on + loss = 36 + 26 * log10 (dist * 1000); + } + return loss; +} + +double +OkumuraHataPropagationLossModel::DoCalcRxPower (double txPowerDbm, + Ptr a, + Ptr b) const +{ + return (txPowerDbm - GetLoss (a, b)); +} + + +} // namespace ns3 diff --git a/src/propagation/model/okumura-hata-propagation-loss-model.h b/src/propagation/model/okumura-hata-propagation-loss-model.h new file mode 100644 index 000000000..fa6d6ae93 --- /dev/null +++ b/src/propagation/model/okumura-hata-propagation-loss-model.h @@ -0,0 +1,66 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011, 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Marco Miozzo + * Nicola Baldo + * + */ + +#ifndef OKUMURA_HATA_PROPAGATION_LOSS_MODEL_H +#define OKUMURA_HATA_PROPAGATION_LOSS_MODEL_H + +#include +#include + +namespace ns3 { + +class OkumuraHataPropagationLossModel : public PropagationLossModel +{ + +public: + + // inherited from Object + static TypeId GetTypeId (void); + + /** + * + * + * \param a the first mobility model + * \param b the second mobility model + * + * \return the loss in dBm for the propagation between + * the two given mobility models + */ + double GetLoss (Ptr a, Ptr b) const; + +private: + + // inherited from PropagationLossModel + virtual double DoCalcRxPower (double txPowerDbm, + Ptr a, + Ptr b) const; + + EnvironmentType m_environment; + CitySize m_citySize; + double m_frequency; // frequency in MHz +}; + +} // namespace ns3 + + +#endif // OKUMURA_HATA_PROPAGATION_LOSS_MODEL_H + diff --git a/src/propagation/model/propagation-environment.h b/src/propagation/model/propagation-environment.h new file mode 100644 index 000000000..1eae7493b --- /dev/null +++ b/src/propagation/model/propagation-environment.h @@ -0,0 +1,54 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011, 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Marco Miozzo + * Nicola Baldo + * + */ + +#ifndef PROPAGATION_ENVIRONMENT_H +#define PROPAGATION_ENVIRONMENT_H + + +namespace ns3 { + + +/** + * The type of propagation environment + * + */ +enum EnvironmentType + { + UrbanEnvironment, SubUrbanEnvironment, OpenAreasEnvironment + }; + + +/** + * The size of the city in which propagation takes place + * + */ +enum CitySize + { + SmallCity, MediumCity, LargeCity + }; + + +} // namespace ns3 + + +#endif // PROPAGATION_ENVIRONMENT_H + diff --git a/src/propagation/wscript b/src/propagation/wscript index 094a7de82..7764d5fe4 100644 --- a/src/propagation/wscript +++ b/src/propagation/wscript @@ -8,6 +8,9 @@ def build(bld): 'model/propagation-loss-model.cc', 'model/jakes-propagation-loss-model.cc', 'model/cost231-propagation-loss-model.cc', + 'model/okumura-hata-propagation-loss-model.cc', + 'model/itu-r-1411-los-propagation-loss-model.cc', + 'model/itu-r-1411-nlos-over-rooftop-propagation-loss-model.cc', ] module_test = bld.create_ns3_module_test_library('propagation') @@ -22,6 +25,10 @@ def build(bld): 'model/propagation-loss-model.h', 'model/jakes-propagation-loss-model.h', 'model/cost231-propagation-loss-model.h', + 'model/propagation-environment.h', + 'model/okumura-hata-propagation-loss-model.h', + 'model/itu-r-1411-los-propagation-loss-model.h', + 'model/itu-r-1411-nlos-over-rooftop-propagation-loss-model.h', ] if (bld.env['ENABLE_EXAMPLES']):