![]() |
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/Pathloss.hpp> 00029 #include <WNS/Assure.hpp> 00030 #include <WNS/Ttos.hpp> 00031 00032 #include <string> 00033 00034 using namespace rise::scenario::pathloss; 00035 00036 Pathloss::Pathloss(const ReturnValueTransformation* rvt) 00037 : transform(rvt) 00038 { 00039 } 00040 00041 Pathloss::~Pathloss() 00042 { 00043 delete transform; 00044 } 00045 00046 wns::Ratio Pathloss::getPathloss(const antenna::Antenna& source, 00047 const antenna::Antenna& target, 00048 const wns::Frequency& frequency) const 00049 { 00050 assure(frequency > 0, "Illegal frequency (" + wns::Ttos(frequency) + " MHz) passed to Pathloss::getPathloss()"); 00051 assure(frequency < std::numeric_limits<wns::Frequency>::infinity(), 00052 "Infinite frequency passed to Pathloss::getPathloss()"); 00053 wns::Ratio result; 00054 try 00055 { // out-of-range must be catched so that distant cells can be simulated 00056 result = (*transform)(calculatePathloss(source, target, frequency)); 00057 } 00058 catch(...) 00059 { // probably out of range 00063 std::cout << "WARNING : Setting pathloss to out of range value! Probably this is a misconfiguration!" << std::endl; 00064 result = OutOfRangePathloss; 00065 } 00066 return result; 00067 }
1.5.5