A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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
30namespace ns3
31{
32
33NS_LOG_COMPONENT_DEFINE("ConstantRateWifiManager");
34
35NS_OBJECT_ENSURE_REGISTERED(ConstantRateWifiManager);
36
37TypeId
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"),
50 .AddAttribute("ControlMode",
51 "The transmission mode to use for every RTS packet transmission.",
52 StringValue("OfdmRate6Mbps"),
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
76void
78{
79 NS_LOG_FUNCTION(this << station << rxSnr << txMode);
80}
81
82void
84{
85 NS_LOG_FUNCTION(this << station);
86}
87
88void
90{
91 NS_LOG_FUNCTION(this << station);
92}
93
94void
96 double ctsSnr,
97 WifiMode ctsMode,
98 double rtsSnr)
99{
100 NS_LOG_FUNCTION(this << st << ctsSnr << ctsMode << rtsSnr);
101}
102
103void
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
114void
116{
117 NS_LOG_FUNCTION(this << station);
118}
119
120void
122{
123 NS_LOG_FUNCTION(this << station);
124}
125
128{
129 NS_LOG_FUNCTION(this << st << allowedWidth);
130 uint8_t nss = std::min(GetMaxNumberOfTransmitStreams(), GetNumberOfSupportedStreams(st));
132 {
133 nss = 1 + (m_dataMode.GetMcsValue() / 8);
134 }
135 return WifiTxVector(
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
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:932
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...
Ptr< const AttributeChecker > MakeWifiModeChecker()
Definition: wifi-mode.cc:263
Ptr< const AttributeAccessor > MakeWifiModeAccessor(T1 a1)
Definition: wifi-mode.h:254
#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:1355
@ 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.