![]() |
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 #ifndef WNS_SERVICE_PHY_OFDMA_PATTERN_HPP 00029 #define WNS_SERVICE_PHY_OFDMA_PATTERN_HPP 00030 00031 #include <vector> 00032 #include <WNS/SmartPtr.hpp> 00033 #include <WNS/PowerRatio.hpp> 00034 00035 namespace rise { namespace antenna { 00036 class Beamforming; 00037 }} 00038 00039 namespace wns { namespace service { namespace phy { namespace ofdma { 00040 00041 class Pattern : 00042 virtual public wns::RefCountable 00043 { 00044 friend class rise::antenna::Beamforming; 00045 public: 00046 wns::Ratio getOmniAttenuation() const 00047 { 00048 return omniAttenuation; 00049 } 00050 00051 double getEntry(unsigned int i) const 00052 { 00053 return pattern.at(i); 00054 } 00055 00056 unsigned int getSize() const 00057 { 00058 return pattern.size(); 00059 } 00060 00061 wns::Ratio getMaxGain() const 00062 { 00063 assure(!pattern.empty(), "empty pattern has no maximum gain"); 00064 double maxEntry = 0.0; 00065 for (unsigned int i = 0; i < pattern.size(); i++) { 00066 if(pattern.at(i) > maxEntry) 00067 maxEntry = pattern.at(i); 00068 } 00069 assure(maxEntry > 0.0, "all zero pattern seems to be invalid"); 00070 return wns::Ratio::from_factor(maxEntry * maxEntry); 00071 } 00072 00073 protected: 00074 std::vector<double> pattern; 00082 wns::Ratio omniAttenuation; 00083 }; 00084 00085 class SumPattern : 00086 public Pattern 00087 { 00088 public: 00089 void add(wns::SmartPtr<Pattern> other) 00090 { 00091 assure(other->getSize() > 0, "pattern to add is empty"); 00092 if(pattern.empty()){ 00093 pattern.reserve(other->getSize()); 00094 for (unsigned int i = 0; i < other->getSize(); i++) { 00095 pattern.push_back(other->getEntry(i)); 00096 } 00097 } 00098 else{ 00099 assure(pattern.size() == other->getSize(), "patterns do not have the same size"); 00100 for (unsigned int i = 0; i < pattern.size(); i++) { 00101 pattern[i] += other->getEntry(i); 00102 } 00103 } 00104 } 00105 }; 00106 00107 typedef wns::SmartPtr<Pattern> PatternPtr; 00108 00109 } // ofdma 00110 } // phy 00111 } // service 00112 } // wns 00113 #endif 00114 00115 00116
1.5.5