![]() |
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 <OFDMAPHY/Sender.hpp> 00029 #include <OFDMAPHY/Transmitter.hpp> 00030 00031 #include <RISE/transmissionobjects/broadcasttransmissionobject.hpp> 00032 #include <RISE/manager/metasystemmanager.hpp> 00033 #include <RISE/plmapping/PhyMode.hpp> 00034 00035 #include <WNS/PowerRatio.hpp> 00036 #include <WNS/node/component/Component.hpp> 00037 00038 using namespace ofdmaphy; 00039 00040 STATIC_FACTORY_REGISTER_WITH_CREATOR( 00041 Sender, 00042 wns::node::component::Interface, 00043 "ofdmaphy.Sender", 00044 wns::node::component::ConfigCreator 00045 ); 00046 00047 Sender::Sender(wns::node::Interface* _node, const wns::pyconfig::View& pyConfigView) : 00048 rise::Station(pyConfigView), 00049 wns::node::component::Component(_node, pyConfigView), 00050 subBand(pyConfigView.get<int>("subBand")), 00051 logger(pyConfigView.get("logger")), 00052 systemManager(dynamic_cast<rise::SystemManager*>(rise::MetaSystemManager::getInstance()->getSystemManagerBySystemName(pyConfigView.get<std::string>("systemManagerName")))), 00053 transmitter(NULL), 00054 txPower(pyConfigView.get<wns::Power>("txPower")) 00055 { 00056 assure(systemManager, "Was not able to acquire SystemManager"); 00057 } 00058 00059 void 00060 Sender::doStartup() 00061 { 00065 MESSAGE_SINGLE(NORMAL, logger, "ofdmaphy::Sender construction. total txPower="<<txPower); 00066 systemManager->addStation(this); 00067 00068 this->transmitter = new Transmitter<Sender>(pyConfigView.getView("transmitter", 0), this, getAntenna()); 00069 00070 double txFrequency = pyConfigView.get<double>("txFrequency"); 00071 double bandwidth = pyConfigView.get<double>("bandwidth"); 00072 int numberOfSubCarrier = pyConfigView.get<int>("numberOfSubCarrier"); 00073 00074 transmitter->tune(txFrequency, 00075 bandwidth, 00076 numberOfSubCarrier); 00077 00078 MESSAGE_BEGIN(NORMAL, logger, m, "ofdmaphy::Sender constructed: "); 00079 m << "#SC="<<numberOfSubCarrier<<", fTx="<<txFrequency<<"MHz, b="<<bandwidth<<"MHz, P="<<txPower; 00080 MESSAGE_END(); 00081 } 00082 00083 Sender::~Sender() 00084 { 00085 delete transmitter; 00086 } 00087 00088 void 00089 Sender::onNodeCreated() 00090 { 00091 this->setMobility( getService<rise::scenario::mobility::MobilityInterface*>("mobility")); 00092 } 00093 00094 void 00095 Sender::onWorldCreated() 00096 { 00097 this->startTransmission(); 00098 } 00099 00100 00101 void 00102 Sender::onShutdown() 00103 { 00104 } 00105 00106 00107 void 00108 Sender::startTransmission() 00109 { 00110 Broadcast bto(new rise::BroadcastTransmissionObject(transmitter, 00111 wns::osi::PDUPtr(), 00112 txPower, 00113 wns::service::phy::phymode::emptyPhyModePtr(), 00114 rise::TransmissionObject::downlink)); 00115 00116 MESSAGE_SINGLE(NORMAL, logger, "ofdmaphy::Sender::startTransmission(subBand=" << subBand << ") Broadcast"); 00117 transmitter->startTransmitting(bto, subBand); 00118 } 00119 00120 rise::SystemManager* 00121 Sender::getSystemManager() const 00122 { 00123 return systemManager; 00124 } 00125 00126 wns::node::Interface* 00127 Sender::getMyNode() const 00128 { 00129 return this->getNode(); 00130 } 00131 00132 00133
1.5.5