User Manual, Developers Guide and API Documentation

Duration.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/Duration.hpp>
00030 #include <cmath>
00031 
00032 using namespace wimemac::management::protocolCalculatorPlugins;
00033 
00034 Duration::Duration( FrameLength* fl_, const wns::pyconfig::View& config):
00035     tsym(config.get<wns::simulator::Time>("tsym")),
00036     fl(fl_)
00037 {
00038 
00039 }
00040 
00041 wns::simulator::Time
00042 Duration::PPDU(Bit psduLength, const wimemac::convergence::PhyMode& pm) const
00043 {
00044     return (preamble(pm) + psduLength / pm.getInfoBitsPer6Symbols() * 6 * tsym);
00045 }
00046 
00047 wns::simulator::Time
00048 Duration::PSDU(Bit psduLength, const wimemac::convergence::PhyMode& pm) const
00049 {
00050     return (psduLength / pm.getInfoBitsPer6Symbols() * 6 * tsym);
00051 }
00052 
00053 wns::simulator::Time
00054 Duration::preamble(const wimemac::convergence::PhyMode& pm) const
00055 {
00056     if(pm.getPreambleMode() == "STANDARD")
00057     {
00058         // Standard Preamble transmission time + PCLP Header transmission time
00059         return (9.375e-6 + 3.75e-6);
00060     }
00061 
00062     if(pm.getPreambleMode() == "BURST")
00063     {
00064         // Burst Preamble transmission time + PCLP Header transmission time
00065         return (5.625e-6 + 3.75e-6);
00066     }
00067 
00068     assure(pm.getPreambleMode() == "STANDARD" or pm.getPreambleMode() == "BURST", "Unknown plcpMode : " << pm.getPreambleMode());
00069 
00070     return(1);
00071 }
00072 
00073 wns::simulator::Time
00074 Duration::MSDU_PPDU(Bit msduFrameSize, const wimemac::convergence::PhyMode& pm) const
00075 {
00076     return(PPDU(fl->getPSDU(msduFrameSize, pm.getInfoBitsPer6Symbols()), pm));
00077 }
00078 
00079 wns::simulator::Time
00080 Duration::MSDU_PSDU(Bit msduFrameSize, const wimemac::convergence::PhyMode& pm) const
00081 {
00082     return(PSDU(fl->getPSDU(msduFrameSize, pm.getInfoBitsPer6Symbols()), pm));
00083 }
00084 
00085 wns::simulator::Time
00086 Duration::PSDU_PPDU(Bit psduFrameSize, const wimemac::convergence::PhyMode& pm) const
00087 {
00088     return(PPDU(psduFrameSize, pm));
00089 }

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