User Manual, Developers Guide and API Documentation

FrameLength.cpp

Go to the documentation of this file.
00001 /******************************************************************************
00002  * WiMeMac                                                                    *
00003  * This file is part of openWNS (open Wireless Network Simulator)
00004  * _____________________________________________________________________________
00005  *
00006  * Copyright (C) 2004-2011
00007  * Chair of Communication Networks (ComNets)
00008  * Kopernikusstr. 5, D-52074 Aachen, Germany
00009  * phone: ++49-241-80-27910,
00010  * fax: ++49-241-80-22242
00011  * email: info@openwns.org
00012  * www: http://www.openwns.org
00013  * _____________________________________________________________________________
00014  *
00015  * openWNS is free software; you can redistribute it and/or modify it under the
00016  * terms of the GNU Lesser General Public License version 2 as published by the
00017  * Free Software Foundation;
00018  *
00019  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00020  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00021  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00022  * details.
00023  *
00024  * You should have received a copy of the GNU Lesser General Public License
00025  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00026  *
00027  ******************************************************************************/
00028 
00029 #include <WIMEMAC/management/protocolCalculatorPlugins/FrameLength.hpp>
00030 #include <math.h>
00031 
00032 using namespace wimemac::management::protocolCalculatorPlugins;
00033 
00034 FrameLength::FrameLength(const wns::pyconfig::View& config):
00035     tail(config.get<Bit>("tail")),
00036     FCS(config.get<Bit>("FCS"))
00037 {
00038 
00039 }
00040 
00041 Bit
00042 FrameLength::getPSDU(Bit msduFrameSize, int nIBP6S) const
00043 {
00044     return (msduFrameSize + this->FCS + this->tail + pad(msduFrameSize, nIBP6S));
00045 }
00046 
00047 Bit
00048 FrameLength::getPreamble(std::string pm) const
00049 {
00050     assure((pm == "STANDARD" || pm == "BURST"), "got an undefined plcpMode");
00051     if (pm == "STANDARD") return 700;
00052     else if (pm == "BURST") return 500;
00053 }
00054 
00055 Bit
00056 FrameLength::pad(Bit msduFrameSize, int nIBP6S) const
00057 {
00058     double nFrame = 6 * ceil( double(msduFrameSize + this->FCS + this->tail)  / nIBP6S);
00059     double nPad = nFrame / 6 * nIBP6S - msduFrameSize - this->FCS - this->tail;
00060     return (nPad);
00061 }

Generated on Sun May 27 03:32:12 2012 for openWNS by  doxygen 1.5.5