A Discrete-Event Network Simulator
API
constant-rate-wifi-manager.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2004,2005 INRIA
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18  */
19 
21 
22 #include "ns3/log.h"
23 #include "ns3/string.h"
24 #include "ns3/wifi-phy.h"
25 #include "ns3/wifi-tx-vector.h"
26 #include "ns3/wifi-utils.h"
27 
28 #include <algorithm>
29 
30 namespace ns3
31 {
32 
33 NS_LOG_COMPONENT_DEFINE("ConstantRateWifiManager");
34 
35 NS_OBJECT_ENSURE_REGISTERED(ConstantRateWifiManager);
36 
37 TypeId
39 {
40  static TypeId tid =
41  TypeId("ns3::ConstantRateWifiManager")
43  .SetGroupName("Wifi")
44  .AddConstructor<ConstantRateWifiManager>()
45  .AddAttribute("DataMode",
46  "The transmission mode to use for every data packet transmission",
47  StringValue("OfdmRate6Mbps"),
48  MakeWifiModeAccessor(&ConstantRateWifiManager::m_dataMode),
49  MakeWifiModeChecker())
50  .AddAttribute("ControlMode",
51  "The transmission mode to use for every RTS packet transmission.",
52  StringValue("OfdmRate6Mbps"),
53  MakeWifiModeAccessor(&ConstantRateWifiManager::m_ctlMode),
54  MakeWifiModeChecker());
55  return tid;
56 }
57 
59 {
60  NS_LOG_FUNCTION(this);
61 }
62 
64 {
65  NS_LOG_FUNCTION(this);
66 }
67 
70 {
71  NS_LOG_FUNCTION(this);
72  auto station = new WifiRemoteStation();
73  return station;
74 }
75 
76 void
78 {
79  NS_LOG_FUNCTION(this << station << rxSnr << txMode);
80 }
81 
82 void
84 {
85  NS_LOG_FUNCTION(this << station);
86 }
87 
88 void
90 {
91  NS_LOG_FUNCTION(this << station);
92 }
93 
94 void
96  double ctsSnr,
97  WifiMode ctsMode,
98  double rtsSnr)
99 {
100  NS_LOG_FUNCTION(this << st << ctsSnr << ctsMode << rtsSnr);
101 }
102 
103 void
105  double ackSnr,
106  WifiMode ackMode,
107  double dataSnr,
108  uint16_t dataChannelWidth,
109  uint8_t dataNss)
110 {
111  NS_LOG_FUNCTION(this << st << ackSnr << ackMode << dataSnr << dataChannelWidth << +dataNss);
112 }
113 
114 void
116 {
117  NS_LOG_FUNCTION(this << station);
118 }
119 
120 void
122 {
123  NS_LOG_FUNCTION(this << station);
124 }
125 
128 {
129  NS_LOG_FUNCTION(this << st << allowedWidth);
132  {
133  nss = 1 + (m_dataMode.GetMcsValue() / 8);
134  }
135  return WifiTxVector(
136  m_dataMode,
143  nss,
144  0,
145  GetPhy()->GetTxBandwidth(m_dataMode, std::min(allowedWidth, GetChannelWidth(st))),
146  GetAggregation(st));
147 }
148 
151 {
152  NS_LOG_FUNCTION(this << st);
153  return WifiTxVector(
154  m_ctlMode,
160  1,
161  1,
162  0,
163  GetPhy()->GetTxBandwidth(m_ctlMode, GetChannelWidth(st)),
164  GetAggregation(st));
165 }
166 
167 } // namespace ns3
#define min(a, b)
Definition: 80211b.c:41
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, uint16_t allowedWidth) 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.
WifiRemoteStation * DoCreateStation() const override
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.
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.
static TypeId GetTypeId()
Get the type ID.
Hold variables of type string.
Definition: string.h:56
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:931
represent a single transmission mode
Definition: wifi-mode.h:51
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:185
uint8_t GetMcsValue() const
Definition: wifi-mode.cc:163
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() const
Return the WifiPhy.
uint16_t GetGuardInterval() const
Return the supported HE guard interval duration (in nanoseconds).
bool GetAggregation(const WifiRemoteStation *station) const
Return whether the given station supports A-MPDU.
bool GetShortGuardIntervalSupported() const
Return whether the device has SGI support enabled.
bool GetShortPreambleEnabled() const
Return whether the device uses short PHY preambles.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#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:46
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1362
@ WIFI_MOD_CLASS_HT
HT (Clause 19)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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.