![]() |
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 <WNS/ldk/harq/softcombining/UniformRandomDecoder.hpp> 00029 00030 #include <WNS/distribution/Uniform.hpp> 00031 #include <WNS/ldk/FUNConfigCreator.hpp> 00032 00033 using namespace wns::ldk::harq::softcombining; 00034 00035 STATIC_FACTORY_REGISTER_WITH_CREATOR( 00036 UniformRandomDecoder, 00037 IDecoder, 00038 "UniformRandomDecoder", 00039 wns::ldk::FUNConfigCreator); 00040 00041 UniformRandomDecoder::UniformRandomDecoder(wns::ldk::fun::FUN*, const wns::pyconfig::View& config): 00042 initialPER_(config.get<double>("initialPER")), 00043 rolloffFactor_(config.get<double>("rolloffFactor")), 00044 logger_(config.get("logger")), 00045 dis_(new wns::distribution::StandardUniform()) 00046 { 00047 } 00048 00049 UniformRandomDecoder::~UniformRandomDecoder() 00050 { 00051 } 00052 00053 void 00054 UniformRandomDecoder::onFUNCreated() 00055 { 00056 00057 } 00058 00059 bool 00060 UniformRandomDecoder::canDecode(const Container<wns::ldk::CompoundPtr>& c) 00061 { 00062 int numTransmissions = 0; 00063 00064 for (int ii=0; ii < c.getNumRVs(); ++ii) 00065 { 00066 numTransmissions += c.getEntriesForRV(0, ii).size(); 00067 } 00068 00069 double threshold = pow(initialPER_, numTransmissions * rolloffFactor_); 00070 00071 MESSAGE_BEGIN(NORMAL, logger_, m, ""); 00072 m << "Effective PER is " << threshold; 00073 MESSAGE_END(); 00074 00075 if ((*dis_)() > threshold) 00076 { 00077 return true; 00078 } 00079 return false; 00080 }
1.5.5