![]() |
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/RangeChecked.hpp> 00029 #include <RISE/scenario/pathloss/defs.hpp> 00030 #include <RISE/antenna/Antenna.hpp> 00031 00032 #include <WNS/Types.hpp> 00033 #include <WNS/Assure.hpp> 00034 00035 using namespace rise::scenario::pathloss; 00036 00037 RangeChecked::RangeChecked(const wns::pyconfig::View& config) 00038 : DistanceDependent(config) 00039 {} 00040 00041 void RangeChecked::addRange(const DistanceRange& distances, const Pathloss* model) 00042 { 00043 distanceMap.insert(distances, model); 00044 } 00045 00046 void RangeChecked::addRange(const FrequencyRange& frequencies, const bool& allowed) 00047 { 00048 frequencyMap.insert(frequencies, allowed); 00049 } 00050 00051 bool RangeChecked::knowsDistance(const wns::Distance& distance) const 00052 { 00053 return distanceMap.has(distance); 00054 } 00055 00056 bool RangeChecked::knowsFrequency(const wns::Frequency& frequency) const 00057 { 00058 return frequencyMap.has(frequency); 00059 } 00060 00061 const Pathloss* RangeChecked::getModel(const wns::Distance& distance) const 00062 { 00063 return distanceMap.get(distance); 00064 } 00065 00066 wns::Ratio RangeChecked::calculatePathloss(const antenna::Antenna& source, 00067 const antenna::Antenna& target, 00068 const wns::Frequency& frequency) const 00069 { 00070 const wns::Distance distance = calculateDistance(source, target); 00071 assure(frequencyMap.get(frequency), "Frequency out of range in RangeChecked::calculatePathloss()."); 00072 return distanceMap.get(distance)->calculatePathloss(source, target, frequency, distance); 00073 } 00074 00075 /* Idea: 00076 wns::Ratio RangeChecked::calculatePathloss(const antenna::Antenna& source, 00077 const antenna::Antenna& target, 00078 const wns::Frequency& frequency, 00079 const wns::PositionOffset shift) const 00080 //const wns::PositionOffset shift = wns::PositionOffset(0,0,0)) const 00081 { 00082 const wns::Distance distance = calculateDistance(source, target); 00083 assure(frequencyMap.get(frequency), "Frequency out of range in RangeChecked::calculatePathloss()."); 00084 return distanceMap.get(distance)->calculatePathloss(source, target, frequency, distance); 00085 } 00086 */
1.5.5