![]() |
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/antenna/Static.hpp> 00029 #include <RISE/antenna/pattern/kernel/Kernel.hpp> 00030 00031 using namespace rise::antenna; 00032 00033 Static::Static(const wns::pyconfig::View& pyConfigView, 00034 Station* const station) 00035 : Antenna(pyConfigView, station), 00036 direction(wns::Direction()), 00037 kernel(0) 00038 { 00039 kernel = pattern::kernel::Kernel::getPatternKernel(pyConfigView); 00040 double elevation = pyConfigView.get<double>("elevation"); 00041 elevation *= M_PI/180; 00042 double azimuth = pyConfigView.get<double>("azimuth"); 00043 azimuth *= M_PI/180; 00044 direction = wns::Direction(elevation, azimuth); 00045 if (drawPattern == true) 00046 drawRadiationPattern(); 00047 } 00048 00049 00050 Static::~Static() 00051 { 00052 kernel = 0; 00053 } 00054 00055 wns::Ratio Static::getGain(const wns::Position& pos, 00056 const PatternPtr) const 00057 { 00058 return getGain(pos); 00059 } 00060 00061 wns::Ratio Static::getGain(const wns::Position& pos) const 00062 { 00063 wns::PositionOffset p = pos - getPosition(); 00064 wns::Direction d = direction.calcAngles(p); 00065 wns::Ratio directivity = kernel->getGain(d); 00066 MESSAGE_BEGIN(NORMAL, log, m,"Directivity in ("); 00067 m << pos.getX() << "," << pos.getY() << "," << pos.getZ() << "): " 00068 << directivity.get_dB(); 00069 MESSAGE_END(); 00070 return directivity; 00071 } 00072 00073
1.5.5