A Discrete-Event Network Simulator
API
constant-rate-wifi-manager.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2004,2005 INRIA
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19 */
20
21#include "ns3/string.h"
22#include "ns3/log.h"
24#include "ns3/wifi-phy.h"
25#include "ns3/wifi-tx-vector.h"
26#include "ns3/wifi-utils.h"
27
28#define Min(a,b) ((a < b) ? a : b)
29
30namespace ns3 {
31
32NS_LOG_COMPONENT_DEFINE ("ConstantRateWifiManager");
33
34NS_OBJECT_ENSURE_REGISTERED (ConstantRateWifiManager);
35
36TypeId
38{
39 static TypeId tid = TypeId ("ns3::ConstantRateWifiManager")
41 .SetGroupName ("Wifi")
42 .AddConstructor<ConstantRateWifiManager> ()
43 .AddAttribute ("DataMode", "The transmission mode to use for every data packet transmission",
44 StringValue ("OfdmRate6Mbps"),
45 MakeWifiModeAccessor (&ConstantRateWifiManager::m_dataMode),
46 MakeWifiModeChecker ())
47 .AddAttribute ("ControlMode", "The transmission mode to use for every RTS packet transmission.",
48 StringValue ("OfdmRate6Mbps"),
49 MakeWifiModeAccessor (&ConstantRateWifiManager::m_ctlMode),
50 MakeWifiModeChecker ())
51 ;
52 return tid;
53}
54
56{
57 NS_LOG_FUNCTION (this);
58}
59
61{
62 NS_LOG_FUNCTION (this);
63}
64
67{
68 NS_LOG_FUNCTION (this);
69 WifiRemoteStation *station = new WifiRemoteStation ();
70 return station;
71}
72
73void
75 double rxSnr, WifiMode txMode)
76{
77 NS_LOG_FUNCTION (this << station << rxSnr << txMode);
78}
79
80void
82{
83 NS_LOG_FUNCTION (this << station);
84}
85
86void
88{
89 NS_LOG_FUNCTION (this << station);
90}
91
92void
94 double ctsSnr, WifiMode ctsMode, double rtsSnr)
95{
96 NS_LOG_FUNCTION (this << st << ctsSnr << ctsMode << rtsSnr);
97}
98
99void
101 double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
102{
103 NS_LOG_FUNCTION (this << st << ackSnr << ackMode << dataSnr << dataChannelWidth << +dataNss);
104}
105
106void
108{
109 NS_LOG_FUNCTION (this << station);
110}
111
112void
114{
115 NS_LOG_FUNCTION (this << station);
116}
117
120{
121 NS_LOG_FUNCTION (this << st);
124 {
125 nss = 1 + (m_dataMode.GetMcsValue () / 8);
126 }
128}
129
132{
133 NS_LOG_FUNCTION (this << st);
135}
136
137} //namespace ns3
use constant rates for data and RTS transmissions
void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode) override
This method is a pure virtual method that must be implemented by the sub-class.
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station) override
WifiMode m_ctlMode
Wifi mode for RTS frames.
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station) override
void DoReportRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
void DoReportFinalRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
void DoReportDataOk(WifiRemoteStation *station, double ackSnr, WifiMode ackMode, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss) override
This method is a pure virtual method that must be implemented by the sub-class.
void DoReportRtsOk(WifiRemoteStation *station, double ctsSnr, WifiMode ctsMode, double rtsSnr) override
This method is a pure virtual method that must be implemented by the sub-class.
static TypeId GetTypeId(void)
Get the type ID.
void DoReportDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
WifiMode m_dataMode
Wifi mode for unicast Data frames.
void DoReportFinalDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
WifiRemoteStation * DoCreateStation(void) const override
Hold variables of type string.
Definition: string.h:41
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
represent a single transmission mode
Definition: wifi-mode.h:48
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:155
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:177
hold a list of per-remote-station state.
uint8_t GetNumberOfSupportedStreams(Mac48Address address) const
Return the number of spatial streams supported by the station.
uint16_t GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.
Ptr< WifiPhy > GetPhy(void) const
Return the WifiPhy.
bool GetAggregation(const WifiRemoteStation *station) const
Return whether the given station supports A-MPDU.
bool GetShortPreambleEnabled(void) const
Return whether the device uses short PHY preambles.
bool GetShortGuardIntervalSupported(void) const
Return whether the device has SGI support enabled.
uint16_t GetGuardInterval(void) const
Return the supported HE guard interval duration (in nanoseconds).
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
int64x64_t Min(const int64x64_t &a, const int64x64_t &b)
Minimum.
Definition: int64x64.h:218
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1269
@ WIFI_MOD_CLASS_HT
HT (Clause 19)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint16_t GetChannelWidthForTransmission(WifiMode mode, uint16_t maxAllowedChannelWidth)
Return the channel width that is allowed based on the selected mode and the given maximum channel wid...
uint16_t ConvertGuardIntervalToNanoSeconds(WifiMode mode, const Ptr< WifiNetDevice > device)
Convert the guard interval to nanoseconds based on the WifiMode.
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble)
Return the preamble to be used for the transmission.
hold per-remote-station state.