--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/buildings/doc/source/lte-building-user.rst Wed Sep 28 16:48:53 2011 +0200
@@ -0,0 +1,121 @@
+.. include:: replace.txt
+
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ User Building Propagation & Mobility Model Documentation
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+
+Background
+**********
+
+
+
+We assume the reader is already familiar with how to use the ns-3
+simulator to run generic simulation programs. If this is not the case,
+we strongly recommend the reader to consult [ns3tutorial]_.
+
+
+Usage Overview
+**************
+
+The ns-3 LTE model is a software library that allows the simulation of
+LTE networks. The process of performing such simulations typically involves the following
+steps:
+
+ 1. *Define the scenario* to be simulated
+ 2. *Write a simulation program* that recreates the desired scenario
+ topology/architecture. This is done accessing the ns-3 LTE model
+ libraryusing the ``ns3::LenaHelper`` API defined in ``src/lte/helper/lena-helper.h``.
+ 3. *Specify configuration parameters* of the objects that are being
+ used for the simulation. This can be done using input files (via the
+ ``ns3::ConfigStore``) or directly within the simulation program.
+ 4. *Configure the desired output* to be produced by the simulator
+ 5. *Run* the simulation.
+
+All these aspects will be explained in the following sections by means
+of practical examples.
+
+
+
+Basic simulation program
+------------------------
+
+In what following, a few guidelines for the usage of the ``BuildingMobilityModel`` and the ``BuildingPropagationModel`` classes.
+
+.. highlight:: none
+
+#. Inheritance::
+
+ #include <ns3/buildings-mobility-model.h>
+ #include <ns3/buildings-propagation-loss-model.h>
+ #include <ns3/building.h>
+
+#. Propagation model selection::
+
+ Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
+
+ lena->SetAttribute ("PropagationModel", StringValue ("ns3::BuildingsPropagationLossModel"));
+
+#. EUTRA Band Selection
+
+The selection of the working frequency of the propagation model has to be done with the standard ns-3 attribute system as described in the correspond section ("Configuration of LTE model parameters") by means of the DlEarfcn and UlEarfcn parameters, for instance::
+
+ default ns3::LteEnbNetDevice::DlEarfcn "100"
+ default ns3::LteEnbNetDevice::UlEarfcn "18100"
+
+It is to be noted that any other configuration (i.e., with BuildingsPropagationLossModel attributes) might generates conflicts in the frequencies definition in the modules during the simulation.
+
+#. Mobility model selection::
+
+ MobilityHelper mobility;
+ mobility.SetMobilityModel ("ns3::BuildingsMobilityModel");
+
+#. Node creation and positioning::
+
+ ueNodes.Create (1);
+ mobility.Install (ueNodes);
+ NetDeviceContainer ueDevs;
+ ueDevs = lena->InstallUeDevice (ueNodes);
+ Ptr<BuildingsMobilityModel> mm = enbNodes.Get (0)->GetObject<BuildingsMobilityModel> ();
+ double x_axis = 0.0;
+ double y_axis = 0.0;
+ double z_axis = 0.0;
+ mm->SetPosition (Vector (x_axis, y_axis, z_axis));
+
+#. Building creation::
+
+ double x_min = 0.0;
+ double x_max = 10.0;
+ double y_min = 0.0;
+ double y_max = 20.0;
+ double z_min = 0.0;
+ double z_max = 10.0;
+ Ptr<Building> building = Create<Building> (x_min, x_max, y_min, y_max, z_min, z_max);
+ building->SetBuildingType (Building::Residential);
+ building->SetExtWallsType (Building::ConcreteWithWindows);
+ building->SetFloorsNumber (3);
+ building->SetNumberRoomX (3);
+ building->SetNumberRoomY (2);
+
+ This will instantiate a residential building with base of 10 x 20 meters and height of 10 meters with concrete with windows as external walls, three floors and a grid of rooms of 3 x 2.
+
+#. Building and nodes interactions::
+
+ mm->SetIndoor (building);
+ mm->SetFloorNumber (2);
+ mm->SetRoomNumberX (1);
+ mm->SetRoomNumberY (1);
+
+ This informs node's mobility model the fact that the node is inside the building at the second floor in the corner room of the 3 x 2 grid.
+ It has to be noted that the simulator does not check the consistence between the node's position and the building site, which is user's responsibility.
+
+
+
+
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/buildings/doc/source/lte-pathloss-design.rst Wed Sep 28 16:48:53 2011 +0200
@@ -0,0 +1,414 @@
+.. include:: replace.txt
+
+
+++++++++++++++++++++++++++++++++++++++
+ Building Pathloss Model Documentation
+++++++++++++++++++++++++++++++++++++++
+
+
+Overview
+++++++++
+
+The pathloss model included in the lte module is obtained through a combination of several well known pathloss models in order to mimic heterogeneous scenarios. In fact, we are interested in modeling different environmental scenarios such as urban, suburban and open areas. Moreover, 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]_.
+
+Description of the Included Models
+++++++++++++++++++++++++++++++++++
+
+The naming used in the following will be:
+
+ * User equipment:: UE
+ * small cell BS (e.g., pico, femto): SC
+ * BS -> eNB
+
+Both UEs and SC might be either indoor and outdoor. The model does not care about the typology of the nodes in the link pathloss computation rather then in their relative position (i.e., indoor vs. outdoor and z-axis respect to the rooftop level).
+
+For discriminate indoor and outdoor users, the model includes a specific class called ``Building`` which contains a ns3 ``Box`` class for defining the dimension of the building. In order to implements the characteristics of the pathloss models included, the ``Building`` class provides support for:
+
+ * building type:
+
+ * Residential (default value)
+ * Office
+ * Commercial
+ * external walls type
+
+ * Wood
+ * ConcreteWithWindows (default value)
+ * ConcreteWithoutWindows
+ * StoneBlocks
+
+ * number of floors (default value 1, which means only ground-floor)
+ * number of rooms in x-axis (default value 1)
+ * number of rooms in x-axis (default value 1)
+
+By means of the number of rooms in x and y axis it is possible the definition of buildings where rooms are organized in grids, typical reference scenario for femto-cells in 3GPP called dual-strip.
+
+The ``Building`` class is included in ``BuildingsMobilityModel`` class, which inherits from the ns3 class ``MobilityModel`` and it is in charge of managing the standard mobility functionalities plus the building ones (e.g., floor and room of the node).
+
+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.).
+
+The model provides the following pathloss link computations:
+
+ * BS <-> UE (indoor and outdoor)
+ * SC (indoor and outdoor) <-> UE (indoor and outdoor)
+
+The model will not include the following pathloss link computations:
+
+ * UE <-> UE
+ * BS <-> BS
+ * BS <-> SC
+ * SC <-> SC
+
+In the following we present the link pathloss models included.
+
+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.
+
+
+
+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<f\leq 1500\end{array} \right.
+
+There extension for the standard OH in suburban is
+
+.. math::
+
+ L_\mathrm{SU} = L_\mathrm{U} - 2 \left(\log{\frac{f}{28}}\right)^2 - 5.4
+
+where
+
+ :math:`L_\mathrm{U}` : pathloss in urban areas
+
+The extension for the standard OH in open area is
+
+.. math::
+
+ L_\mathrm{O} = L_\mathrm{U} - 4.70 (\log{f})^2 + 18.33\log{f} - 40.94
+
+
+The literature lacks of extensions of the COST231 to open area (for suburban it seems that we can just impose C = 0); therefore we consider it a special case fo the suburban one.
+
+
+Regarding the pathloss at 2600 MHz, in literature we found a paper presenting a model coming from an empirical evaluation for urban area [pl26ghz]_:
+
+.. math::
+
+ L = 36 + 26\log{d}
+
+Therefore, also in this case, the suburban and openareas environment scenarios are model as the urban one.
+
+
+Short Range Communications ITU-R P.1411 (I1411)
+---------------------------------------
+
+This model is designed for short range outdoor communication in the frequency range 300 MHz to 100 GHz. It is divided in LOS and NLoS models and NLoS is split in roof-tops and canyons. The model implemented considers the LoS propagation for short distances according to 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.
+
+
+LoS within street canyons
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This model provides an upper and lower bound respectively according to the following formulas
+
+.. math::
+
+ L_\mathrm{LoS,l} = L_\mathrm{bp} + \left\{\begin{array}{ll} 20\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.
+
+.. 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).
+The analytical expression is given in the following.
+
+.. math::
+
+ L_\mathrm{total} = 20\log f + N\log d + L_f(n)- 28 [dB]
+
+where:
+
+ :math:`N = \left\{ \begin{array}{lll} 28 & residential \\ 30 & office \\ 22 & commercial\end{array} \right.` : power loss coefficient [dB]
+
+ :math:`L_f = \left\{ \begin{array}{lll} 4n & residential \\ 15+4(n-1) & office \\ 6+3(n-1) & commercial\end{array} \right.`
+
+ :math:`n` : number of floors between base station and mobile (:math:`n\ge 1`)
+
+ :math:`f` : frequency [MHz]
+
+ :math:`d` : distance (where :math:`d > 1`) [m]
+
+
+
+External Walls Penetration Loss (BEL)
+-------------------------------------
+
+This component models the penetration loss through walls for indoor to outdoor communications and vice-versa. The values are taken from the [cost231]_ model.
+
+ * Wood ~ 4 dB
+ * Concrete with windows (no metallised) ~ 7 dB
+ * Concrete without windows ~ 15 dB (spans between 10 and 20 in COST231)
+ * Stone blocks ~ 12 dB
+
+
+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.
+
+
+
+Hybrid Model Indoor<->Outdoor
+-----------------------------
+
+The pathloss model characterizes the hybrid cases (i.e., when an outdoor node transmit to an indoor one and vice-versa) by adding to the proper model, evaluated according to correspond distance, the external wall penetration loss due to the building (see Section BEL).
+
+
+
+Pathloss Logic Model
+++++++++++++++++++++
+
+
+In the following the pseudo-code of the model is presented::
+
+ if (txNode is outdoor)
+ then
+ if (rxNode is outdoor)
+ then
+ if (distance > 1 km)
+ then
+ if (rxNode or txNode is below the rooftop)
+ then
+ L = I1411
+ else
+ L = OH
+ else
+ L = I1411
+ else (rxNode is indoor)
+ if (distance > 1 km)
+ then
+ if (rxNode or txNode is below the rooftop)
+ L = I1411 + BEL + HG
+ else
+ L = OH + BEL + HG
+ else
+ L = I1411 + BEL + HG
+ else (txNode is indoor)
+ if (rxNode is indoor)
+ then
+ if (same building)
+ then
+ L = I1238
+ else
+ L = I1411 + 2*BEL
+ else (rxNode is outdoor)
+ if (distance > 1 km)
+ then
+ if (rxNode or txNode is below the rooftop)
+ then
+ L = I1411 + BEL + HG
+ else
+ L = OH + BEL + HG
+ else
+ L = I1411 + BEL
+
+
+where ``txNode`` and ``rxNode`` can be one of the elements eNB, SC and UE.
+We note that for SC nodes in case that the distance is greater then 1 km, we still consider the I1411 model since it better models the transmissions with antenna below the roof-top level and moreover due to the fact that OH is specifically designed for macro cells and therefore for antennas above the roof-top level. Finally, we introduced a threshold also or SC transmissions (called ``m_itu1411DistanceThreshold``) for pruning the communications between SCs and UEs too far (the default values is fixed to 2 km).
+
+
+Shadowing Model
++++++++++++++++
+
+The shadowing is modeled according to a log-normal distribution with variable standard deviation as function of the connection characteristics. In the implementation we considered three main possible scenarios which correspond to three standard deviations (i.e., the mean is always 0), in detail:
+
+ * outdoor (``m_shadowingSigmaOutdoor``, defaul value of 7 dB) :math:`\rightarrow X_\mathrm{O} \sim N(\mu_\mathrm{O}, \sigma_\mathrm{O}^2)`.
+ * indoor (``m_shadowingSigmaIndoor``, defaul value of 10 dB) :math:`\rightarrow X_\mathrm{I} \sim N(\mu_\mathrm{I}, \sigma_\mathrm{I}^2)`.
+ * external walls penetration (``m_shadowingSigmaExtWalls``, default value 5 dB) :math:`\rightarrow X_\mathrm{W} \sim N(\mu_\mathrm{W}, \sigma_\mathrm{W}^2)`
+
+The simulator generates a shadowing value per each active link according to nodes' position the first time the link is used for transmitting. In case of transmissions from outdoor nodes to indoor ones, and vice-versa, the standard deviation (:math:`\sigma_\mathrm{IO}`) has to be calculated as the square root of the sum of the quadratic values of the standard deviatio in case of outdoor nodes and the one for the external walls penetration. This is due to the fact that that the components producing the shadowing are independent of each other; therefore, the variance of a distribution resulting from the sum of two independent normal ones is the sum of the variances.
+
+.. math::
+
+ X \sim N(\mu,\sigma^2) \mbox{ and } Y \sim N(\nu,\tau^2)
+
+ Z = X + Y \sim Z (\mu + \nu, \sigma^2 + \tau^2)
+
+ \Rightarrow \sigma_\mathrm{IO} = \sqrt{\sigma_\mathrm{O}^2 + \sigma_\mathrm{W}^2}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/buildings/doc/source/lte-pathloss-testing.rst Wed Sep 28 16:48:53 2011 +0200
@@ -0,0 +1,107 @@
++++++++++++++++++++++++++++++++++++++
+ Pathloss Model Testing Documentation
++++++++++++++++++++++++++++++++++++++
+
+
+Overview
+********
+
+To test and validate the ns-3 Building Pathloss module, a test suites is provided which are integrated with the ns-3 test framework in the lte module.
+To run them, you need to have configured the build of the simulator in this way::
+
+ ./waf configure --enable-tests --enable-modules=lte --enable-examples
+ ./test.py
+
+The above will run not only the test suites belonging to the LTE module, but also those belonging to all the other ns-3 modules on which the LTE module depends. See the ns-3 manual for generic information on the testing framework.
+
+You can get a more detailed report in HTML format in this way::
+
+ ./test.py -w results.html
+
+After the above command has run, you can view the detailed result for each test by opening the file ``results.html`` with a web browser.
+
+You can run each test suite separately using this command::
+
+ ./test.py -s test-suite-name
+
+For more details about ``test.py`` and the ns-3 testing framework, please refer to the ns-3 manual.
+
+
+
+Description of the test suite
+*****************************
+
+The test suite ``lte-pathloss-model`` creates different test cases with
+both unit and system tests. The formers validate the single component model and the pathloss logic behavior. The latter proof the integration of the pathloss model in the ns3 framework and more in specifically in the lte module. Finally. a unit test is provided in order to test the shadowing characterization.
+
+Unit Tests
+~~~~~~~~~~
+
+The unit tests are carried out by comparing the expected results of the pathloss module in specific scenarios with pre calculated values obtained offline with an Octave script (/test/reference/lte-pathloss.m). The tests are considered passed if the two values differs only for a predefined tolerance (0.1) that accounts for the approximations due to floating point arithmetics.
+
+In the following we detailed the scenarios considered, their selection has been done for covering the wide set of possible pathloss logic combinations. The pathloss logic results therefore implicitly tested.
+
+Test #1 Okumura Hata
+--------------------
+
+In this test we test the standard Okumura Hata model; therefore both eNB and UE are placed outside at a distance of 2000 m. The frequency used is the E-UTRA band #5, which correspond to 869 MHz (see table 5.5-1 of 36.101). The test includes also the validation of the areas extensions (i.e., urban, suburban and open-areas) and of the city size (small, medium and large).
+
+Test #2 COST231 Model
+---------------------
+
+This test is aimed at validating the COST231 model. The test is similar to the Okumura Hata one, except that the frequency used is the EUTRA band #1 (2140 MHz) and that the test can be performed only for large and small cities in urban scenarios due to model limitations.
+
+Test #3 2.6 GHz model
+---------------------
+
+This test validates the 2.6 empirical model [pl26ghz]_. The test is similar to Okumura Hata one except that the frequency is the EUTRA band #7 (2620 MHz) and the test can be performed only in urban scenario.
+
+Test #4 ITU1411 LoS model
+-------------------------
+
+This test is aimed at validating the ITU1411 model in case of line of sight within street canyons transmissions. In this case the UE is placed at 100 meters far from the eNB, since the threshold for switching between LoS and NLoS is left to default one (i.e., 200 m.).
+
+Test #5 ITU1411 NLoS model
+--------------------------
+
+This test is aimed at validating the ITU1411 model in case of non line of sight over the rooftop transmissions. In this case the UE is placed at 900 meters far from the eNB, in order to be above the threshold for switching between LoS and NLoS is left to default one (i.e., 200 m.).
+
+Test #6 ITUP1238 model
+----------------------
+
+This test is aimed at validating the ITUP1238 model in case of indoor transmissions. In this case both the UE and the eNB are placed in a residential building with walls made of concrete with windows. Ue is placed at the second floor and distances 30 meters far from the eNB, which is placed at the first floor.
+
+Test #7 Outdoor -> Indoor with Okumura Hata model
+-------------------------------------------------
+
+This test validates the outdoor to indoor transmissions for large distances. In this case the UE is placed in a residential building with wall made of concrete with windows and distances 2000 meters from the outdoor eNB.
+
+Test #8 Outdoor -> Indoor with ITU1411 model
+-------------------------------------------------
+
+This test validates the outdoor to indoor transmissions for short distances. In this case the UE is placed in a residential building with walls made of concrete with windows and distances 100 meters from the outdoor eNB.
+
+
+Test #9 Indoor -> Outdoor with ITU1411 model
+-------------------------------------------------
+
+This test validates the outdoor to indoor transmissions for very short distances. In this case the eNB is placed in the second floor of a residential building with walls made of concrete with windows and distances 100 meters from the outdoor UE (i.e., LoS communication). Therefore the height gain has to be included in the pathloss evaluation.
+
+Test #10 Indoor -> Outdoor with ITU1411 model
+-------------------------------------------------
+
+This test validates the outdoor to indoor transmissions for short distances. In this case the eNB is placed in the second floor of a residential building with walls made of concrete with windows and distances 500 meters from the outdoor UE (i.e., NLoS communication). Therefore the height gain has to be included in the pathloss evaluation.
+
+
+System Test
+~~~~~~~~~~~
+
+The aim of the system test is to verify the integration of the BuildingPathlossModel with the ns3 simulator and in particular with the lte module. The test exploits a set of three pre calculated losses for generating the expected SINR at the receiver counting the transmission and the noise powers. These SINR values are compared with the results obtained from a lte simulation. The losses are calculated off-line with an Octave script (/test/reference/lte-pathloss.m).
+
+
+Shadowing Test
+~~~~~~~~~~~~~~
+
+This unit test is intended to verify the statistics distribution characteristics of the shadowing are the one expected. The shadowing is modeled according to a normal distribution with mean 0 and variable standard deviation (usually called sigma), according to the standard models used in literature.
+The test generates 10,000 samples of shadowing by subtracting the deterministic component from the total loss returned by the ``BuildingPathlossModel``. The mean and variance of the shadowing samples are then used to verify whether the 99% confidence interval is respected by the sequence generated by the simulator.
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/buildings/model/building.cc Wed Sep 28 16:48:53 2011 +0200
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 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 <marco.miozzo@cttc.es>
+ *
+ */
+
+
+#include <ns3/building.h>
+#include <ns3/enum.h>
+
+
+namespace ns3 {
+
+
+Building::Building (double _xMin, double _xMax,
+ double _yMin, double _yMax,
+ double _zMin, double _zMax/*,
+ uint8_t _nFloors, uint8_t _nRoomX, uint8_t _nRoomY*/) :
+ m_floor (1),
+ m_roomX (1),
+ m_roomY (1),
+ m_buildingType (Residential),
+ m_externalWalls (ConcreteWithWindows)
+
+{
+ m_buldingBounds = Box (_xMin, _xMax, _yMin, _yMax, _zMin, _zMax);
+}
+
+
+Building::Building ()
+ : m_floor (1),
+ m_roomX (1),
+ m_roomY (1),
+ m_buildingType (Residential),
+ m_externalWalls (ConcreteWithWindows)
+{
+ m_buldingBounds = Box ();
+}
+
+
+void
+Building::SetBuildingType (Building::BuildingType_t t)
+{
+ m_buildingType = t;
+}
+
+void
+Building::SetExtWallsType (Building::ExtWallsType_t t)
+{
+ m_externalWalls = t;
+}
+
+void
+Building::SetFloorsNumber (uint8_t nfloors)
+{
+ m_floor = nfloors;
+}
+
+void
+Building::SetNumberRoomX (uint8_t nroomx)
+{
+ m_roomX = nroomx;
+}
+
+void
+Building::SetNumberRoomY (uint8_t nroomy)
+{
+ m_roomY = nroomy;
+}
+
+
+Building::BuildingType_t
+Building::GetBuildingType ()
+{
+ return (m_buildingType);
+}
+
+Building::ExtWallsType_t
+Building::GetExtWallsType ()
+{
+ return (m_externalWalls);
+}
+
+uint8_t
+Building::GetNumberFloors ()
+{
+ return (m_floor);
+}
+
+uint8_t
+Building::GetNumberRoomX ()
+{
+ return (m_roomX);
+}
+
+uint8_t
+Building::GetNumberRoomY ()
+{
+ return (m_roomY);
+}
+
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/buildings/model/building.h Wed Sep 28 16:48:53 2011 +0200
@@ -0,0 +1,171 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 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 <marco.miozzo@cttc.es>
+ *
+ */
+#ifndef BUILDING_H
+#define BUILDING_H
+
+#include <ns3/attribute.h>
+#include <ns3/attribute-helper.h>
+#include <ns3/vector.h>
+#include <ns3/box.h>
+#include <ns3/simple-ref-count.h>
+
+
+namespace ns3 {
+
+/**
+ * \ingroup mobility
+ * \brief a 3d building block
+ */
+class Building : public SimpleRefCount<Building>
+{
+public:
+
+ enum BuildingType_t
+ {
+ Residential, Office, Commercial
+ };
+ enum ExtWallsType_t
+ {
+ Wood, ConcreteWithWindows, ConcreteWithoutWindows, StoneBlocks
+ };
+ /**
+ * \param _xMin x coordinates of left boundary.
+ * \param _xMax x coordinates of right boundary.
+ * \param _yMin y coordinates of bottom boundary.
+ * \param _yMax y coordinates of top boundary.
+ * \param _zMin z coordinates of down boundary.
+ * \param _zMax z coordinates of up boundary.
+ * \param _nFloors number of floors
+ * \param _nRoomX number of rooms in the x axis
+ * \param _nRoomY number of rooms in the y axis
+ *
+ * Create a building.
+ */
+ Building (double _xMin, double _xMax,
+ double _yMin, double _yMax,
+ double _zMin, double _zMax/*,
+ uint8_t _nFloors, uint8_t _nRoomX, uint8_t _nRoomY*/);
+
+ /**
+ * Create a zero-sized building located at coordinates (0.0,0.0,0.0)
+ * and with no floors and 1 room.
+ */
+ Building ();
+
+
+ /**
+ * \param t the type of building (i.e., Residential, Office, Commercial)
+ *
+ * This method allows to set building type (default is Residential)
+ */
+ void SetBuildingType (Building::BuildingType_t t);
+
+ /**
+ * \param t the type of external walls (i.e., Wood, ConcreteWithWindows,
+ * ConcreteWithoutWindows and StoneBlocks), used for evaluating the loss
+ * due to the penetration of external walls in outdoor <-> indoor comm.
+ *
+ * This method allows to set external walls type (default is Residential)
+ */
+ void SetExtWallsType (Building::ExtWallsType_t t);
+
+ /**
+ * \param nfloors the number of floors in the building
+ *
+ * This method allows to set the number of floors in the building
+ * (default is 1)
+ */
+ void SetFloorsNumber (uint8_t nfloors);
+
+ /**
+ * \param nroomx the number of rooms in the x axis
+ *
+ * This method allows to set the number of room in x-axis (default is 1)
+ * The rooms are disposed as a grid of nº of rooms in X per nº of rooms in Y
+ */
+ void SetNumberRoomX (uint8_t nroomx);
+
+ /**
+ * \param nroomy the number of floors in the building
+ *
+ * This method allows to set the number of floors in the building
+ * (default is 1)
+ */
+ void SetNumberRoomY (uint8_t nroomy);
+
+
+ /**
+ * \return the type of building
+ * Return the type of building (i.e., Residential, Office, Commercial)
+ */
+ BuildingType_t GetBuildingType ();
+
+ /**
+ * \return the type of external walls
+ * Return the type of external walls (i.e., Wood, ConcreteWithWindows,
+ * ConcreteWithoutWindows)
+ */
+ ExtWallsType_t GetExtWallsType ();
+
+ /**
+ * \return the number of floors
+ * Return the number of floors
+ */
+ uint8_t GetNumberFloors ();
+
+ /**
+ * \return the number of room in x-axis
+ * Return the number of room in x-axis
+ */
+ uint8_t GetNumberRoomX ();
+
+ /**
+ * \return the number of room in y-axis
+ * Return the number of room in y-axis
+ */
+ uint8_t GetNumberRoomY ();
+
+
+private:
+ Box m_buldingBounds;
+ /**
+ * number of floors must be greater then 0 and 1 means only one floor
+ * (i.e., groundfloor)
+ */
+ uint8_t m_floor;
+ uint8_t m_roomX;
+ uint8_t m_roomY;
+
+ uint8_t m_buildingId;
+ BuildingType_t m_buildingType;
+ ExtWallsType_t m_externalWalls;
+
+};
+
+//std::ostream &operator << (std::ostream &os, const Box &box);
+//std::istream &operator >> (std::istream &is, Box &box);
+
+
+ATTRIBUTE_HELPER_HEADER (Building);
+
+} // namespace ns3
+
+#endif /* BUILDING_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/buildings/model/buildings-mobility-model.cc Wed Sep 28 16:48:53 2011 +0200
@@ -0,0 +1,158 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 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 <marco.miozzo@cttc.es>
+ *
+ */
+
+#include <ns3/simulator.h>
+#include <ns3/position-allocator.h>
+#include <ns3/buildings-mobility-model.h>
+#include "ns3/pointer.h"
+
+
+namespace ns3 {
+
+ NS_OBJECT_ENSURE_REGISTERED (BuildingsMobilityModel);
+
+TypeId
+BuildingsMobilityModel::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::BuildingsMobilityModel")
+ .SetParent<MobilityModel> ()
+ .SetGroupName ("Mobility")
+ .AddConstructor<BuildingsMobilityModel> ()
+ .AddAttribute ("Bounds",
+ "Bounds of the area to cruise.",
+ BoxValue (Box (-100.0, 100.0, -100.0, 100.0, 0.0, 100.0)),
+ MakeBoxAccessor (&BuildingsMobilityModel::m_bounds),
+ MakeBoxChecker ());
+
+ return tid;
+}
+
+
+BuildingsMobilityModel::BuildingsMobilityModel ()
+{
+ m_indoor = false;
+ m_nFloor = 0;
+ m_roomX = 1;
+ m_roomY = 1;
+}
+
+void
+BuildingsMobilityModel::DoDispose (void)
+{
+ // chain up
+ m_surroudingBuildings.clear ();
+ MobilityModel::DoDispose ();
+}
+
+Vector
+BuildingsMobilityModel::DoGetPosition (void) const
+{
+ m_helper.Update ();
+ return m_helper.GetCurrentPosition ();
+}
+void
+BuildingsMobilityModel::DoSetPosition (const Vector &position)
+{
+ m_helper.SetPosition (position);
+}
+Vector
+BuildingsMobilityModel::DoGetVelocity (void) const
+{
+ return m_helper.GetVelocity ();
+}
+
+bool
+BuildingsMobilityModel::IsIndoor (void)
+{
+ return (m_indoor);
+}
+
+bool
+BuildingsMobilityModel::IsOutdoor (void)
+{
+ return (!m_indoor);
+}
+
+void
+BuildingsMobilityModel::SetIndoor (Ptr<Building> building)
+{
+ m_indoor = true;
+ m_myBuilding = building;
+}
+
+void
+BuildingsMobilityModel::SetOutdoor (void)
+{
+ m_indoor = false;
+}
+
+void
+BuildingsMobilityModel::SetFloorNumber (uint8_t nfloor)
+{
+ m_nFloor = nfloor;
+}
+
+void
+BuildingsMobilityModel::SetRoomNumberX (uint8_t nroomx)
+{
+ m_roomX = nroomx;
+}
+
+void
+BuildingsMobilityModel::SetRoomNumberY (uint8_t nroomy)
+{
+ m_roomY = nroomy;
+}
+
+
+void
+BuildingsMobilityModel::SetSurroudingBuilding (Ptr<Building> building)
+{
+ m_surroudingBuildings.push_back (building);
+}
+
+uint8_t
+BuildingsMobilityModel::GetFloorNumber (void)
+{
+ return (m_nFloor);
+}
+
+uint8_t
+BuildingsMobilityModel::GetRoomNumberX (void)
+{
+ return (m_roomX);
+}
+
+uint8_t
+BuildingsMobilityModel::GetRoomNumberY (void)
+{
+ return (m_roomY);
+}
+
+
+Ptr<Building>
+BuildingsMobilityModel::GetBuilding ()
+{
+ return (m_myBuilding);
+}
+
+
+} // namespace
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/buildings/model/buildings-mobility-model.h Wed Sep 28 16:48:53 2011 +0200
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 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 <marco.miozzo@cttc.es>
+ *
+ */
+#ifndef BUILDINGS_MOBILITY_MODEL_H
+#define BUILDINGS_MOBILITY_MODEL_H
+
+
+
+#include <ns3/mobility-model.h>
+#include <ns3/ptr.h>
+#include <ns3/object.h>
+#include <ns3/box.h>
+#include <map>
+#include <ns3/constant-velocity-helper.h>
+#include <ns3/building.h>
+//#include "ns3/random-variable.h"
+//#include "ns3/nstime.h"
+//#include "ns3/event-id.h"
+
+
+
+namespace ns3 {
+
+
+/**
+ * \ingroup mobility
+ * \brief Buildings mobility model
+ *
+ * This model implements the managment of scenarios where users might be
+ * either indoor (e.g., houses, offices, etc.) and outdoor.
+ *
+ */
+
+
+class BuildingsMobilityModel : public MobilityModel
+{
+ public:
+ static TypeId GetTypeId (void);
+ BuildingsMobilityModel ();
+
+ bool IsIndoor (void);
+ bool IsOutdoor (void);
+
+ void SetIndoor (Ptr<Building> building);
+ void SetOutdoor (void);
+
+ void SetSurroudingBuilding (Ptr<Building> building);
+
+ void SetFloorNumber (uint8_t nfloor);
+ void SetRoomNumberX (uint8_t nroomx);
+ void SetRoomNumberY (uint8_t nroomy);
+
+ uint8_t GetFloorNumber (void);
+ uint8_t GetRoomNumberX (void);
+ uint8_t GetRoomNumberY (void);
+
+ Ptr<Building> GetBuilding ();
+
+
+
+ private:
+ virtual void DoDispose (void);
+ virtual Vector DoGetPosition (void) const;
+ virtual void DoSetPosition (const Vector &position);
+ virtual Vector DoGetVelocity (void) const;
+ ConstantVelocityHelper m_helper;
+ Box m_bounds; // bounds of the simulation field (if needed)
+ std::list < Ptr<Building> > m_surroudingBuildings; // buildings blocks
+ Ptr<Building> m_myBuilding;
+ bool m_indoor;
+ /**
+ * floors numbering starts from 0 (basement)
+ */
+ uint8_t m_nFloor;
+ uint8_t m_roomX;
+ uint8_t m_roomY;
+
+};
+
+
+
+} // namespace ns3
+
+
+#endif // BUILDINGS_MOBILITY_MODEL_H
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/buildings/model/buildings-propagation-loss-model.cc Wed Sep 28 16:48:53 2011 +0200
@@ -0,0 +1,830 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 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 <marco.miozzo@cttc.es>
+ *
+ */
+
+#include "ns3/propagation-loss-model.h"
+#include "ns3/log.h"
+#include "ns3/mobility-model.h"
+#include "ns3/double.h"
+#include "ns3/pointer.h"
+#include <math.h>
+#include "buildings-propagation-loss-model.h"
+#include "ns3/buildings-mobility-model.h"
+#include "ns3/enum.h"
+
+#include <ns3/shadowing-loss-model.h>
+#include <ns3/jakes-fading-loss-model.h>
+
+
+NS_LOG_COMPONENT_DEFINE ("BuildingsPropagationLossModel");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (BuildingsPropagationLossModel);
+
+
+
+class BuildingsPropagationLossModel::ShadowingLoss
+{
+ public:
+ ShadowingLoss (double mean, double sigma);
+ ~ShadowingLoss ();
+ double GetLoss ();
+ Ptr<MobilityModel> GetReceiver (void);
+ private:
+ Ptr<MobilityModel> m_receiver;
+ NormalVariable m_randVariable;
+ double m_shadowingValue;
+};
+
+
+BuildingsPropagationLossModel::ShadowingLoss::ShadowingLoss (double mean, double sigma) :
+m_randVariable (mean, sigma*sigma) // NormalVariable class wants mean and variance (sigma is a standard deviation)
+{
+ m_shadowingValue = m_randVariable.GetValue ();
+ NS_LOG_INFO (this << " New Shadowing: sigma " << sigma << " value " << m_shadowingValue);
+}
+
+BuildingsPropagationLossModel::ShadowingLoss::~ShadowingLoss ()
+{
+
+}
+
+double
+BuildingsPropagationLossModel::ShadowingLoss::GetLoss ()
+{
+ return (m_shadowingValue);
+}
+
+Ptr<MobilityModel>
+BuildingsPropagationLossModel::ShadowingLoss::GetReceiver ()
+{
+ return m_receiver;
+}
+
+TypeId
+BuildingsPropagationLossModel::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::BuildingsPropagationLossModel")
+
+ .SetParent<PropagationLossModel> ()
+
+ .AddConstructor<BuildingsPropagationLossModel> ()
+
+ .AddAttribute ("Lambda",
+ "The wavelength (default is 2.106 GHz at 300 000 km/s).",
+ DoubleValue (300000000.0 / 2160e6),
+ MakeDoubleAccessor (&BuildingsPropagationLossModel::SetLambda, &BuildingsPropagationLossModel::GetLambda),
+ MakeDoubleChecker<double> ())
+
+ .AddAttribute ("Frequency",
+ "The Frequency (default is 2.106 GHz).",
+ DoubleValue (2160e6),
+ MakeDoubleAccessor (&BuildingsPropagationLossModel::m_frequency),
+ MakeDoubleChecker<double> ())
+
+ .AddAttribute ("ShadowSigmaOutdoor",
+ "Standard deviation of the normal distribution used for calculate the shadowing for outdoor nodes",
+ DoubleValue (7.0),
+ MakeDoubleAccessor (&BuildingsPropagationLossModel::m_shadowingSigmaOutdoor),
+ MakeDoubleChecker<double> ())
+
+ .AddAttribute ("ShadowSigmaIndoor",
+ "Standard deviation of the normal distribution used for calculate the shadowing for indoor nodes ",
+ DoubleValue (8.0),
+ MakeDoubleAccessor (&BuildingsPropagationLossModel::m_shadowingSigmaIndoor),
+ MakeDoubleChecker<double> ())
+ .AddAttribute ("ShadowSigmaExtWalls",
+ "Standard deviation of the normal distribution used for calculate the shadowing due to ext walls ",
+ DoubleValue (5.0),
+ MakeDoubleAccessor (&BuildingsPropagationLossModel::m_shadowingSigmaExtWalls),
+ MakeDoubleChecker<double> ())
+
+ .AddAttribute ("RooftopLevel",
+ " The height of the rooftop [m].",
+ DoubleValue (20.0),
+ MakeDoubleAccessor (&BuildingsPropagationLossModel::m_rooftopHeight),
+ MakeDoubleChecker<double> ())
+
+ .AddAttribute ("Los2NlosThr",
+ " Threshold from LoS to NLoS in ITU 1411 [m].",
+ DoubleValue (200.0),
+ MakeDoubleAccessor (&BuildingsPropagationLossModel::m_itu1411NlosThreshold),
+ MakeDoubleChecker<double> ())
+
+ .AddAttribute ("ITU1411DistanceThr",
+ " Threshold for ITU 1411 [m].",
+ DoubleValue (2000.0),
+ MakeDoubleAccessor (&BuildingsPropagationLossModel::m_itu1411DistanceThreshold),
+ MakeDoubleChecker<double> ())
+
+ .AddAttribute ("MinDistance",
+ "The distance under which the propagation model refuses to give results (m) ",
+ DoubleValue (0.5),
+ MakeDoubleAccessor (&BuildingsPropagationLossModel::SetMinDistance, &BuildingsPropagationLossModel::GetMinDistance),
+ MakeDoubleChecker<double> ())
+
+ .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"));
+
+
+ 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 ()
+{
+ for (PairsList::reverse_iterator i = m_shadowingPairs.rbegin (); i != m_shadowingPairs.rend (); i++)
+ {
+ PairsSet *ps = *i;
+ for (DestinationList::iterator r = ps->receivers.begin (); r != ps->receivers.end (); r++)
+ {
+ ShadowingLoss *pc = *r;
+ delete pc;
+ }
+ ps->sender = 0;
+ ps->receivers.clear ();
+ delete ps;
+ }
+ m_shadowingPairs.clear ();
+}
+
+// void
+// BuildingsPropagationLossModel::SetLambda (double frequency, double speed)
+// {
+// m_lambda = speed / frequency;
+// m_frequency = frequency;
+// }
+
+void
+BuildingsPropagationLossModel::SetLambda (double lambda)
+{
+ m_lambda = lambda;
+ m_frequency = 300000000 / lambda;
+}
+
+double
+BuildingsPropagationLossModel::GetLambda (void) const
+{
+ return m_lambda;
+}
+
+void
+BuildingsPropagationLossModel::SetMinDistance (double minDistance)
+{
+ m_minDistance = minDistance;
+}
+double
+BuildingsPropagationLossModel::GetMinDistance (void) const
+{
+ return m_minDistance;
+}
+
+void
+BuildingsPropagationLossModel::SetEnvironment (Environment env)
+{
+// if (env==Urban)
+// {
+// NS_LOG_INFO (this << " Urban");
+// }
+// else if (env==SubUrban)
+// {
+// NS_LOG_INFO (this << " SubUrban");
+// }
+// else if (env==OpenAreas)
+// {
+// NS_LOG_INFO (this << " OpenAreas");
+// }
+ 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<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> 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<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b) const
+{
+ if (a->GetDistanceFrom (b) < m_itu1411NlosThreshold)
+ {
+ return (ItuR1411Los (a,b));
+ }
+ else
+ {
+ return (ItuR1411NlosOverRooftop (a,b));
+ }
+}
+
+
+double
+BuildingsPropagationLossModel::ItuR1411Los (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> 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<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> 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::ItuR1411NlosStreetCanyons (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b) const
+// {
+// NS_LOG_INFO (this);
+// // reflection pathloss
+// double x1 = a->GetStreetCrossingDistence ();
+// double x2 = b->GetStreetCrossingDistence ();
+// double f_alpha = 0.0;
+// if (m_cornerAngle<= 0.33)
+// {
+// f_alpha = -41.0 + 110*m_cornerAngle;
+// }
+// else if (m_cornerAngle<= 0.42)
+// {
+// f_alpha = -13.94 + 28*m_cornerAngle;
+// }
+// else if (m_cornerAngle<= 0.71)
+// {
+// f_alpha = -5.33 + 7.51*m_cornerAngle;
+// }
+// double pi = 3.141592653589793;
+// double Lr = -20*log10 (x1+x2) + (x1*x2*f_alpha/(m_streetsWidth*m_streetsWidth)) - 20*log10 (4*pi/m_lambda);
+//
+// // diffraction pathloss
+// double Da = -1*(40/(2*pi))*(atan (x2/m_streetsWidth) + atan (x1/m_streetsWidth) - (pi/2));
+// double Ld = -10*log10 (x2*x1*(x1+x2)) + 2*Da + 0.1*(90 - m_cornerAngle*(180/pi)) - 20*log10 (4*pi/m_lambda);
+//
+// double loss = -10*log10 (pow (10, Lr/10) + pow (10, Ld/10));
+// return (loss);
+// }
+
+
+double
+BuildingsPropagationLossModel::ItuR1238 (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b) const
+{
+ double N = 0.0;
+ int n = abs (a->GetFloorNumber () - b->GetFloorNumber ());
+// NS_LOG_INFO (this << " A floor " << (uint16_t)a->GetFloorNumber () << " B floor " << (uint16_t)b->GetFloorNumber () << " n " << n);
+ double Lf = 0.0;
+ Ptr<Building> aBuilding = a->GetBuilding ();
+ if (aBuilding->GetBuildingType () == Building::Residential)
+ {
+ N = 28;
+ Lf = 4 * n;
+// NS_LOG_INFO (this << " Residential ");
+ }
+ else if (aBuilding->GetBuildingType () == Building::Office)
+ {
+ N = 30;
+ Lf = 15 + (4 * (n-1));
+// NS_LOG_INFO (this << " Office ");
+ }
+ else if (aBuilding->GetBuildingType () == Building::Commercial)
+ {
+ N = 22;
+ Lf = 6 + (3 * (n-1));
+// NS_LOG_INFO (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;
+
+ return (loss);
+}
+
+
+double
+BuildingsPropagationLossModel::BEWPL (Ptr<BuildingsMobilityModel> a) const
+{
+ double loss = 0.0;
+ Ptr<Building> aBuilding = a->GetBuilding ();
+ if (aBuilding->GetExtWallsType () == Building::Wood)
+ {
+ loss = 4;
+ }
+ else if (aBuilding->GetExtWallsType () == Building::ConcreteWithWindows)
+ {
+ loss = 7;
+ }
+ else if (aBuilding->GetExtWallsType () == Building::ConcreteWithoutWindows)
+ {
+ loss = 15; // 10 ~ 20 dB
+ }
+ else if (aBuilding->GetExtWallsType () == Building::StoneBlocks)
+ {
+ loss = 12;
+ }
+
+
+ return (loss);
+}
+
+
+double
+BuildingsPropagationLossModel::HeightGain (Ptr<BuildingsMobilityModel> node) const
+{
+ double loss = 0.0;
+
+ int nfloors = node->GetFloorNumber ();
+ loss = -2*(nfloors);
+ return (loss);
+}
+
+
+
+
+double
+BuildingsPropagationLossModel::GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
+{
+
+ double distance = a->GetDistanceFrom (b);
+ if (distance <= m_minDistance)
+ {
+ return 0.0;
+ }
+
+ // get the BuildingsMobilityModel pointers
+ Ptr<BuildingsMobilityModel> a1 = DynamicCast<BuildingsMobilityModel> (a);
+ Ptr<BuildingsMobilityModel> b1 = DynamicCast<BuildingsMobilityModel> (b);
+
+ double loss = 0.0;
+
+ if (a1->IsOutdoor ())
+ {
+ if (b1->IsOutdoor ())
+ {
+ if (distance > 1000)
+ {
+ NS_LOG_INFO (this << a1->GetPosition ().z<<b1->GetPosition ().z<< m_rooftopHeight);
+ if ((a1->GetPosition ().z < m_rooftopHeight)
+ && (b1->GetPosition ().z < m_rooftopHeight))
+ {
+ // ITU limit in distance (i.e., < 2000 for small cells)
+ if (distance < m_itu1411DistanceThreshold)
+ {
+ // short range communication
+ loss = ItuR1411 (a1, b1);
+ NS_LOG_INFO (this << " 0-0 (>1000): down rooftop -> ITUR1411 : " << loss);
+ }
+ else
+ {
+ // out of bound
+ loss = std::numeric_limits<double>::infinity ();
+ NS_LOG_INFO (this << " 0-0 (>2000): down rooftop -> ITUR1411 : " << loss);
+ }
+ }
+ else
+ {
+ // Over the rooftop tranmission -> Okumura Hata
+ loss = OkumuraHata (a1, b1);
+ NS_LOG_INFO (this << " O-O (>1000): Over the rooftop -> OH : " << loss);
+ }
+ }
+ else
+ {
+ // short range outdoor communication
+ loss = ItuR1411 (a1, b1);
+ NS_LOG_INFO (this << " 0-0 (<1000) Street canyon -> ITUR1411 : " << loss);
+ }
+ }
+ else
+ {
+ // b indoor
+ if (distance > 1000)
+ {
+ if ((a1->GetPosition ().z < m_rooftopHeight)
+ && (b1->GetPosition ().z < m_rooftopHeight))
+ {
+
+ // ITU limit in distance (i.e., < 2000 for small cells)
+ if (distance < m_itu1411DistanceThreshold)
+ {
+ // short range communication
+ loss = ItuR1411 (a1, b1) + BEWPL(b1) + HeightGain (a1);
+ NS_LOG_INFO (this << " 0-I (>1000): down rooftop -> ITUR1411 : " << loss);
+ }
+ else
+ {
+ // out of bound
+ loss = std::numeric_limits<double>::infinity ();
+ NS_LOG_INFO (this << " 0-I (>2000): down rooftop -> ITUR1411 : " << loss);
+ }
+ }
+ else
+ {
+ // Over the rooftop tranmission -> Okumura Hata
+ loss = OkumuraHata (a1, b1) + BEWPL(b1);
+ NS_LOG_INFO (this << " O-I (>1000): Over the rooftop -> OH : " << loss);
+ }
+ }
+ else
+ {
+ loss = ItuR1411 (a1, b1) + BEWPL(b1) + HeightGain (b1);
+ NS_LOG_INFO (this << " 0-I (<1000) ITUR1411 + BEL : " << loss);
+ }
+ } // end b1->isIndoor ()
+ }
+ else
+ {
+ // a is indoor
+ if (b1->IsIndoor ())
+ {
+ if (a1->GetBuilding () == b1->GetBuilding ())
+ {
+ // nodes are in same building -> indoor communication ITU-R P.1238
+ loss = ItuR1238 (a1, b1);
+ NS_LOG_INFO (this << " I-I (same building) ITUR1238 : " << loss);
+
+ }
+ else
+ {
+ // nodes are in different buildings
+ loss = ItuR1411 (a1, b1) + BEWPL(a1) + BEWPL(b1);
+ NS_LOG_INFO (this << " I-I (different) ITUR1238 + 2*BEL : " << loss);
+ }
+ }
+ else
+ {
+ // b is outdoor
+ if (distance > 1000)
+ {
+ if ((a1->GetPosition ().z < m_rooftopHeight)
+ && (b1->GetPosition ().z < m_rooftopHeight))
+ {
+
+ // ITU limit in distance (i.e., < 2000 for small cells)
+ if (distance < m_itu1411DistanceThreshold)
+ {
+ // short range communication
+ loss = ItuR1411 (a1, b1) + BEWPL(a1) + HeightGain (a1);
+ NS_LOG_INFO (this << " I-O (>1000): down rooftop -> ITUR1411 : " << loss);
+ }
+ else
+ {
+ // out of bound
+ loss = std::numeric_limits<double>::infinity ();
+ NS_LOG_INFO (this << " I-O (>2000): down rooftop -> ITUR1411 : " << loss);
+ }
+ }
+ else
+ {
+ // above rooftop -> OH
+ loss = OkumuraHata (a1, b1) + BEWPL(a1) + HeightGain (a1);
+ NS_LOG_INFO (this << " =I-O (>1000) over rooftop OH + BEL + HG: " << loss);
+ }
+ }
+ else
+ {
+ loss = ItuR1411 (a1, b1) + BEWPL(a1) + HeightGain (a1);
+ NS_LOG_INFO (this << " I-O (<1000) ITUR1411 + BEL + HG: " << loss);
+ }
+ } // end b1->IsIndoor ()
+ } // end a1->IsOutdoor ()
+
+ // Evaluate the shadowing
+ PairsList::iterator i = m_shadowingPairs.end ();
+ while (i != m_shadowingPairs.begin ())
+ {
+ i--;
+ PairsSet *ps = *i;
+ if (ps->sender == a)
+ {
+ m_shadowingPairs.erase (i);
+ m_shadowingPairs.push_back (ps);
+ for (DestinationList::iterator r = ps->receivers.begin (); r != ps->receivers.end (); r++)
+ {
+ ShadowingLoss *pc = *r;
+ if (pc->GetReceiver () == b)
+ {
+ ps->receivers.erase (r);
+ ps->receivers.push_back (pc);
+ return loss + pc->GetLoss ();
+ }
+ }
+ double sigma = EvaluateSigma (a1, b1);
+ ShadowingLoss *pc = new ShadowingLoss (0.0, sigma);
+ ps->receivers.push_back (pc);
+ return loss + pc->GetLoss ();
+ }
+ }
+ PairsSet *ps = new PairsSet;
+ ps->sender = a;
+ double sigma = EvaluateSigma (a1, b1);
+ ShadowingLoss *pc = new ShadowingLoss (0.0, sigma);
+ ps->receivers.push_back (pc);
+ m_shadowingPairs.push_back (ps);
+ return loss + pc->GetLoss ();
+
+
+
+// if (m_shadowingValue==0)
+// {
+// m_shadowingValue = new ShadowingLoss (m_shadowingMean, m_shadowingSigma);
+// }
+//
+// return (loss + m_shadowingValue->GetLoss ());
+
+}
+
+double
+BuildingsPropagationLossModel::EvaluateSigma (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b)
+const
+{
+ if (a->IsOutdoor ())
+ {
+ if (b->IsOutdoor ())
+ {
+ return (m_shadowingSigmaOutdoor);
+ }
+ else
+ {
+ double sigma = sqrt((m_shadowingSigmaOutdoor*m_shadowingSigmaOutdoor) + (m_shadowingSigmaExtWalls*m_shadowingSigmaExtWalls));
+ return (sigma);
+ }
+ }
+ else
+ if (b->IsIndoor ())
+ {
+ return (m_shadowingSigmaIndoor);
+ }
+ else
+ {
+ double sigma = sqrt((m_shadowingSigmaOutdoor*m_shadowingSigmaOutdoor) + (m_shadowingSigmaExtWalls*m_shadowingSigmaExtWalls));
+ return (sigma);
+ }
+}
+
+
+double
+BuildingsPropagationLossModel::DoCalcRxPower (double txPowerDbm, Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
+{
+ return txPowerDbm - GetLoss (a, b);
+}
+
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/buildings/model/buildings-propagation-loss-model.h Wed Sep 28 16:48:53 2011 +0200
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 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 <marco.miozzo@cttc.es>
+ *
+ */
+
+#ifndef BUILDINGS_PROPAGATION_LOSS_MODEL_H_
+#define BUILDINGS_PROPAGATION_LOSS_MODEL_H_
+
+#include "ns3/nstime.h"
+#include "ns3/propagation-loss-model.h"
+#include <ns3/building.h>
+#include <ns3/buildings-mobility-model.h>
+
+// #include <ns3/jakes-fading-loss-model.h>
+// #include <ns3/shadowing-loss-model.h>
+
+namespace ns3 {
+
+class ShadowingLossModel;
+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 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
+ *
+ */
+
+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
+ * \param b the mobility model of the destination
+ * \returns the propagation loss (in dBm)
+ */
+ double GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
+ void SetEnvironment (Environment env);
+ void SetCitySize (CitySize size);
+ void SetLambda (double lambda);
+ void SetMinDistance (double minDistance);
+ Environment GetEnvironment (void) const;
+ CitySize GetCitySize (void) const;
+ double GetMinDistance (void) const;
+ double GetLambda (void) const;
+// void SetLambda (double frequency, double speed);
+
+
+private:
+ virtual double DoCalcRxPower (double txPowerDbm, Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
+ double OkumuraHata (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b) const;
+ double ItuR1411 (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b) const;
+ double ItuR1411Los (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b) const;
+ double ItuR1411NlosOverRooftop (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b) const;
+// double ItuR1411NlosStreetCanyons (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b) const;
+ double ItuR1238 (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b) const;
+ double BEWPL (Ptr<BuildingsMobilityModel> a) const;
+
+ double HeightGain (Ptr<BuildingsMobilityModel> n) 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
+
+ // the shadowing tx/rx pairs management has been inspired by the
+ // JakesFadingLossModel developed by Federico Maguolo (see jakes-propagation-model.h/cc)
+ class ShadowingLoss;
+ friend class ShadowingLoss;
+ typedef std::vector<ShadowingLoss *> DestinationList;
+ struct PairsSet {
+ Ptr<MobilityModel> sender;
+ DestinationList receivers;
+ };
+ typedef std::vector<PairsSet *> PairsList;
+ double EvaluateSigma (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b) const;
+
+
+ double m_shadowingSigmaExtWalls;
+ double m_shadowingSigmaOutdoor;
+ double m_shadowingSigmaIndoor;
+ mutable PairsList m_shadowingPairs;
+
+};
+
+}
+
+#endif /* COST231PROPAGATIONMODEL_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/buildings/test/buildings-pathloss-test.cc Wed Sep 28 16:48:53 2011 +0200
@@ -0,0 +1,262 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 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 <marco.miozzo@cttc.es>
+ */
+
+#include <ns3/simulator.h>
+
+#include <ns3/log.h>
+
+#include <ns3/buildings-pathloss-test.h>
+#include <ns3/spectrum-model.h>
+#include <ns3/single-model-spectrum-channel.h>
+#include "ns3/string.h"
+#include "ns3/double.h"
+#include <ns3/building.h>
+#include <ns3/enum.h>
+
+
+NS_LOG_COMPONENT_DEFINE ("BuildingsPathlossTest");
+
+using namespace ns3;
+
+
+/**
+ * Test 1.1 BuildingsPathlossModel Pathloss compound test
+ */
+
+/**
+ * This TestSuite tests the BuildingPathlossModel by reproducing
+ * several communication scenarios
+ */
+
+
+BuildingsPathlossTestSuite::BuildingsPathlossTestSuite ()
+ : TestSuite ("buildings-pathloss-test", SYSTEM)
+{
+
+ LogComponentEnable ("BuildingsPathlossTest", LOG_LEVEL_ALL);
+
+ double distance = 2000;
+ double hm = 1;
+ double hb = 30;
+ double freq = 869e6; // E_UTRA BAND #5 see table 5.5-1 of 36.101
+ Ptr<BuildingsMobilityModel> mm1 = CreateObject<BuildingsMobilityModel> ();
+ mm1->SetPosition (Vector (0.0, 0.0, hb));
+
+ Ptr<BuildingsMobilityModel> mm2 = CreateObject<BuildingsMobilityModel> ();
+ mm2->SetPosition (Vector (distance, 0.0, hm));
+
+ AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 137.93, "OH Urban Large city"));
+
+ AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 137.88, "OH Urban small city"));
+
+ AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::SubUrban, BuildingsPropagationLossModel::Large, 128.03, "loss OH SubUrban"));
+
+ AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::OpenAreas, BuildingsPropagationLossModel::Large, 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, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 148.55, "COST231 Urban Large city"));
+
+ AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 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, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 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
+ distance = 100;
+ Ptr<BuildingsMobilityModel> mm3 = CreateObject<BuildingsMobilityModel> ();
+ mm3->SetPosition (Vector (distance, 0.0, hm));
+ AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm3, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 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
+ distance = 900;
+
+ Ptr<BuildingsMobilityModel> mm4 = CreateObject<BuildingsMobilityModel> ();
+ mm4->SetPosition (Vector (distance, 0.0, hm));
+ AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm4, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 143.69, "ITU1411 NLOS"));
+
+ // Test #6 ITUP1238 (HeNB <-> UE)
+
+ distance = 30;
+ freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
+ double henbHeight = 10.0;
+ Ptr<BuildingsMobilityModel> mm5 = CreateObject<BuildingsMobilityModel> ();
+ mm5->SetPosition (Vector (0.0, 0.0, henbHeight));
+ Ptr<Building> building1 = Create<Building> (0.0, 10.0, 0.0, 10.0, 0.0, 20.0/*, 1, 1, 1*/);
+ building1->SetBuildingType (Building::Residential);
+ building1->SetExtWallsType (Building::ConcreteWithWindows);
+ mm5->SetIndoor (building1);
+ Ptr<BuildingsMobilityModel> mm6 = CreateObject<BuildingsMobilityModel> ();
+ mm6->SetPosition (Vector (distance, 0.0, hm));
+ mm6->SetIndoor (building1);
+ mm6->SetFloorNumber (2);
+ AddTestCase (new BuildingsPathlossTestCase (freq, mm5, mm6, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 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
+ distance = 2000;
+ // 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
+ Ptr<BuildingsMobilityModel> mm7 = CreateObject<BuildingsMobilityModel> ();
+ mm7->SetPosition (Vector (distance, 0.0, hm));
+ mm7->SetIndoor (building1);
+ AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm7, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 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
+ distance = 100;
+ Ptr<BuildingsMobilityModel> mm8 = CreateObject<BuildingsMobilityModel> ();
+ mm8->SetPosition (Vector (distance, 0.0, hm));
+ mm8->SetIndoor (building1);
+ // 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, mm1, mm8, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 88.000, "ITU1411 LOS Outdoor -> Indoor"));
+
+ // Test #9 Indoor -> Outdoor LOS (HeNB <-> UE)
+
+ distance = 100;
+ freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
+ Ptr<BuildingsMobilityModel> mm9 = CreateObject<BuildingsMobilityModel> ();
+ mm9->SetPosition (Vector (0.0, 0.0, henbHeight));
+ mm9->SetIndoor (building1);
+ mm9->SetFloorNumber (2);
+ Ptr<BuildingsMobilityModel> mm10 = CreateObject<BuildingsMobilityModel> ();
+ mm10->SetPosition (Vector (distance, 0.0, hm));
+ // 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, mm9, mm10, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 84.838, "ITU1411 LOS Indoor -> Outdoor"));
+
+ // Test #10 Indoor -> Outdoor NLOS (HeNB <-> UE)
+
+ distance = 500;
+ freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
+ Ptr<BuildingsMobilityModel> mm11 = CreateObject<BuildingsMobilityModel> ();
+ mm11->SetPosition (Vector (distance, 0.0, hm));
+ // 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, mm9, mm11, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 183.90, "ITU1411 NLOS Indoor -> Outdoor"));
+
+
+}
+
+
+
+static BuildingsPathlossTestSuite buildingsPathlossTestSuite;
+
+
+/**
+ * TestCase
+ */
+
+BuildingsPathlossTestCase::BuildingsPathlossTestCase (double freq, Ptr<BuildingsMobilityModel> m1, Ptr<BuildingsMobilityModel> m2, BuildingsPropagationLossModel::Environment env, BuildingsPropagationLossModel::CitySize city, double refValue, std::string name)
+ : TestCase ("LOSS calculation: " + name),
+ m_freq (freq),
+ m_node1 (m1),
+ m_node2 (m2),
+ m_env (env),
+ m_city (city),
+ m_lossRef (refValue)
+{
+}
+
+BuildingsPathlossTestCase::~BuildingsPathlossTestCase ()
+{
+}
+
+void
+BuildingsPathlossTestCase::DoRun (void)
+{
+// LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL);
+
+// LogComponentEnable ("LteEnbRrc", logLevel);
+// LogComponentEnable ("LteUeRrc", logLevel);
+// LogComponentEnable ("LteEnbMac", logLevel);
+// LogComponentEnable ("LteUeMac", logLevel);
+// LogComponentEnable ("LteRlc", logLevel);
+// LogComponentEnable ("RrPacketScheduler", logLevel);
+//
+// LogComponentEnable ("LtePhy", logLevel);
+// LogComponentEnable ("LteEnbPhy", logLevel);
+// LogComponentEnable ("LteUePhy", logLevel);
+//
+// LogComponentEnable ("LteSpectrumPhy", logLevel);
+// LogComponentEnable ("LteInterference", logLevel);
+// LogComponentEnable ("LteSinrChunkProcessor", logLevel);
+//
+// LogComponentEnable ("LtePropagationLossModel", logLevel);
+// LogComponentEnable ("LossModel", logLevel);
+// LogComponentEnable ("ShadowingLossModel", logLevel);
+// LogComponentEnable ("PenetrationLossModel", logLevel);
+// LogComponentEnable ("MultipathLossModel", logLevel);
+// LogComponentEnable ("PathLossModel", logLevel);
+//
+// LogComponentEnable ("LteNetDevice", logLevel);
+// LogComponentEnable ("LteUeNetDevice", logLevel);
+// LogComponentEnable ("LteEnbNetDevice", logLevel);
+
+ LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL);
+ NS_LOG_INFO ("Testing " << GetName());
+
+ Ptr<SpectrumChannel> m_downlinkChannel = CreateObject<SingleModelSpectrumChannel> ();
+ Ptr<SpectrumChannel> m_uplinkChannel = CreateObject<SingleModelSpectrumChannel> ();
+ Ptr<BuildingsPropagationLossModel> m_downlinkPropagationLossModel = CreateObject<BuildingsPropagationLossModel> ();
+ m_downlinkPropagationLossModel->SetAttribute ("Frequency", DoubleValue (m_freq));
+ m_downlinkPropagationLossModel->SetAttribute ("Lambda", DoubleValue (300000000.0 /m_freq));
+ m_downlinkPropagationLossModel->SetAttribute ("Environment", EnumValue (m_env));
+ m_downlinkPropagationLossModel->SetAttribute ("CitySize", EnumValue (m_city));
+ // cancel shadowing effect
+ m_downlinkPropagationLossModel->SetAttribute ("ShadowSigmaOutdoor", DoubleValue (0.0));
+ m_downlinkPropagationLossModel->SetAttribute ("ShadowSigmaIndoor", DoubleValue (0.0));
+ m_downlinkPropagationLossModel->SetAttribute ("ShadowSigmaExtWalls", DoubleValue (0.0));
+ Ptr<BuildingsPropagationLossModel> m_uplinkPropagationLossModel = CreateObject<BuildingsPropagationLossModel> ();
+ m_uplinkPropagationLossModel->SetAttribute ("Frequency", DoubleValue (m_freq));
+ m_uplinkPropagationLossModel->SetAttribute ("Lambda", DoubleValue (300000000.0 /m_freq));
+ // cancel shadowing effect
+ m_uplinkPropagationLossModel->SetAttribute ("ShadowSigmaOutdoor", DoubleValue (0.0));
+ m_uplinkPropagationLossModel->SetAttribute ("ShadowSigmaIndoor", DoubleValue (0.0));
+ m_uplinkPropagationLossModel->SetAttribute ("ShadowSigmaExtWalls", DoubleValue (0.0));
+ m_downlinkChannel->AddPropagationLossModel (m_downlinkPropagationLossModel);
+ m_uplinkChannel->AddPropagationLossModel (m_uplinkPropagationLossModel);
+
+
+
+ Simulator::Stop (Seconds (0.1));
+ Simulator::Run ();
+ Simulator::Destroy ();
+ double loss = m_downlinkPropagationLossModel->GetLoss (m_node1, m_node2);
+
+ NS_LOG_INFO ("Calculated loss: " << loss);
+ NS_LOG_INFO ("Theoretical loss: " << m_lossRef);
+
+ NS_TEST_ASSERT_MSG_EQ_TOL(loss, m_lossRef, 0.1, "Wrong loss !");
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/buildings/test/buildings-pathloss-test.h Wed Sep 28 16:48:53 2011 +0200
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 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 <marco.miozzo@cttc.es>
+ */
+
+#ifndef BUILDINGS_PATHLOSS_TEST_H
+#define BUILDINGS_PATHLOSS_TEST_H
+
+#include <ns3/test.h>
+#include <ns3/buildings-mobility-model.h>
+#include <ns3/buildings-propagation-loss-model.h>
+
+
+using namespace ns3;
+
+
+/**
+* Test 1.1 pathloss calculation
+*/
+class BuildingsPathlossTestSuite : public TestSuite
+{
+public:
+ BuildingsPathlossTestSuite ();
+};
+
+
+class BuildingsPathlossTestCase : public TestCase
+{
+public:
+ BuildingsPathlossTestCase (double freq, Ptr<BuildingsMobilityModel> m1, Ptr<BuildingsMobilityModel> m2, BuildingsPropagationLossModel::Environment env, BuildingsPropagationLossModel::CitySize city, double refValue, std::string name);
+ virtual ~BuildingsPathlossTestCase ();
+
+private:
+ virtual void DoRun (void);
+
+ double m_freq;
+ Ptr<BuildingsMobilityModel> m_node1;
+ Ptr<BuildingsMobilityModel> m_node2;
+ BuildingsPropagationLossModel::Environment m_env;
+ BuildingsPropagationLossModel::CitySize m_city;
+ double m_lossRef;
+
+};
+
+
+#endif /* BUILDING_PATHLOSS_TEST_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/buildings/test/buildings-shadowing-test.cc Wed Sep 28 16:48:53 2011 +0200
@@ -0,0 +1,188 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+* Copyright (c) 2011 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 <marco.miozzo@cttc.es>
+*/
+
+#include "ns3/simulator.h"
+#include "ns3/log.h"
+#include "ns3/buildings-shadowing-test.h"
+#include <ns3/buildings-propagation-loss-model.h>
+#include <ns3/spectrum-model.h>
+#include <ns3/single-model-spectrum-channel.h>
+#include "ns3/string.h"
+#include "ns3/double.h"
+#include <ns3/building.h>
+#include <ns3/enum.h>
+// #include <ns3/net-device-container.h>
+// #include <ns3/lte-ue-net-device.h>
+// #include <ns3/lte-enb-net-device.h>
+// #include <ns3/lte-ue-rrc.h>
+// #include <ns3/lena-helper.h>
+// #include <ns3/lte-enb-phy.h>
+// #include <ns3/lte-ue-phy.h>
+// #include <ns3/lte-test-sinr-chunk-processor.h>
+
+NS_LOG_COMPONENT_DEFINE ("BuildingsShadowingTest");
+
+using namespace ns3;
+
+
+/**
+* Test 1.1 Shadowing compound test
+*/
+
+/**
+* This TestSuite tests the shadowing model of BuildingPathlossModel
+* by reproducing several communication scenarios
+*/
+
+
+BuildingsShadowingTestSuite::BuildingsShadowingTestSuite ()
+: TestSuite ("buildings-shadowing-test", SYSTEM)
+{
+
+
+ LogComponentEnable ("BuildingsShadowingTest", LOG_LEVEL_ALL);
+
+ // Test #1 Outdoor Model
+
+ double distance = 2000;
+ double hm = 1;
+ double hb = 30;
+ double freq = 869e6; // E_UTRA BAND #5 see table 5.5-1 of 36.101
+ Ptr<BuildingsMobilityModel> mm1 = CreateObject<BuildingsMobilityModel> ();
+ mm1->SetPosition (Vector (0.0, 0.0, hb));
+
+ Ptr<BuildingsMobilityModel> mm2 = CreateObject<BuildingsMobilityModel> ();
+ mm2->SetPosition (Vector (distance, 0.0, hm));
+
+ AddTestCase (new BuildingsShadowingTestCase (mm1, mm2, 148.86, 7.0, "Outdoor Shadowing"));
+
+ // Test #2 Indoor model
+
+ distance = 30;
+ freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
+ double henbHeight = 10.0;
+ Ptr<BuildingsMobilityModel> mm5 = CreateObject<BuildingsMobilityModel> ();
+ mm5->SetPosition (Vector (0.0, 0.0, henbHeight));
+ Ptr<Building> building1 = Create<Building> (0.0, 10.0, 0.0, 10.0, 0.0, 20.0/*, 1, 1, 1*/);
+ building1->SetBuildingType (Building::Residential);
+ building1->SetExtWallsType (Building::ConcreteWithWindows);
+ mm5->SetIndoor (building1);
+ Ptr<BuildingsMobilityModel> mm6 = CreateObject<BuildingsMobilityModel> ();
+ mm6->SetPosition (Vector (distance, 0.0, hm));
+ mm6->SetIndoor (building1);
+ mm6->SetFloorNumber (2);
+ AddTestCase (new BuildingsShadowingTestCase (mm5, mm6, 88.5724, 8.0, "Indoor Shadowing"));
+
+ // Test #3 Indoor -> Outdoor
+
+ distance = 100;
+ freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
+ Ptr<BuildingsMobilityModel> mm9 = CreateObject<BuildingsMobilityModel> ();
+ mm9->SetPosition (Vector (0.0, 0.0, henbHeight));
+ mm9->SetIndoor (building1);
+ mm9->SetFloorNumber (2);
+ Ptr<BuildingsMobilityModel> mm10 = CreateObject<BuildingsMobilityModel> ();
+ mm10->SetPosition (Vector (distance, 0.0, hm));
+ // 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 BuildingsShadowingTestCase (mm9, mm10, 85.0012, 8.6, "Indoor -> Outdoor Shadowing"));
+
+}
+
+static BuildingsShadowingTestSuite buildingsShadowingTestSuite;
+
+
+/**
+* TestCase
+*/
+
+BuildingsShadowingTestCase::BuildingsShadowingTestCase (Ptr<BuildingsMobilityModel> m1, Ptr<BuildingsMobilityModel> m2, double refValue, double sigmaRef, std::string name)
+: TestCase ("SHADOWING calculation: " + name),
+m_node1 (m1),
+m_node2 (m2),
+m_lossRef (refValue),
+m_sigmaRef (sigmaRef)
+{
+}
+
+BuildingsShadowingTestCase::~BuildingsShadowingTestCase ()
+{
+}
+
+void
+BuildingsShadowingTestCase::DoRun (void)
+{
+// LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL);
+
+ // LogComponentEnable ("LteEnbRrc", logLevel);
+ // LogComponentEnable ("LteUeRrc", logLevel);
+ // LogComponentEnable ("LteEnbMac", logLevel);
+ // LogComponentEnable ("LteUeMac", logLevel);
+ // LogComponentEnable ("LteRlc", logLevel);
+ // LogComponentEnable ("RrPacketScheduler", logLevel);
+ //
+ // LogComponentEnable ("LtePhy", logLevel);
+ // LogComponentEnable ("LteEnbPhy", logLevel);
+ // LogComponentEnable ("LteUePhy", logLevel);
+ //
+ // LogComponentEnable ("LteSpectrumPhy", logLevel);
+ // LogComponentEnable ("LteInterference", logLevel);
+ // LogComponentEnable ("LteSinrChunkProcessor", logLevel);
+ //
+ // LogComponentEnable ("LtePropagationLossModel", logLevel);
+ // LogComponentEnable ("LossModel", logLevel);
+// LogComponentEnable ("ShadowingLossModel", logLevel);
+ // LogComponentEnable ("PenetrationLossModel", logLevel);
+ // LogComponentEnable ("MultipathLossModel", logLevel);
+ // LogComponentEnable ("PathLossModel", logLevel);
+ //
+ // LogComponentEnable ("LteNetDevice", logLevel);
+ // LogComponentEnable ("LteUeNetDevice", logLevel);
+ // LogComponentEnable ("LteEnbNetDevice", logLevel);
+
+// LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL);
+ NS_LOG_INFO ("Testing " << GetName());
+
+ std::vector<double> loss;
+ double sum = 0.0;
+ double sumSquared = 0.0;
+ int samples = 10000;
+ for (int i = 0; i < samples; i++)
+ {
+ Ptr<SpectrumChannel> m_downlinkChannel = CreateObject<SingleModelSpectrumChannel> ();
+ Ptr<SpectrumChannel> m_uplinkChannel = CreateObject<SingleModelSpectrumChannel> ();
+ Ptr<BuildingsPropagationLossModel> m_downlinkPropagationLossModel = CreateObject<BuildingsPropagationLossModel> ();
+ Ptr<BuildingsPropagationLossModel> m_uplinkPropagationLossModel = CreateObject<BuildingsPropagationLossModel> ();
+ m_downlinkChannel->AddPropagationLossModel (m_downlinkPropagationLossModel);
+ m_uplinkChannel->AddPropagationLossModel (m_uplinkPropagationLossModel);
+ loss.push_back (m_downlinkPropagationLossModel->GetLoss (m_node1, m_node2) - m_lossRef);
+ sum += loss.at (loss.size()-1);
+ sumSquared += (loss.at (loss.size()-1)*loss.at (loss.size()-1));
+ }
+ double mean = sum/samples;
+ double sigma = sqrt(sumSquared/samples - (mean*mean));
+ // test whether the distribution falls in the 99% confidence interval, as expected with a nornal distribution
+ double ci = (2.575829303549 * sigma) / sqrt (samples);
+
+ NS_LOG_INFO ("Mean from simulation " << mean << ", sigma " << sigma << ", reference value " << m_sigmaRef << ", CI(99%) " << ci);
+
+ NS_TEST_ASSERT_MSG_EQ_TOL(fabs(mean), 0.0, ci, "Wrong shadowing distribution !");
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/buildings/test/buildings-shadowing-test.h Wed Sep 28 16:48:53 2011 +0200
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+* Copyright (c) 2011 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 <marco.miozzo@cttc.es>
+*/
+
+#ifndef BUILDINGS_SHADOWING_TEST_H
+#define BUILDINGS_SHADOWING_TEST_H
+
+#include "ns3/test.h"
+
+#include <ns3/buildings-mobility-model.h>
+#include <ns3/buildings-propagation-loss-model.h>
+
+
+using namespace ns3;
+
+
+/**
+* Test 1.1 shadowing calculation
+*/
+class BuildingsShadowingTestSuite : public TestSuite
+{
+ public:
+ BuildingsShadowingTestSuite ();
+};
+
+
+class BuildingsShadowingTestCase : public TestCase
+{
+ public:
+ BuildingsShadowingTestCase (Ptr<BuildingsMobilityModel> m1, Ptr<BuildingsMobilityModel> m2, double refValue, double sigmaRef, std::string name);
+ virtual ~BuildingsShadowingTestCase ();
+
+ private:
+ virtual void DoRun (void);
+
+ Ptr<BuildingsMobilityModel> m_node1;
+ Ptr<BuildingsMobilityModel> m_node2;
+ double m_lossRef; // pathloss value (without shadowing)
+ double m_sigmaRef;
+
+};
+
+#endif /*BUILDINGS_SHADOWING_TEST_H*/
\ No newline at end of file
--- a/src/lte/doc/source/conf.py Wed Sep 28 16:48:04 2011 +0200
+++ b/src/lte/doc/source/conf.py Wed Sep 28 16:48:53 2011 +0200
@@ -182,9 +182,7 @@
# ('lte-design', 'lte-doc-design.tex', u'LTE Simulator Design Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'),
# ('lte-user', 'lte-doc-user.tex', u'LTE Simulator User Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'),
#('lte', 'lte-sim-doc.tex', u'LTE Simulator Documentation', u'Centre Tecnològic de Telecomunicacions de Catalunya (CTTC)', 'manual'),
- ('lte-pathloss-design', 'lte-pathloss-design.tex', u'LTE Simulator Pathloss Desing Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'),
- ('lte-pathloss-testing', 'lte-pathloss-testing.tex', u'LTE Simulator Pathloss Testing Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'),
- ('lte-building-user', 'lte-building-user.tex', u'LTE Simulator Building Propagation User Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'),
+ ('lte-fading-design', 'lte-fading-desing.tex', u'LTE Simulator Fadign Design Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
--- a/src/lte/doc/source/lte-building-user.rst Wed Sep 28 16:48:04 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-.. include:: replace.txt
-
-
-++++++++++++++++++++++++++++++++++++++++++++++++++++++
- User Building Propagation & Mobility Model Documentation
-++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-
-Background
-**********
-
-
-
-We assume the reader is already familiar with how to use the ns-3
-simulator to run generic simulation programs. If this is not the case,
-we strongly recommend the reader to consult [ns3tutorial]_.
-
-
-Usage Overview
-**************
-
-The ns-3 LTE model is a software library that allows the simulation of
-LTE networks. The process of performing such simulations typically involves the following
-steps:
-
- 1. *Define the scenario* to be simulated
- 2. *Write a simulation program* that recreates the desired scenario
- topology/architecture. This is done accessing the ns-3 LTE model
- libraryusing the ``ns3::LenaHelper`` API defined in ``src/lte/helper/lena-helper.h``.
- 3. *Specify configuration parameters* of the objects that are being
- used for the simulation. This can be done using input files (via the
- ``ns3::ConfigStore``) or directly within the simulation program.
- 4. *Configure the desired output* to be produced by the simulator
- 5. *Run* the simulation.
-
-All these aspects will be explained in the following sections by means
-of practical examples.
-
-
-
-Basic simulation program
-------------------------
-
-In what following, a few guidelines for the usage of the ``BuildingMobilityModel`` and the ``BuildingPropagationModel`` classes.
-
-.. highlight:: none
-
-#. Inheritance::
-
- #include <ns3/buildings-mobility-model.h>
- #include <ns3/buildings-propagation-loss-model.h>
- #include <ns3/building.h>
-
-#. Propagation model selection::
-
- Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
-
- lena->SetAttribute ("PropagationModel", StringValue ("ns3::BuildingsPropagationLossModel"));
-
-#. EUTRA Band Selection
-
-The selection of the working frequency of the propagation model has to be done with the standard ns-3 attribute system as described in the correspond section ("Configuration of LTE model parameters") by means of the DlEarfcn and UlEarfcn parameters, for instance::
-
- default ns3::LteEnbNetDevice::DlEarfcn "100"
- default ns3::LteEnbNetDevice::UlEarfcn "18100"
-
-It is to be noted that any other configuration (i.e., with BuildingsPropagationLossModel attributes) might generates conflicts in the frequencies definition in the modules during the simulation.
-
-#. Mobility model selection::
-
- MobilityHelper mobility;
- mobility.SetMobilityModel ("ns3::BuildingsMobilityModel");
-
-#. Node creation and positioning::
-
- ueNodes.Create (1);
- mobility.Install (ueNodes);
- NetDeviceContainer ueDevs;
- ueDevs = lena->InstallUeDevice (ueNodes);
- Ptr<BuildingsMobilityModel> mm = enbNodes.Get (0)->GetObject<BuildingsMobilityModel> ();
- double x_axis = 0.0;
- double y_axis = 0.0;
- double z_axis = 0.0;
- mm->SetPosition (Vector (x_axis, y_axis, z_axis));
-
-#. Building creation::
-
- double x_min = 0.0;
- double x_max = 10.0;
- double y_min = 0.0;
- double y_max = 20.0;
- double z_min = 0.0;
- double z_max = 10.0;
- Ptr<Building> building = Create<Building> (x_min, x_max, y_min, y_max, z_min, z_max);
- building->SetBuildingType (Building::Residential);
- building->SetExtWallsType (Building::ConcreteWithWindows);
- building->SetFloorsNumber (3);
- building->SetNumberRoomX (3);
- building->SetNumberRoomY (2);
-
- This will instantiate a residential building with base of 10 x 20 meters and height of 10 meters with concrete with windows as external walls, three floors and a grid of rooms of 3 x 2.
-
-#. Building and nodes interactions::
-
- mm->SetIndoor (building);
- mm->SetFloorNumber (2);
- mm->SetRoomNumberX (1);
- mm->SetRoomNumberY (1);
-
- This informs node's mobility model the fact that the node is inside the building at the second floor in the corner room of the 3 x 2 grid.
- It has to be noted that the simulator does not check the consistence between the node's position and the building site, which is user's responsibility.
-
-
-
-
-
-
-
-
-
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lte/doc/source/lte-fading-design.rst Wed Sep 28 16:48:53 2011 +0200
@@ -0,0 +1,67 @@
+.. include:: replace.txt
+
+
+++++++++++++++++++++++++++++++++++++++
+ Trace Fading Loss Model Documentation
+++++++++++++++++++++++++++++++++++++++
+
+
+GSoC Model
+++++++++++
+
+The fading model of GSoC [Piro2011] is based on the Jakes Simulator. In order to limit the computational complexity, the fading is evaluated run-time by query pre-calculated traces. In detail, the simulator includes a set of fading traces 3 seconds long sampled at 1 ms for different values of speeds (i.e., 0, 3, 30, 60, 120 Kmph) and different number of signaling paths (e.g., 6, 8, 10 and 12). The traces are internally managed by loading a window (with default value of 0.5 seconds) picked up with a start instant uniformly distributed in the whole duration of a trace. The trace to be used is selected according to users' relative speed and the number of path are uniformly picked up among the available ones each window update. This implies that the traces are generated according to a specific speed and number of taps and then shared among users and RBs at the same time (by randomly select the beginning of the window).
+The Jakes Simulator used for generating the traces is a proprietary implementation of the algorithm proposed by Jakes done in Matlab which is not part of the official GSoC release.
+
+Pros.
+
+ * Reduce size of the traces (one trace shared among users and RBs)
+ * Already included in LENA
+
+Cons.
+
+ * The frequency selectivity is modeled by randomly pick up the window in the traces (i.e., there is no correlation between adjacent RBs); this modelization does not have reference in literature
+ * the total length of the trace might be low (3 seconds) for generating independent windows which might be potentially 100 RBs x (no. of users x no. of BSs)
+ * the number of path used is randomly pick up each window actualization (0.5 seconds); therefore it changes during simulation run-time each window.
+
+
+Proposed Model
+++++++++++++++
+
+We suggest the implementation of a similar model relaxing some assumptions. In detail, we propose a new trace format and trace management procedure. Regarding the model of the channel, we suggest the one provided by the ``rayleighchan`` function of Matlab since it provides a well accepted channel modelization both in time and frequency domain with the parameters we are considering, more information following the link:
+
+http://www.mathworks.es/help/toolbox/comm/ug/a1069449399.html#bq5zk36
+
+We note that, this solution allows the realization of a matlab simulation script for allowing users the generation of new traces based on specific scenario tailored needs.
+
+Analyzing the possible channel parameters, we identified the following ones as representative for accurately simulating the channel in the simulator:
+
+ * granularity in frequency, three options are available
+
+ * one value for each RB
+ * one value per group of RBs (size to be dimensioned)
+ * the same trace for all RBs but using a random offset in the trace (as done in GSoC module)
+
+ * length of the trace: ideally large as the simulation time, might be reduced by applying the window mechanism of GSoC
+ * granularity in time: the sampling time (1 ms in GSoC) of the fading might be tuned according scenario characteristics (i.e., channel low or high variable in time)
+ * speed values: speed affects the channel by varying the Doppler shift, a specific speed needs the generation of its correspondent traces
+ * number of set of taps: number of different path of the signal (scenario dependent)
+
+Since the number of variable it is pretty high, generate traces considering all of them might produce a high number of traces of huge size. The following formula express in detail the dimension:
+
+.. math::
+ T_{SIZE} = 8 \times RB_{NUM} \times \frac{T_{total}}{T_{sample}} \times DopplerShift_{NUM} \times |Taps_{NUM}|\mbox{ [bytes]}
+
+where :math:`RB_{NUM}` is the number of RB or set of RBs to be considered, :math:`T_{total}` is the total length of the trace, :math:`T_{sample}` is the sampling period (1 ms for having a new sample each subframe), :math:`DopplerShift_{NUM}` is the number of Doppler frequencies to be used and :math:`Taps_{NUM}` is the number of taps.
+According to the formula we have that a typical single channel realization (i.e., independent RB traces at a given speed and given set of number of taps with one sample per ms/TTI) implies the usage of 8,000,000 bytes (7.6294 MB) considering the precision of double (:math:`1\times10^{-308}` to :math:`1\times10^{308}`). This size can be halved by considering float numbers instead of double, reducing the precision to :math:`1\times10^{-37}` to :math:`1\times10^{37}` (and possibly increasing the computational complexity due to the cast operation between float and double, which is what is used in the simulator; this is compilator dependent and can be evaluated after implementation).
+The number of taps seems to be limited to 7 in case of pedestrian scenario and 9 in case of vehicular and urban model, according to Annex B.2 of 3GPP TS 36.104. This implies, that we need at most 3 different taps configurations, which are static during the simulation.
+
+A typical set of traces for a simulation will result therefore in:
+
+ * :math:`RB_{NUM}`: 100
+ * :math:`T_{total}`: 10 secs
+ * :math:`T_{sample}`: 0.001 secs (1 ms as a subframe)
+ * :math:`DopplerShift_{NUM}`: 0, 10 and 50 Hz for modeling (static, pedestrian a slow vehicle)
+ * :math:`Taps_{NUM}`: 3
+
+which results in 72,000,000 bytes (~6.86 MB) of traces with double precision.
+If instead of using a single trace for all UEs (with random offset UE) we want to have one independent channel trace for each UE, we need to multiply that size by the desired number of independent traces.
\ No newline at end of file
--- a/src/lte/doc/source/lte-pathloss-design.rst Wed Sep 28 16:48:04 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,414 +0,0 @@
-.. include:: replace.txt
-
-
-++++++++++++++++++++++++++++++++++++++
- Building Pathloss Model Documentation
-++++++++++++++++++++++++++++++++++++++
-
-
-Overview
-++++++++
-
-The pathloss model included in the lte module is obtained through a combination of several well known pathloss models in order to mimic heterogeneous scenarios. In fact, we are interested in modeling different environmental scenarios such as urban, suburban and open areas. Moreover, 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]_.
-
-Description of the Included Models
-++++++++++++++++++++++++++++++++++
-
-The naming used in the following will be:
-
- * User equipment:: UE
- * small cell BS (e.g., pico, femto): SC
- * BS -> eNB
-
-Both UEs and SC might be either indoor and outdoor. The model does not care about the typology of the nodes in the link pathloss computation rather then in their relative position (i.e., indoor vs. outdoor and z-axis respect to the rooftop level).
-
-For discriminate indoor and outdoor users, the model includes a specific class called ``Building`` which contains a ns3 ``Box`` class for defining the dimension of the building. In order to implements the characteristics of the pathloss models included, the ``Building`` class provides support for:
-
- * building type:
-
- * Residential (default value)
- * Office
- * Commercial
- * external walls type
-
- * Wood
- * ConcreteWithWindows (default value)
- * ConcreteWithoutWindows
- * StoneBlocks
-
- * number of floors (default value 1, which means only ground-floor)
- * number of rooms in x-axis (default value 1)
- * number of rooms in x-axis (default value 1)
-
-By means of the number of rooms in x and y axis it is possible the definition of buildings where rooms are organized in grids, typical reference scenario for femto-cells in 3GPP called dual-strip.
-
-The ``Building`` class is included in ``BuildingsMobilityModel`` class, which inherits from the ns3 class ``MobilityModel`` and it is in charge of managing the standard mobility functionalities plus the building ones (e.g., floor and room of the node).
-
-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.).
-
-The model provides the following pathloss link computations:
-
- * BS <-> UE (indoor and outdoor)
- * SC (indoor and outdoor) <-> UE (indoor and outdoor)
-
-The model will not include the following pathloss link computations:
-
- * UE <-> UE
- * BS <-> BS
- * BS <-> SC
- * SC <-> SC
-
-In the following we present the link pathloss models included.
-
-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.
-
-
-
-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<f\leq 1500\end{array} \right.
-
-There extension for the standard OH in suburban is
-
-.. math::
-
- L_\mathrm{SU} = L_\mathrm{U} - 2 \left(\log{\frac{f}{28}}\right)^2 - 5.4
-
-where
-
- :math:`L_\mathrm{U}` : pathloss in urban areas
-
-The extension for the standard OH in open area is
-
-.. math::
-
- L_\mathrm{O} = L_\mathrm{U} - 4.70 (\log{f})^2 + 18.33\log{f} - 40.94
-
-
-The literature lacks of extensions of the COST231 to open area (for suburban it seems that we can just impose C = 0); therefore we consider it a special case fo the suburban one.
-
-
-Regarding the pathloss at 2600 MHz, in literature we found a paper presenting a model coming from an empirical evaluation for urban area [pl26ghz]_:
-
-.. math::
-
- L = 36 + 26\log{d}
-
-Therefore, also in this case, the suburban and openareas environment scenarios are model as the urban one.
-
-
-Short Range Communications ITU-R P.1411 (I1411)
----------------------------------------
-
-This model is designed for short range outdoor communication in the frequency range 300 MHz to 100 GHz. It is divided in LOS and NLoS models and NLoS is split in roof-tops and canyons. The model implemented considers the LoS propagation for short distances according to 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.
-
-
-LoS within street canyons
-~~~~~~~~~~~~~~~~~~~~~~~~~
-
-This model provides an upper and lower bound respectively according to the following formulas
-
-.. math::
-
- L_\mathrm{LoS,l} = L_\mathrm{bp} + \left\{\begin{array}{ll} 20\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.
-
-.. 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).
-The analytical expression is given in the following.
-
-.. math::
-
- L_\mathrm{total} = 20\log f + N\log d + L_f(n)- 28 [dB]
-
-where:
-
- :math:`N = \left\{ \begin{array}{lll} 28 & residential \\ 30 & office \\ 22 & commercial\end{array} \right.` : power loss coefficient [dB]
-
- :math:`L_f = \left\{ \begin{array}{lll} 4n & residential \\ 15+4(n-1) & office \\ 6+3(n-1) & commercial\end{array} \right.`
-
- :math:`n` : number of floors between base station and mobile (:math:`n\ge 1`)
-
- :math:`f` : frequency [MHz]
-
- :math:`d` : distance (where :math:`d > 1`) [m]
-
-
-
-External Walls Penetration Loss (BEL)
--------------------------------------
-
-This component models the penetration loss through walls for indoor to outdoor communications and vice-versa. The values are taken from the [cost231]_ model.
-
- * Wood ~ 4 dB
- * Concrete with windows (no metallised) ~ 7 dB
- * Concrete without windows ~ 15 dB (spans between 10 and 20 in COST231)
- * Stone blocks ~ 12 dB
-
-
-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.
-
-
-
-Hybrid Model Indoor<->Outdoor
------------------------------
-
-The pathloss model characterizes the hybrid cases (i.e., when an outdoor node transmit to an indoor one and vice-versa) by adding to the proper model, evaluated according to correspond distance, the external wall penetration loss due to the building (see Section BEL).
-
-
-
-Pathloss Logic Model
-++++++++++++++++++++
-
-
-In the following the pseudo-code of the model is presented::
-
- if (txNode is outdoor)
- then
- if (rxNode is outdoor)
- then
- if (distance > 1 km)
- then
- if (rxNode or txNode is below the rooftop)
- then
- L = I1411
- else
- L = OH
- else
- L = I1411
- else (rxNode is indoor)
- if (distance > 1 km)
- then
- if (rxNode or txNode is below the rooftop)
- L = I1411 + BEL + HG
- else
- L = OH + BEL + HG
- else
- L = I1411 + BEL + HG
- else (txNode is indoor)
- if (rxNode is indoor)
- then
- if (same building)
- then
- L = I1238
- else
- L = I1411 + 2*BEL
- else (rxNode is outdoor)
- if (distance > 1 km)
- then
- if (rxNode or txNode is below the rooftop)
- then
- L = I1411 + BEL + HG
- else
- L = OH + BEL + HG
- else
- L = I1411 + BEL
-
-
-where ``txNode`` and ``rxNode`` can be one of the elements eNB, SC and UE.
-We note that for SC nodes in case that the distance is greater then 1 km, we still consider the I1411 model since it better models the transmissions with antenna below the roof-top level and moreover due to the fact that OH is specifically designed for macro cells and therefore for antennas above the roof-top level. Finally, we introduced a threshold also or SC transmissions (called ``m_itu1411DistanceThreshold``) for pruning the communications between SCs and UEs too far (the default values is fixed to 2 km).
-
-
-Shadowing Model
-+++++++++++++++
-
-The shadowing is modeled according to a log-normal distribution with variable standard deviation as function of the connection characteristics. In the implementation we considered three main possible scenarios which correspond to three standard deviations (i.e., the mean is always 0), in detail:
-
- * outdoor (``m_shadowingSigmaOutdoor``, defaul value of 7 dB) :math:`\rightarrow X_\mathrm{O} \sim N(\mu_\mathrm{O}, \sigma_\mathrm{O}^2)`.
- * indoor (``m_shadowingSigmaIndoor``, defaul value of 10 dB) :math:`\rightarrow X_\mathrm{I} \sim N(\mu_\mathrm{I}, \sigma_\mathrm{I}^2)`.
- * external walls penetration (``m_shadowingSigmaExtWalls``, default value 5 dB) :math:`\rightarrow X_\mathrm{W} \sim N(\mu_\mathrm{W}, \sigma_\mathrm{W}^2)`
-
-The simulator generates a shadowing value per each active link according to nodes' position the first time the link is used for transmitting. In case of transmissions from outdoor nodes to indoor ones, and vice-versa, the standard deviation (:math:`\sigma_\mathrm{IO}`) has to be calculated as the square root of the sum of the quadratic values of the standard deviatio in case of outdoor nodes and the one for the external walls penetration. This is due to the fact that that the components producing the shadowing are independent of each other; therefore, the variance of a distribution resulting from the sum of two independent normal ones is the sum of the variances.
-
-.. math::
-
- X \sim N(\mu,\sigma^2) \mbox{ and } Y \sim N(\nu,\tau^2)
-
- Z = X + Y \sim Z (\mu + \nu, \sigma^2 + \tau^2)
-
- \Rightarrow \sigma_\mathrm{IO} = \sqrt{\sigma_\mathrm{O}^2 + \sigma_\mathrm{W}^2}
-
--- a/src/lte/doc/source/lte-pathloss-testing.rst Wed Sep 28 16:48:04 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-+++++++++++++++++++++++++++++++++++++
- Pathloss Model Testing Documentation
-+++++++++++++++++++++++++++++++++++++
-
-
-Overview
-********
-
-To test and validate the ns-3 Building Pathloss module, a test suites is provided which are integrated with the ns-3 test framework in the lte module.
-To run them, you need to have configured the build of the simulator in this way::
-
- ./waf configure --enable-tests --enable-modules=lte --enable-examples
- ./test.py
-
-The above will run not only the test suites belonging to the LTE module, but also those belonging to all the other ns-3 modules on which the LTE module depends. See the ns-3 manual for generic information on the testing framework.
-
-You can get a more detailed report in HTML format in this way::
-
- ./test.py -w results.html
-
-After the above command has run, you can view the detailed result for each test by opening the file ``results.html`` with a web browser.
-
-You can run each test suite separately using this command::
-
- ./test.py -s test-suite-name
-
-For more details about ``test.py`` and the ns-3 testing framework, please refer to the ns-3 manual.
-
-
-
-Description of the test suite
-*****************************
-
-The test suite ``lte-pathloss-model`` creates different test cases with
-both unit and system tests. The formers validate the single component model and the pathloss logic behavior. The latter proof the integration of the pathloss model in the ns3 framework and more in specifically in the lte module. Finally. a unit test is provided in order to test the shadowing characterization.
-
-Unit Tests
-~~~~~~~~~~
-
-The unit tests are carried out by comparing the expected results of the pathloss module in specific scenarios with pre calculated values obtained offline with an Octave script (/test/reference/lte-pathloss.m). The tests are considered passed if the two values differs only for a predefined tolerance (0.1) that accounts for the approximations due to floating point arithmetics.
-
-In the following we detailed the scenarios considered, their selection has been done for covering the wide set of possible pathloss logic combinations. The pathloss logic results therefore implicitly tested.
-
-Test #1 Okumura Hata
---------------------
-
-In this test we test the standard Okumura Hata model; therefore both eNB and UE are placed outside at a distance of 2000 m. The frequency used is the E-UTRA band #5, which correspond to 869 MHz (see table 5.5-1 of 36.101). The test includes also the validation of the areas extensions (i.e., urban, suburban and open-areas) and of the city size (small, medium and large).
-
-Test #2 COST231 Model
----------------------
-
-This test is aimed at validating the COST231 model. The test is similar to the Okumura Hata one, except that the frequency used is the EUTRA band #1 (2140 MHz) and that the test can be performed only for large and small cities in urban scenarios due to model limitations.
-
-Test #3 2.6 GHz model
----------------------
-
-This test validates the 2.6 empirical model [pl26ghz]_. The test is similar to Okumura Hata one except that the frequency is the EUTRA band #7 (2620 MHz) and the test can be performed only in urban scenario.
-
-Test #4 ITU1411 LoS model
--------------------------
-
-This test is aimed at validating the ITU1411 model in case of line of sight within street canyons transmissions. In this case the UE is placed at 100 meters far from the eNB, since the threshold for switching between LoS and NLoS is left to default one (i.e., 200 m.).
-
-Test #5 ITU1411 NLoS model
---------------------------
-
-This test is aimed at validating the ITU1411 model in case of non line of sight over the rooftop transmissions. In this case the UE is placed at 900 meters far from the eNB, in order to be above the threshold for switching between LoS and NLoS is left to default one (i.e., 200 m.).
-
-Test #6 ITUP1238 model
-----------------------
-
-This test is aimed at validating the ITUP1238 model in case of indoor transmissions. In this case both the UE and the eNB are placed in a residential building with walls made of concrete with windows. Ue is placed at the second floor and distances 30 meters far from the eNB, which is placed at the first floor.
-
-Test #7 Outdoor -> Indoor with Okumura Hata model
--------------------------------------------------
-
-This test validates the outdoor to indoor transmissions for large distances. In this case the UE is placed in a residential building with wall made of concrete with windows and distances 2000 meters from the outdoor eNB.
-
-Test #8 Outdoor -> Indoor with ITU1411 model
--------------------------------------------------
-
-This test validates the outdoor to indoor transmissions for short distances. In this case the UE is placed in a residential building with walls made of concrete with windows and distances 100 meters from the outdoor eNB.
-
-
-Test #9 Indoor -> Outdoor with ITU1411 model
--------------------------------------------------
-
-This test validates the outdoor to indoor transmissions for very short distances. In this case the eNB is placed in the second floor of a residential building with walls made of concrete with windows and distances 100 meters from the outdoor UE (i.e., LoS communication). Therefore the height gain has to be included in the pathloss evaluation.
-
-Test #10 Indoor -> Outdoor with ITU1411 model
--------------------------------------------------
-
-This test validates the outdoor to indoor transmissions for short distances. In this case the eNB is placed in the second floor of a residential building with walls made of concrete with windows and distances 500 meters from the outdoor UE (i.e., NLoS communication). Therefore the height gain has to be included in the pathloss evaluation.
-
-
-System Test
-~~~~~~~~~~~
-
-The aim of the system test is to verify the integration of the BuildingPathlossModel with the ns3 simulator and in particular with the lte module. The test exploits a set of three pre calculated losses for generating the expected SINR at the receiver counting the transmission and the noise powers. These SINR values are compared with the results obtained from a lte simulation. The losses are calculated off-line with an Octave script (/test/reference/lte-pathloss.m).
-
-
-Shadowing Test
-~~~~~~~~~~~~~~
-
-This unit test is intended to verify the statistics distribution characteristics of the shadowing are the one expected. The shadowing is modeled according to a normal distribution with mean 0 and variable standard deviation (usually called sigma), according to the standard models used in literature.
-The test generates 10,000 samples of shadowing by subtracting the deterministic component from the total loss returned by the ``BuildingPathlossModel``. The mean and variance of the shadowing samples are then used to verify whether the 99% confidence interval is respected by the sequence generated by the simulator.
-
--- a/src/lte/test/lte-test-pathloss-model.cc Wed Sep 28 16:48:04 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,559 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2011 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 <marco.miozzo@cttc.es>
- */
-
-#include "ns3/simulator.h"
-
-#include "ns3/log.h"
-
-#include "ns3/spectrum-test.h"
-
-#include "ns3/lte-phy-tag.h"
-#include "ns3/lte-test-ue-phy.h"
-#include "ns3/lte-sinr-chunk-processor.h"
-
-#include "ns3/lte-test-pathloss-model.h"
-#include <ns3/buildings-propagation-loss-model.h>
-#include <ns3/node-container.h>
-#include <ns3/mobility-helper.h>
-#include <ns3/lena-helper.h>
-#include <ns3/single-model-spectrum-channel.h>
-#include "ns3/string.h"
-#include "ns3/double.h"
-#include <ns3/building.h>
-#include <ns3/enum.h>
-#include <ns3/net-device-container.h>
-#include <ns3/lte-ue-net-device.h>
-#include <ns3/lte-enb-net-device.h>
-#include <ns3/lte-ue-rrc.h>
-#include <ns3/lena-helper.h>
-#include <ns3/lte-enb-phy.h>
-#include <ns3/lte-ue-phy.h>
-#include "lte-test-sinr-chunk-processor.h"
-
-NS_LOG_COMPONENT_DEFINE ("LtePathlossModelTest");
-
-using namespace ns3;
-
-
-/**
- * Test 1.1 Pathloss compound test
- */
-
-/**
- * This TestSuite tests the BuildingPathlossModel by reproducing
- * several communication scenarios
- */
-
-
-void
-LteTestPathlossDlSchedCallback (LtePathlossModelSystemTestCase *testcase, std::string path,
- uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
- uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
-{
- testcase->DlScheduling (frameNo, subframeNo, rnti, mcsTb1, sizeTb1, mcsTb2, sizeTb2);
-}
-
-
-
-LtePathlossModelTestSuite::LtePathlossModelTestSuite ()
- : TestSuite ("lte-pathloss-model", SYSTEM)
-{
-
-
-// -------------- COMPOUND TESTS ----------------------------------
-
- LogComponentEnable ("LtePathlossModelTest", LOG_LEVEL_ALL);
-
- // NS_LOG_INFO ("Creating LteDownlinkSinrTestSuite");
-
- Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
-
- lena->SetAttribute ("PropagationModel", StringValue ("ns3::BuildingsPropagationLossModel"));
-
- // Create Nodes: eNodeB, home eNB, UE and home UE (UE attached to HeNB)
- NodeContainer enbNodes;
- NodeContainer henbNodes;
- NodeContainer ueNodes;
- NodeContainer hueNodes;
- enbNodes.Create (1);
- henbNodes.Create (2);
- ueNodes.Create (5);
- hueNodes.Create (3);
-
- // Install Mobility Model
- MobilityHelper mobility;
- mobility.SetMobilityModel ("ns3::BuildingsMobilityModel");
- mobility.Install (enbNodes);
- mobility.Install (henbNodes);
- mobility.Install (ueNodes);
- mobility.Install (hueNodes);
-
- NetDeviceContainer enbDevs;
- NetDeviceContainer henbDevs;
- NetDeviceContainer ueDevs;
- NetDeviceContainer hueDevs;
- enbDevs = lena->InstallEnbDevice (enbNodes);
- ueDevs = lena->InstallUeDevice (ueNodes);
- henbDevs = lena->InstallEnbDevice (henbNodes);
- hueDevs = lena->InstallUeDevice (hueNodes);
-
-
-
- lena->Attach (ueDevs, enbDevs.Get (0));
- lena->Attach (hueDevs, henbDevs.Get (0));
-
-// Test #1 Okumura Hata Model (150 < freq < 1500 MHz) (Macro<->UE)
-
- double distance = 2000;
- double hm = 1;
- double hb = 30;
- double freq = 869e6; // E_UTRA BAND #5 see table 5.5-1 of 36.101
- Ptr<BuildingsMobilityModel> mm1 = enbNodes.Get (0)->GetObject<BuildingsMobilityModel> ();
- mm1->SetPosition (Vector (0.0, 0.0, hb));
-
- Ptr<BuildingsMobilityModel> mm2 = ueNodes.Get (0)->GetObject<BuildingsMobilityModel> ();
- mm2->SetPosition (Vector (distance, 0.0, hm));
-
- AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 137.93, "OH Urban Large city = ??"));
-
- AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 137.88, "OH Urban small city = ??"));
-
- AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::SubUrban, BuildingsPropagationLossModel::Large, 128.03, "loss OH SubUrban"));
-
- AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::OpenAreas, BuildingsPropagationLossModel::Large, 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 LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 148.55, "COST231 Urban Large city"));
-
- AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 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 LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 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
- distance = 100;
- Ptr<BuildingsMobilityModel> mm3 = ueNodes.Get (1)->GetObject<BuildingsMobilityModel> ();
- mm3->SetPosition (Vector (distance, 0.0, hm));
- AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm3, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 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
- distance = 900;
-
- Ptr<BuildingsMobilityModel> mm4 = ueNodes.Get (2)->GetObject<BuildingsMobilityModel> ();
- mm4->SetPosition (Vector (distance, 0.0, hm));
- AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm4, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 143.69, "ITU1411 NLOS"));
-
- // Test #6 ITUP1238 (HeNB <-> UE)
-
- distance = 30;
- freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
- double henbHeight = 10.0;
- Ptr<BuildingsMobilityModel> mm5 = henbNodes.Get (0)->GetObject<BuildingsMobilityModel> ();
- mm5->SetPosition (Vector (0.0, 0.0, henbHeight));
- Ptr<Building> building1 = Create<Building> (0.0, 10.0, 0.0, 10.0, 0.0, 20.0/*, 1, 1, 1*/);
- building1->SetBuildingType (Building::Residential);
- building1->SetExtWallsType (Building::ConcreteWithWindows);
- mm5->SetIndoor (building1);
- Ptr<BuildingsMobilityModel> mm6 = hueNodes.Get (0)->GetObject<BuildingsMobilityModel> ();
- mm6->SetPosition (Vector (distance, 0.0, hm));
- mm6->SetIndoor (building1);
- mm6->SetFloorNumber (2);
- AddTestCase (new LtePathlossModelTestCase (freq, mm5, mm6, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 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
- distance = 2000;
- // 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
- Ptr<BuildingsMobilityModel> mm7 = ueNodes.Get (3)->GetObject<BuildingsMobilityModel> ();
- mm7->SetPosition (Vector (distance, 0.0, hm));
- mm7->SetIndoor (building1);
- AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm7, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 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
- distance = 100;
- Ptr<BuildingsMobilityModel> mm8 = ueNodes.Get (4)->GetObject<BuildingsMobilityModel> ();
- mm8->SetPosition (Vector (distance, 0.0, hm));
- mm8->SetIndoor (building1);
- // 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 LtePathlossModelTestCase (freq, mm1, mm8, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 88.000, "ITU1411 LOS Outdoor -> Indoor"));
-
- // Test #9 Indoor -> Outdoor LOS (HeNB <-> UE)
-
- distance = 100;
- freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
- Ptr<BuildingsMobilityModel> mm9 = henbNodes.Get (1)->GetObject<BuildingsMobilityModel> ();
- mm9->SetPosition (Vector (0.0, 0.0, henbHeight));
- mm9->SetIndoor (building1);
- mm9->SetFloorNumber (2);
- Ptr<BuildingsMobilityModel> mm10 = hueNodes.Get (1)->GetObject<BuildingsMobilityModel> ();
- mm10->SetPosition (Vector (distance, 0.0, hm));
- // 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 LtePathlossModelTestCase (freq, mm9, mm10, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 84.838, "ITU1411 LOS Indoor -> Outdoor"));
-
- // Test #10 Indoor -> Outdoor NLOS (HeNB <-> UE)
-
- distance = 500;
- freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
- Ptr<BuildingsMobilityModel> mm11 = hueNodes.Get (2)->GetObject<BuildingsMobilityModel> ();
- mm11->SetPosition (Vector (distance, 0.0, hm));
- // 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 LtePathlossModelTestCase (freq, mm9, mm11, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 183.90, "ITU1411 NLOS Indoor -> Outdoor"));
-
-
-//------------------- SYSTEM TEST ------------------------------
-
-LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL);
-//
-// LogComponentEnable ("LenaHelper", logLevel);
-LogComponentEnable ("LtePathlossModelTest", logLevel);
-// LogComponentEnable ("BuildingsPropagationLossModel", logLevel);
-// LogComponentEnable ("LteInterference", logLevel);
-// LogComponentEnable ("LteSpectrumValueHelper", logLevel);
-
-
-struct SnrEfficiencyMcs
-{
- double snrDb;
- double efficiency;
- int mcsIndex;
-};
-
-/**
-* Test vectors: SNRDB, Spectral Efficiency, MCS index
-* From XXX
-*/
-SnrEfficiencyMcs snrEfficiencyMcs[] = {
- { -5.00000, 0.08024, -1},
- { -4.00000, 0.10030, -1},
- { -3.00000, 0.12518, -1},
- { -2.00000, 0.15589, 0},
- { -1.00000, 0.19365, 0},
- { 0.00000, 0.23983, 2},
- { 1.00000, 0.29593, 2},
- { 2.00000, 0.36360, 2},
- { 3.00000, 0.44451, 4},
- { 4.00000, 0.54031, 4},
- { 5.00000, 0.65251, 6},
- { 6.00000, 0.78240, 6},
- { 7.00000, 0.93086, 8},
- { 8.00000, 1.09835, 8},
- { 9.00000, 1.28485, 10},
- { 10.00000, 1.48981, 12},
- { 11.00000, 1.71229, 12},
- { 12.00000, 1.95096, 14},
- { 13.00000, 2.20429, 14},
- { 14.00000, 2.47062, 16},
- { 15.00000, 2.74826, 18},
- { 16.00000, 3.03560, 18},
- { 17.00000, 3.33115, 20},
- { 18.00000, 3.63355, 20},
- { 19.00000, 3.94163, 22},
- { 20.00000, 4.25439, 22},
- { 21.00000, 4.57095, 24},
- { 22.00000, 4.89060, 24},
- { 23.00000, 5.21276, 26},
- { 24.00000, 5.53693, 26},
- { 25.00000, 5.86271, 28},
- { 26.00000, 6.18980, 28},
- { 27.00000, 6.51792, 28},
- { 28.00000, 6.84687, 28},
- { 29.00000, 7.17649, 28},
- { 30.00000, 7.50663, 28},
-};
-
-
-double txPowerDbm = 30; // default eNB TX power over whole bandwdith
-double txPowerLin = pow (10, (txPowerDbm - 30)/10);
-double ktDbm = -174; // reference LTE noise PSD
-double noisePowerDbm = ktDbm + 10 * log10 (25 * 180000); // corresponds to kT*bandwidth in linear units
-double receiverNoiseFigureDb = 9.0; // default UE noise figure
-double noiseLin = pow (10, (noisePowerDbm-30+receiverNoiseFigureDb)/10);
-double loss[] = {81.021418, 134.038391, 144.190675};
-double dist[] = {100.0, 500.0, 1500};
-
-int numOfTests = sizeof (loss) / sizeof (double);
-for ( int i = 0 ; i < numOfTests; i++ )
-{
- // double lossDb = txPowerDbm - snrEfficiencyMcs[i].snrDb - noisePowerDbm - receiverNoiseFigureDb;
- double sinrLin = (txPowerLin/(pow(10, loss[i]/10))) / noiseLin;
- // double sinrDb = txPowerDbm- noisePowerDbm - receiverNoiseFigureDb - loss[i];
- double sinrDb = 10*log10(sinrLin);
- NS_LOG_INFO (" Ptx " << txPowerDbm << " Pn " << noisePowerDbm << " Fn " << receiverNoiseFigureDb << " Pl " << loss[i] << " dist " << dist[i]);
- std::ostringstream name;
- name << " snr= " << sinrDb << " dB, "
- << " mcs= " << snrEfficiencyMcs[i].mcsIndex;
- AddTestCase (new LtePathlossModelSystemTestCase (name.str (), sinrDb, dist[i], snrEfficiencyMcs[i].mcsIndex));
-}
-
-
-
-
-
-}
-
-static LtePathlossModelTestSuite ltePathlossModelTestSuite;
-
-
-/**
- * TestCase
- */
-
-LtePathlossModelTestCase::LtePathlossModelTestCase (double freq, Ptr<BuildingsMobilityModel> m1, Ptr<BuildingsMobilityModel> m2, BuildingsPropagationLossModel::Environment env, BuildingsPropagationLossModel::CitySize city, double refValue, std::string name)
- : TestCase ("LOSS calculation: " + name),
- m_freq (freq),
- m_node1 (m1),
- m_node2 (m2),
- m_env (env),
- m_city (city),
- m_lossRef (refValue)
-{
-}
-
-LtePathlossModelTestCase::~LtePathlossModelTestCase ()
-{
-}
-
-void
-LtePathlossModelTestCase::DoRun (void)
-{
-// LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL);
-
-// LogComponentEnable ("LteEnbRrc", logLevel);
-// LogComponentEnable ("LteUeRrc", logLevel);
-// LogComponentEnable ("LteEnbMac", logLevel);
-// LogComponentEnable ("LteUeMac", logLevel);
-// LogComponentEnable ("LteRlc", logLevel);
-// LogComponentEnable ("RrPacketScheduler", logLevel);
-//
-// LogComponentEnable ("LtePhy", logLevel);
-// LogComponentEnable ("LteEnbPhy", logLevel);
-// LogComponentEnable ("LteUePhy", logLevel);
-//
-// LogComponentEnable ("LteSpectrumPhy", logLevel);
-// LogComponentEnable ("LteInterference", logLevel);
-// LogComponentEnable ("LteSinrChunkProcessor", logLevel);
-//
-// LogComponentEnable ("LtePropagationLossModel", logLevel);
-// LogComponentEnable ("LossModel", logLevel);
-// LogComponentEnable ("ShadowingLossModel", logLevel);
-// LogComponentEnable ("PenetrationLossModel", logLevel);
-// LogComponentEnable ("MultipathLossModel", logLevel);
-// LogComponentEnable ("PathLossModel", logLevel);
-//
-// LogComponentEnable ("LteNetDevice", logLevel);
-// LogComponentEnable ("LteUeNetDevice", logLevel);
-// LogComponentEnable ("LteEnbNetDevice", logLevel);
-
- LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL);
- NS_LOG_INFO ("Testing " << GetName());
-
- Ptr<SpectrumChannel> m_downlinkChannel = CreateObject<SingleModelSpectrumChannel> ();
- Ptr<SpectrumChannel> m_uplinkChannel = CreateObject<SingleModelSpectrumChannel> ();
- Ptr<BuildingsPropagationLossModel> m_downlinkPropagationLossModel = CreateObject<BuildingsPropagationLossModel> ();
- m_downlinkPropagationLossModel->SetAttribute ("Frequency", DoubleValue (m_freq));
- m_downlinkPropagationLossModel->SetAttribute ("Lambda", DoubleValue (300000000.0 /m_freq));
- m_downlinkPropagationLossModel->SetAttribute ("Environment", EnumValue (m_env));
- m_downlinkPropagationLossModel->SetAttribute ("CitySize", EnumValue (m_city));
- // cancel shadowing effect
- m_downlinkPropagationLossModel->SetAttribute ("ShadowSigmaOutdoor", DoubleValue (0.0));
- m_downlinkPropagationLossModel->SetAttribute ("ShadowSigmaIndoor", DoubleValue (0.0));
- m_downlinkPropagationLossModel->SetAttribute ("ShadowSigmaExtWalls", DoubleValue (0.0));
- Ptr<BuildingsPropagationLossModel> m_uplinkPropagationLossModel = CreateObject<BuildingsPropagationLossModel> ();
- m_uplinkPropagationLossModel->SetAttribute ("Frequency", DoubleValue (m_freq));
- m_uplinkPropagationLossModel->SetAttribute ("Lambda", DoubleValue (300000000.0 /m_freq));
- // cancel shadowing effect
- m_uplinkPropagationLossModel->SetAttribute ("ShadowSigmaOutdoor", DoubleValue (0.0));
- m_uplinkPropagationLossModel->SetAttribute ("ShadowSigmaIndoor", DoubleValue (0.0));
- m_uplinkPropagationLossModel->SetAttribute ("ShadowSigmaExtWalls", DoubleValue (0.0));
- m_downlinkChannel->AddPropagationLossModel (m_downlinkPropagationLossModel);
- m_uplinkChannel->AddPropagationLossModel (m_uplinkPropagationLossModel);
-
-
-
- Simulator::Stop (Seconds (0.1));
- Simulator::Run ();
- Simulator::Destroy ();
- double loss = m_downlinkPropagationLossModel->GetLoss (m_node1, m_node2);
-
- NS_LOG_INFO ("Calculated loss: " << loss);
- NS_LOG_INFO ("Theoretical loss: " << m_lossRef);
-
- NS_TEST_ASSERT_MSG_EQ_TOL(loss, m_lossRef, 0.1, "Wrong loss !");
-}
-
-
-//-------------------- SYSTEM TEST ---------------------------------
-
-
-LtePathlossModelSystemTestCase::LtePathlossModelSystemTestCase (std::string name, double snrDb, double dist, uint16_t mcsIndex)
-: TestCase (name),
-m_snrDb (snrDb),
-m_distance (dist),
-m_mcsIndex (mcsIndex)
-{
- std::ostringstream sstream1, sstream2;
- sstream1 << " snr=" << snrDb
- << " mcs=" << mcsIndex << " distance=" << dist;
-
- NS_LOG_INFO ("Creating LtePathlossModelSystemTestCase: " + sstream1.str ());
-}
-
-LtePathlossModelSystemTestCase::~LtePathlossModelSystemTestCase ()
-{
-}
-
-void
-LtePathlossModelSystemTestCase::DoRun (void)
-{
- /**
- * Simulation Topology
- */
-// LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL);
-// LogComponentEnable ("LteAmc", LOG_LEVEL_ALL);
-// LogComponentEnable ("LtePhy", LOG_LEVEL_ALL);
-// LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL);
-// LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL);
-// LogComponentEnable ("SingleModelSpectrumChannel", LOG_LEVEL_ALL);
- LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL);
- LogComponentEnable ("LenaHelper", LOG_LEVEL_ALL);
-// LogComponentDisable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL);
-//
- Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
- // lena->EnableLogComponents ();
- lena->EnableMacTraces ();
- lena->EnableRlcTraces ();
- lena->SetAttribute ("PropagationModel", StringValue ("ns3::BuildingsPropagationLossModel"));
- // set frequency
- // this should not be done, since it is charge the Helper of this task using the netdevice settings (earfc parameter)
- double freq = 2.114e+09;
- lena->SetPropagationModelAttribute ("Frequency", DoubleValue (freq));
- lena->SetPropagationModelAttribute ("Lambda", DoubleValue (300000000.0 /freq));
-
- // remove shadowing component
- lena->SetPropagationModelAttribute ("ShadowSigmaOutdoor", DoubleValue (0.0));
- lena->SetPropagationModelAttribute ("ShadowSigmaIndoor", DoubleValue (0.0));
- lena->SetPropagationModelAttribute ("ShadowSigmaExtWalls", DoubleValue (0.0));
-
- // Create Nodes: eNodeB and UE
- NodeContainer enbNodes;
- NodeContainer ueNodes;
- enbNodes.Create (1);
- ueNodes.Create (1);
- NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes );
-
- // Install Mobility Model
- MobilityHelper mobility;
- mobility.SetMobilityModel ("ns3::BuildingsMobilityModel");
- mobility.Install (allNodes);
-
- // Create Devices and install them in the Nodes (eNB and UE)
- NetDeviceContainer enbDevs;
- NetDeviceContainer ueDevs;
- lena->SetSchedulerType ("ns3::RrFfMacScheduler");
- enbDevs = lena->InstallEnbDevice (enbNodes);
- ueDevs = lena->InstallUeDevice (ueNodes);
-
- Ptr<BuildingsMobilityModel> mm_enb = enbNodes.Get (0)->GetObject<BuildingsMobilityModel> ();
- mm_enb->SetPosition (Vector (0.0, 0.0, 30.0));
- Ptr<BuildingsMobilityModel> mm_ue = ueNodes.Get (0)->GetObject<BuildingsMobilityModel> ();
- mm_ue->SetPosition (Vector (m_distance, 0.0, 1.0));
-
- Ptr<LteEnbNetDevice> lteEnbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
- Ptr<LteEnbPhy> enbPhy = lteEnbDev->GetPhy ();
- enbPhy->SetAttribute ("TxPower", DoubleValue (30.0));
- enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0));
-
- Ptr<LteUeNetDevice> lteUeDev = ueDevs.Get (0)->GetObject<LteUeNetDevice> ();
- Ptr<LteUePhy> uePhy = lteUeDev->GetPhy ();
- uePhy->SetAttribute ("TxPower", DoubleValue (23.0));
- uePhy->SetAttribute ("NoiseFigure", DoubleValue (9.0));
-
-
- // Attach a UE to a eNB
- lena->Attach (ueDevs, enbDevs.Get (0));
-
-
- // Activate an EPS bearer
- enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
- EpsBearer bearer (q);
- lena->ActivateEpsBearer (ueDevs, bearer);
-
- // Use testing chunk processor in the PHY layer
- // It will be used to test that the SNR is as intended
- //Ptr<LtePhy> uePhy = ueDevs.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetObject<LtePhy> ();
- Ptr<LteTestSinrChunkProcessor> testSinr = Create<LteTestSinrChunkProcessor> (uePhy);
- uePhy->GetDownlinkSpectrumPhy ()->AddSinrChunkProcessor (testSinr);
-
-// Config::Connect ("/NodeList/0/DeviceList/0/LteEnbMac/DlScheduling",
-// MakeBoundCallback (&LteTestPathlossDlSchedCallback, this));
-
- Simulator::Stop (Seconds (0.005));
- Simulator::Run ();
-
- double calculatedSinrDb = 10.0 * log10 (testSinr->GetSinr ()[0]);
- NS_LOG_INFO ("Distance " << m_distance << " Calculated SINR " << calculatedSinrDb << " ref " << m_snrDb);
- Simulator::Destroy ();
- NS_TEST_ASSERT_MSG_EQ_TOL (calculatedSinrDb, m_snrDb, 0.001, "Wrong SINR !");
-}
-
-
-void
-LtePathlossModelSystemTestCase::DlScheduling (uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
- uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
-{
- static bool firstTime = true;
-
- if ( firstTime )
- {
- firstTime = false;
- NS_LOG_INFO ("SNR\tRef_MCS\tCalc_MCS");
- }
-
- /**
- * Note:
- * For first 4 subframeNo in the first frameNo, the MCS cannot be properly evaluated,
- * because CQI feedback is still not available at the eNB.
- */
- if ( (frameNo > 1) || (subframeNo > 4) )
- {
- NS_LOG_INFO (m_snrDb << "\t" << m_mcsIndex << "\t" << (uint16_t)mcsTb1);
-
- NS_TEST_ASSERT_MSG_EQ ((uint16_t)mcsTb1, m_mcsIndex, "Wrong MCS index");
- }
-}
-
--- a/src/lte/test/lte-test-pathloss-model.h Wed Sep 28 16:48:04 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2011 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 <marco.miozzo@cttc.es>
- */
-
-#ifndef LTE_TEST_PATHLOSS_MODEL_H
-#define LTE_TEST_PATHLOSS_MODEL_H
-
-#include "ns3/spectrum-value.h"
-
-#include "ns3/test.h"
-
-#include <ns3/buildings-mobility-model.h>
-#include <ns3/buildings-propagation-loss-model.h>
-
-
-using namespace ns3;
-
-
-/**
- * Test 1.1 pathloss calculation
- */
-class LtePathlossModelTestSuite : public TestSuite
-{
-public:
- LtePathlossModelTestSuite ();
-};
-
-
-class LtePathlossModelTestCase : public TestCase
-{
-public:
- LtePathlossModelTestCase (double freq, Ptr<BuildingsMobilityModel> m1, Ptr<BuildingsMobilityModel> m2, BuildingsPropagationLossModel::Environment env, BuildingsPropagationLossModel::CitySize city, double refValue, std::string name);
- virtual ~LtePathlossModelTestCase ();
-
-private:
- virtual void DoRun (void);
-
-// Ptr<SpectrumValue> m_sv;
-// Ptr<const SpectrumModel> m_sm;
-// Ptr<SpectrumValue> m_sinr;
- double m_freq;
- Ptr<BuildingsMobilityModel> m_node1;
- Ptr<BuildingsMobilityModel> m_node2;
- BuildingsPropagationLossModel::Environment m_env;
- BuildingsPropagationLossModel::CitySize m_city;
- double m_lossRef;
-
-};
-
-class LtePathlossModelSystemTestCase : public TestCase
-{
- public:
- LtePathlossModelSystemTestCase (std::string name, double snrDb, double dist, uint16_t mcsIndex);
- LtePathlossModelSystemTestCase ();
- virtual ~LtePathlossModelSystemTestCase ();
-
- void DlScheduling (uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
- uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2);
-
- private:
- virtual void DoRun (void);
-
- double m_snrDb;
- double m_distance;
- uint16_t m_mcsIndex;
-};
-
-
-#endif /* LTE_TEST_PATHLOSS_MODEL_H */
-
--- a/src/lte/test/lte-test-shadowing.cc Wed Sep 28 16:48:04 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,237 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
-* Copyright (c) 2011 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 <marco.miozzo@cttc.es>
-*/
-
-#include "ns3/simulator.h"
-
-#include "ns3/log.h"
-
-#include "ns3/spectrum-test.h"
-
-#include "ns3/lte-phy-tag.h"
-#include "ns3/lte-test-ue-phy.h"
-#include "ns3/lte-sinr-chunk-processor.h"
-
-#include "ns3/lte-test-shadowing.h"
-#include <ns3/buildings-propagation-loss-model.h>
-#include <ns3/node-container.h>
-#include <ns3/mobility-helper.h>
-#include <ns3/lena-helper.h>
-#include <ns3/single-model-spectrum-channel.h>
-#include "ns3/string.h"
-#include "ns3/double.h"
-#include <ns3/building.h>
-#include <ns3/enum.h>
-#include <ns3/net-device-container.h>
-#include <ns3/lte-ue-net-device.h>
-#include <ns3/lte-enb-net-device.h>
-#include <ns3/lte-ue-rrc.h>
-#include <ns3/lena-helper.h>
-#include <ns3/lte-enb-phy.h>
-#include <ns3/lte-ue-phy.h>
-#include "lte-test-sinr-chunk-processor.h"
-
-NS_LOG_COMPONENT_DEFINE ("LteShadowingTest");
-
-using namespace ns3;
-
-
-/**
-* Test 1.1 Shadowing compound test
-*/
-
-/**
-* This TestSuite tests the shadowing model of BuildingPathlossModel
-* by reproducing several communication scenarios
-*/
-
-
-LteShadowingTestSuite::LteShadowingTestSuite ()
-: TestSuite ("lte-shadowing-model", SYSTEM)
-{
-
-
- // -------------- UNIT TESTS ----------------------------------
-
- LogComponentEnable ("LteShadowingTest", LOG_LEVEL_ALL);
-
- // NS_LOG_INFO ("Creating LteDownlinkSinrTestSuite");
-
- Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
-
- lena->SetAttribute ("PropagationModel", StringValue ("ns3::BuildingsPropagationLossModel"));
-
- // Create Nodes: eNodeB, home eNB, UE and home UE (UE attached to HeNB)
- NodeContainer enbNodes;
- NodeContainer henbNodes;
- NodeContainer ueNodes;
- NodeContainer hueNodes;
- enbNodes.Create (1);
- henbNodes.Create (2);
- ueNodes.Create (5);
- hueNodes.Create (3);
-
- // Install Mobility Model
- MobilityHelper mobility;
- mobility.SetMobilityModel ("ns3::BuildingsMobilityModel");
- mobility.Install (enbNodes);
- mobility.Install (henbNodes);
- mobility.Install (ueNodes);
- mobility.Install (hueNodes);
-
- NetDeviceContainer enbDevs;
- NetDeviceContainer henbDevs;
- NetDeviceContainer ueDevs;
- NetDeviceContainer hueDevs;
- enbDevs = lena->InstallEnbDevice (enbNodes);
- ueDevs = lena->InstallUeDevice (ueNodes);
- henbDevs = lena->InstallEnbDevice (henbNodes);
- hueDevs = lena->InstallUeDevice (hueNodes);
-
-
-
- lena->Attach (ueDevs, enbDevs.Get (0));
- lena->Attach (hueDevs, henbDevs.Get (0));
-
- // Test #1 Outdoor Model
-
- double distance = 2000;
- double hm = 1;
- double hb = 30;
- double freq = 869e6; // E_UTRA BAND #5 see table 5.5-1 of 36.101
- Ptr<BuildingsMobilityModel> mm1 = enbNodes.Get (0)->GetObject<BuildingsMobilityModel> ();
- mm1->SetPosition (Vector (0.0, 0.0, hb));
-
- Ptr<BuildingsMobilityModel> mm2 = ueNodes.Get (0)->GetObject<BuildingsMobilityModel> ();
- mm2->SetPosition (Vector (distance, 0.0, hm));
-
- AddTestCase (new LteShadowingTestCase (mm1, mm2, 148.86, 7.0, "Outdoor Shadowing"));
-
- // Test #2 Indoor model
-
- distance = 30;
- freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
- double henbHeight = 10.0;
- Ptr<BuildingsMobilityModel> mm5 = henbNodes.Get (0)->GetObject<BuildingsMobilityModel> ();
- mm5->SetPosition (Vector (0.0, 0.0, henbHeight));
- Ptr<Building> building1 = Create<Building> (0.0, 10.0, 0.0, 10.0, 0.0, 20.0/*, 1, 1, 1*/);
- building1->SetBuildingType (Building::Residential);
- building1->SetExtWallsType (Building::ConcreteWithWindows);
- mm5->SetIndoor (building1);
- Ptr<BuildingsMobilityModel> mm6 = hueNodes.Get (0)->GetObject<BuildingsMobilityModel> ();
- mm6->SetPosition (Vector (distance, 0.0, hm));
- mm6->SetIndoor (building1);
- mm6->SetFloorNumber (2);
- AddTestCase (new LteShadowingTestCase (mm5, mm6, 88.5724, 8.0, "Indoor Shadowing"));
-
- // Test #3 Indoor -> Outdoor
-
- distance = 100;
- freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
- Ptr<BuildingsMobilityModel> mm9 = henbNodes.Get (1)->GetObject<BuildingsMobilityModel> ();
- mm9->SetPosition (Vector (0.0, 0.0, henbHeight));
- mm9->SetIndoor (building1);
- mm9->SetFloorNumber (2);
- Ptr<BuildingsMobilityModel> mm10 = hueNodes.Get (1)->GetObject<BuildingsMobilityModel> ();
- mm10->SetPosition (Vector (distance, 0.0, hm));
- // 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 LteShadowingTestCase (mm9, mm10, 85.0012, 8.6, "Indoor -> Outdoor Shadowing"));
-
-}
-
-static LteShadowingTestSuite lteShadowingTestSuite;
-
-
-/**
-* TestCase
-*/
-
-LteShadowingTestCase::LteShadowingTestCase (Ptr<BuildingsMobilityModel> m1, Ptr<BuildingsMobilityModel> m2, double refValue, double sigmaRef, std::string name)
-: TestCase ("SHADOWING calculation: " + name),
-m_node1 (m1),
-m_node2 (m2),
-m_lossRef (refValue),
-m_sigmaRef (sigmaRef)
-{
-}
-
-LteShadowingTestCase::~LteShadowingTestCase ()
-{
-}
-
-void
-LteShadowingTestCase::DoRun (void)
-{
-// LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL);
-
- // LogComponentEnable ("LteEnbRrc", logLevel);
- // LogComponentEnable ("LteUeRrc", logLevel);
- // LogComponentEnable ("LteEnbMac", logLevel);
- // LogComponentEnable ("LteUeMac", logLevel);
- // LogComponentEnable ("LteRlc", logLevel);
- // LogComponentEnable ("RrPacketScheduler", logLevel);
- //
- // LogComponentEnable ("LtePhy", logLevel);
- // LogComponentEnable ("LteEnbPhy", logLevel);
- // LogComponentEnable ("LteUePhy", logLevel);
- //
- // LogComponentEnable ("LteSpectrumPhy", logLevel);
- // LogComponentEnable ("LteInterference", logLevel);
- // LogComponentEnable ("LteSinrChunkProcessor", logLevel);
- //
- // LogComponentEnable ("LtePropagationLossModel", logLevel);
- // LogComponentEnable ("LossModel", logLevel);
-// LogComponentEnable ("ShadowingLossModel", logLevel);
- // LogComponentEnable ("PenetrationLossModel", logLevel);
- // LogComponentEnable ("MultipathLossModel", logLevel);
- // LogComponentEnable ("PathLossModel", logLevel);
- //
- // LogComponentEnable ("LteNetDevice", logLevel);
- // LogComponentEnable ("LteUeNetDevice", logLevel);
- // LogComponentEnable ("LteEnbNetDevice", logLevel);
-
-// LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL);
- NS_LOG_INFO ("Testing " << GetName());
- std::vector<double> loss;
- double sum = 0.0;
- double sumSquared = 0.0;
- int samples = 10000;
- for (int i = 0; i < samples; i++)
- {
- Ptr<SpectrumChannel> m_downlinkChannel = CreateObject<SingleModelSpectrumChannel> ();
- Ptr<SpectrumChannel> m_uplinkChannel = CreateObject<SingleModelSpectrumChannel> ();
- Ptr<BuildingsPropagationLossModel> m_downlinkPropagationLossModel = CreateObject<BuildingsPropagationLossModel> ();
- Ptr<BuildingsPropagationLossModel> m_uplinkPropagationLossModel = CreateObject<BuildingsPropagationLossModel> ();
- m_downlinkChannel->AddPropagationLossModel (m_downlinkPropagationLossModel);
- m_uplinkChannel->AddPropagationLossModel (m_uplinkPropagationLossModel);
- loss.push_back (m_downlinkPropagationLossModel->GetLoss (m_node1, m_node2) - m_lossRef);
- sum += loss.at (loss.size()-1);
- sumSquared += (loss.at (loss.size()-1)*loss.at (loss.size()-1));
- }
- double mean = sum/samples;
- double sigma = sqrt(sumSquared/samples - (mean*mean));
- // test whether the distribution falls in the 99% confidence interval, as expected with a nornal distribution
- double ci = (2.575829303549 * sigma) / sqrt (samples);
-
- NS_LOG_INFO ("Mean from simulation " << mean << ", sigma " << sigma << ", reference value " << m_sigmaRef << ", CI(99%) " << ci);
-
- NS_TEST_ASSERT_MSG_EQ_TOL(fabs(mean), 0.0, ci, "Wrong shadowing distribution !");
-}
--- a/src/lte/test/lte-test-shadowing.h Wed Sep 28 16:48:04 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
-* Copyright (c) 2011 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 <marco.miozzo@cttc.es>
-*/
-
-#ifndef LTE_TEST_SHADOWING_MODEL_H
-#define LTE_TEST_SHADOWING_MODEL_H
-
-#include "ns3/spectrum-value.h"
-
-#include "ns3/test.h"
-
-#include <ns3/buildings-mobility-model.h>
-#include <ns3/buildings-propagation-loss-model.h>
-
-
-using namespace ns3;
-
-
-/**
-* Test 1.1 shadowing calculation
-*/
-class LteShadowingTestSuite : public TestSuite
-{
- public:
- LteShadowingTestSuite ();
-};
-
-
-class LteShadowingTestCase : public TestCase
-{
- public:
- LteShadowingTestCase (Ptr<BuildingsMobilityModel> m1, Ptr<BuildingsMobilityModel> m2, double refValue, double sigmaRef, std::string name);
- virtual ~LteShadowingTestCase ();
-
- private:
- virtual void DoRun (void);
-
- Ptr<BuildingsMobilityModel> m_node1;
- Ptr<BuildingsMobilityModel> m_node2;
- double m_lossRef; // pathloss value (without shadowing)
- double m_sigmaRef;
-
-};
-
-#endif /*LTE_TEST_SHADOWING_MODEL_H*/
\ No newline at end of file
--- a/src/lte/wscript Wed Sep 28 16:48:04 2011 +0200
+++ b/src/lte/wscript Wed Sep 28 16:48:53 2011 +0200
@@ -2,7 +2,7 @@
def build(bld):
- module = bld.create_ns3_module('lte', ['core', 'network', 'spectrum', 'stats'])
+ module = bld.create_ns3_module('lte', ['core', 'network', 'spectrum', 'buildings', 'stats'])
module.source = [
'model/lte-common.cc',
'model/lte-spectrum-phy.cc',
@@ -62,10 +62,9 @@
'test/lte-test-pf-ff-mac-scheduler.cc',
'test/lte-test-earfcn.cc',
'test/lte-test-spectrum-value-helper.cc',
- 'test/lte-test-pathloss-model.cc',
'test/epc-test-gtpu-v1.cc',
- 'test/lte-test-shadowing.cc',
'test/lte-test-fading.cc',
+ 'test/lte-test-pathloss-model.cc'
]
headers = bld.new_task_gen('ns3header')
@@ -125,10 +124,9 @@
'test/lte-test-rr-ff-mac-scheduler.h',
'test/lte-test-pf-ff-mac-scheduler.h',
'test/lte-test-pf-ff-mac-scheduler.h',
- 'test/lte-test-pathloss-model.h',
'test/epc-test-gtpu-v1.h',
- 'test/lte-test-shadowing.h',
'test/lte-test-fading.h',
+ 'test/lte-test-pathloss-model.h'
]
if (bld.env['ENABLE_EXAMPLES']):
--- a/src/mobility/model/building.cc Wed Sep 28 16:48:04 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2011 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 <marco.miozzo@cttc.es>
- *
- */
-
-
-#include <ns3/building.h>
-#include <ns3/enum.h>
-
-
-namespace ns3 {
-
-
-Building::Building (double _xMin, double _xMax,
- double _yMin, double _yMax,
- double _zMin, double _zMax/*,
- uint8_t _nFloors, uint8_t _nRoomX, uint8_t _nRoomY*/) :
- m_floor (1),
- m_roomX (1),
- m_roomY (1),
- m_buildingType (Residential),
- m_externalWalls (ConcreteWithWindows)
-
-{
- m_buldingBounds = Box (_xMin, _xMax, _yMin, _yMax, _zMin, _zMax);
-}
-
-
-Building::Building ()
- : m_floor (1),
- m_roomX (1),
- m_roomY (1),
- m_buildingType (Residential),
- m_externalWalls (ConcreteWithWindows)
-{
- m_buldingBounds = Box ();
-}
-
-
-void
-Building::SetBuildingType (Building::BuildingType_t t)
-{
- m_buildingType = t;
-}
-
-void
-Building::SetExtWallsType (Building::ExtWallsType_t t)
-{
- m_externalWalls = t;
-}
-
-void
-Building::SetFloorsNumber (uint8_t nfloors)
-{
- m_floor = nfloors;
-}
-
-void
-Building::SetNumberRoomX (uint8_t nroomx)
-{
- m_roomX = nroomx;
-}
-
-void
-Building::SetNumberRoomY (uint8_t nroomy)
-{
- m_roomY = nroomy;
-}
-
-
-Building::BuildingType_t
-Building::GetBuildingType ()
-{
- return (m_buildingType);
-}
-
-Building::ExtWallsType_t
-Building::GetExtWallsType ()
-{
- return (m_externalWalls);
-}
-
-uint8_t
-Building::GetNumberFloors ()
-{
- return (m_floor);
-}
-
-uint8_t
-Building::GetNumberRoomX ()
-{
- return (m_roomX);
-}
-
-uint8_t
-Building::GetNumberRoomY ()
-{
- return (m_roomY);
-}
-
-
-} // namespace ns3
--- a/src/mobility/model/building.h Wed Sep 28 16:48:04 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2011 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 <marco.miozzo@cttc.es>
- *
- */
-#ifndef BUILDING_H
-#define BUILDING_H
-
-#include <ns3/attribute.h>
-#include <ns3/attribute-helper.h>
-#include <ns3/vector.h>
-#include <ns3/box.h>
-#include <ns3/simple-ref-count.h>
-
-
-namespace ns3 {
-
-/**
- * \ingroup mobility
- * \brief a 3d building block
- */
-class Building : public SimpleRefCount<Building>
-{
-public:
-
- enum BuildingType_t
- {
- Residential, Office, Commercial
- };
- enum ExtWallsType_t
- {
- Wood, ConcreteWithWindows, ConcreteWithoutWindows, StoneBlocks
- };
- /**
- * \param _xMin x coordinates of left boundary.
- * \param _xMax x coordinates of right boundary.
- * \param _yMin y coordinates of bottom boundary.
- * \param _yMax y coordinates of top boundary.
- * \param _zMin z coordinates of down boundary.
- * \param _zMax z coordinates of up boundary.
- * \param _nFloors number of floors
- * \param _nRoomX number of rooms in the x axis
- * \param _nRoomY number of rooms in the y axis
- *
- * Create a building.
- */
- Building (double _xMin, double _xMax,
- double _yMin, double _yMax,
- double _zMin, double _zMax/*,
- uint8_t _nFloors, uint8_t _nRoomX, uint8_t _nRoomY*/);
-
- /**
- * Create a zero-sized building located at coordinates (0.0,0.0,0.0)
- * and with no floors and 1 room.
- */
- Building ();
-
-
- /**
- * \param t the type of building (i.e., Residential, Office, Commercial)
- *
- * This method allows to set building type (default is Residential)
- */
- void SetBuildingType (Building::BuildingType_t t);
-
- /**
- * \param t the type of external walls (i.e., Wood, ConcreteWithWindows,
- * ConcreteWithoutWindows and StoneBlocks), used for evaluating the loss
- * due to the penetration of external walls in outdoor <-> indoor comm.
- *
- * This method allows to set external walls type (default is Residential)
- */
- void SetExtWallsType (Building::ExtWallsType_t t);
-
- /**
- * \param nfloors the number of floors in the building
- *
- * This method allows to set the number of floors in the building
- * (default is 1)
- */
- void SetFloorsNumber (uint8_t nfloors);
-
- /**
- * \param nroomx the number of rooms in the x axis
- *
- * This method allows to set the number of room in x-axis (default is 1)
- * The rooms are disposed as a grid of nº of rooms in X per nº of rooms in Y
- */
- void SetNumberRoomX (uint8_t nroomx);
-
- /**
- * \param nroomy the number of floors in the building
- *
- * This method allows to set the number of floors in the building
- * (default is 1)
- */
- void SetNumberRoomY (uint8_t nroomy);
-
-
- /**
- * \return the type of building
- * Return the type of building (i.e., Residential, Office, Commercial)
- */
- BuildingType_t GetBuildingType ();
-
- /**
- * \return the type of external walls
- * Return the type of external walls (i.e., Wood, ConcreteWithWindows,
- * ConcreteWithoutWindows)
- */
- ExtWallsType_t GetExtWallsType ();
-
- /**
- * \return the number of floors
- * Return the number of floors
- */
- uint8_t GetNumberFloors ();
-
- /**
- * \return the number of room in x-axis
- * Return the number of room in x-axis
- */
- uint8_t GetNumberRoomX ();
-
- /**
- * \return the number of room in y-axis
- * Return the number of room in y-axis
- */
- uint8_t GetNumberRoomY ();
-
-
-private:
- Box m_buldingBounds;
- /**
- * number of floors must be greater then 0 and 1 means only one floor
- * (i.e., groundfloor)
- */
- uint8_t m_floor;
- uint8_t m_roomX;
- uint8_t m_roomY;
-
- uint8_t m_buildingId;
- BuildingType_t m_buildingType;
- ExtWallsType_t m_externalWalls;
-
-};
-
-//std::ostream &operator << (std::ostream &os, const Box &box);
-//std::istream &operator >> (std::istream &is, Box &box);
-
-
-ATTRIBUTE_HELPER_HEADER (Building);
-
-} // namespace ns3
-
-#endif /* BUILDING_H */
--- a/src/mobility/model/buildings-mobility-model.cc Wed Sep 28 16:48:04 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2011 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 <marco.miozzo@cttc.es>
- *
- */
-
-#include <ns3/simulator.h>
-#include <ns3/position-allocator.h>
-#include <ns3/buildings-mobility-model.h>
-#include "ns3/pointer.h"
-
-
-namespace ns3 {
-
- NS_OBJECT_ENSURE_REGISTERED (BuildingsMobilityModel);
-
-TypeId
-BuildingsMobilityModel::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::BuildingsMobilityModel")
- .SetParent<MobilityModel> ()
- .SetGroupName ("Mobility")
- .AddConstructor<BuildingsMobilityModel> ()
- .AddAttribute ("Bounds",
- "Bounds of the area to cruise.",
- BoxValue (Box (-100.0, 100.0, -100.0, 100.0, 0.0, 100.0)),
- MakeBoxAccessor (&BuildingsMobilityModel::m_bounds),
- MakeBoxChecker ());
-
- return tid;
-}
-
-
-BuildingsMobilityModel::BuildingsMobilityModel ()
-{
- m_indoor = false;
- m_nFloor = 0;
- m_roomX = 1;
- m_roomY = 1;
-}
-
-void
-BuildingsMobilityModel::DoDispose (void)
-{
- // chain up
- m_surroudingBuildings.clear ();
- MobilityModel::DoDispose ();
-}
-
-Vector
-BuildingsMobilityModel::DoGetPosition (void) const
-{
- m_helper.Update ();
- return m_helper.GetCurrentPosition ();
-}
-void
-BuildingsMobilityModel::DoSetPosition (const Vector &position)
-{
- m_helper.SetPosition (position);
-}
-Vector
-BuildingsMobilityModel::DoGetVelocity (void) const
-{
- return m_helper.GetVelocity ();
-}
-
-bool
-BuildingsMobilityModel::IsIndoor (void)
-{
- return (m_indoor);
-}
-
-bool
-BuildingsMobilityModel::IsOutdoor (void)
-{
- return (!m_indoor);
-}
-
-void
-BuildingsMobilityModel::SetIndoor (Ptr<Building> building)
-{
- m_indoor = true;
- m_myBuilding = building;
-}
-
-void
-BuildingsMobilityModel::SetOutdoor (void)
-{
- m_indoor = false;
-}
-
-void
-BuildingsMobilityModel::SetFloorNumber (uint8_t nfloor)
-{
- m_nFloor = nfloor;
-}
-
-void
-BuildingsMobilityModel::SetRoomNumberX (uint8_t nroomx)
-{
- m_roomX = nroomx;
-}
-
-void
-BuildingsMobilityModel::SetRoomNumberY (uint8_t nroomy)
-{
- m_roomY = nroomy;
-}
-
-
-void
-BuildingsMobilityModel::SetSurroudingBuilding (Ptr<Building> building)
-{
- m_surroudingBuildings.push_back (building);
-}
-
-uint8_t
-BuildingsMobilityModel::GetFloorNumber (void)
-{
- return (m_nFloor);
-}
-
-uint8_t
-BuildingsMobilityModel::GetRoomNumberX (void)
-{
- return (m_roomX);
-}
-
-uint8_t
-BuildingsMobilityModel::GetRoomNumberY (void)
-{
- return (m_roomY);
-}
-
-
-Ptr<Building>
-BuildingsMobilityModel::GetBuilding ()
-{
- return (m_myBuilding);
-}
-
-
-} // namespace
\ No newline at end of file
--- a/src/mobility/model/buildings-mobility-model.h Wed Sep 28 16:48:04 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2011 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 <marco.miozzo@cttc.es>
- *
- */
-#ifndef BUILDINGS_MOBILITY_MODEL_H
-#define BUILDINGS_MOBILITY_MODEL_H
-
-
-
-#include <ns3/mobility-model.h>
-#include <ns3/ptr.h>
-#include <ns3/object.h>
-#include <ns3/box.h>
-#include <map>
-#include <ns3/constant-velocity-helper.h>
-#include <ns3/building.h>
-//#include "ns3/random-variable.h"
-//#include "ns3/nstime.h"
-//#include "ns3/event-id.h"
-
-
-
-namespace ns3 {
-
-
-/**
- * \ingroup mobility
- * \brief Buildings mobility model
- *
- * This model implements the managment of scenarios where users might be
- * either indoor (e.g., houses, offices, etc.) and outdoor.
- *
- */
-
-
-class BuildingsMobilityModel : public MobilityModel
-{
- public:
- static TypeId GetTypeId (void);
- BuildingsMobilityModel ();
-
- bool IsIndoor (void);
- bool IsOutdoor (void);
-
- void SetIndoor (Ptr<Building> building);
- void SetOutdoor (void);
-
- void SetSurroudingBuilding (Ptr<Building> building);
-
- void SetFloorNumber (uint8_t nfloor);
- void SetRoomNumberX (uint8_t nroomx);
- void SetRoomNumberY (uint8_t nroomy);
-
- uint8_t GetFloorNumber (void);
- uint8_t GetRoomNumberX (void);
- uint8_t GetRoomNumberY (void);
-
- Ptr<Building> GetBuilding ();
-
-
-
- private:
- virtual void DoDispose (void);
- virtual Vector DoGetPosition (void) const;
- virtual void DoSetPosition (const Vector &position);
- virtual Vector DoGetVelocity (void) const;
- ConstantVelocityHelper m_helper;
- Box m_bounds; // bounds of the simulation field (if needed)
- std::list < Ptr<Building> > m_surroudingBuildings; // buildings blocks
- Ptr<Building> m_myBuilding;
- bool m_indoor;
- /**
- * floors numbering starts from 0 (basement)
- */
- uint8_t m_nFloor;
- uint8_t m_roomX;
- uint8_t m_roomY;
-
-};
-
-
-
-} // namespace ns3
-
-
-#endif // BUILDINGS_MOBILITY_MODEL_H
\ No newline at end of file
--- a/src/mobility/wscript Wed Sep 28 16:48:04 2011 +0200
+++ b/src/mobility/wscript Wed Sep 28 16:48:53 2011 +0200
@@ -19,8 +19,6 @@
'model/steady-state-random-waypoint-mobility-model.cc',
'model/waypoint.cc',
'model/waypoint-mobility-model.cc',
- 'model/building.cc',
- 'model/buildings-mobility-model.cc',
'helper/mobility-helper.cc',
'helper/ns2-mobility-helper.cc',
]
@@ -50,8 +48,6 @@
'model/random-waypoint-mobility-model.h',
'model/steady-state-random-waypoint-mobility-model.h',
'model/waypoint.h',
- 'model/building.h',
- 'model/buildings-mobility-model.h',
'model/waypoint-mobility-model.h',
'helper/mobility-helper.h',
'helper/ns2-mobility-helper.h',
--- a/src/propagation/model/buildings-propagation-loss-model.cc Wed Sep 28 16:48:04 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,830 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2011 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 <marco.miozzo@cttc.es>
- *
- */
-
-#include "ns3/propagation-loss-model.h"
-#include "ns3/log.h"
-#include "ns3/mobility-model.h"
-#include "ns3/double.h"
-#include "ns3/pointer.h"
-#include <math.h>
-#include "buildings-propagation-loss-model.h"
-#include "ns3/buildings-mobility-model.h"
-#include "ns3/enum.h"
-
-#include <ns3/shadowing-loss-model.h>
-#include <ns3/jakes-fading-loss-model.h>
-
-
-NS_LOG_COMPONENT_DEFINE ("BuildingsPropagationLossModel");
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED (BuildingsPropagationLossModel);
-
-
-
-class BuildingsPropagationLossModel::ShadowingLoss
-{
- public:
- ShadowingLoss (double mean, double sigma);
- ~ShadowingLoss ();
- double GetLoss ();
- Ptr<MobilityModel> GetReceiver (void);
- private:
- Ptr<MobilityModel> m_receiver;
- NormalVariable m_randVariable;
- double m_shadowingValue;
-};
-
-
-BuildingsPropagationLossModel::ShadowingLoss::ShadowingLoss (double mean, double sigma) :
-m_randVariable (mean, sigma*sigma) // NormalVariable class wants mean and variance (sigma is a standard deviation)
-{
- m_shadowingValue = m_randVariable.GetValue ();
- NS_LOG_INFO (this << " New Shadowing: sigma " << sigma << " value " << m_shadowingValue);
-}
-
-BuildingsPropagationLossModel::ShadowingLoss::~ShadowingLoss ()
-{
-
-}
-
-double
-BuildingsPropagationLossModel::ShadowingLoss::GetLoss ()
-{
- return (m_shadowingValue);
-}
-
-Ptr<MobilityModel>
-BuildingsPropagationLossModel::ShadowingLoss::GetReceiver ()
-{
- return m_receiver;
-}
-
-TypeId
-BuildingsPropagationLossModel::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::BuildingsPropagationLossModel")
-
- .SetParent<PropagationLossModel> ()
-
- .AddConstructor<BuildingsPropagationLossModel> ()
-
- .AddAttribute ("Lambda",
- "The wavelength (default is 2.106 GHz at 300 000 km/s).",
- DoubleValue (300000000.0 / 2160e6),
- MakeDoubleAccessor (&BuildingsPropagationLossModel::SetLambda, &BuildingsPropagationLossModel::GetLambda),
- MakeDoubleChecker<double> ())
-
- .AddAttribute ("Frequency",
- "The Frequency (default is 2.106 GHz).",
- DoubleValue (2160e6),
- MakeDoubleAccessor (&BuildingsPropagationLossModel::m_frequency),
- MakeDoubleChecker<double> ())
-
- .AddAttribute ("ShadowSigmaOutdoor",
- "Standard deviation of the normal distribution used for calculate the shadowing for outdoor nodes",
- DoubleValue (7.0),
- MakeDoubleAccessor (&BuildingsPropagationLossModel::m_shadowingSigmaOutdoor),
- MakeDoubleChecker<double> ())
-
- .AddAttribute ("ShadowSigmaIndoor",
- "Standard deviation of the normal distribution used for calculate the shadowing for indoor nodes ",
- DoubleValue (8.0),
- MakeDoubleAccessor (&BuildingsPropagationLossModel::m_shadowingSigmaIndoor),
- MakeDoubleChecker<double> ())
- .AddAttribute ("ShadowSigmaExtWalls",
- "Standard deviation of the normal distribution used for calculate the shadowing due to ext walls ",
- DoubleValue (5.0),
- MakeDoubleAccessor (&BuildingsPropagationLossModel::m_shadowingSigmaExtWalls),
- MakeDoubleChecker<double> ())
-
- .AddAttribute ("RooftopLevel",
- " The height of the rooftop [m].",
- DoubleValue (20.0),
- MakeDoubleAccessor (&BuildingsPropagationLossModel::m_rooftopHeight),
- MakeDoubleChecker<double> ())
-
- .AddAttribute ("Los2NlosThr",
- " Threshold from LoS to NLoS in ITU 1411 [m].",
- DoubleValue (200.0),
- MakeDoubleAccessor (&BuildingsPropagationLossModel::m_itu1411NlosThreshold),
- MakeDoubleChecker<double> ())
-
- .AddAttribute ("ITU1411DistanceThr",
- " Threshold for ITU 1411 [m].",
- DoubleValue (2000.0),
- MakeDoubleAccessor (&BuildingsPropagationLossModel::m_itu1411DistanceThreshold),
- MakeDoubleChecker<double> ())
-
- .AddAttribute ("MinDistance",
- "The distance under which the propagation model refuses to give results (m) ",
- DoubleValue (0.5),
- MakeDoubleAccessor (&BuildingsPropagationLossModel::SetMinDistance, &BuildingsPropagationLossModel::GetMinDistance),
- MakeDoubleChecker<double> ())
-
- .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"));
-
-
- 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 ()
-{
- for (PairsList::reverse_iterator i = m_shadowingPairs.rbegin (); i != m_shadowingPairs.rend (); i++)
- {
- PairsSet *ps = *i;
- for (DestinationList::iterator r = ps->receivers.begin (); r != ps->receivers.end (); r++)
- {
- ShadowingLoss *pc = *r;
- delete pc;
- }
- ps->sender = 0;
- ps->receivers.clear ();
- delete ps;
- }
- m_shadowingPairs.clear ();
-}
-
-// void
-// BuildingsPropagationLossModel::SetLambda (double frequency, double speed)
-// {
-// m_lambda = speed / frequency;
-// m_frequency = frequency;
-// }
-
-void
-BuildingsPropagationLossModel::SetLambda (double lambda)
-{
- m_lambda = lambda;
- m_frequency = 300000000 / lambda;
-}
-
-double
-BuildingsPropagationLossModel::GetLambda (void) const
-{
- return m_lambda;
-}
-
-void
-BuildingsPropagationLossModel::SetMinDistance (double minDistance)
-{
- m_minDistance = minDistance;
-}
-double
-BuildingsPropagationLossModel::GetMinDistance (void) const
-{
- return m_minDistance;
-}
-
-void
-BuildingsPropagationLossModel::SetEnvironment (Environment env)
-{
-// if (env==Urban)
-// {
-// NS_LOG_INFO (this << " Urban");
-// }
-// else if (env==SubUrban)
-// {
-// NS_LOG_INFO (this << " SubUrban");
-// }
-// else if (env==OpenAreas)
-// {
-// NS_LOG_INFO (this << " OpenAreas");
-// }
- 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<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> 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<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b) const
-{
- if (a->GetDistanceFrom (b) < m_itu1411NlosThreshold)
- {
- return (ItuR1411Los (a,b));
- }
- else
- {
- return (ItuR1411NlosOverRooftop (a,b));
- }
-}
-
-
-double
-BuildingsPropagationLossModel::ItuR1411Los (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> 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<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> 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::ItuR1411NlosStreetCanyons (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b) const
-// {
-// NS_LOG_INFO (this);
-// // reflection pathloss
-// double x1 = a->GetStreetCrossingDistence ();
-// double x2 = b->GetStreetCrossingDistence ();
-// double f_alpha = 0.0;
-// if (m_cornerAngle<= 0.33)
-// {
-// f_alpha = -41.0 + 110*m_cornerAngle;
-// }
-// else if (m_cornerAngle<= 0.42)
-// {
-// f_alpha = -13.94 + 28*m_cornerAngle;
-// }
-// else if (m_cornerAngle<= 0.71)
-// {
-// f_alpha = -5.33 + 7.51*m_cornerAngle;
-// }
-// double pi = 3.141592653589793;
-// double Lr = -20*log10 (x1+x2) + (x1*x2*f_alpha/(m_streetsWidth*m_streetsWidth)) - 20*log10 (4*pi/m_lambda);
-//
-// // diffraction pathloss
-// double Da = -1*(40/(2*pi))*(atan (x2/m_streetsWidth) + atan (x1/m_streetsWidth) - (pi/2));
-// double Ld = -10*log10 (x2*x1*(x1+x2)) + 2*Da + 0.1*(90 - m_cornerAngle*(180/pi)) - 20*log10 (4*pi/m_lambda);
-//
-// double loss = -10*log10 (pow (10, Lr/10) + pow (10, Ld/10));
-// return (loss);
-// }
-
-
-double
-BuildingsPropagationLossModel::ItuR1238 (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b) const
-{
- double N = 0.0;
- int n = abs (a->GetFloorNumber () - b->GetFloorNumber ());
-// NS_LOG_INFO (this << " A floor " << (uint16_t)a->GetFloorNumber () << " B floor " << (uint16_t)b->GetFloorNumber () << " n " << n);
- double Lf = 0.0;
- Ptr<Building> aBuilding = a->GetBuilding ();
- if (aBuilding->GetBuildingType () == Building::Residential)
- {
- N = 28;
- Lf = 4 * n;
-// NS_LOG_INFO (this << " Residential ");
- }
- else if (aBuilding->GetBuildingType () == Building::Office)
- {
- N = 30;
- Lf = 15 + (4 * (n-1));
-// NS_LOG_INFO (this << " Office ");
- }
- else if (aBuilding->GetBuildingType () == Building::Commercial)
- {
- N = 22;
- Lf = 6 + (3 * (n-1));
-// NS_LOG_INFO (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;
-
- return (loss);
-}
-
-
-double
-BuildingsPropagationLossModel::BEWPL (Ptr<BuildingsMobilityModel> a) const
-{
- double loss = 0.0;
- Ptr<Building> aBuilding = a->GetBuilding ();
- if (aBuilding->GetExtWallsType () == Building::Wood)
- {
- loss = 4;
- }
- else if (aBuilding->GetExtWallsType () == Building::ConcreteWithWindows)
- {
- loss = 7;
- }
- else if (aBuilding->GetExtWallsType () == Building::ConcreteWithoutWindows)
- {
- loss = 15; // 10 ~ 20 dB
- }
- else if (aBuilding->GetExtWallsType () == Building::StoneBlocks)
- {
- loss = 12;
- }
-
-
- return (loss);
-}
-
-
-double
-BuildingsPropagationLossModel::HeightGain (Ptr<BuildingsMobilityModel> node) const
-{
- double loss = 0.0;
-
- int nfloors = node->GetFloorNumber ();
- loss = -2*(nfloors);
- return (loss);
-}
-
-
-
-
-double
-BuildingsPropagationLossModel::GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
-{
-
- double distance = a->GetDistanceFrom (b);
- if (distance <= m_minDistance)
- {
- return 0.0;
- }
-
- // get the BuildingsMobilityModel pointers
- Ptr<BuildingsMobilityModel> a1 = DynamicCast<BuildingsMobilityModel> (a);
- Ptr<BuildingsMobilityModel> b1 = DynamicCast<BuildingsMobilityModel> (b);
-
- double loss = 0.0;
-
- if (a1->IsOutdoor ())
- {
- if (b1->IsOutdoor ())
- {
- if (distance > 1000)
- {
- NS_LOG_INFO (this << a1->GetPosition ().z<<b1->GetPosition ().z<< m_rooftopHeight);
- if ((a1->GetPosition ().z < m_rooftopHeight)
- && (b1->GetPosition ().z < m_rooftopHeight))
- {
- // ITU limit in distance (i.e., < 2000 for small cells)
- if (distance < m_itu1411DistanceThreshold)
- {
- // short range communication
- loss = ItuR1411 (a1, b1);
- NS_LOG_INFO (this << " 0-0 (>1000): down rooftop -> ITUR1411 : " << loss);
- }
- else
- {
- // out of bound
- loss = std::numeric_limits<double>::infinity ();
- NS_LOG_INFO (this << " 0-0 (>2000): down rooftop -> ITUR1411 : " << loss);
- }
- }
- else
- {
- // Over the rooftop tranmission -> Okumura Hata
- loss = OkumuraHata (a1, b1);
- NS_LOG_INFO (this << " O-O (>1000): Over the rooftop -> OH : " << loss);
- }
- }
- else
- {
- // short range outdoor communication
- loss = ItuR1411 (a1, b1);
- NS_LOG_INFO (this << " 0-0 (<1000) Street canyon -> ITUR1411 : " << loss);
- }
- }
- else
- {
- // b indoor
- if (distance > 1000)
- {
- if ((a1->GetPosition ().z < m_rooftopHeight)
- && (b1->GetPosition ().z < m_rooftopHeight))
- {
-
- // ITU limit in distance (i.e., < 2000 for small cells)
- if (distance < m_itu1411DistanceThreshold)
- {
- // short range communication
- loss = ItuR1411 (a1, b1) + BEWPL(b1) + HeightGain (a1);
- NS_LOG_INFO (this << " 0-I (>1000): down rooftop -> ITUR1411 : " << loss);
- }
- else
- {
- // out of bound
- loss = std::numeric_limits<double>::infinity ();
- NS_LOG_INFO (this << " 0-I (>2000): down rooftop -> ITUR1411 : " << loss);
- }
- }
- else
- {
- // Over the rooftop tranmission -> Okumura Hata
- loss = OkumuraHata (a1, b1) + BEWPL(b1);
- NS_LOG_INFO (this << " O-I (>1000): Over the rooftop -> OH : " << loss);
- }
- }
- else
- {
- loss = ItuR1411 (a1, b1) + BEWPL(b1) + HeightGain (b1);
- NS_LOG_INFO (this << " 0-I (<1000) ITUR1411 + BEL : " << loss);
- }
- } // end b1->isIndoor ()
- }
- else
- {
- // a is indoor
- if (b1->IsIndoor ())
- {
- if (a1->GetBuilding () == b1->GetBuilding ())
- {
- // nodes are in same building -> indoor communication ITU-R P.1238
- loss = ItuR1238 (a1, b1);
- NS_LOG_INFO (this << " I-I (same building) ITUR1238 : " << loss);
-
- }
- else
- {
- // nodes are in different buildings
- loss = ItuR1411 (a1, b1) + BEWPL(a1) + BEWPL(b1);
- NS_LOG_INFO (this << " I-I (different) ITUR1238 + 2*BEL : " << loss);
- }
- }
- else
- {
- // b is outdoor
- if (distance > 1000)
- {
- if ((a1->GetPosition ().z < m_rooftopHeight)
- && (b1->GetPosition ().z < m_rooftopHeight))
- {
-
- // ITU limit in distance (i.e., < 2000 for small cells)
- if (distance < m_itu1411DistanceThreshold)
- {
- // short range communication
- loss = ItuR1411 (a1, b1) + BEWPL(a1) + HeightGain (a1);
- NS_LOG_INFO (this << " I-O (>1000): down rooftop -> ITUR1411 : " << loss);
- }
- else
- {
- // out of bound
- loss = std::numeric_limits<double>::infinity ();
- NS_LOG_INFO (this << " I-O (>2000): down rooftop -> ITUR1411 : " << loss);
- }
- }
- else
- {
- // above rooftop -> OH
- loss = OkumuraHata (a1, b1) + BEWPL(a1) + HeightGain (a1);
- NS_LOG_INFO (this << " =I-O (>1000) over rooftop OH + BEL + HG: " << loss);
- }
- }
- else
- {
- loss = ItuR1411 (a1, b1) + BEWPL(a1) + HeightGain (a1);
- NS_LOG_INFO (this << " I-O (<1000) ITUR1411 + BEL + HG: " << loss);
- }
- } // end b1->IsIndoor ()
- } // end a1->IsOutdoor ()
-
- // Evaluate the shadowing
- PairsList::iterator i = m_shadowingPairs.end ();
- while (i != m_shadowingPairs.begin ())
- {
- i--;
- PairsSet *ps = *i;
- if (ps->sender == a)
- {
- m_shadowingPairs.erase (i);
- m_shadowingPairs.push_back (ps);
- for (DestinationList::iterator r = ps->receivers.begin (); r != ps->receivers.end (); r++)
- {
- ShadowingLoss *pc = *r;
- if (pc->GetReceiver () == b)
- {
- ps->receivers.erase (r);
- ps->receivers.push_back (pc);
- return loss + pc->GetLoss ();
- }
- }
- double sigma = EvaluateSigma (a1, b1);
- ShadowingLoss *pc = new ShadowingLoss (0.0, sigma);
- ps->receivers.push_back (pc);
- return loss + pc->GetLoss ();
- }
- }
- PairsSet *ps = new PairsSet;
- ps->sender = a;
- double sigma = EvaluateSigma (a1, b1);
- ShadowingLoss *pc = new ShadowingLoss (0.0, sigma);
- ps->receivers.push_back (pc);
- m_shadowingPairs.push_back (ps);
- return loss + pc->GetLoss ();
-
-
-
-// if (m_shadowingValue==0)
-// {
-// m_shadowingValue = new ShadowingLoss (m_shadowingMean, m_shadowingSigma);
-// }
-//
-// return (loss + m_shadowingValue->GetLoss ());
-
-}
-
-double
-BuildingsPropagationLossModel::EvaluateSigma (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b)
-const
-{
- if (a->IsOutdoor ())
- {
- if (b->IsOutdoor ())
- {
- return (m_shadowingSigmaOutdoor);
- }
- else
- {
- double sigma = sqrt((m_shadowingSigmaOutdoor*m_shadowingSigmaOutdoor) + (m_shadowingSigmaExtWalls*m_shadowingSigmaExtWalls));
- return (sigma);
- }
- }
- else
- if (b->IsIndoor ())
- {
- return (m_shadowingSigmaIndoor);
- }
- else
- {
- double sigma = sqrt((m_shadowingSigmaOutdoor*m_shadowingSigmaOutdoor) + (m_shadowingSigmaExtWalls*m_shadowingSigmaExtWalls));
- return (sigma);
- }
-}
-
-
-double
-BuildingsPropagationLossModel::DoCalcRxPower (double txPowerDbm, Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
-{
- return txPowerDbm - GetLoss (a, b);
-}
-
-
-} // namespace ns3
--- a/src/propagation/model/buildings-propagation-loss-model.h Wed Sep 28 16:48:04 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2011 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 <marco.miozzo@cttc.es>
- *
- */
-
-#ifndef BUILDINGS_PROPAGATION_LOSS_MODEL_H_
-#define BUILDINGS_PROPAGATION_LOSS_MODEL_H_
-
-#include "ns3/nstime.h"
-#include "ns3/propagation-loss-model.h"
-#include <ns3/building.h>
-#include <ns3/buildings-mobility-model.h>
-
-// #include <ns3/jakes-fading-loss-model.h>
-// #include <ns3/shadowing-loss-model.h>
-
-namespace ns3 {
-
-class ShadowingLossModel;
-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 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
- *
- */
-
-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
- * \param b the mobility model of the destination
- * \returns the propagation loss (in dBm)
- */
- double GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
- void SetEnvironment (Environment env);
- void SetCitySize (CitySize size);
- void SetLambda (double lambda);
- void SetMinDistance (double minDistance);
- Environment GetEnvironment (void) const;
- CitySize GetCitySize (void) const;
- double GetMinDistance (void) const;
- double GetLambda (void) const;
-// void SetLambda (double frequency, double speed);
-
-
-private:
- virtual double DoCalcRxPower (double txPowerDbm, Ptr<MobilityModel> a, Ptr<MobilityModel> b) const;
- double OkumuraHata (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b) const;
- double ItuR1411 (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b) const;
- double ItuR1411Los (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b) const;
- double ItuR1411NlosOverRooftop (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b) const;
-// double ItuR1411NlosStreetCanyons (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b) const;
- double ItuR1238 (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b) const;
- double BEWPL (Ptr<BuildingsMobilityModel> a) const;
-
- double HeightGain (Ptr<BuildingsMobilityModel> n) 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
-
- // the shadowing tx/rx pairs management has been inspired by the
- // JakesFadingLossModel developed by Federico Maguolo (see jakes-propagation-model.h/cc)
- class ShadowingLoss;
- friend class ShadowingLoss;
- typedef std::vector<ShadowingLoss *> DestinationList;
- struct PairsSet {
- Ptr<MobilityModel> sender;
- DestinationList receivers;
- };
- typedef std::vector<PairsSet *> PairsList;
- double EvaluateSigma (Ptr<BuildingsMobilityModel> a, Ptr<BuildingsMobilityModel> b) const;
-
-
- double m_shadowingSigmaExtWalls;
- double m_shadowingSigmaOutdoor;
- double m_shadowingSigmaIndoor;
- mutable PairsList m_shadowingPairs;
-
-};
-
-}
-
-#endif /* COST231PROPAGATIONMODEL_H_ */
--- a/src/propagation/wscript Wed Sep 28 16:48:04 2011 +0200
+++ b/src/propagation/wscript Wed Sep 28 16:48:53 2011 +0200
@@ -8,7 +8,6 @@
'model/propagation-loss-model.cc',
'model/jakes-propagation-loss-model.cc',
'model/cost231-propagation-loss-model.cc',
- 'model/buildings-propagation-loss-model.cc',
]
module_test = bld.create_ns3_module_test_library('propagation')
@@ -23,7 +22,6 @@
'model/propagation-loss-model.h',
'model/jakes-propagation-loss-model.h',
'model/cost231-propagation-loss-model.h',
- 'model/buildings-propagation-loss-model.h',
]
if (bld.env['ENABLE_EXAMPLES']):
--- a/src/wscript Wed Sep 28 16:48:04 2011 +0200
+++ b/src/wscript Wed Sep 28 16:48:53 2011 +0200
@@ -63,6 +63,7 @@
'point-to-point-layout',
'csma-layout',
'template',
+ 'buildings',
]
def set_options(opt):