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-tx-vector.h"
25#include "ns3/wifi-utils.h"
26
27#define Min(a,b) ((a < b) ? a : b)
28
29namespace ns3 {
30
31NS_LOG_COMPONENT_DEFINE ("ConstantRateWifiManager");
32
33NS_OBJECT_ENSURE_REGISTERED (ConstantRateWifiManager);
34
35TypeId
37{
38 static TypeId tid = TypeId ("ns3::ConstantRateWifiManager")
40 .SetGroupName ("Wifi")
41 .AddConstructor<ConstantRateWifiManager> ()
42 .AddAttribute ("DataMode", "The transmission mode to use for every data packet transmission",
43 StringValue ("OfdmRate6Mbps"),
44 MakeWifiModeAccessor (&ConstantRateWifiManager::m_dataMode),
45 MakeWifiModeChecker ())
46 .AddAttribute ("ControlMode", "The transmission mode to use for every RTS packet transmission.",
47 StringValue ("OfdmRate6Mbps"),
48 MakeWifiModeAccessor (&ConstantRateWifiManager::m_ctlMode),
49 MakeWifiModeChecker ())
50 ;
51 return tid;
52}
53
55{
56 NS_LOG_FUNCTION (this);
57}
58
60{
61 NS_LOG_FUNCTION (this);
62}
63
66{
67 NS_LOG_FUNCTION (this);
68 WifiRemoteStation *station = new WifiRemoteStation ();
69 return station;
70}
71
72void
74 double rxSnr, WifiMode txMode)
75{
76 NS_LOG_FUNCTION (this << station << rxSnr << txMode);
77}
78
79void
81{
82 NS_LOG_FUNCTION (this << station);
83}
84
85void
87{
88 NS_LOG_FUNCTION (this << station);
89}
90
91void
93 double ctsSnr, WifiMode ctsMode, double rtsSnr)
94{
95 NS_LOG_FUNCTION (this << st << ctsSnr << ctsMode << rtsSnr);
96}
97
98void
100 double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
101{
102 NS_LOG_FUNCTION (this << st << ackSnr << ackMode << dataSnr << dataChannelWidth << +dataNss);
103}
104
105void
107{
108 NS_LOG_FUNCTION (this << station);
109}
110
111void
113{
114 NS_LOG_FUNCTION (this << station);
115}
116
119{
120 NS_LOG_FUNCTION (this << st);
123 {
124 nss = 1 + (m_dataMode.GetMcsValue () / 8);
125 }
127}
128
131{
132 NS_LOG_FUNCTION (this << st);
134}
135
136} //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.
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:1268
@ 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 maxSupportedChannelWidth)
Return the channel width that corresponds to the selected mode (instead of letting the PHY's default ...
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.