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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 */
8
10
11#include "ns3/log.h"
12#include "ns3/string.h"
13#include "ns3/wifi-phy.h"
14#include "ns3/wifi-tx-vector.h"
15#include "ns3/wifi-utils.h"
16
17#include <algorithm>
18
19namespace ns3
20{
21
22NS_LOG_COMPONENT_DEFINE("ConstantRateWifiManager");
23
24NS_OBJECT_ENSURE_REGISTERED(ConstantRateWifiManager);
25
26TypeId
28{
29 static TypeId tid =
30 TypeId("ns3::ConstantRateWifiManager")
32 .SetGroupName("Wifi")
33 .AddConstructor<ConstantRateWifiManager>()
34 .AddAttribute("DataMode",
35 "The transmission mode to use for every data packet transmission",
36 StringValue("OfdmRate6Mbps"),
39 .AddAttribute("ControlMode",
40 "The transmission mode to use for every RTS packet transmission.",
41 StringValue("OfdmRate6Mbps"),
44 return tid;
45}
46
51
56
59{
60 NS_LOG_FUNCTION(this);
61 auto station = new WifiRemoteStation();
62 return station;
63}
64
65void
67{
68 NS_LOG_FUNCTION(this << station << rxSnr << txMode);
69}
70
71void
76
77void
82
83void
85 double ctsSnr,
86 WifiMode ctsMode,
87 double rtsSnr)
88{
89 NS_LOG_FUNCTION(this << st << ctsSnr << ctsMode << rtsSnr);
90}
91
92void
94 double ackSnr,
95 WifiMode ackMode,
96 double dataSnr,
97 MHz_u dataChannelWidth,
98 uint8_t dataNss)
99{
100 NS_LOG_FUNCTION(this << st << ackSnr << ackMode << dataSnr << dataChannelWidth << +dataNss);
101}
102
103void
108
109void
114
117{
118 NS_LOG_FUNCTION(this << st << allowedWidth);
119 uint8_t nss = std::min(GetMaxNumberOfTransmitStreams(), GetNumberOfSupportedStreams(st));
121 {
122 nss = 1 + (m_dataMode.GetMcsValue() / 8);
123 }
124 return WifiTxVector(
130 GetGuardInterval(st)),
132 nss,
133 0,
134 GetPhy()->GetTxBandwidth(m_dataMode, std::min(allowedWidth, GetChannelWidth(st))),
135 GetAggregation(st));
136}
137
155
156} // 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.
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 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.
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station, MHz_u allowedWidth) override
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.
void DoReportDataOk(WifiRemoteStation *station, double ackSnr, WifiMode ackMode, double dataSnr, MHz_u dataChannelWidth, uint8_t dataNss) override
This method is a pure virtual method that must be implemented by the sub-class.
Hold variables of type string.
Definition string.h:45
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
represent a single transmission mode
Definition wifi-mode.h:40
WifiModulationClass GetModulationClass() const
Definition wifi-mode.cc:174
uint8_t GetMcsValue() const
Definition wifi-mode.cc:152
hold a list of per-remote-station state.
uint8_t GetNumberOfSupportedStreams(Mac48Address address) const
Return the number of spatial streams supported by the station.
Time GetGuardInterval() const
Return the supported HE guard interval duration.
Ptr< WifiPhy > GetPhy() const
Return the WifiPhy.
MHz_u 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 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 AttributeAccessor > MakeWifiModeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition wifi-mode.h:243
Ptr< const AttributeChecker > MakeWifiModeChecker()
Definition wifi-mode.cc:252
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#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:35
@ WIFI_MOD_CLASS_HT
HT (Clause 19)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Time GetGuardIntervalForMode(WifiMode mode, const Ptr< WifiNetDevice > device)
Get the guard interval for a given WifiMode.
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble)
Return the preamble to be used for the transmission.
hold per-remote-station state.