![]() |
User Manual, Developers Guide and API Documentation |
![]() |
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/ITUPathloss.hpp> 00029 #include <RISE/stations/station.hpp> 00030 00031 #include <WNS/distribution/Uniform.hpp> 00032 00033 #include <boost/random.hpp> 00034 #include <boost/functional/hash.hpp> 00035 00036 using namespace rise::scenario::pathloss; 00037 00038 ITUPathloss::ITUPathloss(const wns::pyconfig::View& pyco): 00039 rise::scenario::pathloss::DistanceDependent(pyco), 00040 losProbabilityCC_("rise.scenario.pathloss.ITUPathloss.losProbability"), 00041 shadowingCC_("rise.scenario.pathloss.ITUPathloss.shadowing"), 00042 useShadowing_(pyco.get<bool>("useShadowing")), 00043 useCarPenetration_(pyco.get<bool>("useCarPenetration")) 00044 {} 00045 00046 wns::Ratio 00047 ITUPathloss::calculatePathloss(const rise::antenna::Antenna& source, 00048 const rise::antenna::Antenna& target, 00049 const wns::Frequency& frequency, 00050 const wns::Distance& distance) const 00051 { 00052 static wns::distribution::Uniform dis(0.0, 1.0, wns::simulator::getRNG()); 00053 static unsigned int initialSeed = dis() * pow(2, sizeof(unsigned int)*8); 00054 00055 00056 detail::HashRNG hrng(initialSeed, 00057 source.getPosition(), 00058 target.getPosition(), 00059 true, true); 00060 00061 wns::Ratio pl; 00062 00063 if (hrng() < getLOSProbability(distance)) 00064 { 00065 losProbabilityCC_.put(distance); 00066 pl = getLOSPathloss(source, target, frequency, distance); 00067 00068 double sh = 0.0; 00069 if (useShadowing_) 00070 { 00071 boost::normal_distribution<double> shadow(0.0, getLOSShadowingStd(source, target, frequency, distance)); 00072 sh = shadow(hrng); 00073 pl += wns::Ratio::from_dB(sh); 00074 } 00075 shadowingCC_.put(sh); 00076 } 00077 else 00078 { 00079 pl = getNLOSPathloss(source, target, frequency, distance); 00080 double sh = 0.0; 00081 if (useShadowing_) 00082 { 00083 boost::normal_distribution<double> shadow(0.0, getNLOSShadowingStd(source, target, frequency, distance)); 00084 sh = shadow(hrng); 00085 pl += wns::Ratio::from_dB(sh); 00086 } 00087 shadowingCC_.put(sh); 00088 } 00089 00090 double penetrationLoss = 0.0; 00091 if (useCarPenetration_) 00092 { 00093 // Take car of car penetration loss 00094 // Pathloss models that do not exhibit car penetration 00095 // should return zero mean and zero std as distribution parameters 00096 00097 // Only take into account the UT for in-car penetration loss 00098 detail::HashRNG onlyUT(initialSeed + 2637, 00099 source.getPosition(), 00100 target.getPosition(), 00101 false, true); 00102 00103 boost::normal_distribution<double> shadow(getCarPenetrationMean(), getCarPenetrationStd()); 00104 penetrationLoss = shadow(onlyUT); 00105 } 00106 00107 return pl + wns::Ratio::from_dB(penetrationLoss);; 00108 }
1.5.5