User Manual, Developers Guide and API Documentation

DecoderConvolutional.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/decoder/DecoderConvolutional.hpp>
00029 
00030 #include <WNS/Assure.hpp>
00031 
00032 #include <cmath>
00033 #include <cassert>
00034 #include <stdexcept>
00035 
00036 using namespace std;
00037 using namespace rise;
00038 
00039 DecoderConvolutional::~DecoderConvolutional()
00040 {}
00041 
00042 DecoderConvolutional::DecoderConvolutional(int k,
00043                                            int bdfree,
00044                                            int dfree,
00045                                            double punctuation) :
00046     K(k),
00047     B_dfree(bdfree),
00048     D_free(dfree),
00049     Punctuation(punctuation)
00050 {
00051     assure(B_dfree > 0, "B_dfree must be > 0");
00052     assure(D_free > 0, "D_free must be > 0");
00053     assure(K > 0, "K must be > 0");
00054     assure(Punctuation >= 1.0, "Punctuation must be >= 1");
00055 }
00056 
00057 double DecoderConvolutional::getBER(double p_raw)
00058 {
00059     return getBER(p_raw, Punctuation);
00060 }
00061 
00062 double DecoderConvolutional::getBER(double p_raw, double aPuncturingFactor)
00063 {
00064     assure(p_raw>=0 && p_raw<=0.5, "Raw BER must be in [0, 0.5]");
00065     double ber = double(B_dfree)/K*pow(2*sqrt(p_raw*(1-p_raw)),
00066                                        (D_free/aPuncturingFactor));
00067     if (ber > 0.5)
00068         ber = 0.5;
00069     return ber;
00070 }
00071 
00072 

Generated on Wed May 23 03:31:52 2012 for openWNS by  doxygen 1.5.5