User Manual, Developers Guide and API Documentation

ITUAntenna.cpp

Go to the documentation of this file.
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/ITUAntenna.hpp>
00029 #include <RISE/stations/station.hpp>
00030 
00031 using namespace rise::antenna;
00032 
00033 ITUAntenna::ITUAntenna(const wns::pyconfig::View& pyConfigView, Station* const station):
00034     Antenna(pyConfigView, station),
00035     gain_(pyConfigView.get<wns::Ratio>("antennaGain")),
00036     direction_(pyConfigView.get<double>("elevation"),
00037                pyConfigView.get<double>("azimuth")),
00038     theta_3dB(pyConfigView.get<double>("theta_3dB")),
00039     phi_3dB(pyConfigView.get<double>("phi_3dB")),
00040     gainCC_("rise.antenna.ITUAntenna.gain")
00041 {
00042 }
00043 
00044 ITUAntenna::~ ITUAntenna()
00045 {
00046 }
00047 
00048 wns::Ratio
00049 ITUAntenna::getGain(const wns::Position& pos, const PatternPtr pattern) const
00050 {
00051     wns::PositionOffset p = pos - getPosition();
00052 
00053     // Apply antenna orientaion
00054     wns::Direction d = direction_.calcAngles(p);
00055 
00056     double elevation = d.getElevation();
00057 
00058     double azimuth = d.getAzimuth();
00059     if (azimuth > 3.14)
00060     {
00061         azimuth = azimuth - 2 * 3.14159265;
00062     }
00063     // theta_3dB = 70 degree = 1.221730475 rad
00064     //double horiz = -1.0 * std::min(12.0 * pow(azimuth/1.221730475, 2), 20.0);
00065     double horiz = -1.0 * std::min(12.0 * pow(azimuth/theta_3dB, 2), 20.0);
00066 
00067     // Elevation of main lobe is 90 degree = 1.570796325 rad in rise!
00068     // phi_3dB = 15 degree = 0.261799387 rad
00069     //double vert = -1.0 * std::min(12.0 * pow(elevation/0.261799387, 2), 20.0);
00070     double vert = 0.0;
00071     if(phi_3dB > 0)
00072     {
00073         vert = -1.0 * std::min(12.0 * pow(elevation/phi_3dB, 2), 20.0);
00074     }
00075 
00076     double directivity = -1 * std::min( -1 * (horiz + vert), 20.0);
00077 
00078     MESSAGE_BEGIN(NORMAL, log, m,"Directivity of ITUAntenna in (");
00079     m << pos.getX() << "," << pos.getY() <<  "," << pos.getZ() << "): "
00080         << directivity;
00081     MESSAGE_END();
00082 
00083     gainCC_.put(directivity + gain_.get_dB(), boost::make_tuple(
00084         "rise.scenario.mobility.x", (int) pos.getX(),
00085         "rise.scenario.mobility.y", (int) pos.getY(),
00086         "rise.scenario.StationID", getStation()->getStationId()));
00087 
00088     return wns::Ratio::from_dB(directivity) + gain_;
00089 }

Generated on Thu May 24 03:31:53 2012 for openWNS by  doxygen 1.5.5