User Manual, Developers Guide and API Documentation

ITUUMi.cpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * This file is part of openWNS (open Wireless Network Simulator)
00003  * _____________________________________________________________________________
00004  *
00005  * Copyright (C) 2004-2007
00006  * Chair of Communication Networks (ComNets)
00007  * Kopernikusstr. 5, D-52074 Aachen, Germany
00008  * phone: ++49-241-80-27910,
00009  * fax: ++49-241-80-22242
00010  * email: info@openwns.org
00011  * www: http://www.openwns.org
00012  * _____________________________________________________________________________
00013  *
00014  * openWNS is free software; you can redistribute it and/or modify it under the
00015  * terms of the GNU Lesser General Public License version 2 as published by the
00016  * Free Software Foundation;
00017  *
00018  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00019  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00020  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00021  * details.
00022  *
00023  * You should have received a copy of the GNU Lesser General Public License
00024  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00025  *
00026  ******************************************************************************/
00027 
00028 #include <RISE/scenario/pathloss/ITUUMi.hpp>
00029 #include <RISE/stations/station.hpp>
00030 
00031 #include <WNS/StaticFactoryBroker.hpp>
00032 #include <RISE/scenario/pathloss/HashRNG.hpp>
00033 #include <WNS/distribution/Uniform.hpp>
00034 
00035 #include <boost/functional/hash.hpp>
00036 
00037 STATIC_FACTORY_BROKER_REGISTER(rise::scenario::pathloss::ITUUMi, rise::scenario::pathloss::Pathloss, "ITUUMi");
00038 
00039 using namespace rise::scenario::pathloss;
00040 
00041 ITUUMi::ITUUMi(const wns::pyconfig::View& pyco):
00042     DistanceDependent(pyco),
00043     losProbabilityCC_("rise.scenario.pathloss.ITUPathloss.losProbability"),
00044     shadowingCC_("rise.scenario.pathloss.ITUPathloss.shadowing"),
00045     useShadowing_(pyco.get<bool>("useShadowing"))
00046 {
00047     outdoorProbability = pyco.get<double>("outdoorProbability");
00048 }
00049 
00050 wns::Ratio
00051 ITUUMi::calculatePathloss(const antenna::Antenna& source,
00052               const antenna::Antenna& target,
00053               const wns::Frequency& frequency,
00054               const wns::Distance& distance) const
00055 {
00056     static wns::distribution::Uniform dis(0.0, 1.0, wns::simulator::getRNG());
00057     static unsigned int initialSeed = dis() * pow(2, sizeof(unsigned int)*8);
00058 
00059     detail::HashRNG hrng(initialSeed,
00060                          source.getPosition(),
00061                          target.getPosition(),
00062                          true, true);
00063 
00064     detail::HashRNG hrngOnlyUTPos(initialSeed + 2637,
00065                                 source.getPosition(),
00066                                 target.getPosition(),
00067                                 false, true);
00068 
00069     wns::Ratio pl;
00070     double sh = 0.0;
00071     if (hrng() < getLOSProbability(distance))
00072     {
00073         losProbabilityCC_.put(distance);
00074         pl = getLOSPathloss(source, target, frequency, distance);
00075         if (useShadowing_)
00076         {
00077             boost::normal_distribution<double> shadow(0.0, getLOSShadowingStd(source, target, frequency, distance));
00078             sh = shadow(hrng);
00079         }
00080     }
00081     else
00082     {
00083         pl = getNLOSPathloss(source, target, frequency, distance);
00084         if (useShadowing_)
00085         {
00086             boost::normal_distribution<double> shadow(0.0, getNLOSShadowingStd(source, target, frequency, distance));
00087             sh = shadow(hrng);
00088         }
00089     }
00090 
00091     bool isIndoor = hrngOnlyUTPos() > outdoorProbability;
00092 
00093     if (isIndoor)
00094     {
00095         double d_in = 0.0;
00096         if (distance > 25.0)
00097         {
00098             //d_in is uniformly distributed between 0 and 25
00099             d_in = hrng() * 25.0;
00100         }
00101         else
00102         {
00103             //d_in is uniformly distributed between 0 and distance
00104             d_in = hrng() * distance;
00105         }
00106         pl += wns::Ratio::from_dB(20.0 + 0.5 * d_in);
00107 
00108         if (useShadowing_)
00109         {
00110             boost::normal_distribution<double> shadow(0.0, getIndoorShadowingStd(source, target, frequency, distance));
00111             sh = shadow(hrng);
00112         }
00113       }
00114     shadowingCC_.put(sh);
00115     pl += wns::Ratio::from_dB(sh);
00116     return pl;
00117 }
00118 
00119 double
00120 ITUUMi::getLOSProbability(double distance) const
00121 {
00122     double pLOS = std::min(1.0, 18.0/distance) * (1 - exp(-distance/36.0)) + exp(-distance/36.0);
00123     return pLOS;
00124 
00125 }
00126 
00127 wns::Ratio
00128 ITUUMi::getLOSPathloss(const rise::antenna::Antenna& source,
00129                        const rise::antenna::Antenna& target,
00130                        const wns::Frequency& frequency,
00131                        const wns::Distance& distance) const
00132 {
00133     double bsHeight = source.getPosition().getZ();
00134     double utHeight = target.getPosition().getZ();
00135 
00136     // We must assume here that the higher one is the BS
00137     if (bsHeight < utHeight) std::swap(bsHeight, utHeight);
00138 
00139     assure(bsHeight == 10.0, "BS Height must be 10 m");
00140     assure(utHeight >= 1.5, "BS Height must be at least 1 m");
00141     assure(utHeight < 10.0, "BS Height cannot be larger than 10 m");
00142 
00143     // For UMiLOS the effictive heights are used heff = h - 1.0
00144     bsHeight -= 1.0;
00145     utHeight -= 1.0;
00146 
00147     double dBP = 4 * bsHeight * utHeight * frequency / 3.0e02;
00148     double pl;
00149     if (distance < dBP)
00150     {
00151       pl = 22.0 * log10(distance) + 28.0 + 20 * log10(frequency/1000.0);
00152       return wns::Ratio::from_dB(pl);
00153     }
00154     else
00155     {
00156         pl = 40 * log10(distance) + 7.8;
00157         pl -= 18.0 * log10(bsHeight) + 18.0 * log10(utHeight);
00158         pl += 2.0 * log10(frequency/1000.0);
00159     return wns::Ratio::from_dB(pl);
00160     }
00161 }
00162 
00163 wns::Ratio
00164 ITUUMi::getNLOSPathloss(const rise::antenna::Antenna& source,
00165                         const rise::antenna::Antenna& target,
00166                         const wns::Frequency& frequency,
00167                         const wns::Distance& distance) const
00168 {
00169     double bsHeight = source.getPosition().getZ();
00170     double utHeight = target.getPosition().getZ();
00171 
00172     // We must assume here that the higher one is the BS
00173     if (bsHeight < utHeight) std::swap(bsHeight, utHeight);
00174 
00175     assure(bsHeight == 10.0, "BS Height must be 10 m");
00176     assure(utHeight >= 1.0, "BS Height must be at least 1 m");
00177     assure(utHeight <= 2.5, "BS Height cannot be larger than 2.5 m");
00178 
00179     double pl =  36.7 * log10(distance) + 22.7 + 26.0 * log10(frequency/1000.0);
00180     return wns::Ratio::from_dB(pl);
00181 }
00182 
00183 double
00184 ITUUMi::getLOSShadowingStd(const rise::antenna::Antenna& source,
00185                            const rise::antenna::Antenna& target,
00186                            const wns::Frequency& frequency,
00187                            const wns::Distance& distance) const
00188 {
00189       assure(distance > 10.0, "This model is only valid for a minimum distance of 10m");
00190       assure(distance < 5000.0, "This model is only valid for a maximum distance of 5000m");
00191       //standard deviation of 3dB
00192       return 3;
00193 }
00194 
00195 double
00196 ITUUMi::getNLOSShadowingStd(const rise::antenna::Antenna& source,
00197                             const rise::antenna::Antenna& target,
00198                             const wns::Frequency& frequency,
00199                             const wns::Distance& distance) const
00200 {
00201        assure(distance > 10.0, "This model is only valid for a minimum distance of 10m");
00202       assure(distance < 2000.0, "This model is only valid for a maximum distance of 2000m");
00203       //standard deviation of 4dB
00204       return 4;
00205 }
00206 
00207 double
00208 ITUUMi::getIndoorShadowingStd(const rise::antenna::Antenna& source,
00209                             const rise::antenna::Antenna& target,
00210                             const wns::Frequency& frequency,
00211                             const wns::Distance& distance) const
00212 {
00213     assure(distance > 10.0, "This model is only valid for a minimum distance of 10m");
00214     assure(distance < 1000.0, "This model is only valid for a maximum distance of 1000m");
00215 
00216     //standard deviation of 7dB
00217     return 7;
00218 }
00219 
00220 double
00221 ITUUMi::getCarPenetrationStd() const
00222 {
00223     return 0.0;
00224 }
00225 
00226 double
00227 ITUUMi::getCarPenetrationMean() const
00228 {
00229     return 0.0;
00230 }

Generated on Thu May 24 03:31:56 2012 for openWNS by  doxygen 1.5.5